From bddb750d4426271f5d249cf219d7e5dd43647fea Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Wed, 23 Nov 2022 15:02:11 +0000 Subject: [PATCH 01/11] build: Add BOM to the module (#262) --- .github/workflows/graalvm.yml | 2 +- gradle.properties | 1 - hibernate-validator-bom/build.gradle.kts | 11 +++++++++++ hibernate-validator/build.gradle | 10 ---------- settings.gradle | 8 +++----- 5 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 hibernate-validator-bom/build.gradle.kts diff --git a/.github/workflows/graalvm.yml b/.github/workflows/graalvm.yml index d0cf0939..23d72277 100644 --- a/.github/workflows/graalvm.yml +++ b/.github/workflows/graalvm.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: ['11', '17'] + java: ['17'] graalvm: ['latest', 'dev'] steps: # https://github.com/actions/virtual-environments/issues/709 diff --git a/gradle.properties b/gradle.properties index 85b45a7f..b0e9cb28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,5 @@ projectVersion=3.3.0-SNAPSHOT projectGroup=io.micronaut.beanvalidation -micronautSharedSettingVersion=5.3.15 title=Micronaut Hibernate Validator Configuration projectDesc=Provides integration between Micronaut and Hibernate Validator diff --git a/hibernate-validator-bom/build.gradle.kts b/hibernate-validator-bom/build.gradle.kts new file mode 100644 index 00000000..164f4e19 --- /dev/null +++ b/hibernate-validator-bom/build.gradle.kts @@ -0,0 +1,11 @@ +import org.gradle.internal.execution.caching.CachingState.enabled + +plugins { + id("io.micronaut.build.internal.bom") +} + +micronautBuild { + binaryCompatibility { + enabled.set(false) + } +} diff --git a/hibernate-validator/build.gradle b/hibernate-validator/build.gradle index d55b780e..ae62fa97 100644 --- a/hibernate-validator/build.gradle +++ b/hibernate-validator/build.gradle @@ -16,13 +16,3 @@ dependencies { testCompileOnly mn.micronaut.inject.groovy testImplementation mn.micronaut.http.server.netty } - -micronautBuild { - resolutionStrategy { - force (libs.hibernate.validator) - } - binaryCompatibility { - // Last version 3.0.0 is way to old - enabled.set(false) - } -} diff --git a/settings.gradle b/settings.gradle index bf53cacc..4627c020 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,4 @@ pluginManagement { - plugins { - id 'io.micronaut.build.shared.settings' version getProperty("micronautSharedSettingVersion") - } repositories { gradlePluginPortal() mavenCentral() @@ -9,13 +6,14 @@ pluginManagement { } plugins { - id 'io.micronaut.build.shared.settings' + id 'io.micronaut.build.shared.settings' version '5.3.15' } rootProject.name = 'hibernate-validator-parent' +include 'hibernate-validator-bom' include 'hibernate-validator' micronautBuild { importMicronautCatalog() -} \ No newline at end of file +} From ceff26a16c3f133098b406df3b734461cd522317 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:07:49 +0100 Subject: [PATCH 02/11] build: Micronaut Framework 3.7.4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f747c0d7..b2fcb167 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -micronaut = "3.7.2" +micronaut = "3.7.4" micronaut-docs = "2.0.0" groovy = "3.0.13" glassfish-el = '2.2.1-b05' From b369c624cf1bcb1c8a0ae28df880274c04a51079 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:10:23 +0100 Subject: [PATCH 03/11] ci: temurin distribution and cla provenance --- .github/workflows/release.yml | 50 +++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6afbba2f..7724cf70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ on: jobs: release: outputs: - hashes: ${{ steps.hash.outputs.hashes }} # Computed hashes for build artifacts. + artifacts-sha256: ${{ steps.hash.outputs.artifacts-sha256 }} # Computed hashes for build artifacts. runs-on: ubuntu-latest steps: - name: Checkout repository @@ -21,7 +21,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - distribution: 'adopt' + distribution: 'temurin' java-version: '11' - name: Set the current release version id: release_version @@ -52,8 +52,8 @@ jobs: VERSION=$(./gradlew properties | grep 'version:' | awk '{print $2}') # Read the project group from gradle.properties. GROUP_PATH=$(./gradlew properties| grep "projectGroup" | awk '{print $2}' | sed 's/\./\//g') - echo "::set-output name=version::$VERSION" - echo "::set-output name=group::$GROUP_PATH" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "group=$GROUP_PATH" >> "$GITHUB_OUTPUT" - name: Generate subject id: hash run: | @@ -61,13 +61,21 @@ jobs: ARTIFACTS=$(find build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/* \ -regextype sed -regex '\(.*\.jar\|.*\.pom\|.*\.module\|.*\.toml\)') # Compute the hashes for the artifacts. - echo "::set-output name=hashes::$(sha256sum $ARTIFACTS | base64 -w0)" + # Set the hash as job output for debugging. + echo "artifacts-sha256=$(sha256sum $ARTIFACTS | base64 -w0)" >> "$GITHUB_OUTPUT" + # Store the hash in a file, which is uploaded as a workflow artifact. + echo $(sha256sum $ARTIFACTS | base64 -w0) > artifacts-sha256 - name: Upload build artifacts uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 with: name: gradle-build-outputs path: build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/* - if-no-files-found: error + retention-days: 5 + - name: Upload artifacts-sha256 + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: artifacts-sha256 + path: artifacts-sha256 retention-days: 5 - name: Generate docs env: @@ -113,27 +121,47 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - provenance: + provenance-subject: needs: [release] + runs-on: ubuntu-latest + outputs: + artifacts-sha256: ${{ steps.set-hash.outputs.artifacts-sha256 }} + steps: + - name: Download artifacts-sha256 + uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 + with: + name: artifacts-sha256 + # The SLSA provenance generator expects the hash digest of artifacts to be passed as a job + # output. So we need to download the artifacts-sha256 and set it as job output. The hash of + # the artifacts should be set as output directly in the release job. But due to a known bug + # in GitHub Actions we have to use a workaround. + # See https://github.com/community/community/discussions/37942. + - name: Set artifacts-sha256 as output + id: set-hash + shell: bash + run: echo "artifacts-sha256=$(cat artifacts-sha256)" >> "$GITHUB_OUTPUT" + + provenance: + needs: [release, provenance-subject] permissions: actions: read # To read the workflow path. id-token: write # To sign the provenance. contents: write # To add assets to a release. - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.1 + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.2 with: - base64-subjects: "${{ needs.release.outputs.hashes }}" + base64-subjects: "${{ needs.provenance-subject.outputs.artifacts-sha256 }}" upload-assets: true # Upload to a new release. compile-generator: true # Build the generator from source. github_release: - needs: [release, provenance] + needs: [release] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - name: Checkout repository uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Download artifacts - uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0 + uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 with: name: gradle-build-outputs path: build/repo From bea1d600435ea45515cad2a251c4a99529572d02 Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Wed, 23 Nov 2022 15:25:49 +0000 Subject: [PATCH 04/11] [skip ci] Release v3.3.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b0e9cb28..672d076d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.3.0-SNAPSHOT +projectVersion=3.3.0 projectGroup=io.micronaut.beanvalidation title=Micronaut Hibernate Validator Configuration From 8ba3f090894786cf71f4be3d71aeed2e67b30a5d Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Wed, 23 Nov 2022 15:28:26 +0000 Subject: [PATCH 05/11] Back to 3.3.1-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 672d076d..082e1ef8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.3.0 +projectVersion=3.3.1-SNAPSHOT projectGroup=io.micronaut.beanvalidation title=Micronaut Hibernate Validator Configuration From d844e3d57ffb837393299efadb46db9536f83781 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:31:34 +0100 Subject: [PATCH 06/11] build: use Gradle Kotlin DSL --- hibernate-validator/build.gradle | 18 ------------------ hibernate-validator/build.gradle.kts | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 hibernate-validator/build.gradle create mode 100644 hibernate-validator/build.gradle.kts diff --git a/hibernate-validator/build.gradle b/hibernate-validator/build.gradle deleted file mode 100644 index ae62fa97..00000000 --- a/hibernate-validator/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'io.micronaut.build.internal.module' -} - -dependencies { - annotationProcessor mn.micronaut.graal - annotationProcessor mn.micronaut.inject.java - compileOnly libs.glassfish.el - compileOnly mn.micronaut.router - implementation libs.hibernate.validator - implementation mn.micronaut.inject - implementation mn.micronaut.validation - runtimeOnly libs.glassfish.jakarta.el - - testAnnotationProcessor mn.micronaut.inject.java - testCompileOnly mn.micronaut.inject.groovy - testImplementation mn.micronaut.http.server.netty -} diff --git a/hibernate-validator/build.gradle.kts b/hibernate-validator/build.gradle.kts new file mode 100644 index 00000000..509e4b6d --- /dev/null +++ b/hibernate-validator/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("io.micronaut.build.internal.module") +} +dependencies { + annotationProcessor(mn.micronaut.graal) + annotationProcessor(mn.micronaut.inject.java) + compileOnly(libs.glassfish.el) + compileOnly(mn.micronaut.router) + implementation(libs.hibernate.validator) + implementation(mn.micronaut.inject) + implementation(mn.micronaut.validation) + runtimeOnly(libs.glassfish.jakarta.el) + + testAnnotationProcessor(mn.micronaut.inject.java) + testCompileOnly(mn.micronaut.inject.groovy) + testImplementation(mn.micronaut.http.server.netty) +} From bc115092ad165fffd69519b64f79d38fca1e25c4 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:36:24 +0100 Subject: [PATCH 07/11] serde bom --- build.gradle | 5 ----- gradle/libs.versions.toml | 3 +++ hibernate-validator/build.gradle | 30 ---------------------------- hibernate-validator/build.gradle.kts | 1 + settings.gradle | 13 +++--------- 5 files changed, 7 insertions(+), 45 deletions(-) delete mode 100644 hibernate-validator/build.gradle diff --git a/build.gradle b/build.gradle index 983ccdf3..a63efb20 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,3 @@ plugins { id 'io.micronaut.build.internal.docs' id 'io.micronaut.build.internal.quality-reporting' } - -repositories { - mavenCentral() - maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9f128ee3..f0089101 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] micronaut = "4.0.0-SNAPSHOT" micronaut-docs = "2.0.0" +micronaut-serialization = "2.0.0-SNAPSHOT" groovy = "4.0.6" glassfish-el = '2.2.1-b05' glassfish-javax-el = '3.0.1-b12' @@ -8,6 +9,8 @@ glassfish-jakarta-el = '3.0.4' hibernate-validator = '6.2.5.Final' [libraries] +micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serialization" } + glassfish-el = { module = 'org.glassfish.web:el-impl', version.ref = 'glassfish-el' } glassfish-javax-el = { module = 'org.glassfish:javax.el', version.ref = 'glassfish-javax-el' } glassfish-jakarta-el = { module = 'org.glassfish:jakarta.el', version.ref = 'glassfish-jakarta-el' } diff --git a/hibernate-validator/build.gradle b/hibernate-validator/build.gradle deleted file mode 100644 index ac52b00b..00000000 --- a/hibernate-validator/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -plugins { - id 'io.micronaut.build.internal.hibernate-validator-module' -} - -dependencies { - annotationProcessor mn.micronaut.graal - annotationProcessor mn.micronaut.inject.java - compileOnly libs.glassfish.el - compileOnly mn.micronaut.router - implementation libs.hibernate.validator - implementation mn.micronaut.inject - implementation mn.micronaut.validation - runtimeOnly libs.glassfish.jakarta.el - - testAnnotationProcessor mn.micronaut.inject.java - testCompileOnly mn.micronaut.inject.groovy - testImplementation mn.micronaut.http.server.netty - testRuntimeOnly mn.snakeyaml - testImplementation(mn.micronaut.serde.jackson) -} - -micronautBuild { - resolutionStrategy { - force (libs.hibernate.validator) - } - binaryCompatibility { - // Last version 3.0.0 is way to old - enabled.set(false) - } -} diff --git a/hibernate-validator/build.gradle.kts b/hibernate-validator/build.gradle.kts index 509e4b6d..7e3b0f43 100644 --- a/hibernate-validator/build.gradle.kts +++ b/hibernate-validator/build.gradle.kts @@ -14,4 +14,5 @@ dependencies { testAnnotationProcessor(mn.micronaut.inject.java) testCompileOnly(mn.micronaut.inject.groovy) testImplementation(mn.micronaut.http.server.netty) + testImplementation(mnSerde.micronaut.serde.jackson) } diff --git a/settings.gradle b/settings.gradle index ad3f017f..ebb873dd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,23 +4,16 @@ pluginManagement { mavenCentral() } } - plugins { id 'io.micronaut.build.shared.settings' version '6.1.0' } - rootProject.name = 'hibernate-validator-parent' include 'hibernate-validator-bom' include 'hibernate-validator' - -dependencyResolutionManagement { - repositories { - mavenCentral() - maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } - } -} - micronautBuild { + // Required for 4.0.0-SNAPSHOT, can be removed after + addSnapshotRepository() importMicronautCatalog() + importMicronautCatalog("micronaut-serde") } From 31e002cbf73a3459dc4d0177f8b016dc4b7b4ec6 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:40:42 +0100 Subject: [PATCH 08/11] remove @PendingFeature --- hibernate-validator/build.gradle.kts | 5 ----- .../hibernate/validator/ValidatedBeanSpec.groovy | 4 ---- 2 files changed, 9 deletions(-) diff --git a/hibernate-validator/build.gradle.kts b/hibernate-validator/build.gradle.kts index 7e3b0f43..ca5dc713 100644 --- a/hibernate-validator/build.gradle.kts +++ b/hibernate-validator/build.gradle.kts @@ -3,16 +3,11 @@ plugins { } dependencies { annotationProcessor(mn.micronaut.graal) - annotationProcessor(mn.micronaut.inject.java) compileOnly(libs.glassfish.el) compileOnly(mn.micronaut.router) implementation(libs.hibernate.validator) - implementation(mn.micronaut.inject) implementation(mn.micronaut.validation) runtimeOnly(libs.glassfish.jakarta.el) - - testAnnotationProcessor(mn.micronaut.inject.java) - testCompileOnly(mn.micronaut.inject.groovy) testImplementation(mn.micronaut.http.server.netty) testImplementation(mnSerde.micronaut.serde.jackson) } diff --git a/hibernate-validator/src/test/groovy/io/micronaut/configuration/hibernate/validator/ValidatedBeanSpec.groovy b/hibernate-validator/src/test/groovy/io/micronaut/configuration/hibernate/validator/ValidatedBeanSpec.groovy index 1f24b046..3c17c4e8 100644 --- a/hibernate-validator/src/test/groovy/io/micronaut/configuration/hibernate/validator/ValidatedBeanSpec.groovy +++ b/hibernate-validator/src/test/groovy/io/micronaut/configuration/hibernate/validator/ValidatedBeanSpec.groovy @@ -20,7 +20,6 @@ import io.micronaut.context.DefaultApplicationContext import io.micronaut.context.annotation.Value import io.micronaut.context.exceptions.BeanInstantiationException import org.hibernate.validator.constraints.URL -import spock.lang.PendingFeature import spock.lang.Specification import spock.util.environment.RestoreSystemProperties @@ -31,7 +30,6 @@ import jakarta.inject.Singleton */ class ValidatedBeanSpec extends Specification { - @PendingFeature void "test validated bean invalid bean"() { given: System.setProperty("a.url", "test") @@ -55,7 +53,6 @@ List of constraint violations:[ ''') } - @PendingFeature void "test validated bean invalid bean custom validator"() { given: @@ -80,7 +77,6 @@ List of constraint violations:[ ''') } - @PendingFeature @RestoreSystemProperties void "test validated bean invalid bean custom validator that isnt a bean"() { From 24059e257dc6f3eb713c19b5b2b3ce48e41d0155 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:42:19 +0100 Subject: [PATCH 09/11] Update build.gradle.kts --- hibernate-validator-bom/build.gradle.kts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hibernate-validator-bom/build.gradle.kts b/hibernate-validator-bom/build.gradle.kts index 164f4e19..e3c487bb 100644 --- a/hibernate-validator-bom/build.gradle.kts +++ b/hibernate-validator-bom/build.gradle.kts @@ -3,9 +3,3 @@ import org.gradle.internal.execution.caching.CachingState.enabled plugins { id("io.micronaut.build.internal.bom") } - -micronautBuild { - binaryCompatibility { - enabled.set(false) - } -} From 3c3fa75d41406629c64236d2a36982d0f7a19402 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Wed, 23 Nov 2022 16:42:57 +0100 Subject: [PATCH 10/11] Update build.gradle.kts --- hibernate-validator/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-validator/build.gradle.kts b/hibernate-validator/build.gradle.kts index ca5dc713..16359bc3 100644 --- a/hibernate-validator/build.gradle.kts +++ b/hibernate-validator/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("io.micronaut.build.internal.module") + id("io.micronaut.build.internal.hibernate-validator-module") } dependencies { annotationProcessor(mn.micronaut.graal) From bbc219d387bab7407884dfe3394bede6f255a027 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Wed, 23 Nov 2022 16:08:59 +0000 Subject: [PATCH 11/11] Define micronaut-test version and spock --- gradle/libs.versions.toml | 4 ++++ settings.gradle => settings.gradle.kts | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) rename settings.gradle => settings.gradle.kts (53%) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f0089101..551aefbb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,12 @@ [versions] micronaut = "4.0.0-SNAPSHOT" +micronaut-test = "4.0.0-SNAPSHOT" micronaut-docs = "2.0.0" micronaut-serialization = "2.0.0-SNAPSHOT" + groovy = "4.0.6" +spock = "2.3-groovy-4.0" + glassfish-el = '2.2.1-b05' glassfish-javax-el = '3.0.1-b12' glassfish-jakarta-el = '3.0.4' diff --git a/settings.gradle b/settings.gradle.kts similarity index 53% rename from settings.gradle rename to settings.gradle.kts index ebb873dd..0326c52e 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -4,14 +4,17 @@ pluginManagement { mavenCentral() } } + plugins { - id 'io.micronaut.build.shared.settings' version '6.1.0' + id("io.micronaut.build.shared.settings") version "6.1.0" } -rootProject.name = 'hibernate-validator-parent' -include 'hibernate-validator-bom' -include 'hibernate-validator' -micronautBuild { +rootProject.name = "hibernate-validator-parent" + +include("hibernate-validator-bom") +include("hibernate-validator") + +configure { // Required for 4.0.0-SNAPSHOT, can be removed after addSnapshotRepository() importMicronautCatalog()