From 26c8471480e1f376f56c556a189ff1e393678bf6 Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Sun, 15 Dec 2024 12:26:45 +0100 Subject: [PATCH] WIP 314 Add/Fix Maven plugin integration test as the integration tests build the full READMEs of all components. Then check them for consistency with each UI, i.e., with CLI, Gradle, and Maven. --- integration-test/build.gradle | 51 ++++++++++++++++++++++------ integration-test/common/build.gradle | 19 ++++++++++- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/integration-test/build.gradle b/integration-test/build.gradle index fb462316..e8aefabb 100644 --- a/integration-test/build.gradle +++ b/integration-test/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'base' +} + final String BUILD_DIRECTORY = "${Project.DEFAULT_BUILD_DIR_NAME}" version = htmlSanityCheckVersion @@ -124,34 +128,61 @@ tasks.register("integrationTestCli") { final String INTEGRATION_TEST_DIRECTORY_MAVEN = "maven-plugin" -tasks.register("integrationTestMaven") { +tasks.register("cleanIntegrationTestMavenPlugin") { group("Verification") - description("Run overall integration tests (no publish)") + description("Deletes the result directory of maven-plugin integration tests") + + File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN) + final File testIndex = new File(integrationTestDirectory, "target/reports/index.html") + + outputs.file testIndex doLast { def result = exec { workingDir INTEGRATION_TEST_DIRECTORY_MAVEN commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "cmd /c mvnw.cmd" : "./mvnw", - "clean", "verify", "-Dhsc.version=${project.version}", "-ssettings.xml" + "clean", "-Dhsc.version=${project.version}", "-ssettings.xml" + } + + } + + outputs.upToDateWhen { + !testIndex.exists() + } +} + +tasks.register("integrationTestMavenPlugin") { + group("Verification") + description("Run Maven integration tests (only)") + + File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN) + final File testIndex = new File(integrationTestDirectory, "target/reports/index.html") + + outputs.file testIndex + + doLast { + def result = exec { + workingDir INTEGRATION_TEST_DIRECTORY_MAVEN + commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "cmd /c mvnw.cmd" : "./mvnw", + "verify", "-Dhsc.version=${project.version}", "-ssettings.xml" } logger.debug "Script output: $result" - File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN) - final File testIndex = new File(integrationTestDirectory, "target/reports/htmlSanityCheck/index.html") assert testIndex.exists() } } - tasks.register("integrationTest") { group("Verification") description("Run all integration tests (without any installations etc.)") - dependsOn(integrationTestGradlePlugin, integrationTestCli, integrationTestMaven) + dependsOn(integrationTestGradlePlugin, integrationTestCli, integrationTestMavenPlugin) } -tasks.register("clean", Delete) { +tasks.register("cleanIntegrationTest", Delete) { group("Build") - description("Deletes all builds") + description("Deletes all integration test builds") - dependsOn(cleanIntegrationTestCommon, cleanIntegrationTestGradlePlugin, cleanIntegrationTestCli) + dependsOn(cleanIntegrationTestCommon, cleanIntegrationTestGradlePlugin, + cleanIntegrationTestCli, cleanIntegrationTestMavenPlugin) } +clean.dependsOn(cleanIntegrationTest) diff --git a/integration-test/common/build.gradle b/integration-test/common/build.gradle index 37665f9f..629f53c4 100644 --- a/integration-test/common/build.gradle +++ b/integration-test/common/build.gradle @@ -70,11 +70,28 @@ tasks.register('buildReadmeCli', org.asciidoctor.gradle.jvm.AsciidoctorTask) { buildReadmeCli.dependsOn(copyReadmeResources) buildReadmeCli.mustRunAfter(buildReadmeGradlePlugin) +tasks.register('buildReadmeMavenPlugin', org.asciidoctor.gradle.jvm.AsciidoctorTask) { + group 'Verification' + description 'Convert Maven README for integration test' + + sourceDir projectRoot + sources { + include 'htmlSanityCheck-maven-plugin/README.adoc' + } + baseDirFollowsSourceFile() + outputDir file("${Project.DEFAULT_BUILD_DIR_NAME}/docs") + attributes( + "imagesdir": "../images" + ) +} +buildReadmeMavenPlugin.dependsOn(copyReadmeResources) +buildReadmeMavenPlugin.mustRunAfter(buildReadmeCli) + tasks.register('buildReadmeAll') { group 'Verification' description 'Convert all READMEs for integration test' } -buildReadmeAll.dependsOn(buildReadmeRoot, buildReadmeGradlePlugin, buildReadmeCli) +buildReadmeAll.dependsOn(buildReadmeRoot, buildReadmeGradlePlugin, buildReadmeCli, buildReadmeMavenPlugin) build.dependsOn(buildReadmeAll) /*