From bcd73fc89473ea517ca2ef50d0a7cdfac6ba51fa Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:44:24 +0100 Subject: [PATCH 1/6] Issue-802: During the gradle test release, do not sign anything Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- .../test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java b/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java index faa2c1a015..4b08dae85d 100644 --- a/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java +++ b/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java @@ -33,6 +33,7 @@ void copyResourcesToTemporaryDirectory() throws IOException { void publishPluginVersionToMavenLocal()throws IOException { GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir"))) .withArguments("publishToMavenLocal", "-x", "test") //don't test, or we'll loop infinitely + .withArguments("-x", "signPluginMavenPublication") //may break releases. .build(); } From 7cb3510e08f916e38ca20dabfb3214eb47364532 Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:45:30 +0100 Subject: [PATCH 2/6] Don't print the task graph all the time Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- jgiven-maven-plugin/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jgiven-maven-plugin/build.gradle b/jgiven-maven-plugin/build.gradle index 6831d5b983..191a93f9d2 100644 --- a/jgiven-maven-plugin/build.gradle +++ b/jgiven-maven-plugin/build.gradle @@ -58,7 +58,7 @@ generateMavenPlugin.configure { .collect(Collectors.toList()) ) onlyIf { - println("taskGraph: " + gradle.taskGraph.getAllTasks().stream().map(Task::getName).collect(Collectors.toList())) + logger.debug("taskGraph: " + gradle.taskGraph.getAllTasks().stream().map(Task::getName).collect(Collectors.toList())) gradle.taskGraph.getAllTasks().stream().anyMatch(thisProjectsPublishTasks::contains) } } From 70a6fdae61212b48e0e2d77c059c2b4b5b7a3b3c Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:45:55 +0100 Subject: [PATCH 3/6] Format spock2 build file Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- jgiven-spock2/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jgiven-spock2/build.gradle b/jgiven-spock2/build.gradle index a09e2f2907..5e329f46fc 100644 --- a/jgiven-spock2/build.gradle +++ b/jgiven-spock2/build.gradle @@ -1,9 +1,8 @@ plugins { id 'java-library' + id 'groovy' } -apply plugin: 'groovy' - description = "Module for writing JGiven tests with Spock 2" ext { @@ -20,6 +19,7 @@ dependencies { implementation libs.byteBuddy testImplementation project(':jgiven-html5-report') + } test { From d51e727dcdd7cfd7084157470a04bce62c7bb5ee Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:48:44 +0100 Subject: [PATCH 4/6] remove maven warning about a plugin not having `provided` scope Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- jgiven-maven-plugin/src/main/maven/pom.xml | 123 +++++++++++---------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/jgiven-maven-plugin/src/main/maven/pom.xml b/jgiven-maven-plugin/src/main/maven/pom.xml index 243893d0b5..d43860c2b7 100644 --- a/jgiven-maven-plugin/src/main/maven/pom.xml +++ b/jgiven-maven-plugin/src/main/maven/pom.xml @@ -1,66 +1,67 @@ - 4.0.0 - jgiven-maven-plugin - maven-plugin - JGiven Maven Mojo - com.tngtech.jgiven - ${version} - JGiven - BDD in plain Java + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + jgiven-maven-plugin + maven-plugin + JGiven Maven Mojo + com.tngtech.jgiven + ${version} + JGiven - BDD in plain Java - - UTF-8 - + + UTF-8 + - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.10.2 - - - default-descriptor - - descriptor - - process-classes - - - help-descriptor - - helpmojo - - process-classes - - - - - ../../src/main/java - ../../build/maven/target/classes - + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.10.2 + + + default-descriptor + + descriptor + + process-classes + + + help-descriptor + + helpmojo + + process-classes + + + + + ../../src/main/java + ../../build/maven/target/classes + - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.10.2 - provided - - - org.apache.maven - maven-plugin-api - 3.9.5 - - - com.tngtech.jgiven - jgiven-html5-report - ${version} - - - com.tngtech.jgiven - jgiven-core - ${version} - - + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.10.2 + provided + + + org.apache.maven + maven-plugin-api + 3.9.5 + provided + + + com.tngtech.jgiven + jgiven-html5-report + ${version} + + + com.tngtech.jgiven + jgiven-core + ${version} + + From 71c5233e2f917c7c8ab9608f58cfe64331540e16 Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:48:12 +0100 Subject: [PATCH 5/6] reduce usage of implicit `it` in build gradle Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- build.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 98fe7926c5..42e7753a5e 100644 --- a/build.gradle +++ b/build.gradle @@ -77,13 +77,13 @@ subprojects { } withXml { project.configurations.compileOnly.allDependencies.each { dep -> - asNode().dependencies[0].appendNode('dependency').with { - it.appendNode('groupId', dep.group) - it.appendNode('artifactId', dep.name) + asNode().dependencies[0].appendNode('dependency').with { dependencyNode -> + dependencyNode.appendNode('groupId', dep.group) + dependencyNode.appendNode('artifactId', dep.name) if (dep.version != null && dep.version.trim() != "") { - it.appendNode('version', dep.version) + dependencyNode.appendNode('version', dep.version) } - it.appendNode('scope', 'provided') + dependencyNode.appendNode('scope', 'provided') } } @@ -292,6 +292,7 @@ configure(subprojects) { // -- build and publish artifacts ------------------------------------------------------------------------------------- signing { + // requires gradle.properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html required { isReleaseVersion && gradle.taskGraph.getAllTasks().any { it instanceof PublishToMavenRepository } From a3a623b5c4cca1a633fefd585f976a3a2fefd925 Mon Sep 17 00:00:00 2001 From: l-1squared <30831153+l-1squared@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:33:42 +0100 Subject: [PATCH 6/6] Only use one "withArguments" statement Signed-off-by: l-1squared <30831153+l-1squared@users.noreply.github.com> --- .../tngtech/jgiven/maven/BasicMavenMojoTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java b/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java index 4b08dae85d..121a2ed2b6 100644 --- a/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java +++ b/jgiven-maven-plugin/src/test/java/com/tngtech/jgiven/maven/BasicMavenMojoTest.java @@ -30,10 +30,13 @@ void copyResourcesToTemporaryDirectory() throws IOException { } @BeforeEach - void publishPluginVersionToMavenLocal()throws IOException { - GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir"))) - .withArguments("publishToMavenLocal", "-x", "test") //don't test, or we'll loop infinitely - .withArguments("-x", "signPluginMavenPublication") //may break releases. + void publishPluginVersionToMavenLocal(){ + GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir"))) + .withArguments( + "publishToMavenLocal", + "-x", "test", //don't test, or we'll loop infinitely + "-x", "signPluginMavenPublication" //may break releases. + ) .build(); } @@ -53,7 +56,7 @@ void testMavenProducesHtmlAndAsciiReport() throws MavenInvocationException { invoker.setMavenExecutable(mavenExecutable); InvocationResult result = invoker.execute(request); - assertThat(result.getExitCode()).isZero(); + assertThat(result.getExitCode()).as("Maven exit code").isZero(); assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/html/index.html")).exists(); assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/asciidoc/index.asciidoc")).exists(); assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/text")).exists();