diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fe90e42..9a4155a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,9 +167,9 @@ jobs: # Cross-module gate: serialization has no tests in its own build, so the # `mvn verify` above exercises nothing. Its behavioral coverage lives in - # aws-lambda-java-tests, which depends on serialization via a version - # property. Install the just-built serialization and run that suite - # against it, so we never publish serialization the suite hasn't exercised. + # aws-lambda-java-tests, which depends on it via the parent version map. + # Install the just-built serialization and run that suite against it, so + # we never publish serialization the suite hasn't exercised. - name: Run cross-module test gate run: | case "$MODULE" in @@ -179,8 +179,10 @@ jobs: echo "::group::Installing $MODULE $MOD_VER for the gate" mvn install -DskipTests --file "$MODULE/pom.xml" echo "::endgroup::" - echo "::notice::Gating $MODULE on aws-lambda-java-tests (aws-lambda-java-serialization.version=$MOD_VER)" - mvn verify -Daws-lambda-java-serialization.version="$MOD_VER" --file aws-lambda-java-tests/pom.xml + echo "::notice::Gating $MODULE on aws-lambda-java-tests (lambda.serialization.version=$MOD_VER)" + # Override the map property so the suite runs against the + # just-built serialization, not the version pinned in the map. + mvn verify -Dlambda.serialization.version="$MOD_VER" --file aws-lambda-java-tests/pom.xml ;; *) echo "::notice::No cross-module test gate for $MODULE" @@ -261,13 +263,15 @@ jobs: -Darguments="-gs $MAVEN_SETTINGS -Prelease -Dgpg.keyname=$GPG_KEYNAME -Dgpg.passphrase=$GPG_PASSPHRASE" \ --file "$MODULE/pom.xml" - # Record the published version in the module's lastPublished comment so - # the POM reflects what's on Central. Rides in the version-bump PR below - # (main is protected). - - name: Record released version (POM lastPublished) + # Record the published version in the two places that track it, from the + # same EFFECTIVE_RELEASE_VERSION in one commit so they can't drift: + # (1) the module's lastPublished comment (informational, every module) and + # (2) the parent version map (functional, only for modules others depend + # on). Rides in the version-bump PR below (main is protected). + - name: Record released version (POM lastPublished + parent version map) if: ${{ github.event.inputs.skip_publish != 'true' }} run: | - # Module's lastPublished annotation. + # (1) Module's lastPublished annotation. if grep -q "||" "$MODULE/pom.xml" git add "$MODULE/pom.xml" @@ -275,11 +279,22 @@ jobs: echo "::notice::$MODULE has no lastPublished comment; skipping annotation" fi - # Commit the record, or nothing if it didn't change. + # (2) Parent version map. Update the module's entry only if the parent declares one + PROP="lambda.${MODULE#aws-lambda-java-}.version" + if grep -qF "<${PROP}>" pom.xml; then + PROP_RE="${PROP//./\\.}" + sed -i.bak -E "s|(<${PROP_RE}>)[^<]*()|\1${EFFECTIVE_RELEASE_VERSION}\2|" pom.xml + rm -f pom.xml.bak + git add pom.xml + else + echo "::notice::$MODULE is not consumed by other modules (no ${PROP} in parent POM); version map unchanged" + fi + + # One commit for both records, or nothing if neither changed. if git diff --cached --quiet; then echo "::notice::$MODULE already recorded at ${EFFECTIVE_RELEASE_VERSION}; nothing to commit" else - git commit -m "chore(release): record ${MODULE} ${EFFECTIVE_RELEASE_VERSION} lastPublished" + git commit -m "chore(release): record ${MODULE} ${EFFECTIVE_RELEASE_VERSION} (lastPublished + version map)" fi # Prepend the changelog entry so it ships in the version-bump PR. Passed diff --git a/.gitignore b/.gitignore index 5a277e5d..5e4d8c8c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,7 @@ experimental/aws-lambda-java-profiler/integration_tests/helloworld/bin .kiro build mise.toml + +# flatten-maven-plugin generates this self-contained POM at build time; it is +# published in place of the raw module POM and must never be committed. +.flattened-pom.xml diff --git a/RELEASING.md b/RELEASING.md index f2f0865f..6b453a08 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -32,7 +32,8 @@ Releasable modules: `aws-lambda-java-core`, `aws-lambda-java-events`, 2. Builds and tests the module. 3. Publishes to Maven Central and pushes the tag `-`. 4. Opens a **version-bump PR** into `main` with the next `-SNAPSHOT`, the updated - `lastPublished` comment, and your changelog entry. + `lastPublished` comment, the parent POM's version-map entry (for modules other + modules depend on: core, events, serialization), and your changelog entry. 5. Creates a GitHub Release on the tag from your changelog entry. Merge the version-bump PR to return `main` to a clean `-SNAPSHOT` state. diff --git a/aws-lambda-java-core/pom.xml b/aws-lambda-java-core/pom.xml index 669ef58f..b4b5cba6 100644 --- a/aws-lambda-java-core/pom.xml +++ b/aws-lambda-java-core/pom.xml @@ -3,6 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + com.amazonaws aws-lambda-java-core 1.4.1-SNAPSHOT diff --git a/aws-lambda-java-events-sdk-transformer/pom.xml b/aws-lambda-java-events-sdk-transformer/pom.xml index 17955dc9..c310be2a 100644 --- a/aws-lambda-java-events-sdk-transformer/pom.xml +++ b/aws-lambda-java-events-sdk-transformer/pom.xml @@ -3,7 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - com.amazonaws + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + aws-lambda-java-events-sdk-transformer 3.1.2-SNAPSHOT @@ -42,7 +48,6 @@ 1.8 1.11.914 2.15.40 - 5.12.2 3.5.4 @@ -69,14 +74,14 @@ com.amazonaws aws-lambda-java-events - 3.16.1 + provided org.junit.jupiter junit-jupiter-engine - ${junit-jupiter.version} + test diff --git a/aws-lambda-java-events/pom.xml b/aws-lambda-java-events/pom.xml index 555d9134..949d420b 100644 --- a/aws-lambda-java-events/pom.xml +++ b/aws-lambda-java-events/pom.xml @@ -3,6 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + com.amazonaws aws-lambda-java-events 3.16.2-SNAPSHOT @@ -43,7 +50,6 @@ UTF-8 2.20.1 2.40.1 - 5.12.2 @@ -100,7 +106,7 @@ org.junit.jupiter junit-jupiter-engine - ${junit-jupiter.version} + test diff --git a/aws-lambda-java-log4j2/pom.xml b/aws-lambda-java-log4j2/pom.xml index d8945133..c50667d8 100644 --- a/aws-lambda-java-log4j2/pom.xml +++ b/aws-lambda-java-log4j2/pom.xml @@ -1,7 +1,13 @@ 4.0.0 - com.amazonaws + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + aws-lambda-java-log4j2 1.6.6-SNAPSHOT @@ -37,7 +43,6 @@ 1.8 1.8 2.25.5 - 5.12.2 @@ -51,7 +56,7 @@ com.amazonaws aws-lambda-java-core - 1.2.3 + org.apache.logging.log4j @@ -72,7 +77,7 @@ org.junit.jupiter junit-jupiter-engine - ${junit-jupiter.version} + test diff --git a/aws-lambda-java-runtime-interface-client/pom.xml b/aws-lambda-java-runtime-interface-client/pom.xml index 756fe353..ef67d180 100644 --- a/aws-lambda-java-runtime-interface-client/pom.xml +++ b/aws-lambda-java-runtime-interface-client/pom.xml @@ -2,7 +2,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - com.amazonaws + + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + aws-lambda-java-runtime-interface-client 2.12.0-SNAPSHOT jar @@ -40,7 +47,9 @@ 0.8.12 2.4 3.1.1 - 5.12.2 + 3.4.0 3.5.4 com.amazonaws aws-lambda-java-serialization - 1.4.1 + software.amazon.awssdk @@ -80,13 +89,13 @@ org.junit.jupiter junit-jupiter-engine - ${junit-jupiter.version} + test org.junit.jupiter junit-jupiter - ${junit-jupiter.version} + test diff --git a/aws-lambda-java-serialization/pom.xml b/aws-lambda-java-serialization/pom.xml index a5a085ca..d815f8c8 100644 --- a/aws-lambda-java-serialization/pom.xml +++ b/aws-lambda-java-serialization/pom.xml @@ -2,6 +2,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + com.amazonaws aws-lambda-java-serialization 1.4.2-SNAPSHOT diff --git a/aws-lambda-java-tests/pom.xml b/aws-lambda-java-tests/pom.xml index 8fb3ee0c..4d53bf33 100644 --- a/aws-lambda-java-tests/pom.xml +++ b/aws-lambda-java-tests/pom.xml @@ -3,7 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - com.amazonaws + + com.amazonaws + aws-lambda-java-libs + 1.0.0 + ../pom.xml + + aws-lambda-java-tests 1.1.3-SNAPSHOT @@ -44,8 +50,7 @@ --> 5.9.2 0.8.7 - 1.4.1 - 3.16.1 + 3.18.0 3.27.7 @@ -54,12 +59,10 @@ com.amazonaws aws-lambda-java-serialization - ${aws-lambda-java-serialization.version} com.amazonaws aws-lambda-java-events - ${aws-lambda-java-events.version} org.junit.jupiter diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..e50ed715 --- /dev/null +++ b/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + com.amazonaws + aws-lambda-java-libs + + 1.0.0 + pom + + AWS Lambda Java Libs Parent + + Build-time-only parent that centralizes internal module versions. + + https://aws.amazon.com/lambda/ + + + Apache License, Version 2.0 + https://aws.amazon.com/apache2.0 + repo + + + + https://github.com/aws/aws-lambda-java-libs.git + scm:git:https://github.com/aws/aws-lambda-java-libs.git + scm:git:https://github.com/aws/aws-lambda-java-libs.git + HEAD + + + + AWS Lambda team + Amazon Web Services + https://aws.amazon.com/ + + + + + 1.4.0 + 3.16.1 + 1.4.1 + 5.12.2 + + + + + + com.amazonaws + aws-lambda-java-core + ${lambda.core.version} + + + com.amazonaws + aws-lambda-java-events + ${lambda.events.version} + + + com.amazonaws + aws-lambda-java-serialization + ${lambda.serialization.version} + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.6.0 + + ossrh + true + + + + flatten + process-resources + + flatten + + + + flatten-clean + clean + + clean + + + + + + +