From b7d56dea4418024010415d45d0698cac7f25c55a Mon Sep 17 00:00:00 2001 From: Bogdan Mukvich Date: Mon, 11 Dec 2023 11:39:27 +0100 Subject: [PATCH] Point ArtifactsTests to custom maven repo dir to avoid stale artifacts ^KTI-1345 --- build.gradle.kts | 10 ++++++++++ libraries/pom.xml | 6 ++++-- libraries/tools/kotlin-bom/pom.xml | 6 ++++-- repo/artifacts-tests/README.md | 8 +------- repo/artifacts-tests/build.gradle.kts | 2 +- .../org/jetbrains/kotlin/kotlin-bom/kotlin-bom.pom | 6 ++++-- .../jetbrains/kotlin/kotlin-project/kotlin-project.pom | 6 ++++-- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c1abd58dea7..b62beedf56c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -991,6 +991,16 @@ tasks { workingDir = rootProject.projectDir.resolve("libraries") commandLine = getMvnwCmd() + listOf("clean", "install", "-DskipTests") } + register("mvnPublish") { + group = "publishing" + workingDir = rootProject.projectDir.resolve("libraries") + commandLine = getMvnwCmd() + listOf( + "clean", "deploy", "--activate-profiles=noTest", + "-Dinvoker.skip=true", "-DskipTests", + "-Ddeploy-snapshot-repo=local", + "-Ddeploy-snapshot-url=file://${rootProject.projectDir.resolve("build/repo")}" + ) + } } val zipCompiler by tasks.registering(Zip::class) { diff --git a/libraries/pom.xml b/libraries/pom.xml index b92ab0b0958..dc3f48eacfb 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -60,6 +60,8 @@ 1.6 1.6 + sonatype-nexus-staging + https://oss.sonatype.org/content/repositories/snapshots/ @@ -72,8 +74,8 @@ ${deploy-url} - sonatype-nexus-staging - https://oss.sonatype.org/content/repositories/snapshots/ + ${deploy-snapshot-repo} + ${deploy-snapshot-url} diff --git a/libraries/tools/kotlin-bom/pom.xml b/libraries/tools/kotlin-bom/pom.xml index 2209a6652fa..f478dec6ebd 100644 --- a/libraries/tools/kotlin-bom/pom.xml +++ b/libraries/tools/kotlin-bom/pom.xml @@ -50,6 +50,8 @@ neither it is visible in the consumer project. --> ${project.version} + sonatype-nexus-staging + https://oss.sonatype.org/content/repositories/snapshots/ @@ -186,8 +188,8 @@ ${deploy-url} - sonatype-nexus-staging - https://oss.sonatype.org/content/repositories/snapshots/ + ${deploy-snapshot-repo} + ${deploy-snapshot-url} diff --git a/repo/artifacts-tests/README.md b/repo/artifacts-tests/README.md index ee9eac89e3e..3368b963cda 100644 --- a/repo/artifacts-tests/README.md +++ b/repo/artifacts-tests/README.md @@ -5,11 +5,5 @@ This module contains tests for changes in pom files for all maven artifacts we p To reproduce locally build all artifacts first: ```shell -# clean local m2 from old artifacts to avoid unrelated failures -# up-to-date version is in defaultSnapshotVersion property and should be used instead of "*-2.0.255*" -find ~/.m2/repository/org/jetbrains/kotlin -name "*-2.0.255*" -delete - -./gradlew install -cd libraries -./mvnw install -DskipTests +./gradlew clean install publish mvnPublish ``` diff --git a/repo/artifacts-tests/build.gradle.kts b/repo/artifacts-tests/build.gradle.kts index 325d49e2aba..6bc58eaea35 100644 --- a/repo/artifacts-tests/build.gradle.kts +++ b/repo/artifacts-tests/build.gradle.kts @@ -18,7 +18,7 @@ projectTest(jUnitMode = JUnitMode.JUnit5) { useJUnitPlatform { } val kotlinVersion = version doFirst { - val defaultMavenLocal = Paths.get(System.getProperty("user.home"), ".m2", "repository").toAbsolutePath() + val defaultMavenLocal = rootProject.projectDir.resolve("build/repo").absolutePath val mavenLocal = System.getProperty("maven.repo.local") ?: defaultMavenLocal systemProperty("maven.repo.local", mavenLocal) systemProperty("kotlin.version", kotlinVersion) diff --git a/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-bom/kotlin-bom.pom b/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-bom/kotlin-bom.pom index 5da7e01b7d4..853aca6f76a 100644 --- a/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-bom/kotlin-bom.pom +++ b/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-bom/kotlin-bom.pom @@ -50,6 +50,8 @@ neither it is visible in the consumer project. --> ${project.version} + sonatype-nexus-staging + https://oss.sonatype.org/content/repositories/snapshots/ @@ -186,8 +188,8 @@ ${deploy-url} - sonatype-nexus-staging - https://oss.sonatype.org/content/repositories/snapshots/ + ${deploy-snapshot-repo} + ${deploy-snapshot-url} diff --git a/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-project/kotlin-project.pom b/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-project/kotlin-project.pom index 0e41c643477..0e901f272de 100644 --- a/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-project/kotlin-project.pom +++ b/repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-project/kotlin-project.pom @@ -60,6 +60,8 @@ 1.6 1.6 + sonatype-nexus-staging + https://oss.sonatype.org/content/repositories/snapshots/ @@ -72,8 +74,8 @@ ${deploy-url} - sonatype-nexus-staging - https://oss.sonatype.org/content/repositories/snapshots/ + ${deploy-snapshot-repo} + ${deploy-snapshot-url}