Skip to content

Commit

Permalink
Merge pull request #472 from rnc/NCLSUP1186
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc authored Dec 11, 2024
2 parents 04f9743 + a678be0 commit 4460185
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,11 @@ public void ensureAlignmentFileCreated()
SettingsXpp3Reader settingsXpp3Reader = new SettingsXpp3Reader();
Settings generatedSettings = settingsXpp3Reader.read(reader);
List<Repository> repositories = generatedSettings.getProfiles().get(0).getRepositories();

if (GradleVersion.current().compareTo(GradleVersion.version("7.4")) <= 0) {
assertThat(repositories).extracting("url").containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://oss.sonatype.org/content/repositories/snapshots/",
"https://dl.google.com/dl/android/maven2/");
} else {
assertThat(repositories).extracting("url").containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2",
"https://oss.sonatype.org/content/repositories/snapshots/",
"https://dl.google.com/dl/android/maven2/");
}
assertThat(repositories).extracting("url").containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2",
"https://oss.sonatype.org/content/repositories/snapshots/",
"https://dl.google.com/dl/android/maven2/");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,12 @@ public void ensureAlignmentFileCreatedAndAlignmentTaskRun()
Settings generatedSettings = settingsXpp3Reader.read(reader);
List<Repository> repositories = generatedSettings.getProfiles().get(0).getRepositories();

if (GradleVersion.current().compareTo(GradleVersion.version("7.4")) <= 0) {
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://repo.maven.apache.org/maven2/");
} else {
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2");
}
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven",
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2");
}

// make sure the project name was not changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,11 @@ public void ensureAlignmentFileCreatedAndAlignmentTaskRun()
Settings generatedSettings = settingsXpp3Reader.read(reader);
List<Repository> repositories = generatedSettings.getProfiles().get(0).getRepositories();

if (GradleVersion.current().compareTo(GradleVersion.version("7.4")) <= 0) {
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://repo.maven.apache.org/maven2/");
} else {
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2");
}
assertThat(repositories).extracting("url")
// should not contain duplicate entries
.containsOnly(
"https://repo.maven.apache.org/maven2/",
"https://plugins.gradle.org/m2");
}

// make sure the project name was not changed
Expand Down
10 changes: 10 additions & 0 deletions analyzer/src/functTest/resources/multi-module/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

pluginManagement {
repositories {
maven {
url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven"
}
gradlePluginPortal()
}
}

rootProject.name = 'root'
include 'subproject1'
include 'subproject1:subproject11'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
import org.gradle.api.artifacts.ResolvedDependency;
import org.gradle.api.artifacts.UnresolvedDependency;
import org.gradle.api.artifacts.repositories.ArtifactRepository;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.attributes.Attribute;
import org.gradle.api.internal.GradleInternal;
import org.gradle.api.internal.artifacts.result.DefaultResolvedDependencyResult;
import org.gradle.api.internal.plugins.DefaultPluginManager;
import org.gradle.api.logging.Logger;
Expand Down Expand Up @@ -257,6 +259,15 @@ public void perform() {
org.jboss.gm.common.utils.FileUtils.relativize(root, project.getProjectDir().toPath())));
project.getBuildscript().getRepositories().forEach(r -> cache.addRepository(r,
org.jboss.gm.common.utils.FileUtils.relativize(root, project.getProjectDir().toPath())));
// Complete hack due to
// /~https://github.com/gradle/gradle/issues/19711
// /~https://github.com/gradle/gradle/issues/17295
// /~https://github.com/gradlex-org/jvm-dependency-conflict-resolution/blob/1c25db65e0080ee5dcb9f54bd7db2dda4ca80b6c/src/main/java/org/gradlex/javaecosystem/capabilities/BasePluginApplication.java
((GradleInternal) project.getGradle()).getSettings().getSettings().getPluginManagement().getRepositories().forEach(
r -> {
cache.addRepository(r,
org.jboss.gm.common.utils.FileUtils.relativize(root, project.getProjectDir().toPath()));
});

if (StringUtils.isBlank(groupId) ||
DEFAULT_VERSION.equals(currentProjectVersion)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.name = 'root'
include 'subproject1'
include 'subproject2'
include 'subproject2'

0 comments on commit 4460185

Please sign in to comment.