-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gradle: fix IllegalStateException when resolving project deps
- Loading branch information
Showing
12 changed files
with
267 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
integration-tests/gradle/src/main/resources/included-build/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Reproducer for https://github.com/quarkusio/quarkus/pull/38607: IllegalStateException when resolving project deps | ||
Test class: io.quarkus.gradle.IncludedQuarkusBuildTest |
45 changes: 45 additions & 0 deletions
45
integration-tests/gradle/src/main/resources/included-build/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
buildscript { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
group = 'com.quarkus.demo' | ||
version = '1.0' | ||
|
||
|
||
subprojects { | ||
|
||
apply plugin: 'java' | ||
group = 'com.quarkus.demo' | ||
|
||
test { | ||
dependsOn 'cleanTest' | ||
useJUnitPlatform() | ||
forkEvery 1 | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} | ||
|
||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...tion-tests/gradle/src/main/resources/included-build/depend-on-included-build/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id 'java-library' | ||
} | ||
|
||
dependencies { | ||
implementation("com.quarkus.includedbuild:included-quarkus:1.0") | ||
} |
2 changes: 2 additions & 0 deletions
2
integration-tests/gradle/src/main/resources/included-build/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformGroupId=io.quarkus |
45 changes: 45 additions & 0 deletions
45
integration-tests/gradle/src/main/resources/included-build/included/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
buildscript { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
group = 'com.quarkus.directinclude' | ||
version = '1.0' | ||
|
||
|
||
subprojects { | ||
|
||
apply plugin: 'java' | ||
group = 'com.quarkus.directinclude' | ||
|
||
test { | ||
dependsOn 'cleanTest' | ||
useJUnitPlatform() | ||
forkEvery 1 | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} | ||
|
||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
integration-tests/gradle/src/main/resources/included-build/included/nested/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
buildscript { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
group = 'com.quarkus.includedbuild' | ||
version = '1.0' | ||
|
||
|
||
subprojects { | ||
|
||
apply plugin: 'java' | ||
group = 'com.quarkus.includedbuild' | ||
|
||
test { | ||
dependsOn 'cleanTest' | ||
useJUnitPlatform() | ||
forkEvery 1 | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} | ||
|
||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ts/gradle/src/main/resources/included-build/included/nested/included-quarkus/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'io.quarkus' | ||
} | ||
|
||
dependencies { | ||
} |
20 changes: 20 additions & 0 deletions
20
integration-tests/gradle/src/main/resources/included-build/included/nested/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
//noinspection GroovyAssignabilityCheck | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
|
||
rootProject.name = 'nested' | ||
|
||
include ':included-quarkus' |
23 changes: 23 additions & 0 deletions
23
integration-tests/gradle/src/main/resources/included-build/included/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
//noinspection GroovyAssignabilityCheck | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
|
||
includeBuild 'nested' | ||
|
||
rootProject.name = 'included' | ||
|
||
include ':dependency' | ||
include ':included-quarkus' |
5 changes: 5 additions & 0 deletions
5
integration-tests/gradle/src/main/resources/included-build/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rootProject.name = 'include-quarkus-build' | ||
|
||
includeBuild 'included' | ||
|
||
include ':depend-on-included-build' |
48 changes: 48 additions & 0 deletions
48
integration-tests/gradle/src/test/java/io/quarkus/gradle/IncludedQuarkusBuildTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkus.gradle; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.stream.Stream; | ||
|
||
import org.assertj.core.api.SoftAssertions; | ||
import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; | ||
import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Reproducer for <a href="https://github.com/quarkusio/quarkus/pull/38607">{@code IllegalStateException} when | ||
* Quarkus project is in an <em>included</em> Gradle build</a>. | ||
*/ | ||
@ExtendWith(SoftAssertionsExtension.class) | ||
public class IncludedQuarkusBuildTest extends QuarkusGradleWrapperTestBase { | ||
@InjectSoftAssertions | ||
SoftAssertions soft; | ||
|
||
@Test | ||
public void test() throws Exception { | ||
|
||
final File projectDir = getProjectDir("included-build"); | ||
|
||
Path prjDir = projectDir.toPath(); | ||
Path target1 = prjDir.resolve("included").resolve("gradle.properties"); | ||
Path target2 = prjDir.resolve("included").resolve("nested").resolve("gradle.properties"); | ||
Files.deleteIfExists(target1); | ||
Files.deleteIfExists(target2); | ||
Files.copy(prjDir.resolve("gradle.properties"), target1); | ||
Files.copy(prjDir.resolve("gradle.properties"), target2); | ||
|
||
soft.assertThat(runGradleWrapper(projectDir, "clean", "jar", "--no-build-cache").unsuccessfulTasks()) | ||
.isEmpty(); | ||
|
||
try { | ||
soft.assertAll(); | ||
} catch (AssertionError ex) { | ||
try (Stream<Path> files = Files.walk(prjDir)) { | ||
files.map(Path::toString).sorted().forEach(System.err::println); | ||
} | ||
throw ex; | ||
} | ||
} | ||
} |