Skip to content

Commit

Permalink
fix local plugin repos for Maven tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-enko committed Jan 22, 2024
1 parent d585de1 commit d8c86ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class BiojavaIntegrationTest : AbstractIntegrationTest(), TestOutputCopier {
private val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH")))
override val projectOutputLocation: File by lazy { File(projectDir, "biojava-core/target/dokkaJavadoc") }

private val localSettingsXml: File by lazy {
projectDir.resolve("local-settings.xml").apply {
writeText(createSettingsXml())
}
}

@BeforeTest
fun prepareProjectFiles() {
val bioJavaDir = File("projects", "biojava")
Expand All @@ -36,7 +42,7 @@ class BiojavaIntegrationTest : AbstractIntegrationTest(), TestOutputCopier {
.command(
mavenBinaryFile.absolutePath,
"dokka:javadoc",
"--settings", "local-settings.xml",
"--settings", localSettingsXml.invariantSeparatorsPath,
"-pl",
"biojava-core",
"\"-Ddokka_version=$currentDokkaVersion\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class MavenIntegrationTest : AbstractIntegrationTest() {

private val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH")))

private val localSettingsXml: File by lazy {
projectDir.resolve("local-settings.xml").apply {
writeText(createSettingsXml())
}
}

@BeforeTest
fun prepareProjectFiles() {
val templateProjectDir = File("projects", "it-maven")
Expand All @@ -29,7 +35,6 @@ class MavenIntegrationTest : AbstractIntegrationTest() {
if (customResourcesDir.exists() && customResourcesDir.isDirectory) {
customResourcesDir.copyRecursively(File(projectDir, "customResources"), overwrite = true)
}
projectDir.resolve("local-settings.xml").writeText(createSettingsXml())
}

@Test
Expand All @@ -40,7 +45,7 @@ class MavenIntegrationTest : AbstractIntegrationTest() {
"dokka:help",
"-U",
"-e",
"--settings", "local-settings.xml",
"--settings", localSettingsXml.invariantSeparatorsPath,
)
.start()
.awaitProcessResult()
Expand Down Expand Up @@ -68,7 +73,7 @@ class MavenIntegrationTest : AbstractIntegrationTest() {
"dokka:dokka",
"-U",
"-e",
"--settings", "local-settings.xml",
"--settings", localSettingsXml.invariantSeparatorsPath,
).start().awaitProcessResult()

diagnosticAsserts(result)
Expand Down Expand Up @@ -123,7 +128,7 @@ class MavenIntegrationTest : AbstractIntegrationTest() {
"dokka:javadoc",
"-U",
"-e",
"--settings", "local-settings.xml",
"--settings", localSettingsXml.invariantSeparatorsPath,
).start().awaitProcessResult()

diagnosticAsserts(result)
Expand Down Expand Up @@ -151,7 +156,7 @@ class MavenIntegrationTest : AbstractIntegrationTest() {
"dokka:javadocJar",
"-U",
"-e",
"--settings", "local-settings.xml",
"--settings", localSettingsXml.invariantSeparatorsPath,
).start().awaitProcessResult()

diagnosticAsserts(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import java.nio.file.Paths
/** Create `settings.xml` file contents, with the custom dev Maven repos. */
@Language("xml")
fun createSettingsXml(): String {
/** file-based Maven repositories that contains the Dokka dependencies */
/** file-based Maven repositories that contain Dokka dependencies */
val projectLocalMavenDirs: List<Path> by systemProperty { it.split(":").map(Paths::get) }

val repos = projectLocalMavenDirs.withIndex().joinToString("\n\n") {(i, path) ->
/* language=xml */ """
<repository>
<pluginRepository>
<id>dev-repo-$i</id>
<url>${path.toUri().toASCIIString()}</url>
</repository>
</pluginRepository>
""".trimIndent()
}

Expand All @@ -30,9 +30,9 @@ fun createSettingsXml(): String {
<profiles>
<profile>
<id>maven-dev</id>
<repositories>
<pluginRepositories>
$repos
</repositories>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
Expand Down

0 comments on commit d8c86ac

Please sign in to comment.