From f02f2f43ac194fd75d2b78622327f1d6da98d8ad Mon Sep 17 00:00:00 2001 From: Cedric Champeau Date: Fri, 8 Oct 2021 09:34:52 +0200 Subject: [PATCH] Attempt to fix snapshot publishing for Maven --- .../build/maven/GeneratePluginDescriptor.java | 4 ++++ native-maven-plugin/build.gradle.kts | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/native-maven-plugin/build-plugins/src/main/java/org/graalvm/build/maven/GeneratePluginDescriptor.java b/native-maven-plugin/build-plugins/src/main/java/org/graalvm/build/maven/GeneratePluginDescriptor.java index 488367b6a..083bd0af8 100644 --- a/native-maven-plugin/build-plugins/src/main/java/org/graalvm/build/maven/GeneratePluginDescriptor.java +++ b/native-maven-plugin/build-plugins/src/main/java/org/graalvm/build/maven/GeneratePluginDescriptor.java @@ -29,6 +29,9 @@ public abstract class GeneratePluginDescriptor extends MavenTask { @Internal public abstract DirectoryProperty getCommonRepository(); + @Internal + public abstract DirectoryProperty getLocalRepository(); + public GeneratePluginDescriptor() { getArguments().set(Arrays.asList("-q", "org.apache.maven.plugins:maven-plugin-plugin:3.6.1:descriptor")); } @@ -36,6 +39,7 @@ public GeneratePluginDescriptor() { @Override protected void prepareSpec(JavaExecSpec spec) { spec.systemProperty("common.repo.uri", getCommonRepository().getAsFile().get().toURI().toString()); + spec.systemProperty("seed.repo.uri", getLocalRepository().get().getAsFile().toURI().toASCIIString()); } @Override diff --git a/native-maven-plugin/build.gradle.kts b/native-maven-plugin/build.gradle.kts index 3f99e8db1..440b02907 100644 --- a/native-maven-plugin/build.gradle.kts +++ b/native-maven-plugin/build.gradle.kts @@ -97,9 +97,12 @@ publishing { } } +val localRepositoryDir = project.layout.buildDirectory.dir("maven-seeded-repo") + tasks { generatePluginDescriptor { commonRepository.set(repoDirectory) + localRepository.set(localRepositoryDir) } } @@ -111,19 +114,17 @@ val prepareSeedingProject = tasks.register("prepareSeedingProject") { outputs.upToDateWhen { false } } -val localRepository = project.layout.buildDirectory.dir("maven-seeded-repo") - val prepareMavenLocalRepo = tasks.register("prepareMavenLocalRepo") { dependsOn(prepareSeedingProject) projectDirectory.set(prepareSeedingProject.map { seedingDir.get() }) settingsFile.set(layout.projectDirectory.file("config/settings.xml")) pomFile.set(seedingDir.map { it.file("pom.xml") }) mavenEmbedderClasspath.from(configurations.mavenEmbedder) - outputDirectory.set(localRepository) + outputDirectory.set(localRepositoryDir) arguments.set(listOf( "-q", "-Dproject.build.directory=${File(temporaryDir, "target")}", - "-Dmaven.repo.local=${localRepository.get().asFile.absolutePath}", + "-Dmaven.repo.local=${localRepositoryDir.get().asFile.absolutePath}", "-Djunit.jupiter.version=${libs.versions.junitJupiter.get()}", "-Dnative.maven.plugin.version=${libs.versions.nativeBuildTools.get()}", "-Djunit.platform.native.version=${libs.versions.nativeBuildTools.get()}", @@ -136,7 +137,7 @@ val prepareMavenLocalRepo = tasks.register("prepareMavenLocalRepo") { ) doFirst { - GFileUtils.deleteDirectory(localRepository.get().asFile) + GFileUtils.deleteDirectory(localRepositoryDir.get().asFile) } } @@ -154,7 +155,7 @@ tasks { systemProperty("native.maven.plugin.version", libs.versions.nativeBuildTools.get()) systemProperty("junit.platform.native.version", libs.versions.nativeBuildTools.get()) systemProperty("common.repo.uri", repoDirectory.get().asFile.toURI().toASCIIString()) - systemProperty("seed.repo.uri", localRepository.get().asFile.toURI().toASCIIString()) + systemProperty("seed.repo.uri", localRepositoryDir.get().asFile.toURI().toASCIIString()) systemProperty("maven.classpath", configurations.mavenEmbedder.get().asPath) systemProperty("maven.settings", layout.projectDirectory.file("config/settings.xml").asFile.absolutePath) systemProperty("java.executable", javaLauncher.get().executablePath.asFile.absolutePath)