Going back to snapshots
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-docker-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Docker Parent</name>
|
||||
<description>Spring Cloud Contract Docker Parent</description>
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-docker-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-docker</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Docker</name>
|
||||
<description>Spring Cloud Contract Docker</description>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.daemon=false
|
||||
verifierVersion=3.0.0-M4
|
||||
verifierVersion=3.0.0-SNAPSHOT
|
||||
springBootVersion=2.4.0-M3
|
||||
camelVersion=3.4.3
|
||||
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-docker-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-stub-runner-docker</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Stub Runner Docker</name>
|
||||
<description>Spring Cloud Contract Stub Runner Docker</description>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-docs</artifactId>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>2020.0.0-M4</spring-cloud.version>
|
||||
<spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>2020.0.0-M4</spring-cloud.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>2020.0.0-M4</spring-cloud.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-guides</artifactId>
|
||||
|
||||
16
pom.xml
16
pom.xml
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
||||
<name>Spring Cloud Contract</name>
|
||||
<description>Spring Cloud Contract</description>
|
||||
@@ -28,12 +28,12 @@
|
||||
<checkstyle.version>2.17</checkstyle.version>
|
||||
<pact.version>4.0.9</pact.version>
|
||||
<jsch-agent.version>0.0.9</jsch-agent.version>
|
||||
<spring-cloud-build.version>3.0.0-M4</spring-cloud-build.version>
|
||||
<spring-cloud-zookeeper.version>3.0.0-M4</spring-cloud-zookeeper.version>
|
||||
<spring-cloud-stream.version>3.1.0-M3</spring-cloud-stream.version>
|
||||
<spring-cloud-netflix.version>3.0.0-M4</spring-cloud-netflix.version>
|
||||
<spring-cloud-consul.version>3.0.0-M4</spring-cloud-consul.version>
|
||||
<spring-cloud-commons.version>3.0.0-M4</spring-cloud-commons.version>
|
||||
<spring-cloud-build.version>3.0.0-SNAPSHOT</spring-cloud-build.version>
|
||||
<spring-cloud-zookeeper.version>3.0.0-SNAPSHOT</spring-cloud-zookeeper.version>
|
||||
<spring-cloud-stream.version>3.1.0-SNAPSHOT</spring-cloud-stream.version>
|
||||
<spring-cloud-netflix.version>3.0.0-SNAPSHOT</spring-cloud-netflix.version>
|
||||
<spring-cloud-consul.version>3.0.0-SNAPSHOT</spring-cloud-consul.version>
|
||||
<spring-cloud-commons.version>3.0.0-SNAPSHOT</spring-cloud-commons.version>
|
||||
<spring-cloud-functiondonotreplace.version>3.0.6.RELEASE</spring-cloud-functiondonotreplace.version>
|
||||
<jopt-simple.version>5.0.4</jopt-simple.version>
|
||||
<cglib.version>3.2.11</cglib.version>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-samples</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Samples</name>
|
||||
<description>Spring Cloud Contract Samples</description>
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-samples</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-samples-standalone</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Standalone Test Samples</name>
|
||||
<description>Spring Cloud Contract Standalone Test Samples used for end to end tests
|
||||
</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock-jetty</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock-jetty</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock-native</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock-native</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock-tomcat</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock-tomcat</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock-undertow-ssl</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock-undertow-ssl</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock-undertow</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock-undertow</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wiremock</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>wiremock</name>
|
||||
@@ -21,7 +21,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-contract.version>3.0.0-M4</spring-cloud-contract.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-cloud-contract-specs</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<name>Spring Cloud Contract Specs</name>
|
||||
<description>Spring Cloud Contract Specs</description>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-spec-groovy</artifactId>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-spec-java</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-spec-kotlin</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-spec</artifactId>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-dependencies</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>spring-cloud-contract-dependencies</name>
|
||||
<description>Spring Cloud Contract Dependencies</description>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-shade</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-starters</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-contract-stub-runner-jetty</artifactId>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-starters</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-starters</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-boot</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tools</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-converters</artifactId>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
nexusUsername=
|
||||
nexusPassword=
|
||||
verifierVersion=3.0.0-M4
|
||||
verifierVersion=3.0.0-SNAPSHOT
|
||||
org.gradle.daemon=false
|
||||
aetherVersion=1.1.0
|
||||
springCloudBuildVersion=3.0.0-M4
|
||||
springCloudBuildVersion=3.0.0-SNAPSHOT
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tools</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -112,8 +112,7 @@ public class ContractVerifierExtension implements Serializable {
|
||||
private final DirectoryProperty generatedTestJavaSourcesDir;
|
||||
|
||||
/**
|
||||
* Groovy test source directory where tests generated from Contract DSL should be
|
||||
* placed
|
||||
* Groovy test source directory where tests generated from Contract DSL should be placed
|
||||
*/
|
||||
private final DirectoryProperty generatedTestGroovySourcesDir;
|
||||
|
||||
@@ -123,8 +122,8 @@ public class ContractVerifierExtension implements Serializable {
|
||||
private final DirectoryProperty generatedTestResourcesDir;
|
||||
|
||||
/**
|
||||
* Dir where the generated stubs from Groovy DSL should be placed. You can then
|
||||
* mention them in your packaging task to create jar with stubs
|
||||
* Dir where the generated stubs from Groovy DSL should be placed.
|
||||
* You can then mention them in your packaging task to create jar with stubs
|
||||
*/
|
||||
private final DirectoryProperty stubsOutputDir;
|
||||
|
||||
@@ -163,10 +162,10 @@ public class ContractVerifierExtension implements Serializable {
|
||||
private final Dependency contractDependency;
|
||||
|
||||
/**
|
||||
* The path in the JAR with all the contracts where contracts for this particular
|
||||
* service lay. If not provided will be resolved to {@code groupid/artifactid}.
|
||||
* Example: If {@code groupid} is {@code com.example} and {@code artifactid} is
|
||||
* {@code service} then the resolved path will be {@code /com/example/artifactid}
|
||||
* The path in the JAR with all the contracts where contracts for this particular service lay.
|
||||
* If not provided will be resolved to {@code groupid/artifactid}. Example:
|
||||
* If {@code groupid} is {@code com.example} and {@code artifactid} is {@code service} then the resolved path will be
|
||||
* {@code /com/example/artifactid}
|
||||
*/
|
||||
private final Property<String> contractsPath;
|
||||
|
||||
@@ -176,36 +175,34 @@ public class ContractVerifierExtension implements Serializable {
|
||||
private final Property<StubRunnerProperties.StubsMode> contractsMode;
|
||||
|
||||
/**
|
||||
* A package that contains all the base clases for generated tests. If your contract
|
||||
* resides in a location {@code src/test/resources/contracts/com/example/v1/} and you
|
||||
* provide the {@code packageWithBaseClasses} value to
|
||||
* {@code com.example.contracts.base} then we will search for a test source file that
|
||||
* will have the package {@code com.example.contracts.base} and name
|
||||
* {@code ExampleV1Base}. As you can see it will take the two last folders to and
|
||||
* attach {@code Base} to its name.
|
||||
* A package that contains all the base clases for generated tests. If your contract resides in a location
|
||||
* {@code src/test/resources/contracts/com/example/v1/} and you provide the {@code packageWithBaseClasses}
|
||||
* value to {@code com.example.contracts.base} then we will search for a test source file that will
|
||||
* have the package {@code com.example.contracts.base} and name {@code ExampleV1Base}. As you can see
|
||||
* it will take the two last folders to and attach {@code Base} to its name.
|
||||
*/
|
||||
private final Property<String> packageWithBaseClasses;
|
||||
|
||||
/**
|
||||
* A way to override any base class mappings. The keys are regular expressions on the
|
||||
* package name and the values FQN to a base class for that given expression. Example
|
||||
* of a mapping [.*.com.example.v1..*] to [com.example.SomeBaseClass] When a
|
||||
* contract's package matches the provided regular expression then extending class
|
||||
* will be the one provided in the map - in this case
|
||||
* {@code com.example.SomeBaseClass}
|
||||
* A way to override any base class mappings. The keys are regular expressions on the package name
|
||||
* and the values FQN to a base class for that given expression.
|
||||
* Example of a mapping
|
||||
* [.*.com.example.v1..*] to [com.example.SomeBaseClass]
|
||||
* When a contract's package matches the provided regular expression then extending class will be the one
|
||||
* provided in the map - in this case {@code com.example.SomeBaseClass}
|
||||
*/
|
||||
private final BaseClassMapping baseClassMappings;
|
||||
|
||||
/**
|
||||
* If set to true then the {@code target} or {@code build} folders are getting
|
||||
* excluded from any operations. This is used out of the box when working with common
|
||||
* repo with contracts.
|
||||
* excluded from any operations. This is used out of the box when working with
|
||||
* common repo with contracts.
|
||||
*/
|
||||
private final Property<Boolean> excludeBuildFolders;
|
||||
|
||||
/**
|
||||
* If set to {@code false} will NOT delete stubs from a temporary folder after running
|
||||
* tests
|
||||
* If set to {@code false} will NOT delete stubs from a temporary
|
||||
* folder after running tests
|
||||
*/
|
||||
private final Property<Boolean> deleteStubsAfterTest;
|
||||
|
||||
@@ -215,22 +212,20 @@ public class ContractVerifierExtension implements Serializable {
|
||||
private final Property<Boolean> convertToYaml;
|
||||
|
||||
/**
|
||||
* Map of properties that can be passed to custom
|
||||
* {@link org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder}
|
||||
* Map of properties that can be passed to custom {@link org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder}
|
||||
*/
|
||||
private final MapProperty<String, String> contractsProperties;
|
||||
|
||||
/**
|
||||
* Is set to true will not provide the default publication task
|
||||
* @deprecated - with 3.0.0, the user should include stubs with their own
|
||||
* publication(s)
|
||||
*
|
||||
* @deprecated - with 3.0.0, the user should include stubs with their own publication(s)
|
||||
*/
|
||||
@Deprecated
|
||||
private final Property<Boolean> disableStubPublication;
|
||||
|
||||
/**
|
||||
* Source set where the contracts are stored. If not provided will assume
|
||||
* {@code test}.
|
||||
* Source set where the contracts are stored. If not provided will assume {@code test}.
|
||||
*/
|
||||
private final Property<String> sourceSet;
|
||||
|
||||
@@ -246,15 +241,11 @@ public class ContractVerifierExtension implements Serializable {
|
||||
this.ignoredFiles = objects.listProperty(String.class).convention(new ArrayList<>());
|
||||
this.imports = objects.listProperty(String.class).convention(new ArrayList<>());
|
||||
this.staticImports = objects.listProperty(String.class).convention(new ArrayList<>());
|
||||
this.contractsDslDir = objects.directoryProperty()
|
||||
.convention(layout.getProjectDirectory().dir("src/test/resources/contracts"));
|
||||
this.contractsDslDir = objects.directoryProperty().convention(layout.getProjectDirectory().dir("src/test/resources/contracts"));
|
||||
this.generatedTestSourcesDir = objects.directoryProperty();
|
||||
this.generatedTestJavaSourcesDir = objects.directoryProperty()
|
||||
.convention(layout.getBuildDirectory().dir("generated-test-sources/contractTest/java"));
|
||||
this.generatedTestGroovySourcesDir = objects.directoryProperty()
|
||||
.convention(layout.getBuildDirectory().dir("generated-test-sources/contractTest/groovy"));
|
||||
this.generatedTestResourcesDir = objects.directoryProperty()
|
||||
.convention(layout.getBuildDirectory().dir("generated-test-resources/contractTest"));
|
||||
this.generatedTestJavaSourcesDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("generated-test-sources/contractTest/java"));
|
||||
this.generatedTestGroovySourcesDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("generated-test-sources/contractTest/groovy"));
|
||||
this.generatedTestResourcesDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("generated-test-resources/contractTest"));
|
||||
this.stubsOutputDir = objects.directoryProperty().convention(layout.getBuildDirectory().dir("stubs"));
|
||||
this.stubsSuffix = objects.property(String.class).convention("stubs");
|
||||
this.assertJsonSize = objects.property(Boolean.class).convention(false);
|
||||
@@ -264,8 +255,7 @@ public class ContractVerifierExtension implements Serializable {
|
||||
this.publishStubsToScm = objects.newInstance(PublishStubsToScm.class);
|
||||
this.contractDependency = objects.newInstance(Dependency.class);
|
||||
this.contractsPath = objects.property(String.class);
|
||||
this.contractsMode = objects.property(StubRunnerProperties.StubsMode.class)
|
||||
.convention(StubRunnerProperties.StubsMode.CLASSPATH);
|
||||
this.contractsMode = objects.property(StubRunnerProperties.StubsMode.class).convention(StubRunnerProperties.StubsMode.CLASSPATH);
|
||||
this.packageWithBaseClasses = objects.property(String.class);
|
||||
this.baseClassMappings = objects.newInstance(BaseClassMapping.class);
|
||||
this.excludeBuildFolders = objects.property(Boolean.class).convention(false);
|
||||
@@ -569,15 +559,10 @@ public class ContractVerifierExtension implements Serializable {
|
||||
}
|
||||
|
||||
public static class Dependency implements Serializable {
|
||||
|
||||
private final Property<String> groupId;
|
||||
|
||||
private final Property<String> artifactId;
|
||||
|
||||
private final Property<String> version;
|
||||
|
||||
private final Property<String> classifier;
|
||||
|
||||
private final Property<String> stringNotation;
|
||||
|
||||
@Inject
|
||||
@@ -631,15 +616,17 @@ public class ContractVerifierExtension implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Dependency{" + "groupId=" + groupId.getOrNull() + ", artifactId=" + artifactId.getOrNull()
|
||||
+ ", classifier=" + classifier.getOrNull() + ", version=" + version.getOrNull()
|
||||
+ ", stringNotation=" + stringNotation.getOrNull() + '}';
|
||||
return "Dependency{" +
|
||||
"groupId=" + groupId.getOrNull() +
|
||||
", artifactId=" + artifactId.getOrNull() +
|
||||
", classifier=" + classifier.getOrNull() +
|
||||
", version=" + version.getOrNull() +
|
||||
", stringNotation=" + stringNotation.getOrNull() +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class BaseClassMapping implements Serializable {
|
||||
|
||||
private final MapProperty<String, String> baseClassMappings;
|
||||
|
||||
@Inject
|
||||
@@ -658,21 +645,14 @@ public class ContractVerifierExtension implements Serializable {
|
||||
public void baseClassMapping(Map<String, String> mapping) {
|
||||
baseClassMappings.putAll(mapping);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This class is used as an input to the tasks, so all fields are marked as `@Input`
|
||||
// to allow incremental build
|
||||
// This class is used as an input to the tasks, so all fields are marked as `@Input` to allow incremental build
|
||||
public static class ContractRepository implements Serializable {
|
||||
|
||||
private final Property<String> repositoryUrl;
|
||||
|
||||
private final Property<String> username;
|
||||
|
||||
private final Property<String> password;
|
||||
|
||||
private final Property<Integer> proxyPort;
|
||||
|
||||
private final Property<String> proxyHost;
|
||||
|
||||
@Inject
|
||||
@@ -727,11 +707,14 @@ public class ContractVerifierExtension implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ContractRepository{" + "repositoryUrl=" + repositoryUrl.getOrNull() + ", username="
|
||||
+ username.getOrNull() + ", password=" + password.getOrNull() + ", proxyPort="
|
||||
+ proxyPort.getOrNull() + ", proxyHost=" + proxyHost.getOrNull() + '}';
|
||||
return "ContractRepository{" +
|
||||
"repositoryUrl=" + repositoryUrl.getOrNull() +
|
||||
", username=" + username.getOrNull() +
|
||||
", password=" + password.getOrNull() +
|
||||
", proxyPort=" + proxyPort.getOrNull() +
|
||||
", proxyHost=" + proxyHost.getOrNull() +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PublishStubsToScm implements Serializable {
|
||||
@@ -767,10 +750,10 @@ public class ContractVerifierExtension implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PublishStubsToScm{" + "contractDependency=" + contractDependency + ", contractRepository="
|
||||
+ contractRepository + '}';
|
||||
return "PublishStubsToScm{" +
|
||||
"contractDependency=" + contractDependency +
|
||||
", contractRepository=" + contractRepository +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,8 +58,9 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
// TODO: Convert to incremental task: https://docs.gradle.org/current/userguide/custom_tasks.html#incremental_tasks
|
||||
/**
|
||||
* Task that copies the contracts in order for the jar task to generate the jar. It takes
|
||||
* into consideration the inclusion patterns when working with repo with shared contracts.
|
||||
* Task that copies the contracts in order for the jar task to
|
||||
* generate the jar. It takes into consideration the inclusion
|
||||
* patterns when working with repo with shared contracts.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Anatoliy Balakirev
|
||||
@@ -95,8 +96,8 @@ class ContractsCopyTask extends DefaultTask {
|
||||
/**
|
||||
* @see ContractVerifierExtension#deleteStubsAfterTest
|
||||
*
|
||||
* This property will delete the temporary dependency or Git repository from which
|
||||
* stubs were copied to this task's output directory.
|
||||
* This property will delete the temporary dependency or Git repository from
|
||||
* which stubs were copied to this task's output directory.
|
||||
*/
|
||||
private final Property<Boolean> deleteStubsAfterTest;
|
||||
|
||||
@@ -121,8 +122,7 @@ class ContractsCopyTask extends DefaultTask {
|
||||
copiedContractsFolder = objects.directoryProperty();
|
||||
backupContractsFolder = objects.directoryProperty();
|
||||
|
||||
this.getOutputs().upToDateWhen(task -> !(this.shouldDownloadContracts()
|
||||
&& this.getContractDependency().toStubConfiguration().isVersionChanging()));
|
||||
this.getOutputs().upToDateWhen(task -> !(this.shouldDownloadContracts() && this.getContractDependency().toStubConfiguration().isVersionChanging()));
|
||||
// Lambdas break build caching support
|
||||
this.doFirst(new Action<Task>() {
|
||||
@Override
|
||||
@@ -133,20 +133,19 @@ class ContractsCopyTask extends DefaultTask {
|
||||
branch = StringUtils.hasText(branch) ? branch : "master";
|
||||
UsernamePasswordCredentialsProvider provider = null;
|
||||
if (StringUtils.hasText(contractRepository.getUsername().get())) {
|
||||
provider = new UsernamePasswordCredentialsProvider(contractRepository.getUsername().get(),
|
||||
contractRepository.getPassword().get());
|
||||
provider = new UsernamePasswordCredentialsProvider(contractRepository.getUsername().get(), contractRepository.getPassword().get());
|
||||
}
|
||||
try {
|
||||
Collection<Ref> refs = Git.lsRemoteRepository().setRemote(repositoryUrl)
|
||||
.setCredentialsProvider(provider).call();
|
||||
Collection<Ref> refs = Git.lsRemoteRepository()
|
||||
.setRemote(repositoryUrl)
|
||||
.setCredentialsProvider(provider)
|
||||
.call();
|
||||
for (Ref ref : refs) {
|
||||
if (ref.getName().equals(branch) || ref.getName().equals("refs/heads/" + branch)
|
||||
|| ref.getName().equals("refs/tags/" + branch)) {
|
||||
if (ref.getName().equals(branch) || ref.getName().equals("refs/heads/" + branch) || ref.getName().equals("refs/tags/" + branch)) {
|
||||
contractsProperties.put("git.commit", ref.getObjectId().name());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (GitAPIException e) {
|
||||
} catch (GitAPIException e) {
|
||||
ContractsCopyTask.this.getLogger().warn("Unable to determine git repository commit id");
|
||||
}
|
||||
}
|
||||
@@ -168,34 +167,27 @@ class ContractsCopyTask extends DefaultTask {
|
||||
contractsDirectory = this.contractsDirectory.getAsFile().getOrNull();
|
||||
antPattern = "**/";
|
||||
}
|
||||
getLogger().info("For project [{}] will use contracts provided in the folder [{}]", getProject().getName(),
|
||||
contractsDirectory);
|
||||
getLogger().info("For project [{}] will use contracts provided in the folder [{}]", getProject().getName(), contractsDirectory);
|
||||
final String contractsRepository = this.contractRepository.getRepositoryUrl().getOrElse("");
|
||||
throwExceptionWhenFailOnNoContracts(contractsDirectory, contractsRepository);
|
||||
|
||||
final String slashSeparatedGroupId = getProject().getGroup().toString().replace(".", File.separator);
|
||||
final String dotSeparatedAntPattern = antPattern.replace(slashSeparatedGroupId,
|
||||
getProject().getGroup().toString());
|
||||
final String dotSeparatedAntPattern = antPattern.replace(slashSeparatedGroupId, getProject().getGroup().toString());
|
||||
File output = copiedContractsFolder.get().getAsFile();
|
||||
getLogger().info(
|
||||
"Downloading and unpacking files from [{}] to [{}]. The inclusion ant patterns are [{}] and [{}]",
|
||||
contractsDirectory, output, antPattern, dotSeparatedAntPattern);
|
||||
getLogger().info("Downloading and unpacking files from [{}] to [{}]. The inclusion ant patterns are [{}] and [{}]", contractsDirectory, output, antPattern, dotSeparatedAntPattern);
|
||||
sync(contractsDirectory, antPattern, dotSeparatedAntPattern, excludeBuildFolders.get(), output);
|
||||
if (convertToYaml.get()) {
|
||||
convertContractsToYaml(contractsDirectory, antPattern, dotSeparatedAntPattern, output,
|
||||
excludeBuildFolders.get());
|
||||
convertContractsToYaml(contractsDirectory, antPattern, dotSeparatedAntPattern, output, excludeBuildFolders.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void convertContractsToYaml(File file, String antPattern, String slashSeparatedAntPattern,
|
||||
File outputContractsFolder, boolean excludeBuildFolders) {
|
||||
private void convertContractsToYaml(File file, String antPattern, String slashSeparatedAntPattern, File outputContractsFolder, boolean excludeBuildFolders) {
|
||||
sync(file, antPattern, slashSeparatedAntPattern, excludeBuildFolders, backupContractsFolder.get().getAsFile());
|
||||
ToYamlConverter.replaceContractWithYaml(outputContractsFolder);
|
||||
getLogger().info("Replaced DSL files with their YAML representation at [{}]", outputContractsFolder);
|
||||
}
|
||||
|
||||
private void sync(File file, String antPattern, String dotSeparatedAntPattern, boolean excludeBuildFolders,
|
||||
File outputContractsFolder) {
|
||||
private void sync(File file, String antPattern, String dotSeparatedAntPattern, boolean excludeBuildFolders, File outputContractsFolder) {
|
||||
getProject().sync(spec -> {
|
||||
spec.from(file);
|
||||
// by default group id is slash separated...
|
||||
@@ -223,26 +215,23 @@ class ContractsCopyTask extends DefaultTask {
|
||||
final ContractDownloader contractDownloader = new ContractDownloader(downloader, configuration,
|
||||
contractsPath.getOrNull(), groupId, artifactId, getProject().getVersion().toString());
|
||||
final File downloadedContracts = contractDownloader.unpackAndDownloadContracts();
|
||||
final ContractDownloader.InclusionProperties inclusionProperties = contractDownloader
|
||||
.createNewInclusionProperties(downloadedContracts);
|
||||
final ContractDownloader.InclusionProperties inclusionProperties =
|
||||
contractDownloader.createNewInclusionProperties(downloadedContracts);
|
||||
|
||||
// TODO: inclusionProperties.includedContracts is never used eventually. Review
|
||||
// this:
|
||||
// TODO: inclusionProperties.includedContracts is never used eventually. Review this:
|
||||
return new DownloadedData(contractsSubDirIfPresent(downloadedContracts), inclusionProperties);
|
||||
}
|
||||
|
||||
private void throwExceptionWhenFailOnNoContracts(@Nullable File file, String contractsRepository) {
|
||||
if (StringUtils.hasText(contractsRepository)) {
|
||||
if (getLogger().isDebugEnabled()) {
|
||||
getLogger().debug(
|
||||
"Contracts repository is set, will not throw an exception that the contracts are not found");
|
||||
getLogger().debug("Contracts repository is set, will not throw an exception that the contracts are not found");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (failOnNoContracts.get() && (!file.exists() || file.listFiles().length == 0)) {
|
||||
String path = file.getAbsolutePath();
|
||||
throw new GradleException("Contracts could not be found: [" + path
|
||||
+ "]\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]");
|
||||
throw new GradleException("Contracts could not be found: [" + path + "]\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,16 +247,13 @@ class ContractsCopyTask extends DefaultTask {
|
||||
}
|
||||
|
||||
private class DownloadedData {
|
||||
|
||||
final File downloadedContracts;
|
||||
|
||||
final ContractDownloader.InclusionProperties inclusionProperties;
|
||||
|
||||
private DownloadedData(File downloadedContracts, ContractDownloader.InclusionProperties inclusionProperties) {
|
||||
this.downloadedContracts = downloadedContracts;
|
||||
this.inclusionProperties = inclusionProperties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Input
|
||||
@@ -292,17 +278,12 @@ class ContractsCopyTask extends DefaultTask {
|
||||
}
|
||||
|
||||
static class Dependency {
|
||||
|
||||
private static final String LATEST_VERSION = "+";
|
||||
|
||||
private final Property<String> groupId;
|
||||
|
||||
private final Property<String> artifactId;
|
||||
|
||||
private final Property<String> version;
|
||||
|
||||
private final Property<String> classifier;
|
||||
|
||||
private final Property<String> stringNotation;
|
||||
|
||||
@Inject
|
||||
@@ -353,11 +334,11 @@ class ContractsCopyTask extends DefaultTask {
|
||||
|
||||
String groupId = this.groupId.getOrNull();
|
||||
String artifactId = this.artifactId.getOrNull();
|
||||
String version = StringUtils.hasText(this.version.getOrNull()) ? this.version.getOrNull() : LATEST_VERSION;
|
||||
String version = StringUtils.hasText(this.version.getOrNull()) ?
|
||||
this.version.getOrNull() : LATEST_VERSION;
|
||||
String classifier = this.classifier.getOrNull();
|
||||
return new StubConfiguration(groupId, artifactId, version, classifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -366,15 +347,10 @@ class ContractsCopyTask extends DefaultTask {
|
||||
}
|
||||
|
||||
static class Repository {
|
||||
|
||||
private final Property<String> repositoryUrl;
|
||||
|
||||
private final Property<String> username;
|
||||
|
||||
private final Property<String> password;
|
||||
|
||||
private final Property<String> proxyHost;
|
||||
|
||||
private final Property<Integer> proxyPort;
|
||||
|
||||
@Inject
|
||||
@@ -415,7 +391,6 @@ class ContractsCopyTask extends DefaultTask {
|
||||
Property<Integer> getProxyPort() {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Input
|
||||
@@ -457,23 +432,24 @@ class ContractsCopyTask extends DefaultTask {
|
||||
}
|
||||
|
||||
private boolean shouldDownloadContracts() {
|
||||
return StringUtils.hasText(contractDependency.getArtifactId().getOrNull())
|
||||
|| StringUtils.hasText(contractDependency.getStringNotation().getOrNull())
|
||||
|| StringUtils.hasText(contractRepository.getRepositoryUrl().getOrNull());
|
||||
return StringUtils.hasText(contractDependency.getArtifactId().getOrNull()) ||
|
||||
StringUtils.hasText(contractDependency.getStringNotation().getOrNull()) ||
|
||||
StringUtils.hasText(contractRepository.getRepositoryUrl().getOrNull());
|
||||
}
|
||||
|
||||
private StubRunnerOptions createStubRunnerOptions() {
|
||||
StubRunnerOptionsBuilder options = new StubRunnerOptionsBuilder()
|
||||
.withOptions(StubRunnerOptions.fromSystemProps())
|
||||
.withStubRepositoryRoot(contractRepository.repositoryUrl.getOrNull()).withStubsMode(contractsMode.get())
|
||||
.withStubRepositoryRoot(contractRepository.repositoryUrl.getOrNull())
|
||||
.withStubsMode(contractsMode.get())
|
||||
.withUsername(contractRepository.username.getOrNull())
|
||||
.withPassword(contractRepository.password.getOrNull())
|
||||
.withDeleteStubsAfterTest(deleteStubsAfterTest.get()).withProperties(contractsProperties.getOrNull())
|
||||
.withDeleteStubsAfterTest(deleteStubsAfterTest.get())
|
||||
.withProperties(contractsProperties.getOrNull())
|
||||
.withFailOnNoStubs(failOnNoContracts.get());
|
||||
if (contractRepository.proxyPort.isPresent()) {
|
||||
options = options.withProxy(contractRepository.proxyHost.getOrNull(), contractRepository.proxyPort.get());
|
||||
}
|
||||
return options.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,8 +75,8 @@ class GenerateClientStubsFromDslTask extends DefaultTask {
|
||||
getLogger().info("Spring Cloud Contract Verifier Plugin: Invoking DSL to client stubs conversion");
|
||||
getLogger().info("Contracts dir is [{}] output stubs dir is [{}]", contractsDslDir.get().getAsFile(), output);
|
||||
List<String> excludedFiles = this.excludedFiles.get();
|
||||
RecursiveFilesConverter converter = new RecursiveFilesConverter(output, contractsDslDir.get().getAsFile(),
|
||||
excludedFiles, ".*", excludeBuildFolders.get());
|
||||
RecursiveFilesConverter converter = new RecursiveFilesConverter(output,
|
||||
contractsDslDir.get().getAsFile(), excludedFiles, ".*", excludeBuildFolders.get());
|
||||
converter.processFiles();
|
||||
}
|
||||
|
||||
@@ -100,5 +100,4 @@ class GenerateClientStubsFromDslTask extends DefaultTask {
|
||||
public Property<Directory> getStubsOutputDir() {
|
||||
return stubsOutputDir;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,41 +51,24 @@ import java.util.List;
|
||||
*/
|
||||
@CacheableTask
|
||||
class GenerateServerTestsTask extends DefaultTask {
|
||||
|
||||
static final String TASK_NAME = "generateContractTests";
|
||||
|
||||
private final DirectoryProperty contractsDslDir;
|
||||
|
||||
private final Property<String> nameSuffixForTests;
|
||||
|
||||
private final Property<String> basePackageForTests;
|
||||
|
||||
private final Property<String> baseClassForTests;
|
||||
|
||||
private final Property<String> packageWithBaseClasses;
|
||||
|
||||
private final ListProperty<String> excludedFiles;
|
||||
|
||||
private final ListProperty<String> ignoredFiles;
|
||||
|
||||
private final ListProperty<String> includedFiles;
|
||||
|
||||
private final ListProperty<String> imports;
|
||||
|
||||
private final ListProperty<String> staticImports;
|
||||
|
||||
private final Property<TestMode> testMode;
|
||||
|
||||
private final Property<TestFramework> testFramework;
|
||||
|
||||
private final MapProperty<String, String> baseClassMappings;
|
||||
|
||||
private final Property<Boolean> assertJsonSize;
|
||||
|
||||
private final Property<Boolean> failOnInProgress;
|
||||
|
||||
private final DirectoryProperty generatedTestSourcesDir;
|
||||
|
||||
private final DirectoryProperty generatedTestResourcesDir;
|
||||
|
||||
@Inject
|
||||
@@ -121,8 +104,7 @@ class GenerateServerTestsTask extends DefaultTask {
|
||||
getLogger().info("Contracts are unpacked to [{}]", contractsDslDir);
|
||||
getLogger().info("Included contracts are [{}]", includedContracts);
|
||||
try {
|
||||
TestGenerator generator = new TestGenerator(toConfigProperties(contractsDslDir, includedContracts,
|
||||
generatedTestSources, generatedTestResources));
|
||||
TestGenerator generator = new TestGenerator(toConfigProperties(contractsDslDir, includedContracts, generatedTestSources, generatedTestResources));
|
||||
int generatedClasses = generator.generate();
|
||||
getLogger().info("Generated {} test classes", generatedClasses);
|
||||
}
|
||||
@@ -221,8 +203,9 @@ class GenerateServerTestsTask extends DefaultTask {
|
||||
return generatedTestResourcesDir;
|
||||
}
|
||||
|
||||
private ContractVerifierConfigProperties toConfigProperties(File contractsDslDir, String includedContracts,
|
||||
File generatedTestSources, File generatedTestResources) {
|
||||
private ContractVerifierConfigProperties toConfigProperties(File contractsDslDir,
|
||||
String includedContracts, File generatedTestSources,
|
||||
File generatedTestResources) {
|
||||
List<String> excludedFiles = this.excludedFiles.get();
|
||||
List<String> ignoredFiles = this.ignoredFiles.get();
|
||||
List<String> includedFiles = this.includedFiles.get();
|
||||
@@ -250,5 +233,4 @@ class GenerateServerTestsTask extends DefaultTask {
|
||||
properties.setFailOnInProgress(failOnInProgress.get());
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* For SCM based repositories will copy the generated stubs to the cloned repo with
|
||||
* contracts and stubs. Will also commit the changes and push them to origin.
|
||||
* For SCM based repositories will copy the generated stubs
|
||||
* to the cloned repo with contracts and stubs. Will also
|
||||
* commit the changes and push them to origin.
|
||||
*
|
||||
* NOTE: starting with 2.3.0.RELEASE the <code>customize{}</code> closure previously used
|
||||
* for {@link PublishStubsToScmTask} customisation is no longer available. The settings
|
||||
* should be applied directly within the <code>publishStubsToScm</code> closure as in the
|
||||
* example above.
|
||||
* NOTE: starting with 2.3.0.RELEASE the <code>customize{}</code> closure previously used for
|
||||
* {@link PublishStubsToScmTask} customisation is no longer available. The settings should be applied directly
|
||||
* within the <code>publishStubsToScm</code> closure as in the example above.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Anatoliy Balakirev
|
||||
@@ -62,8 +62,8 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
/**
|
||||
* @see ContractVerifierExtension#deleteStubsAfterTest
|
||||
*
|
||||
* This property will delete the Git repository where the input stubs to this task
|
||||
* have been committed.
|
||||
* This property will delete the Git repository where the input
|
||||
* stubs to this task have been committed.
|
||||
*/
|
||||
private final Property<Boolean> deleteStubsAfterTest;
|
||||
|
||||
@@ -85,9 +85,7 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
this.onlyIf(task -> {
|
||||
String contractRepoUrl = contractRepository.repositoryUrl.getOrElse("");
|
||||
if (StringUtils.isEmpty(contractRepoUrl) || !ScmStubDownloaderBuilder.isProtocolAccepted(contractRepoUrl)) {
|
||||
getLogger().warn(
|
||||
"Skipping pushing stubs to scm since your contracts repository URL [{}] doesn't match any of the accepted protocols for SCM stub downloader",
|
||||
contractRepoUrl);
|
||||
getLogger().warn("Skipping pushing stubs to scm since your contracts repository URL [{}] doesn't match any of the accepted protocols for SCM stub downloader", contractRepoUrl);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -96,12 +94,10 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
|
||||
@TaskAction
|
||||
void publishStubsToScm() {
|
||||
String projectName = getProject().getGroup().toString() + ":" + getProject().getName() + ":"
|
||||
+ getProject().getVersion().toString();
|
||||
String projectName = getProject().getGroup().toString() + ":" + getProject().getName() + ":" + getProject().getVersion().toString();
|
||||
getLogger().info("Pushing Stubs to SCM for project [{}]", projectName);
|
||||
StubRunnerOptions stubRunnerOptions = createStubRunnerOptions();
|
||||
new ContractProjectUpdater(stubRunnerOptions).updateContractProject(projectName,
|
||||
stubsDir.get().getAsFile().toPath());
|
||||
new ContractProjectUpdater(stubRunnerOptions).updateContractProject(projectName, stubsDir.get().getAsFile().toPath());
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -110,15 +106,10 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
}
|
||||
|
||||
static class Repository {
|
||||
|
||||
private final Property<String> repositoryUrl;
|
||||
|
||||
private final Property<String> username;
|
||||
|
||||
private final Property<String> password;
|
||||
|
||||
private final Property<Integer> proxyPort;
|
||||
|
||||
private final Property<String> proxyHost;
|
||||
|
||||
@Inject
|
||||
@@ -159,7 +150,6 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
Property<String> getProxyHost() {
|
||||
return proxyHost;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Input
|
||||
@@ -191,15 +181,16 @@ class PublishStubsToScmTask extends DefaultTask {
|
||||
private StubRunnerOptions createStubRunnerOptions() {
|
||||
StubRunnerOptionsBuilder options = new StubRunnerOptionsBuilder()
|
||||
.withOptions(StubRunnerOptions.fromSystemProps())
|
||||
.withStubRepositoryRoot(contractRepository.repositoryUrl.getOrNull()).withStubsMode(contractsMode.get())
|
||||
.withStubRepositoryRoot(contractRepository.repositoryUrl.getOrNull())
|
||||
.withStubsMode(contractsMode.get())
|
||||
.withUsername(contractRepository.username.getOrNull())
|
||||
.withPassword(contractRepository.password.getOrNull())
|
||||
.withDeleteStubsAfterTest(deleteStubsAfterTest.get()).withProperties(contractsProperties.getOrNull())
|
||||
.withDeleteStubsAfterTest(deleteStubsAfterTest.get())
|
||||
.withProperties(contractsProperties.getOrNull())
|
||||
.withFailOnNoStubs(failOnNoContracts.get());
|
||||
if (contractRepository.proxyPort.isPresent()) {
|
||||
options = options.withProxy(contractRepository.proxyHost.getOrNull(), contractRepository.proxyPort.get());
|
||||
}
|
||||
return options.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,32 +49,26 @@ import org.springframework.cloud.contract.verifier.config.TestFramework;
|
||||
/**
|
||||
* Gradle plugin for Spring Cloud Contract Verifier that from the DSL contract can
|
||||
* <ul>
|
||||
* <li>generate tests</li>
|
||||
* <li>generate stubs</li>
|
||||
* <li>generate tests</li>
|
||||
* <li>generate stubs</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Jakub Kubrynski, codearte.io
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Anatoliy Balakirev
|
||||
* @author Shannon Pamperl
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project> {
|
||||
|
||||
private static final String GROUP_NAME = "Verification";
|
||||
|
||||
private static final String EXTENSION_NAME = "contracts";
|
||||
|
||||
private static final String CONTRACT_TEST_SOURCE_SET_NAME = "contractTest";
|
||||
|
||||
private static final String CONTRACT_TEST_COMPILE_ONLY_CONFIGURATION_NAME = "contractTestCompileOnly";
|
||||
|
||||
private static final String CONTRACT_TEST_IMPLEMENTATION_CONFIGURATION_NAME = "contractTestImplementation";
|
||||
|
||||
private static final String CONTRACT_TEST_RUNTIME_ONLY_CONFIGURATION_NAME = "contractTestRuntimeOnly";
|
||||
|
||||
private static final String VERIFIER_STUBS_JAR_TASK_NAME = "verifierStubsJar";
|
||||
|
||||
private static final String CONTRACT_TEST_TASK_NAME = "contractTest";
|
||||
|
||||
private Project project;
|
||||
@@ -83,8 +77,7 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
public void apply(Project project) {
|
||||
this.project = project;
|
||||
project.getPlugins().apply(JavaPlugin.class);
|
||||
ContractVerifierExtension extension = project.getExtensions().create(EXTENSION_NAME,
|
||||
ContractVerifierExtension.class);
|
||||
ContractVerifierExtension extension = project.getExtensions().create(EXTENSION_NAME, ContractVerifierExtension.class);
|
||||
|
||||
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
|
||||
SourceSet contractTestSourceSet = configureSourceSets(extension, javaConvention);
|
||||
@@ -92,8 +85,7 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
registerContractTestTask(contractTestSourceSet);
|
||||
|
||||
TaskProvider<ContractsCopyTask> copyContracts = createAndConfigureCopyContractsTask(extension);
|
||||
TaskProvider<GenerateClientStubsFromDslTask> generateClientStubs = createAndConfigureGenerateClientStubs(
|
||||
extension, copyContracts);
|
||||
TaskProvider<GenerateClientStubsFromDslTask> generateClientStubs = createAndConfigureGenerateClientStubs(extension, copyContracts);
|
||||
|
||||
createAndConfigureStubsJarTasks(extension, generateClientStubs);
|
||||
createGenerateTestsTask(extension, contractTestSourceSet, copyContracts);
|
||||
@@ -104,12 +96,10 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
if (generatedTestSourcesDir.isPresent()) {
|
||||
if (extension.getTestFramework().get() == TestFramework.SPOCK) {
|
||||
project.getPlugins().withType(GroovyPlugin.class, groovyPlugin -> {
|
||||
GroovySourceSet groovy = ((HasConvention) contractTestSourceSet).getConvention()
|
||||
.getPlugin(GroovySourceSet.class);
|
||||
GroovySourceSet groovy = ((HasConvention) contractTestSourceSet).getConvention().getPlugin(GroovySourceSet.class);
|
||||
groovy.getGroovy().srcDirs(generatedTestSourcesDir);
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
contractTestSourceSet.getJava().srcDirs(generatedTestSourcesDir);
|
||||
}
|
||||
}
|
||||
@@ -144,8 +134,7 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
Configuration testImplementation = configurations.getByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME);
|
||||
Configuration testRuntimeOnly = configurations.getByName(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME);
|
||||
Configuration contractTestCompileOnly = configurations.getByName(CONTRACT_TEST_COMPILE_ONLY_CONFIGURATION_NAME);
|
||||
Configuration contractTestImplementation = configurations
|
||||
.getByName(CONTRACT_TEST_IMPLEMENTATION_CONFIGURATION_NAME);
|
||||
Configuration contractTestImplementation = configurations.getByName(CONTRACT_TEST_IMPLEMENTATION_CONFIGURATION_NAME);
|
||||
Configuration contractTestRuntimeOnly = configurations.getByName(CONTRACT_TEST_RUNTIME_ONLY_CONFIGURATION_NAME);
|
||||
|
||||
contractTestCompileOnly.extendsFrom(testCompileOnly);
|
||||
@@ -154,29 +143,25 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
}
|
||||
|
||||
private void registerContractTestTask(SourceSet contractTestSourceSet) {
|
||||
TaskProvider<Test> contractTestTask = project.getTasks().register(CONTRACT_TEST_TASK_NAME, Test.class,
|
||||
contractTest -> {
|
||||
contractTest.setDescription("Runs the contract tests");
|
||||
contractTest.setGroup(GROUP_NAME);
|
||||
contractTest.setTestClassesDirs(contractTestSourceSet.getOutput().getClassesDirs());
|
||||
contractTest.setClasspath(contractTestSourceSet.getRuntimeClasspath());
|
||||
TaskProvider<Test> contractTestTask = project.getTasks().register(CONTRACT_TEST_TASK_NAME, Test.class, contractTest -> {
|
||||
contractTest.setDescription("Runs the contract tests");
|
||||
contractTest.setGroup(GROUP_NAME);
|
||||
contractTest.setTestClassesDirs(contractTestSourceSet.getOutput().getClassesDirs());
|
||||
contractTest.setClasspath(contractTestSourceSet.getRuntimeClasspath());
|
||||
|
||||
contractTest.mustRunAfter(project.getTasks().named(JavaPlugin.TEST_TASK_NAME));
|
||||
});
|
||||
contractTest.mustRunAfter(project.getTasks().named(JavaPlugin.TEST_TASK_NAME));
|
||||
});
|
||||
|
||||
project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME, check -> check.dependsOn(contractTestTask));
|
||||
}
|
||||
|
||||
private void createGenerateTestsTask(ContractVerifierExtension extension, SourceSet contractTestSourceSet,
|
||||
TaskProvider<ContractsCopyTask> copyContracts) {
|
||||
TaskProvider<GenerateServerTestsTask> task = project.getTasks().register(GenerateServerTestsTask.TASK_NAME,
|
||||
GenerateServerTestsTask.class);
|
||||
private void createGenerateTestsTask(ContractVerifierExtension extension, SourceSet contractTestSourceSet, TaskProvider<ContractsCopyTask> copyContracts) {
|
||||
TaskProvider<GenerateServerTestsTask> task = project.getTasks().register(GenerateServerTestsTask.TASK_NAME, GenerateServerTestsTask.class);
|
||||
task.configure(generateServerTestsTask -> {
|
||||
generateServerTestsTask.setDescription("Generate server tests from the contracts");
|
||||
generateServerTestsTask.setGroup(GROUP_NAME);
|
||||
|
||||
generateServerTestsTask.getContractsDslDir()
|
||||
.convention(copyContracts.flatMap(ContractsCopyTask::getCopiedContractsFolder));
|
||||
generateServerTestsTask.getContractsDslDir().convention(copyContracts.flatMap(ContractsCopyTask::getCopiedContractsFolder));
|
||||
generateServerTestsTask.getNameSuffixForTests().convention(extension.getNameSuffixForTests());
|
||||
generateServerTestsTask.getBasePackageForTests().convention(extension.getBasePackageForTests());
|
||||
generateServerTestsTask.getBaseClassForTests().convention(extension.getBaseClassForTests());
|
||||
@@ -188,21 +173,18 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
generateServerTestsTask.getStaticImports().convention(extension.getStaticImports());
|
||||
generateServerTestsTask.getTestMode().convention(extension.getTestMode());
|
||||
generateServerTestsTask.getTestFramework().convention(extension.getTestFramework());
|
||||
generateServerTestsTask.getBaseClassMappings()
|
||||
.convention(extension.getBaseClassMappings().getBaseClassMappings());
|
||||
generateServerTestsTask.getBaseClassMappings().convention(extension.getBaseClassMappings().getBaseClassMappings());
|
||||
generateServerTestsTask.getAssertJsonSize().convention(extension.getAssertJsonSize());
|
||||
generateServerTestsTask.getFailOnInProgress().convention(extension.getFailOnInProgress());
|
||||
generateServerTestsTask.getGeneratedTestSourcesDir()
|
||||
.convention(extension.getTestFramework().flatMap(testFramework -> {
|
||||
Property<Directory> correctSourceSetDir;
|
||||
if (testFramework == TestFramework.SPOCK) {
|
||||
correctSourceSetDir = extension.getGeneratedTestGroovySourcesDir();
|
||||
}
|
||||
else {
|
||||
correctSourceSetDir = extension.getGeneratedTestJavaSourcesDir();
|
||||
}
|
||||
return extension.getGeneratedTestSourcesDir().orElse(correctSourceSetDir);
|
||||
}));
|
||||
generateServerTestsTask.getGeneratedTestSourcesDir().convention(extension.getTestFramework().flatMap(testFramework -> {
|
||||
Property<Directory> correctSourceSetDir;
|
||||
if (testFramework == TestFramework.SPOCK) {
|
||||
correctSourceSetDir = extension.getGeneratedTestGroovySourcesDir();
|
||||
} else {
|
||||
correctSourceSetDir = extension.getGeneratedTestJavaSourcesDir();
|
||||
}
|
||||
return extension.getGeneratedTestSourcesDir().orElse(correctSourceSetDir);
|
||||
}));
|
||||
generateServerTestsTask.getGeneratedTestResourcesDir().convention(extension.getGeneratedTestResourcesDir());
|
||||
|
||||
generateServerTestsTask.dependsOn(copyContracts);
|
||||
@@ -219,60 +201,48 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
|
||||
private void createAndConfigurePublishStubsToScmTask(ContractVerifierExtension extension,
|
||||
TaskProvider<GenerateClientStubsFromDslTask> generateClientStubs) {
|
||||
TaskProvider<PublishStubsToScmTask> task = project.getTasks().register(PublishStubsToScmTask.TASK_NAME,
|
||||
PublishStubsToScmTask.class);
|
||||
TaskProvider<PublishStubsToScmTask> task = project.getTasks().register(PublishStubsToScmTask.TASK_NAME, PublishStubsToScmTask.class);
|
||||
task.configure(publishStubsToScmTask -> {
|
||||
publishStubsToScmTask
|
||||
.setDescription("The generated stubs get committed to the SCM repo and pushed to origin");
|
||||
publishStubsToScmTask.setDescription("The generated stubs get committed to the SCM repo and pushed to origin");
|
||||
publishStubsToScmTask.setGroup(GROUP_NAME);
|
||||
|
||||
ContractVerifierExtension.ContractRepository stubs = extension.getPublishStubsToScm()
|
||||
.getContractRepository();
|
||||
ContractVerifierExtension.ContractRepository stubs = extension.getPublishStubsToScm().getContractRepository();
|
||||
ContractVerifierExtension.ContractRepository original = extension.getContractRepository();
|
||||
|
||||
publishStubsToScmTask.getContractRepository().getRepositoryUrl()
|
||||
.convention(stubs.getRepositoryUrl().orElse(original.getRepositoryUrl()));
|
||||
publishStubsToScmTask.getContractRepository().getUsername()
|
||||
.convention(stubs.getUsername().orElse(original.getUsername()));
|
||||
publishStubsToScmTask.getContractRepository().getPassword()
|
||||
.convention(stubs.getPassword().orElse(original.getPassword()));
|
||||
publishStubsToScmTask.getContractRepository().getProxyHost()
|
||||
.convention(stubs.getProxyHost().orElse(original.getProxyHost()));
|
||||
publishStubsToScmTask.getContractRepository().getProxyPort()
|
||||
.convention(stubs.getProxyPort().orElse(original.getProxyPort()));
|
||||
publishStubsToScmTask.getContractRepository().getRepositoryUrl().convention(stubs.getRepositoryUrl().orElse(original.getRepositoryUrl()));
|
||||
publishStubsToScmTask.getContractRepository().getUsername().convention(stubs.getUsername().orElse(original.getUsername()));
|
||||
publishStubsToScmTask.getContractRepository().getPassword().convention(stubs.getPassword().orElse(original.getPassword()));
|
||||
publishStubsToScmTask.getContractRepository().getProxyHost().convention(stubs.getProxyHost().orElse(original.getProxyHost()));
|
||||
publishStubsToScmTask.getContractRepository().getProxyPort().convention(stubs.getProxyPort().orElse(original.getProxyPort()));
|
||||
publishStubsToScmTask.getContractsMode().convention(extension.getContractsMode());
|
||||
publishStubsToScmTask.getDeleteStubsAfterTest().convention(extension.getDeleteStubsAfterTest());
|
||||
publishStubsToScmTask.getFailOnNoContracts().convention(extension.getFailOnNoContracts());
|
||||
publishStubsToScmTask.getContractsProperties().convention(extension.getContractsProperties());
|
||||
publishStubsToScmTask.getStubsDir()
|
||||
.convention(generateClientStubs.flatMap(GenerateClientStubsFromDslTask::getStubsOutputDir));
|
||||
publishStubsToScmTask.getStubsDir().convention(generateClientStubs.flatMap(GenerateClientStubsFromDslTask::getStubsOutputDir));
|
||||
|
||||
publishStubsToScmTask.dependsOn(generateClientStubs);
|
||||
});
|
||||
}
|
||||
|
||||
private TaskProvider<GenerateClientStubsFromDslTask> createAndConfigureGenerateClientStubs(
|
||||
ContractVerifierExtension extension, TaskProvider<ContractsCopyTask> copyContracts) {
|
||||
TaskProvider<GenerateClientStubsFromDslTask> task = project.getTasks().register(
|
||||
GenerateClientStubsFromDslTask.TASK_NAME, GenerateClientStubsFromDslTask.class, generateClientStubs -> {
|
||||
generateClientStubs.setGroup(GROUP_NAME);
|
||||
generateClientStubs.setDescription("Generate client stubs from the contracts");
|
||||
private TaskProvider<GenerateClientStubsFromDslTask> createAndConfigureGenerateClientStubs(ContractVerifierExtension extension,
|
||||
TaskProvider<ContractsCopyTask> copyContracts) {
|
||||
TaskProvider<GenerateClientStubsFromDslTask> task = project.getTasks().register(GenerateClientStubsFromDslTask.TASK_NAME, GenerateClientStubsFromDslTask.class, generateClientStubs -> {
|
||||
generateClientStubs.setGroup(GROUP_NAME);
|
||||
generateClientStubs.setDescription("Generate client stubs from the contracts");
|
||||
|
||||
generateClientStubs.getContractsDslDir()
|
||||
.convention(copyContracts.flatMap(ContractsCopyTask::getCopiedContractsFolder));
|
||||
generateClientStubs.getExcludedFiles().convention(extension.getExcludedFiles());
|
||||
generateClientStubs.getExcludeBuildFolders().convention(extension.getExcludeBuildFolders());
|
||||
generateClientStubs.getContractsDslDir().convention(copyContracts.flatMap(ContractsCopyTask::getCopiedContractsFolder));
|
||||
generateClientStubs.getExcludedFiles().convention(extension.getExcludedFiles());
|
||||
generateClientStubs.getExcludeBuildFolders().convention(extension.getExcludeBuildFolders());
|
||||
|
||||
generateClientStubs.getStubsOutputDir().convention(extension.getStubsOutputDir()
|
||||
.dir(buildRootPath(GenerateClientStubsFromDslTask.DEFAULT_MAPPINGS_FOLDER)));
|
||||
generateClientStubs.getStubsOutputDir().convention(extension.getStubsOutputDir().dir(buildRootPath(GenerateClientStubsFromDslTask.DEFAULT_MAPPINGS_FOLDER)));
|
||||
|
||||
generateClientStubs.dependsOn(copyContracts);
|
||||
});
|
||||
generateClientStubs.dependsOn(copyContracts);
|
||||
});
|
||||
return task;
|
||||
}
|
||||
|
||||
private void createAndConfigureStubsJarTasks(ContractVerifierExtension extension,
|
||||
TaskProvider<GenerateClientStubsFromDslTask> generateClientStubs) {
|
||||
TaskProvider<GenerateClientStubsFromDslTask> generateClientStubs) {
|
||||
TaskProvider<Jar> verifierStubsJar = project.getTasks().register(VERIFIER_STUBS_JAR_TASK_NAME, Jar.class);
|
||||
verifierStubsJar.configure(stubsJar -> {
|
||||
stubsJar.setDescription("Creates the stubs JAR task");
|
||||
@@ -288,14 +258,12 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void createAndConfigureMavenPublishPlugin(TaskProvider<Jar> stubsTask,
|
||||
ContractVerifierExtension extension) {
|
||||
private void createAndConfigureMavenPublishPlugin(TaskProvider<Jar> stubsTask, ContractVerifierExtension extension) {
|
||||
if (!classIsOnClasspath("org.gradle.api.publish.maven.plugins.MavenPublishPlugin")) {
|
||||
project.getLogger().debug("Maven Publish Plugin is not present - won't add default publication");
|
||||
return;
|
||||
}
|
||||
// This must be called within afterEvaluate due to getting data from extension,
|
||||
// which must be initialised first:
|
||||
// This must be called within afterEvaluate due to getting data from extension, which must be initialised first:
|
||||
project.afterEvaluate(inner -> {
|
||||
project.getLogger().debug("Spring Cloud Contract Verifier Plugin: Generating default publication");
|
||||
if (extension.getDisableStubPublication().get()) {
|
||||
@@ -305,12 +273,10 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
project.getPlugins().withType(MavenPublishPlugin.class, publishingPlugin -> {
|
||||
PublishingExtension publishingExtension = project.getExtensions().findByType(PublishingExtension.class);
|
||||
if (hasStubsPublication(publishingExtension)) {
|
||||
project.getLogger().info(
|
||||
"Spring Cloud Contract Verifier Plugin: Stubs publication was present - won't create a new one. Remember about passing stubs as artifact");
|
||||
project.getLogger().info("Spring Cloud Contract Verifier Plugin: Stubs publication was present - won't create a new one. Remember about passing stubs as artifact");
|
||||
}
|
||||
else {
|
||||
project.getLogger().debug(
|
||||
"Spring Cloud Contract Verifier Plugin: Stubs publication is not present - will create one");
|
||||
project.getLogger().debug("Spring Cloud Contract Verifier Plugin: Stubs publication is not present - will create one");
|
||||
setPublications(publishingExtension, stubsTask);
|
||||
}
|
||||
});
|
||||
@@ -348,45 +314,32 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
}
|
||||
|
||||
private TaskProvider<ContractsCopyTask> createAndConfigureCopyContractsTask(ContractVerifierExtension extension) {
|
||||
TaskProvider<ContractsCopyTask> task = project.getTasks().register(ContractsCopyTask.TASK_NAME,
|
||||
ContractsCopyTask.class, contractsCopyTask -> {
|
||||
contractsCopyTask.setGroup(GROUP_NAME);
|
||||
contractsCopyTask.setDescription("Copies contracts to the output folder");
|
||||
TaskProvider<ContractsCopyTask> task = project.getTasks().register(ContractsCopyTask.TASK_NAME, ContractsCopyTask.class, contractsCopyTask -> {
|
||||
contractsCopyTask.setGroup(GROUP_NAME);
|
||||
contractsCopyTask.setDescription("Copies contracts to the output folder");
|
||||
|
||||
contractsCopyTask.getConvertToYaml().convention(extension.getConvertToYaml());
|
||||
contractsCopyTask.getFailOnNoContracts().convention(extension.getFailOnNoContracts());
|
||||
contractsCopyTask.getContractsDirectory().convention(extension.getContractsDslDir());
|
||||
contractsCopyTask.getContractDependency().getGroupId()
|
||||
.convention(extension.getContractDependency().getGroupId());
|
||||
contractsCopyTask.getContractDependency().getArtifactId()
|
||||
.convention(extension.getContractDependency().getArtifactId());
|
||||
contractsCopyTask.getContractDependency().getVersion()
|
||||
.convention(extension.getContractDependency().getVersion());
|
||||
contractsCopyTask.getContractDependency().getClassifier()
|
||||
.convention(extension.getContractDependency().getClassifier());
|
||||
contractsCopyTask.getContractDependency().getStringNotation()
|
||||
.convention(extension.getContractDependency().getStringNotation());
|
||||
contractsCopyTask.getContractRepository().getRepositoryUrl()
|
||||
.convention(extension.getContractRepository().getRepositoryUrl());
|
||||
contractsCopyTask.getContractRepository().getUsername()
|
||||
.convention(extension.getContractRepository().getUsername());
|
||||
contractsCopyTask.getContractRepository().getPassword()
|
||||
.convention(extension.getContractRepository().getPassword());
|
||||
contractsCopyTask.getContractRepository().getProxyHost()
|
||||
.convention(extension.getContractRepository().getProxyHost());
|
||||
contractsCopyTask.getContractRepository().getProxyPort()
|
||||
.convention(extension.getContractRepository().getProxyPort());
|
||||
contractsCopyTask.getContractsMode().convention(extension.getContractsMode());
|
||||
contractsCopyTask.getContractsProperties().convention(extension.getContractsProperties());
|
||||
contractsCopyTask.getContractsPath().convention(extension.getContractsPath());
|
||||
contractsCopyTask.getExcludeBuildFolders().convention(extension.getExcludeBuildFolders());
|
||||
contractsCopyTask.getDeleteStubsAfterTest().convention(extension.getDeleteStubsAfterTest());
|
||||
contractsCopyTask.getConvertToYaml().convention(extension.getConvertToYaml());
|
||||
contractsCopyTask.getFailOnNoContracts().convention(extension.getFailOnNoContracts());
|
||||
contractsCopyTask.getContractsDirectory().convention(extension.getContractsDslDir());
|
||||
contractsCopyTask.getContractDependency().getGroupId().convention(extension.getContractDependency().getGroupId());
|
||||
contractsCopyTask.getContractDependency().getArtifactId().convention(extension.getContractDependency().getArtifactId());
|
||||
contractsCopyTask.getContractDependency().getVersion().convention(extension.getContractDependency().getVersion());
|
||||
contractsCopyTask.getContractDependency().getClassifier().convention(extension.getContractDependency().getClassifier());
|
||||
contractsCopyTask.getContractDependency().getStringNotation().convention(extension.getContractDependency().getStringNotation());
|
||||
contractsCopyTask.getContractRepository().getRepositoryUrl().convention(extension.getContractRepository().getRepositoryUrl());
|
||||
contractsCopyTask.getContractRepository().getUsername().convention(extension.getContractRepository().getUsername());
|
||||
contractsCopyTask.getContractRepository().getPassword().convention(extension.getContractRepository().getPassword());
|
||||
contractsCopyTask.getContractRepository().getProxyHost().convention(extension.getContractRepository().getProxyHost());
|
||||
contractsCopyTask.getContractRepository().getProxyPort().convention(extension.getContractRepository().getProxyPort());
|
||||
contractsCopyTask.getContractsMode().convention(extension.getContractsMode());
|
||||
contractsCopyTask.getContractsProperties().convention(extension.getContractsProperties());
|
||||
contractsCopyTask.getContractsPath().convention(extension.getContractsPath());
|
||||
contractsCopyTask.getExcludeBuildFolders().convention(extension.getExcludeBuildFolders());
|
||||
contractsCopyTask.getDeleteStubsAfterTest().convention(extension.getDeleteStubsAfterTest());
|
||||
|
||||
contractsCopyTask.getCopiedContractsFolder()
|
||||
.convention(extension.getStubsOutputDir().dir(buildRootPath(ContractsCopyTask.CONTRACTS)));
|
||||
contractsCopyTask.getBackupContractsFolder()
|
||||
.convention(extension.getStubsOutputDir().dir(buildRootPath(ContractsCopyTask.BACKUP)));
|
||||
});
|
||||
contractsCopyTask.getCopiedContractsFolder().convention(extension.getStubsOutputDir().dir(buildRootPath(ContractsCopyTask.CONTRACTS)));
|
||||
contractsCopyTask.getBackupContractsFolder().convention(extension.getStubsOutputDir().dir(buildRootPath(ContractsCopyTask.BACKUP)));
|
||||
});
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -405,11 +358,16 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
|
||||
private Provider<String> buildRootPath(String path) {
|
||||
return project.provider(() -> {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("META-INF").append(File.separator).append(project.getGroup()).append(File.separator)
|
||||
.append(project.getName()).append(File.separator).append(project.getVersion())
|
||||
.append(File.separator).append(path);
|
||||
builder.append("META-INF")
|
||||
.append(File.separator)
|
||||
.append(project.getGroup())
|
||||
.append(File.separator)
|
||||
.append(project.getName())
|
||||
.append(File.separator)
|
||||
.append(project.getVersion())
|
||||
.append(File.separator)
|
||||
.append(path);
|
||||
return builder.toString();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
#
|
||||
wiremockVersion=2.27.0
|
||||
jsonAssertVersion=0.4.13
|
||||
verifierVersion=3.0.0-M4
|
||||
verifierVersion=3.0.0-SNAPSHOT
|
||||
groovyVersion=2.4.17
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
#
|
||||
wiremockVersion=2.27.0
|
||||
jsonAssertVersion=0.4.13
|
||||
verifierVersion=3.0.0-M4
|
||||
verifierVersion=3.0.0-SNAPSHOT
|
||||
bootVersion=2.4.0-M3
|
||||
groovyVersion=2.4.17
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
#
|
||||
wiremockVersion=2.27.0
|
||||
jsonAssertVersion=0.4.13
|
||||
verifierVersion=3.0.0-M4
|
||||
verifierVersion=3.0.0-SNAPSHOT
|
||||
bootVersion=2.4.0-M3
|
||||
groovyVersion=2.4.17
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tools</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tools</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tools</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-pact</artifactId>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-verifier</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-wiremock</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-parent</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-sample-amqp</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-sample-camel</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-sample-integration</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-sample-jms</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-sample-stream</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-amqp</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-boot-eureka</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-boot-zookeeper</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-camel</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-context-path</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-integration</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-jms</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-kafka</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-moco-contract-jar</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-moco</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-tests</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-contract-stub-runner-stream</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user