diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2524559..6d3604f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,13 +1,56 @@ name: Java CI Combined -on: [push, pull_request, workflow_dispatch] +# Push publishes the -SNAPSHOT version already in pom.xml to the Sonatype snapshot repo (and S3, until the cut-off). +# A manual run picks a type: release (default) X.Y.Z.N, rc X.Y.Z.N-RC, beta X.Y.Z.N-BETA, alpha X.Y.Z.N-ALPHA +# (N from the -SNAPSHOT in pom.xml), then commits the next -SNAPSHOT. Type "snapshot" only deploys the current snapshot. +# Where each version goes: +# final (X.Y.Z.N) and -SNAPSHOT: mvn deploy (Maven Central / snapshot repo) + S3 Maven layout +# -RC, -BETA, -ALPHA: mvn install (signed), S3 Maven layout only (maven.lucee-services.com), never Central +# A push to a branch with a -SNAPSHOT version also commits the next -SNAPSHOT after the deploy, +# so every commit gets its own build number. The bump commit itself does not bump again. +on: + push: + pull_request: + workflow_dispatch: + inputs: + type: + description: 'What to publish: release (X.Y.Z.N), rc (-RC), beta (-BETA), alpha (-ALPHA), or snapshot (deploy the current -SNAPSHOT, no bump)' + type: choice + options: + - release + - rc + - beta + - alpha + - snapshot + default: release jobs: setup: runs-on: ubuntu-latest outputs: version: ${{ steps.extract-version.outputs.VERSION }} + release: ${{ steps.extract-version.outputs.RELEASE }} + next_version: ${{ steps.extract-version.outputs.NEXT_VERSION }} + lucee_matrix: ${{ steps.lucee-matrix.outputs.MATRIX }} + publish: ${{ steps.publish.outputs.PUBLISH }} steps: + # Only pushes and manual runs on master/main, a version branch (1.0, 2.0, ...) or release/* may + # publish (deploy, s3) or commit (bump). Feature and PR branches only build and test. + - name: Decide whether this run may publish + id: publish + env: + EVENT: ${{ github.event_name }} + REF: ${{ github.ref }} + run: | + PUBLISH=false + if [[ "$EVENT" == "push" || "$EVENT" == "workflow_dispatch" ]]; then + BRANCH="${REF#refs/heads/}" + if [[ "$REF" == refs/heads/* ]] && [[ "$BRANCH" == "master" || "$BRANCH" == "main" || "$BRANCH" =~ ^[0-9]+(\.[0-9]+)*$ || "$BRANCH" == release/* ]]; then + PUBLISH=true + fi + fi + echo "event=${EVENT} ref=${REF} publish=${PUBLISH}" + echo "PUBLISH=${PUBLISH}" >> "$GITHUB_OUTPUT" - name: Checkout repository uses: actions/checkout@v4 @@ -21,15 +64,105 @@ jobs: uses: actions/cache@v4 with: path: ~/.m2 - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-maven-v2-${{ hashFiles('**/pom.xml') }} restore-keys: | - ${{ runner.os }}-maven- + ${{ runner.os }}-maven-v2- - name: Extract version number id: extract-version + env: + # A manual run releases unless the box is unticked. Push and pull_request never do. + RELEASE_TYPE: ${{ github.event_name == 'workflow_dispatch' && inputs.type || 'snapshot' }} run: | - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - echo "::set-output name=VERSION::$VERSION" + set -euo pipefail + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr -d '\r') + RELEASE=false + NEXT_VERSION="" + case "$RELEASE_TYPE" in + release) SUFFIX="" ;; + rc) SUFFIX="-RC" ;; + beta) SUFFIX="-BETA" ;; + alpha) SUFFIX="-ALPHA" ;; + snapshot) SUFFIX="none" ;; + *) echo "::error::unknown release type [${RELEASE_TYPE}]"; exit 1 ;; + esac + if [[ "$SUFFIX" != "none" ]]; then + if [[ "$VERSION" != *-SNAPSHOT ]]; then + echo "::error::A release run needs a -SNAPSHOT version in pom.xml (found ${VERSION})" + exit 1 + fi + RELEASE_VERSION="${VERSION%-SNAPSHOT}" + if ! [[ "$RELEASE_VERSION" =~ ^[0-9]+(\.[0-9]+){3}$ ]]; then + echo "::error::[${RELEASE_VERSION}] is not a 4-part release version" + exit 1 + fi + PREFIX="${RELEASE_VERSION%.*}" + LAST="${RELEASE_VERSION##*.}" + NEXT_VERSION="${PREFIX}.$((10#$LAST + 1))-SNAPSHOT" + VERSION="${RELEASE_VERSION}${SUFFIX}" + if ! [[ "$VERSION" =~ ^[0-9]+(\.[0-9]+){3}(-RC|-BETA|-ALPHA)?$ ]]; then + echo "::error::[${VERSION}] is not a valid release version" + exit 1 + fi + RELEASE=true + echo "Release run: publish ${VERSION}, then bump pom.xml to ${NEXT_VERSION}" + fi + echo "Using VERSION=${VERSION} RELEASE=${RELEASE} NEXT_VERSION=${NEXT_VERSION}" + echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" + echo "RELEASE=${RELEASE}" >> "$GITHUB_OUTPUT" + echo "NEXT_VERSION=${NEXT_VERSION}" >> "$GITHUB_OUTPUT" + + # Repository and organization variables are not passed to pull_request runs from forks, so + # vars.LUCEE_TEST_VERSIONS_7 is empty there and fromJSON('') fails the whole run before build-and-test starts. + # Use the variable when it is set, otherwise test the latest build of each Lucee line through + # a version query (script-runner resolves it), so fork PRs are tested too. + - name: Resolve Lucee test matrix + id: lucee-matrix + env: + TEST_VERSIONS: ${{ vars.LUCEE_TEST_VERSIONS_7 }} + # this extension needs Lucee 7.1.0.204 or newer (luceeCoreVersion in pom.xml) + FALLBACK_LINES: "7.1 8.0" + REQUIRED_LINES: "" + run: | + set -euo pipefail + if [[ -n "${TEST_VERSIONS// }" ]] && echo "$TEST_VERSIONS" | jq -e 'type == "array" and length > 0' > /dev/null; then + echo "Using vars.LUCEE_TEST_VERSIONS_7" + MATRIX=$(echo "$TEST_VERSIONS" | jq -c '.') + else + echo "::notice::vars.LUCEE_TEST_VERSIONS_7 is not available (fork pull request?), testing the latest build of: ${FALLBACK_LINES}" + MATRIX=$(printf '%s\n' $FALLBACK_LINES | jq -R -s -c 'split("\n") | map(select(length > 0)) | map({version: (. + "/all/light"), query: (. + "/all/light")})') + fi + for LINE in $REQUIRED_LINES; do + if ! echo "$MATRIX" | jq -e --arg l "$LINE" 'any(.[]; ((.query // "") | startswith($l + "/")) or ((.version // "") | test("^[a-z]*-?" + ($l | gsub("\\."; "\\.")) + "\\.")))' > /dev/null; then + echo "Adding the latest ${LINE} build to the matrix" + MATRIX=$(echo "$MATRIX" | jq -c --arg l "$LINE" '. + [{version: ($l + "/all/light"), query: ($l + "/all/light")}]') + fi + done + # also test the oldest supported core, luceeCoreVersion from pom.xml (Lucee jar from the CDN) + MIN_VERSION=$(mvn -B help:evaluate -Dexpression=luceeCoreVersion -q -DforceStdout | tr -d '\r') + if ! [[ "$MIN_VERSION" =~ ^[0-9]+(\.[0-9]+){3}(-[A-Z]+)?$ ]]; then + echo "::error::[${MIN_VERSION}] is not a valid luceeCoreVersion" + exit 1 + fi + # drop entries older than luceeCoreVersion: a version is compared in full, a line (7.0/...) by major.minor + MATRIX=$(echo "$MATRIX" | jq -c --arg min "${MIN_VERSION%%-*}" ' + def nums: [scan("[0-9]+") | tonumber]; + ($min | nums) as $m + | map(select( + ([(.version // ""), (.query // "")] | map([match("[0-9]+(\\.[0-9]+){1,3}").string]) | add | first // "") as $v + | if $v == "" then true + else ($v | nums) as $n | if ($n | length) < 4 then $n >= $m[0:($n | length)] else $n >= $m end + end))') + if ! echo "$MATRIX" | jq -e --arg v "$MIN_VERSION" 'any(.[]; (.version // "") | endswith($v))' > /dev/null; then + echo "Adding the minimum supported version ${MIN_VERSION} to the matrix" + MATRIX=$(echo "$MATRIX" | jq -c --arg v "light-$MIN_VERSION" '. + [{version: $v, query: ""}]') + fi + # artifact names cannot contain "/", so give every entry a label. + # testRef is the lucee/lucee branch of the same line (6.2, 7.1, ...), so each core runs the test suite + # written for it; tests for core fixes on newer lines would otherwise fail on older cores. + MATRIX=$(echo "$MATRIX" | jq -c 'map(. + {label: ((.version // .query) | gsub("[^A-Za-z0-9._-]"; "-")), testRef: ((([.query, .version] | map(select(. != null and . != "")) | first // "") | capture("(?[0-9]+\\.[0-9]+)").l) // "")})') + echo "Lucee test matrix: ${MATRIX}" + echo "MATRIX=${MATRIX}" >> "$GITHUB_OUTPUT" - name: Cache Lucee files uses: actions/cache@v4 @@ -37,20 +170,13 @@ jobs: path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache key: lucee-downloads - - name: Import GPG key - run: | - echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - build-and-test: runs-on: ubuntu-latest needs: setup - env: - LUCEE_TEST_VERSIONS_PLUS: ${{ vars.LUCEE_TEST_VERSIONS_PLUS }} strategy: + fail-fast: false matrix: - lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS_PLUS) }} + lucee: ${{ fromJSON(needs.setup.outputs.lucee_matrix) }} steps: - uses: actions/checkout@v4 @@ -60,22 +186,65 @@ jobs: java-version: '21' distribution: 'temurin' + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-maven-v2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-v2- + + # A release run builds the version with -SNAPSHOT removed, the same one deploy publishes. + - name: Set the version for this run + if: needs.setup.outputs.release == 'true' + env: + VERSION: ${{ needs.setup.outputs.version }} + run: | + set -euo pipefail + python3 - "$VERSION" <<'PY' + import pathlib, re, sys + new = sys.argv[1] + path = pathlib.Path("pom.xml") + text = path.read_text() + pattern = r"(argon2-extension\s*)[^<]+()" + text2, n = re.subn(pattern, lambda m: m.group(1) + new + m.group(2), text, count=1) + if n != 1: + raise SystemExit(f"project version was not updated (matches={n})") + path.write_text(text2) + print(f"pom.xml version is now {new}") + PY + - name: Build and Install with Maven + timeout-minutes: 15 run: | echo "------- Maven Install -------"; - mvn -B -e -f pom.xml clean install + mvn -B -e -f pom.xml clean install -Dgoal=install - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: argon2-lex-${{ matrix.lucee.version }} - path: target/*.lex + name: argon2-lex-${{ matrix.lucee.label }} + path: | + target/*.lex + !target/*.lite.lex - name: Checkout Lucee uses: actions/checkout@v4 with: repository: lucee/lucee path: lucee + ref: ${{ matrix.lucee.testRef }} + + - name: Prepare extension dir for tests + run: rm -f target/*.lite.lex + + - name: Log Lucee test matrix version + run: | + echo "Matrix lucee.version: ${{ matrix.lucee.version }}" + echo "Matrix lucee.query: ${{ matrix.lucee.query }}" + if [ -n "${{ matrix.lucee.query }}" ]; then + echo "Note: script-runner uses luceeVersionQuery when set; it overrides luceeVersion." + fi - name: Run Lucee Test Suite uses: lucee/script-runner@main @@ -91,8 +260,9 @@ jobs: deploy: runs-on: ubuntu-latest - needs: [build-and-test] - if: always() && needs.build-and-test.result == 'success' + needs: [setup, build-and-test] + # pull requests (often from forks) get no secrets, so they only build and test + if: always() && needs.build-and-test.result == 'success' && needs.setup.outputs.publish == 'true' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -107,9 +277,9 @@ jobs: uses: actions/cache@v4 with: path: ~/.m2 - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-maven-v2-${{ hashFiles('**/pom.xml') }} restore-keys: | - ${{ runner.os }}-maven- + ${{ runner.os }}-maven-v2- - name: Import GPG key run: | @@ -117,16 +287,210 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Install Maven 3.9.16 + # ubuntu-latest moved to Maven 3.10.0 (Oct 2026), which stages maven-metadata-local.xml + # in org/lucee/argon2-extension/; Central then rejects the bundle + # ("Bundle has content that does NOT have a .pom file"). Pin 3.9.16 for the deploy. + run: | + curl -fsSL -o /tmp/maven.tar.gz https://archive.apache.org/dist/maven/maven-3/3.9.16/binaries/apache-maven-3.9.16-bin.tar.gz + echo "831a8591fe20c8243b1dbe7d71e3244f31d1665b0804b2e825e38cbbe5ce0cafb8338851f90780735568773e0a6cd07bbec107cda0b896b008b861075358b6f6 /tmp/maven.tar.gz" | sha512sum -c - + tar -xzf /tmp/maven.tar.gz -C /tmp + echo "/tmp/apache-maven-3.9.16/bin" >> "$GITHUB_PATH" + /tmp/apache-maven-3.9.16/bin/mvn -v + + - name: Set the version for this run + if: needs.setup.outputs.release == 'true' + env: + VERSION: ${{ needs.setup.outputs.version }} + run: | + set -euo pipefail + python3 - "$VERSION" <<'PY' + import pathlib, re, sys + new = sys.argv[1] + path = pathlib.Path("pom.xml") + text = path.read_text() + pattern = r"(argon2-extension\s*)[^<]+()" + text2, n = re.subn(pattern, lambda m: m.group(1) + new + m.group(2), text, count=1) + if n != 1: + raise SystemExit(f"project version was not updated (matches={n})") + path.write_text(text2) + print(f"pom.xml version is now {new}") + PY + - name: Build and Deploy with Maven env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + VERSION: ${{ needs.setup.outputs.version }} run: | - if [[ "${{ needs.setup.outputs.version }}" == *-SNAPSHOT ]]; then - echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------"; - mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml + set -euo pipefail + if [[ "$VERSION" == *-SNAPSHOT ]]; then + echo "------- Maven Deploy snapshot ${VERSION} on ${{ github.event_name }} -------"; + mvn -B -e -f pom.xml clean deploy -Dgoal=deploy --settings maven-settings.xml + elif [[ "$VERSION" =~ -(RC|BETA|ALPHA)$ ]]; then + # pre-releases are not published to Maven Central, only to S3 (s3 job below) + echo "------- Maven Install (signed) ${VERSION} on ${{ github.event_name }}, S3 only -------"; + mvn -B -e -f pom.xml clean install -Dgoal=install -DperformRelease=true --settings maven-settings.xml + else + echo "------- Maven Deploy release ${VERSION} on ${{ github.event_name }} -------"; + mvn -B -e -f pom.xml clean deploy -Dgoal=deploy -DperformRelease=true --settings maven-settings.xml + fi + + # everything the S3 upload needs (LDEV-6568): full and lite .lex plus the flattened POM + - name: Upload artifact for S3 + if: success() + uses: actions/upload-artifact@v4 + with: + name: argon2-s3 + include-hidden-files: true + path: | + target/*.lex + .flattened-pom.xml + + # LDEV-6688: publish every final, ALPHA, BETA and RC build as a GitHub release with its .lex files attached, + # so ext.lucee.org can redirect downloads to GitHub releases (LDEV-6511). -SNAPSHOT builds get no GitHub release. + # Separate job, so a failure here never blocks the Maven Central or S3 upload. + github-release: + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: [setup, deploy] + if: >- + always() && needs.deploy.result == 'success' + && needs.setup.outputs.publish == 'true' + && !endsWith(needs.setup.outputs.version, '-SNAPSHOT') + permissions: + # create the release (and its tag) and upload its assets + contents: write + steps: + # the same files the S3 job uploads (built by the deploy job with the published version) + - name: Download published extension + uses: actions/download-artifact@v4 + with: + name: argon2-s3 + path: release-files + + - name: Create GitHub release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + VERSION: ${{ needs.setup.outputs.version }} + IS_DEFAULT_BRANCH: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + set -euo pipefail + mapfile -t FILES < <(find release-files -type f \( -name "*-${VERSION}.lex" -o -name "*-${VERSION}.lite.lex" \) | sort) + if [ "${#FILES[@]}" -eq 0 ]; then + echo "::error::no .lex files for $VERSION found"; find release-files -type f; exit 1 + fi + printf 'Asset: %s\n' "${FILES[@]}" + + # the release tag is the exact published version (2.1.0.8 or 2.1.0.8-RC), created on this commit + # if it does not exist yet. ALPHA/BETA/RC are pre-releases and never "latest". + if [[ "$VERSION" == *-* ]]; then + PRE=(--prerelease --latest=false) + elif [ "$IS_DEFAULT_BRANCH" == "true" ]; then + PRE=(--latest) else - echo "------- Maven Deploy release on ${{ github.event_name }} -------"; - mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml + PRE=(--latest=false) + fi + + if gh release view "$VERSION" >/dev/null 2>&1; then + echo "Release $VERSION already exists - uploading assets again" + gh release upload "$VERSION" "${FILES[@]}" --clobber + else + echo "Creating release $VERSION ${PRE[*]} on $GITHUB_SHA" + gh release create "$VERSION" "${FILES[@]}" "${PRE[@]}" --target "$GITHUB_SHA" \ + --title "$VERSION" \ + --notes "Build $VERSION from commit $GITHUB_SHA, published by $RUN_URL" + fi + + # upload the published build to the Maven folders, LDEV-6568. + # Cut-off rules (SNAPSHOTs stop on 2027-03-01) live in the called workflow. + # Finals and SNAPSHOTs are also on Central / the snapshot repo; RC, BETA and ALPHA are only here. + # secrets: inherit passes the org secrets S3_ACCESS_ID_DOWNLOAD and S3_SECRET_KEY_DOWNLOAD. + # The called workflow warns and skips when those secrets are not available to this repo. + s3: + needs: [setup, deploy] + if: always() && needs.deploy.result == 'success' && needs.setup.outputs.publish == 'true' + uses: lucee/lucee/.github/workflows/extension-s3-upload.yml@7.1 + with: + artifact-name: argon2-s3 + version: ${{ needs.setup.outputs.version }} + secrets: inherit + + # After a release deploy, or a SNAPSHOT deploy on a push, commit the next -SNAPSHOT. + # No loop: the push uses the workflow token, which does not start another workflow run, + # and runs started by github-actions[bot] or with the bump message are skipped anyway. + bump: + runs-on: ubuntu-latest + needs: [setup, deploy, s3] + if: >- + always() && needs.deploy.result == 'success' + && needs.setup.outputs.publish == 'true' + && (needs.s3.result == 'success' || needs.s3.result == 'skipped') + && (needs.setup.outputs.release == 'true' + || (github.event_name == 'push' + && startsWith(github.ref, 'refs/heads/') + && endsWith(needs.setup.outputs.version, '-SNAPSHOT') + && github.actor != 'github-actions[bot]' + && !startsWith(github.event.head_commit.message, 'Set version to ') + && !contains(github.event.head_commit.message, '[skip ci]'))) + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + + - name: Bump to the next SNAPSHOT + env: + NEXT_VERSION: ${{ needs.setup.outputs.next_version }} + DEPLOYED_VERSION: ${{ needs.setup.outputs.version }} + IS_RELEASE: ${{ needs.setup.outputs.release }} + run: | + set -euo pipefail + if [[ "$IS_RELEASE" != "true" ]]; then + # push: bump from the version on the branch tip, only if nobody bumped it since this deploy + CURRENT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr -d '\r') + if [[ "$CURRENT" != "$DEPLOYED_VERSION" ]]; then + echo "Branch is at ${CURRENT}, deployed ${DEPLOYED_VERSION}; already bumped, nothing to do" + exit 0 + fi + BASE="${CURRENT%-SNAPSHOT}" + if ! [[ "$BASE" =~ ^[0-9]+(\.[0-9]+){3}$ ]]; then + echo "::warning::[${CURRENT}] is not a 4-part SNAPSHOT version, not bumping" + exit 0 + fi + NEXT_VERSION="${BASE%.*}.$((10#${BASE##*.} + 1))-SNAPSHOT" + echo "Push run: bump pom.xml from ${CURRENT} to ${NEXT_VERSION}" + fi + if [[ -z "$NEXT_VERSION" ]]; then + echo "::error::next version was not resolved" + exit 1 + fi + python3 - "$NEXT_VERSION" <<'PY' + import pathlib, re, sys + new = sys.argv[1] + path = pathlib.Path("pom.xml") + text = path.read_text() + pattern = r"(argon2-extension\s*)[^<]+()" + text2, n = re.subn(pattern, lambda m: m.group(1) + new + m.group(2), text, count=1) + if n != 1: + raise SystemExit(f"project version was not updated (matches={n})") + path.write_text(text2) + print(f"pom.xml version is now {new}") + PY + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add pom.xml + if git diff --cached --quiet; then + echo "pom.xml already at ${NEXT_VERSION}" + exit 0 fi + git commit -m "Set version to ${NEXT_VERSION}" + git fetch origin "${GITHUB_REF_NAME}" + git rebase "origin/${GITHUB_REF_NAME}" + git push origin "HEAD:${GITHUB_REF_NAME}" diff --git a/.gitignore b/.gitignore index ef59bb6..f795b1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /dist +temp **/Test.java **/TestCase.java **/.DS_Store @@ -10,3 +11,4 @@ target target/* *.lock *.DS_Store +**/.flattened-pom.xml diff --git a/build.xml b/build.xml index ffac689..a4e17f3 100644 --- a/build.xml +++ b/build.xml @@ -1,58 +1,107 @@ - + Build Argon2 Extension - - + - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + goal:${maven.goal} + effective.goal:${effective.goal} + performRelease:${is.deploy} + groupId:${mvnGroupId} + artifactId:${mvnArtifactId} + bundleversion:${bundleversion} + luceeCoreVersion:${luceeCoreVersion} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + - + - + - Manifest-Version: 1.0 Built-Date: ${NOW} version: "${bundleversion}" @@ -66,67 +115,12 @@ release-type: ${releaseType} start-bundles: false - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -135,16 +129,21 @@ start-bundles: false - - - + + + - + + + + + + + + + + + - - - - - - \ No newline at end of file + diff --git a/copy-parent-poms.sh b/copy-parent-poms.sh new file mode 100644 index 0000000..6ace280 --- /dev/null +++ b/copy-parent-poms.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +DEPENDENCY_DIR="$1" +M2_REPO="${HOME}/.m2/repository" +COPIED_TRACKER="${DEPENDENCY_DIR}/.parent_poms_copied" + +echo "========================================" +echo "Copying parent POMs from local Maven repository" +echo "========================================" + +# Create tracker file +mkdir -p "$DEPENDENCY_DIR" +> "$COPIED_TRACKER" + +# Function to check if we've already copied this POM +is_already_copied() { + grep -qx "$1" "$COPIED_TRACKER" 2>/dev/null +} + +# Function to mark POM as copied +mark_as_copied() { + echo "$1" >> "$COPIED_TRACKER" +} + +# Function to recursively copy parent chain +copy_parent_chain() { + pom_file="$1" + + # Check if POM exists + if [ ! -f "$pom_file" ]; then + return + fi + + # Extract parent info (handles multi-line XML) + parent_block=$(sed -n '//,/<\/parent>/p' "$pom_file" | tr '\n' ' ') + + if [ -z "$parent_block" ]; then + return # No parent, stop recursion + fi + + parent_group=$(echo "$parent_block" | sed -n 's/.*\([^<]*\)<\/groupId>.*/\1/p' | head -1) + parent_artifact=$(echo "$parent_block" | sed -n 's/.*\([^<]*\)<\/artifactId>.*/\1/p' | head -1) + parent_version=$(echo "$parent_block" | sed -n 's/.*\([^<]*\)<\/version>.*/\1/p' | head -1) + + # Validate we got all three values + if [ -z "$parent_group" ] || [ -z "$parent_artifact" ] || [ -z "$parent_version" ]; then + return + fi + + # Create unique key for this POM (safe for file storage) + pom_key="${parent_group}__${parent_artifact}__${parent_version}" + + # Skip if already copied + if is_already_copied "$pom_key"; then + return + fi + + # Convert group ID to path + parent_path=$(echo "$parent_group" | tr '.' '/') + + # Source location in local Maven repo + parent_pom="$M2_REPO/$parent_path/$parent_artifact/$parent_version/$parent_artifact-$parent_version.pom" + + # Target location in dependency directory + target_dir="$DEPENDENCY_DIR/$parent_path/$parent_artifact/$parent_version" + + if [ -f "$parent_pom" ]; then + mkdir -p "$target_dir" + cp "$parent_pom" "$target_dir/" + echo "✓ Copied: $parent_artifact:$parent_version" + + # Mark as copied + mark_as_copied "$pom_key" + + # Recursively copy this parent's parent + copy_parent_chain "$parent_pom" + else + echo "✗ NOT FOUND in local repo: $parent_artifact:$parent_version" + echo " Expected at: $parent_pom" + fi +} + +# Find all POM files and process each +find "$DEPENDENCY_DIR" -name "*.pom" -type f | while read pom; do + copy_parent_chain "$pom" +done + +# Clean up tracker file +rm -f "$COPIED_TRACKER" + +echo "========================================" +echo "Parent POM copy complete" +echo "========================================" diff --git a/pom.xml b/pom.xml index 7f5ba33..3a05c18 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.lucee argon2-extension - 1.0.0.11 + 1.1.0.0-SNAPSHOT pom Argon2 Extension @@ -17,7 +17,11 @@ https://raw.githubusercontent.com/lucee/extension-argon2/master/source/images/logo.png ${maven.build.timestamp} org.lucee.argon2.extension - 5.0.0.157 + org.lucee + org/lucee + argon2-functions + + 7.1.0.204 server https://oss.sonatype.org/service/local/staging/deploy/maven2/ @@ -83,6 +87,7 @@ ${project.build.directory}/${project.artifactId}-${project.version}.lex + ${project.build.directory}/${project.artifactId}-${project.version}.lite.lex @@ -156,8 +161,16 @@ - - + + + + + + + + + + @@ -170,6 +183,11 @@ true + + + + + @@ -193,6 +211,11 @@ ${project.build.directory}/${project.artifactId}-${project.version}.lex lex + + ${project.build.directory}/${project.artifactId}-${project.version}.lite.lex + lex + lite + @@ -238,16 +261,17 @@ 3.0.0-M1 - default-deploy + deploy-lite deploy deploy-file - ${project.build.directory}/${project.artifactId}-${project.version}.lex + ${project.build.directory}/${project.artifactId}-${project.version}.lite.lex ${project.groupId} ${project.artifactId} ${project.version} + lite ossrh ${deploy.url} lex diff --git a/source/fld/function.fld b/source/fld/function.fld index a9f99ad..c19eff5 100755 --- a/source/fld/function.fld +++ b/source/fld/function.fld @@ -14,7 +14,7 @@ GenerateArgon2Hash - org.lucee.extension.argon2.GenerateArgon2Hash + org.lucee.extension.argon2.GenerateArgon2Hash 5.3.8.18 Returns hash of input using Argon2. @@ -59,7 +59,7 @@ Argon2CheckHash - org.lucee.extension.argon2.Argon2CheckHash + org.lucee.extension.argon2.Argon2CheckHash 5.3.8.43 Returns hash of input using Argon2. diff --git a/source/java/.classpath b/source/java/.classpath index 2e679f3..adeb0a3 100644 --- a/source/java/.classpath +++ b/source/java/.classpath @@ -6,11 +6,5 @@ - - - - - - diff --git a/source/java/.gitignore b/source/java/.gitignore index 5e56e04..c41ba8f 100644 --- a/source/java/.gitignore +++ b/source/java/.gitignore @@ -1 +1,3 @@ /bin +target +.flattened-pom.xml diff --git a/source/java/libs/com.sun.jna-5.8.0.jar b/source/java/libs/com.sun.jna-5.8.0.jar deleted file mode 100644 index c3d534c..0000000 Binary files a/source/java/libs/com.sun.jna-5.8.0.jar and /dev/null differ diff --git a/source/java/libs/javax.servlet-api-3.1.0.jar b/source/java/libs/javax.servlet-api-3.1.0.jar deleted file mode 100644 index 6b14c3d..0000000 Binary files a/source/java/libs/javax.servlet-api-3.1.0.jar and /dev/null differ diff --git a/source/java/libs/jsp-api-2.2.jar b/source/java/libs/jsp-api-2.2.jar deleted file mode 100644 index 64e1b74..0000000 Binary files a/source/java/libs/jsp-api-2.2.jar and /dev/null differ diff --git a/source/java/libs/lucee.jar b/source/java/libs/lucee.jar deleted file mode 100644 index 0676b53..0000000 Binary files a/source/java/libs/lucee.jar and /dev/null differ diff --git a/source/java/libs/org.lucee.argon2-2.12.0.jar b/source/java/libs/org.lucee.argon2-2.12.0.jar deleted file mode 100644 index cd8ca7b..0000000 Binary files a/source/java/libs/org.lucee.argon2-2.12.0.jar and /dev/null differ diff --git a/source/java/libs/org.lucee.argon2-jvm-nolibs-2.12.0.jar b/source/java/libs/org.lucee.argon2-jvm-nolibs-2.12.0.jar deleted file mode 100644 index eafceb8..0000000 Binary files a/source/java/libs/org.lucee.argon2-jvm-nolibs-2.12.0.jar and /dev/null differ diff --git a/source/java/maven-settings.xml b/source/java/maven-settings.xml new file mode 100755 index 0000000..339881c --- /dev/null +++ b/source/java/maven-settings.xml @@ -0,0 +1,27 @@ + + + + + + + ossrh + ${maven.username} + ${maven.password} + + + + + + ossrh + + true + + + gpg2 + ${gpg.passphrase} + + + + \ No newline at end of file diff --git a/source/java/pom.xml b/source/java/pom.xml new file mode 100644 index 0000000..f53feb6 --- /dev/null +++ b/source/java/pom.xml @@ -0,0 +1,204 @@ + + 4.0.0 + org.lucee + argon2-functions + ${revision} + + Argon2 Functions + Implementation of the GenerateArgon2Hash and Argon2CheckHash functions on top of the upstream de.mkammerer:argon2-jvm + https://github.com/lucee/extension-argon2 + + + UTF-8 + + 7.1.0.204 + + + + + The GNU Lesser General Public License, Version 2.1 + http://www.gnu.org/licenses/lgpl-2.1.txt + + + + + + micstriit + Michael Offner + michael@lucee.org + Lucee Association Switzerland + http://lucee.org + + Project-Administrator + Developer + + +1 + + + + + src + + + + org.codehaus.mojo + flatten-maven-plugin + 1.6.0 + + true + oss + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + 11 + none + + + + + org.apache.maven.plugins + maven-release-plugin + 3.0.0 + + true + false + release + deploy + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 11 + 11 + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + true + + + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + ossrh + true + + + + + + + + + + de.mkammerer + argon2-jvm + 2.12 + compile + + + org.lucee + lucee + ${lucee.version} + provided + + + + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + https://github.com/lucee/extension-argon2 + scm:git:git://github.com/lucee/extension-argon2.git + scm:git:git@github.com:lucee/extension-argon2.git + ${project.version} + + + diff --git a/source/java/src/META-INF/MANIFEST.MF b/source/java/src/META-INF/MANIFEST.MF deleted file mode 100644 index 790fa4b..0000000 --- a/source/java/src/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Export-Package: org.lucee.extension.argon2 -Bundle-ManifestVersion: 2 -Require-Bundle: org.lucee.argon2;bundle-version=2.12.0, - org.lucee.argon2-jvm-nolibs;bundle-version=2.12.0