Skip to content

Commit

Permalink
Minimal *-deployment dependencies for integration-tests + enforcer rule
Browse files Browse the repository at this point in the history
Fixes quarkusio#10859 by enforcing a consistent build order.

Presence of such minimal dependencies is enforced by the new RequiresMinimalDeploymentDependency rule.
  • Loading branch information
famod authored and gastaldi committed Aug 26, 2020
1 parent 6fedf53 commit 562f987
Show file tree
Hide file tree
Showing 126 changed files with 5,749 additions and 396 deletions.
68 changes: 68 additions & 0 deletions devtools/enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-devtools-all</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-enforcer-rules</artifactId>
<name>Quarkus - Enforcer Rules</name>

<dependencies>
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-api</artifactId>
<version>${version.enforcer.plugin}</version>
<scope>provided</scope>
<!-- avoid dependencyConvergence issues -->
<exclusions>
<exclusion>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
<!-- avoid dependencyConvergence issues -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.1</version>
<!-- http://maven.apache.org/plugins/maven-invoker-plugin/usage.html -->
<configuration>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<settingsFile>src/it/settings.xml</settingsFile>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<postBuildHookScript>verify</postBuildHookScript> <!-- no extension required -->
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
36 changes: 36 additions & 0 deletions devtools/enforcer-rules/src/it/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!-- http://maven.apache.org/plugins/maven-invoker-plugin/examples/fast-use.html -->
<settings>
<profiles>
<profile>
<id>it-repo</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
13 changes: 13 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/ext1/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext1-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-ext1-deployment</artifactId>

</project>
19 changes: 19 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/ext1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-ext1-parent</artifactId>
<packaging>pom</packaging>

<modules>
<module>runtime</module>
<module>deployment</module>
</modules>

</project>
13 changes: 13 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/ext1/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext1-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-ext1</artifactId>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deployment-artifact=io.quarkus\:quarkus-enforcer-rules-smoketest-ext1-deployment\:1.0-SNAPSHOT
18 changes: 18 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/ext2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-ext2-parent</artifactId>
<packaging>pom</packaging>

<modules>
<module>runtime</module>
</modules>

</project>
13 changes: 13 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/ext2/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext2-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-ext2</artifactId>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deployment-artifact=io.quarkus\:quarkus-enforcer-rules-smoketest-ext2-deployment\:1.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-integration-tests</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-integration-tests-ext1</artifactId>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext1</artifactId>
<version>${project.version}</version>
</dependency>

<!-- "Symbolic" test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext1-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-integration-tests</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-integration-tests-ext2</artifactId>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest-ext2</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
47 changes: 47 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-enforcer-rules-smoketest-integration-tests</artifactId>
<packaging>pom</packaging>

<modules>
<module>ext1</module>
<module>ext2</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-deployment-deps</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requiresMinimalDeploymentDependency implementation="io.quarkus.enforcer.RequiresMinimalDeploymentDependency"/>
</rules>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.buildResult = failure
23 changes: 23 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>37</version>
</parent>

<groupId>io.quarkus</groupId>
<artifactId>quarkus-enforcer-rules-smoketest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>ext1</module>
<module>ext2</module>
<module>integration-tests</module>
</modules>

<!-- note: rule is configured in integration-tests/pom.xml -->
</project>
5 changes: 5 additions & 0 deletions devtools/enforcer-rules/src/it/smoketest/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( 'quarkus-enforcer-rules-smoketest-integration-tests-ext1 SUCCESS' )
assert buildLog.text.contains( 'quarkus-enforcer-rules-smoketest-integration-tests-ext2 FAILURE' )
assert buildLog.text.contains( 'RequiresMinimalDeploymentDependency failed with message' )
assert buildLog.text.contains( '<artifactId>quarkus-enforcer-rules-smoketest-ext2-deployment</artifactId>' )
Loading

0 comments on commit 562f987

Please sign in to comment.