diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a342276..54d0473 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: CI-Gradle-build on: push: + branches: + - master release: workflow_dispatch: inputs: @@ -13,6 +15,7 @@ on: # FIXME we probably want this to work on the latest release tag only # * is a special character in YAML # setup monthly background build + # Hmm GH won't run schedule if no activity for 2 months - cron: '45 4 18 * *' jobs: @@ -25,7 +28,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Version run: | @@ -46,42 +49,37 @@ jobs: echo "target_version=$target_version" >> $GITHUB_ENV - name: Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: ${{ matrix.jvm }} - - name: Cache - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Gradle - wrapper-validation-action + uses: gradle/wrapper-validation-action@v1 - name: Gradle - setup uses: gradle/gradle-build-action@v2 - - name: Gradle - build - run: ./gradlew build + - name: Gradle - assemble + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS assemble - name: Gradle - check - run: ./gradlew check + run: ./gradlew $GRADLE_EXTRA_ARGS check - name: Gradle - integrationTest if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} - run: ./gradlew integrationTest + run: ./gradlew $GRADLE_EXTRA_ARGS integrationTest - name: Gradle - asciidoctor - run: ./gradlew asciidoctor + run: ./gradlew $GRADLE_EXTRA_ARGS asciidoctor - name: Gradle - dokka - run: ./gradlew dokka + run: ./gradlew $GRADLE_EXTRA_ARGS dokka - name: Gradle - publish - run: ./gradlew publish + run: ./gradlew $GRADLE_EXTRA_ARGS publish - name: Upload - prepare if: ${{ matrix.os == 'ubuntu-latest' }} @@ -97,8 +95,11 @@ jobs: mkdir -p build/gh-pages cp -a build/reports/tests build/gh-pages/ - cp -a build/asciidoc/html5/* build/gh-pages/ - cp -a build/dokka build/gh-pages/ + + docs_build_dir="build" + [ -d docs/build ] && docs_build_dir="docs/build" || true + cp -a $docs_build_dir/asciidoc/html5/* build/gh-pages/ + cp -a $docs_build_dir/dokka build/gh-pages/ mkdir -p build/gh-pages/maven2 cp -a build/repo/* build/gh-pages/maven2/ @@ -114,7 +115,7 @@ jobs: retention-days: 1 - name: Upload - perform - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ matrix.os == 'ubuntu-latest' }} with: name: java${{ matrix.jvm }}-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts @@ -126,9 +127,11 @@ jobs: needs: build runs-on: ubuntu-latest + env: + GRADLE_EXTRA_ARGS: --no-daemon steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Version run: | @@ -149,25 +152,25 @@ jobs: echo "target_version=$target_version" >> $GITHUB_ENV - name: Download - java8-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: java8-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts path: build/java8-artifacts/ - name: Download - java8-github-pages - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: java8-github-pages path: build/java8-github-pages-artifacts/ - name: Download - java11-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: java11-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts path: build/java11-artifacts/ - name: Download - java11-github-pages - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: java11-github-pages path: build/java11-github-pages-artifacts/ @@ -227,17 +230,17 @@ jobs: ls -lR build - name: github-pages - artifacts/ Generate Directory Listings - uses: jayanta525/github-pages-directory-listing@19ee734e017b656528749434335f75a1efb931bc + uses: jayanta525/github-pages-directory-listing@624ac8c4e56893256d3772f61a88e3b14d54314e with: FOLDER: build/gh-pages/artifacts/ #directory to generate index - name: github-pages - java8/ Generate Directory Listings - uses: jayanta525/github-pages-directory-listing@19ee734e017b656528749434335f75a1efb931bc + uses: jayanta525/github-pages-directory-listing@624ac8c4e56893256d3772f61a88e3b14d54314e with: FOLDER: build/gh-pages/java8/ #directory to generate index - name: github-pages - java11/ Generate Directory Listings - uses: jayanta525/github-pages-directory-listing@19ee734e017b656528749434335f75a1efb931bc + uses: jayanta525/github-pages-directory-listing@624ac8c4e56893256d3772f61a88e3b14d54314e with: FOLDER: build/gh-pages/java11/ #directory to generate index @@ -265,4 +268,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v3 diff --git a/.github/workflows/canary-build.yml b/.github/workflows/canary-build.yml new file mode 100644 index 0000000..76bf6de --- /dev/null +++ b/.github/workflows/canary-build.yml @@ -0,0 +1,319 @@ +name: CI-Gradle-canary-build +# This build exists to test compatibility of the plugin project build to generate the plugin +# with the latest Gradle version. +# This is checking and reporting about the plugin maintainers perspective of building this plugin +# This also indirectly tests against JVM updates as well but that is not considered the main focus +# +# So I'm calling this a canary as it provides an early warning after a new official Gradle release +# of consumer issues. We do not test release candidates or against any Gradle builds that are not +# an official release as there is no maintenance capacity to keep uptodate with daily issues from +# doing this not any reason to thing doing this will improve the quality of the plugin. +# +# Gradle publishes public data to in this area to help with automation: +# https://services.gradle.org/versions/ +# https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json + +## TODO build project test, using newer Gradle versions, setup matrix of useful version +## TODO run deprecation test turn on warnings, collect output to summary +## TODO emit compile log output warnings to summary + +on: + workflow_dispatch: + inputs: + GRADLE_TARGET_ENABLE_integrationTest: + description: 'Run with integrationTest ?' + default: true + type: boolean + schedule: + # setup weekly canary build + - cron: '45 4 * * 6' + +jobs: + build: + strategy: + max-parallel: 3 + matrix: + # Maintenance update as necessary the expected latest Gradle version supports the JVM matrix listed + os: [ubuntu-latest] + jvm: ['8', '11', '17', '21'] + gradle: [ + 'latest', + '8', + '8.5', # JDK21 + '7', + '7.6', + '7.3', # JDK11 + '6', + '6.6.1' # oldest supported to build project with + ] + exclude: + - jvm: 21 + gradle: 7 + - jvm: 21 + gradle: 7.6 + - jvm: 21 + gradle: 7.3 + - jvm: 21 + gradle: 6 + - jvm: 21 + gradle: 6.6.1 + - jvm: 17 + gradle: 6 + - jvm: 17 + gradle: 6.6.1 + fail-fast: false + runs-on: ${{ matrix.os }} + env: + GRADLE_EXTRA_ARGS: --no-daemon --warning-mode=all + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Matrix Check + run: | + ## Disable runs requesting invalid matrix (done via 'strategy.matrix.exclude' GHA setting) + # jvm=21 only latest 8.5 + # jvm=17 only latest 8.5 7 7.6 7.3 + # jvm=11 only latest 8.5 7 7.6 7.3 6 5 5.6 + # jvm=8 only latest 8.5 7 7.6 7.3 6 5 5.6 + # Resolve all values to actual value + # Remove duplicates (and alias runs) + if [ -z "${{ matrix.os }}" ] + then + echo "$0: matrix.os is not setup" 1>&2 + exit 1 + fi + if [ -z "${{ matrix.jvm }}" ] + then + echo "$0: matrix.jvm is not setup" 1>&2 + exit 1 + fi + if [ -z "${{ matrix.gradle }}" ] + then + echo "$0: matrix.gradle is not setup" 1>&2 + exit 1 + fi + + - name: GHA Option Setup + run: | + if [ -z "${GRADLE_TARGET_ENABLE_integrationTest}" ] && [ -n "${{ github.event.schedule }}" ]; then + # force this on for schedule build + # "${{ github.event.schedule }}" == "45 4 18 * *" + # $GITHUB_EVENT_NAME == "schedule" + echo "GRADLE_TARGET_ENABLE_integrationTest=true" >> $GITHUB_ENV + fi + target_plugin="org.unbroken-dome.xjc" + target_group=$(grep "^group=" gradle.properties | cut -d'=' -f2-) + target_artifact="gradle-xjc-plugin" + target_version=$(grep "^version=" gradle.properties | cut -d'=' -f2-) + + echo "target_plugin=$target_plugin" >> $GITHUB_ENV + echo "target_group=$target_group" >> $GITHUB_ENV + echo "target_artifact=$target_artifact" >> $GITHUB_ENV + echo "target_version=$target_version" >> $GITHUB_ENV + + - name: Gradle Version Setup + run: | + # + curl -s "https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json" > released-versions.json + + # Only supporting 6.6.1 or newer (to build the project itself) + GRADLE_ALL_VERSIONS=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | tr '\n' ' ' | sed -e 's#\s6.6\s.*##') + echo "GRADLE_ALL_VERSIONS=$GRADLE_ALL_VERSIONS" + + GRADLE_CANARY_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | head -n1) + echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" + + GRADLE_CANARY_MAJOR=$(echo -n "$GRADLE_CANARY_VERSION" | cut -d '.' -f1) + + regex_transform=$(echo -ne "${{ matrix.gradle }}" | sed -e 's#\.#\\\0#g') + GRADLE_MATRIX_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | egrep -- "^${regex_transform}" | head -n1 | tr -d '\r\n') + echo "GRADLE_MATRIX_VERSION=$GRADLE_MATRIX_VERSION" + + GRADLE_MATRIX_MAJOR=$(echo -n "$GRADLE_MATRIX_VERSION" | cut -d '.' -f1) + + if gradlew -v || which gradlew + then + # confirm GHA didn't provide its own + echo "$0: ERROR ./gradlew appears to already be installed" 1>&2 + exit 1 + fi + + if [ "${{ matrix.gradle }}" = "latest" ] + then + GRADLE_VERSION="$GRADLE_CANARY_VERSION" + else + GRADLE_VERSION="$GRADLE_MATRIX_VERSION" + fi + GRADLE_VERSION_MAJOR=$(echo -n "$GRADLE_VERSION" | cut -d '.' -f1) + + # TODO disable duplicate runs which resolve to the same matrix versions + # latest 8 8.5 all resolve to 8.5 for example + + echo "GRADLE_ALL_VERSIONS=$GRADLE_ALL_VERSIONS" >> $GITHUB_ENV + echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" >> $GITHUB_ENV + echo "GRADLE_CANARY_MAJOR=$GRADLE_CANARY_MAJOR" >> $GITHUB_ENV + echo "GRADLE_MATRIX_VERSION=$GRADLE_MATRIX_VERSION" >> $GITHUB_ENV + echo "GRADLE_MATRIX_MAJOR=$GRADLE_MATRIX_MAJOR" >> $GITHUB_ENV + echo "GRADLE_VERSION=$GRADLE_VERSION" >> $GITHUB_ENV + echo "GRADLE_VERSION_MAJOR=$GRADLE_VERSION_MAJOR" >> $GITHUB_ENV + + # Make the version so with wrapper edit + sed -e 's/^distributionUrl=/\#\0/' -i gradle/wrapper/gradle-wrapper.properties + echo "distributionUrl=https\://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip" >> gradle/wrapper/gradle-wrapper.properties + + # Fixup gradle.properties based on Gradle major used to build + sed -e 's/^kotlinVersion=/\#\0/' -i gradle.properties + sed -e 's/^testSetsVersion=/\#\0/' -i gradle.properties + case "$GRADLE_VERSION_MAJOR" in + 5|6) echo "kotlinVersion=1.3.72" >> gradle.properties + echo "testSetsVersion=3.0.1" >> gradle.properties + ;; + 7) echo "kotlinVersion=1.6.21" >> gradle.properties + echo "testSetsVersion=4.0.0" >> gradle.properties + ;; + 8|*) echo "kotlinVersion=1.9.20" >> gradle.properties + if [ "${{ matrix.jvm }}" = "8" ] + then + # The official org.unbroken-dome.test-sets 4.1.0 Needs Java11+ and is the first version to support Gradle 8.x + #echo "testSetsVersion=4.0.0" >> gradle.properties + # So this is why this if[] exists, but the we now use unofficial: + #org.darrylmiles.repack.org.unbroken-dome.test-sets which a release in Java8 bytecode of 4.1.0 + echo "testSetsVersion=4.1.0" >> gradle.properties + else + # The official org.unbroken-dome.test-sets 4.1.0 Needs Java11+ + echo "testSetsVersion=4.1.0" >> gradle.properties + fi + ;; + esac + echo "### gradle.properties:" + cat gradle.properties + + - name: Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.jvm }} + + - name: Gradle - wrapper-validation-action + uses: gradle/wrapper-validation-action@v1 + + - name: Gradle - setup + uses: gradle/gradle-build-action@v2 + + - name: Show Diff + run: | + git diff || true + + - name: Report Versions + run: | + # Print verbose diagnostics into logs + java -version + + # download-artifact removes executable perm from files + test -x ./gradlew || chmod -c a+x ./gradlew + # Now run it + ./gradlew -v + + JAVA_ARG_VERSION=$(java -version 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + JAVA_ARG_VERSION_SUMMARY=$(java -version 2>&1 | head -n1 | sed -e 's#openjdk\s\+##' -e 's#version\s\+##' -e 's#"##g' -e 's#\s\+.*$##') + GRADLE_ARG_VERSION=$(./gradlew -v 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + GRADLE_WRAPPER_VERSION=$(egrep "^distributionUrl\s*=" gradle/wrapper/gradle-wrapper.properties | sed -e 's#^.*=##' -e 's#.*distributions/##' -e 's#^gradle\-##' -e 's#\-.*$##') + + cat <> /tmp/GITHUB_STEP_SUMMARY$$.txt + Gradle Version $GRADLE_VERSION (${{ matrix.gradle }}) JDK $JAVA_ARG_VERSION_SUMMARY (${{ matrix.jvm }}) + + | Package | Details | + | ---------- | --------------------- | + | Java | ${JAVA_ARG_VERSION} | + | Gradle | ${GRADLE_ARG_VERSION} | + EOF + + cat /tmp/GITHUB_STEP_SUMMARY$$.txt + cat /tmp/GITHUB_STEP_SUMMARY$$.txt >> $GITHUB_STEP_SUMMARY + + - name: Gradle - dependencies + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS dependencies + + - name: Gradle - assemble + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS assemble + + - name: Gradle - build + run: ./gradlew $GRADLE_EXTRA_ARGS build + + - name: Gradle - check + run: | + if ! ./gradlew $GRADLE_EXTRA_ARGS check + then + ./gradlew $GRADLE_EXTRA_ARGS --stacktrace check + fi + + - name: Gradle - integrationTest + if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} + run: ./gradlew $GRADLE_EXTRA_ARGS "-Dorg.unbrokendome.gradle.plugins.xjc.testutil.GradleVersions=${GRADLE_VERSION}" integrationTest + + - name: Gradle - asciidoctor + if: false # needs fixing for 7.x + run: ./gradlew $GRADLE_EXTRA_ARGS asciidoctor + + - name: Gradle - dokka + if: false # needs fixing for 7.x + run: ./gradlew $GRADLE_EXTRA_ARGS dokka + + - name: Gradle - publish + run: ./gradlew $GRADLE_EXTRA_ARGS publish + + - name: Gradle - deprecation check + run: ./gradlew -Dorg.gradle.deprecation.trace=true --warning-mode=all --stacktrace validatePlugins + + - name: Upload - prepare + if: ${{ matrix.os == 'ubuntu-latest' }} + shell: bash + run: | + mkdir dist + _build_repo_list=$(find . -type d -path "*/build/repo") + if [ -n "${_build_repo_list}" ] + then + for dir in ${_build_repo_list} + do + cp -a "$dir" "dist/" + done + else + echo "$0: no **/build/repo directories found" 1>&2 + fi + find "dist" -type f -exec ls -ld {} \; + du -s "dist" + + mkdir -p build/gh-pages + [ -d build/reports/tests ] && cp -a build/reports/tests build/gh-pages/ + + docs_build_dir="build" + [ -d docs/build ] && docs_build_dir="docs/build" || true + [ -d $docs_build_dir/asciidoc/html5 ] && cp -a $docs_build_dir/asciidoc/html5/* build/gh-pages/ + [ -d $docs_build_dir/dokka ] && cp -a $docs_build_dir/dokka build/gh-pages/ + + mkdir -p build/gh-pages/maven2 + [ -d "build/repo" ] && cp -a build/repo/* build/gh-pages/maven2/ + + ls -lad build/gh-pages + du -s build/gh-pages + + - name: Upload - java${{ matrix.jvm }}-gradle${{ matrix.gradle }}-github-pages + uses: actions/upload-pages-artifact@main + if: false + with: + name: java${{ matrix.jvm }}-github-pages + path: build/gh-pages/ + retention-days: 1 + + - name: Upload - perform + uses: actions/upload-artifact@v4 + if: ${{ matrix.os == 'ubuntu-latest' }} + with: + name: java${{ matrix.jvm }}-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts + path: dist/repo/* + if-no-files-found: warn diff --git a/.github/workflows/canary-consume.yml b/.github/workflows/canary-consume.yml new file mode 100644 index 0000000..9575c92 --- /dev/null +++ b/.github/workflows/canary-consume.yml @@ -0,0 +1,491 @@ +name: CI-Gradle-canary-consume +# This build exists to test compatibility of the plugin produces with the latest Gradle version +# This is checking and reporting about the user perspective of consuming this plugin +# This also indirectly tests against JVM updates as well but that is not considered the main focus +# +# So I'm calling this a canary as it provides an early warning after a new official Gradle release +# of consumer issues. We do not test release candidates or against any Gradle builds that are not +# an official release as there is no maintenance capacity to keep uptodate with daily issues from +# doing this not any reason to thing doing this will improve the quality of the plugin. +# +# Gradle publishes public data to in this area to help with automation: +# https://services.gradle.org/versions/ +# https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json + +## TODO build project test, using newer Gradle versions, setup matrix of useful version +## TODO run deprecation test turn on warnings, collect output to summary +## TODO emit compile log output warnings to summary + +on: + workflow_dispatch: + inputs: + GRADLE_TARGET_ENABLE_integrationTest: + description: 'Run with integrationTest ?' + default: true + type: boolean + schedule: + # setup weekly canary consume + - cron: '45 4 * * 6' + +jobs: + build: + runs-on: ubuntu-latest + env: + GHA_INPUT_BUILD_JVM: 8 + GRADLE_EXTRA_ARGS: --no-daemon + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: GHA Option Setup + run: | + if [ -f "original/gradle.properties" ] + then + gradle_properties_path="original/gradle.properties" + else + gradle_properties_path="gradle.properties" + fi + + if [ -z "${GRADLE_TARGET_ENABLE_integrationTest}" ] && [ -n "${{ github.event.schedule }}" ]; then + # force this on for schedule build + # "${{ github.event.schedule }}" == "45 4 18 * *" + # $GITHUB_EVENT_NAME == "schedule" + echo "GRADLE_TARGET_ENABLE_integrationTest=true" >> $GITHUB_ENV + fi + target_plugin="org.unbroken-dome.xjc" + target_group=$(grep "^group=" $gradle_properties_path | cut -d'=' -f2-) + target_artifact="gradle-xjc-plugin" + target_version=$(grep "^version=" $gradle_properties_path | cut -d'=' -f2-) + + echo "target_plugin=$target_plugin" >> $GITHUB_ENV + echo "target_group=$target_group" >> $GITHUB_ENV + echo "target_artifact=$target_artifact" >> $GITHUB_ENV + echo "target_version=$target_version" >> $GITHUB_ENV + + - name: Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ env.GHA_INPUT_BUILD_JVM }} + + - name: Gradle - wrapper-validation-action + uses: gradle/wrapper-validation-action@v1 + + - name: Gradle - setup + uses: gradle/gradle-build-action@v2 + + - name: Report Versions + run: | + # Print verbose diagnostics into logs + java -version + + # download-artifact removes executable perm from files + test -x ./gradlew || chmod -c a+x ./gradlew + # Now run it + ./gradlew -v + + JAVA_ARG_VERSION=$(java -version 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + JAVA_ARG_VERSION_SUMMARY=$(java -version 2>&1 | head -n1 | sed -e 's#openjdk\s\+##' -e 's#version\s\+##' -e 's#"##g' -e 's#\s\+.*$##') + GRADLE_ARG_VERSION=$(./gradlew -v 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + GRADLE_WRAPPER_VERSION=$(egrep "^distributionUrl\s*=" gradle/wrapper/gradle-wrapper.properties | sed -e 's#^.*=##' -e 's#.*distributions/##' -e 's#^gradle\-##' -e 's#\-.*$##') + + cat <> /tmp/GITHUB_STEP_SUMMARY$$.txt + Gradle Version $GRADLE_VERSION (wrapper ${GRADLE_WRAPPER_VERSION}) JDK $JAVA_ARG_VERSION_SUMMARY (${{ env.GHA_INPUT_BUILD_JVM }}) + + | Package | Details | + | ---------- | --------------------- | + | Java | ${JAVA_ARG_VERSION} | + | Gradle | ${GRADLE_ARG_VERSION} | + EOF + + cat /tmp/GITHUB_STEP_SUMMARY$$.txt + cat /tmp/GITHUB_STEP_SUMMARY$$.txt >> $GITHUB_STEP_SUMMARY + + - name: Gradle - dependencies + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS dependencies + + - name: Gradle - assemble + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS assemble + + - name: Gradle - check + run: ./gradlew $GRADLE_EXTRA_ARGS check + + - name: Gradle - integrationTest + if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} + run: ./gradlew $GRADLE_EXTRA_ARGS "-Dorg.unbrokendome.gradle.plugins.xjc.testutil.GradleVersions=${GRADLE_VERSION}" integrationTest + + - name: Gradle - asciidoctor + run: ./gradlew $GRADLE_EXTRA_ARGS asciidoctor + + - name: Gradle - dokka + run: ./gradlew $GRADLE_EXTRA_ARGS dokka + + - name: Gradle - publish + run: ./gradlew $GRADLE_EXTRA_ARGS publish + + - name: Gradle - deprecation check + run: ./gradlew $GRADLE_EXTRA_ARGS publish + + - name: Upload - prepare + if: true # ${{ matrix.os == 'ubuntu-latest' }} + shell: bash + run: | + mkdir dist + _build_repo_list=$(find . -type d -path "*/build/repo") + if [ -n "${_build_repo_list}" ] + then + for dir in ${_build_repo_list} + do + cp -a "$dir" "dist/" + done + else + echo "$0: no **/build/repo directories found" 1>&2 + fi + find "dist" -type f -exec ls -ld {} \; + du -s "dist" + + mkdir -p build/gh-pages + [ -d build/reports/tests ] && cp -a build/reports/tests build/gh-pages/ + + docs_build_dir="build" + [ -d docs/build ] && docs_build_dir="docs/build" || true + [ -d $docs_build_dir/asciidoc/html5 ] && cp -a $docs_build_dir/asciidoc/html5/* build/gh-pages/ + [ -d $docs_build_dir/dokka ] && cp -a $docs_build_dir/dokka build/gh-pages/ + + mkdir -p build/gh-pages/maven2 + [ -d "build/repo" ] && cp -a build/repo/* build/gh-pages/maven2/ + + ls -lad build/gh-pages + du -s build/gh-pages + + - name: Upload - java${{ matrix.jvm }}-gradle${{ matrix.gradle }}-github-pages + uses: actions/upload-pages-artifact@main + if: false + with: + name: java${{ matrix.jvm }}-github-pages + path: build/gh-pages/ + retention-days: 1 + + - name: Upload - perform + uses: actions/upload-artifact@v4 + if: true # ${{ matrix.os == 'ubuntu-latest' }} + with: + name: java${{ env.GHA_INPUT_BUILD_JVM }}-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-build-artifacts + path: '*' + if-no-files-found: error + + + # Now we have the plugin built using release engineering settings (such as Java8 built with Gradle 6.6.1) + # we now consume it and perform tests across multiple JVMs and Gradle combintations. The integrationTest + # matrix suite already gets the project a long way there on this. + # TODO use a plugin repository source override to be the build/repo/** output directory from 'build' job. + # Then switch the checkout/download-artifact to place the downloaded copy in a subdir and provide options + # to ensure gradle. Need to execute + consume: + needs: build + strategy: + max-parallel: 3 + matrix: + # Maintenance update as necessary the expected latest Gradle version supports the JVM matrix listed + os: [ubuntu-latest] + jvm: ['8', '11', '17', '21'] + gradle: [ + 'latest', + '8', + '8.5', # JDK21 + '7', + '7.6', + '7.3', # JDK11 + '6', + '6.6.1', # self-hosted build/consume + '5', + '5.6' + ] + exclude: + - jvm: 21 + gradle: 7 + - jvm: 21 + gradle: 7.6 + - jvm: 21 + gradle: 7.3 + - jvm: 21 + gradle: 6 + - jvm: 21 + gradle: 6.6.1 + - jvm: 21 + gradle: 5 + - jvm: 21 + gradle: 5.6 + - jvm: 17 + gradle: 6 + - jvm: 17 + gradle: 6.6.1 + - jvm: 17 + gradle: 5 + - jvm: 17 + gradle: 5.6 + fail-fast: false + runs-on: ${{ matrix.os }} + env: + GRADLE_EXTRA_ARGS: -DexcludeDocsTasks=true --no-daemon --warning-mode=all + GHA_INPUT_BUILD_JVM: 8 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: original + + - name: GHA Option Setup + run: | + if [ -f "original/gradle.properties" ] + then + gradle_properties_path="original/gradle.properties" + else + gradle_properties_path="gradle.properties" + fi + + if [ -z "${GRADLE_TARGET_ENABLE_integrationTest}" ] && [ -n "${{ github.event.schedule }}" ]; then + # force this on for schedule build + # "${{ github.event.schedule }}" == "45 4 18 * *" + # $GITHUB_EVENT_NAME == "schedule" + echo "GRADLE_TARGET_ENABLE_integrationTest=true" >> $GITHUB_ENV + fi + target_plugin="org.unbroken-dome.xjc" + target_group=$(grep "^group=" $gradle_properties_path | cut -d'=' -f2-) + target_artifact="gradle-xjc-plugin" + target_version=$(grep "^version=" $gradle_properties_path | cut -d'=' -f2-) + + echo "target_plugin=$target_plugin" >> $GITHUB_ENV + echo "target_group=$target_group" >> $GITHUB_ENV + echo "target_artifact=$target_artifact" >> $GITHUB_ENV + echo "target_version=$target_version" >> $GITHUB_ENV + + - uses: actions/download-artifact@v4 + with: + name: java${{ env.GHA_INPUT_BUILD_JVM }}-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-build-artifacts + path: . + + - name: Matrix Check + run: | + pwd + ls -la + # TODO We restored the build, so the dist should not be here, when we use plugin respotory from local files dist/repo + # we can check out clean project here and this move won't be needed + [ -d dist ] && mv -v dist dist_moved + + ## Disable runs requesting invalid matrix (done via 'strategy.matrix.exclude' GHA setting) + # jvm=21 only latest 8.5 + # jvm=17 only latest 8.5 7 7.6 7.3 + # jvm=11 only latest 8.5 7 7.6 7.3 6 5 5.6 + # jvm=8 only latest 8.5 7 7.6 7.3 6 5 5.6 + # Resolve all values to actual value + # Remove duplicates (and alias runs) + if [ -z "${{ matrix.os }}" ] + then + echo "$0: matrix.os is not setup" 1>&2 + exit 1 + fi + if [ -z "${{ matrix.jvm }}" ] + then + echo "$0: matrix.jvm is not setup" 1>&2 + exit 1 + fi + if [ -z "${{ matrix.gradle }}" ] + then + echo "$0: matrix.gradle is not setup" 1>&2 + exit 1 + fi + + - name: Gradle Version Setup + run: | + # + curl -s "https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json" > released-versions.json + + # Only supporting 5.6 or newer + GRADLE_ALL_VERSIONS=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | tr '\n' ' ' | sed -e 's#\s5.5.1\s.*##') + echo "GRADLE_ALL_VERSIONS=$GRADLE_ALL_VERSIONS" + + GRADLE_CANARY_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | head -n1) + echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" + + GRADLE_CANARY_MAJOR=$(echo -n "$GRADLE_CANARY_VERSION" | cut -d '.' -f1) + + regex_transform=$(echo -ne "${{ matrix.gradle }}" | sed -e 's#\.#\\\0#g') + GRADLE_MATRIX_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | egrep -- "^${regex_transform}" | head -n1 | tr -d '\r\n') + echo "GRADLE_MATRIX_VERSION=$GRADLE_MATRIX_VERSION" + + GRADLE_MATRIX_MAJOR=$(echo -n "$GRADLE_MATRIX_VERSION" | cut -d '.' -f1) + + if gradlew -v || which gradlew + then + # confirm GHA didn't provide its own + echo "$0: ERROR ./gradlew appears to already be installed" 1>&2 + exit 1 + fi + + if [ "${{ matrix.gradle }}" = "latest" ] + then + GRADLE_VERSION="$GRADLE_CANARY_VERSION" + else + GRADLE_VERSION="$GRADLE_MATRIX_VERSION" + fi + GRADLE_VERSION_MAJOR=$(echo -n "$GRADLE_VERSION" | cut -d '.' -f1) + + # TODO disable duplicate runs which resolve to the same matrix versions + # latest 8 8.5 all resolve to 8.5 for example + + echo "GRADLE_ALL_VERSIONS=$GRADLE_ALL_VERSIONS" >> $GITHUB_ENV + echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" >> $GITHUB_ENV + echo "GRADLE_CANARY_MAJOR=$GRADLE_CANARY_MAJOR" >> $GITHUB_ENV + echo "GRADLE_MATRIX_VERSION=$GRADLE_MATRIX_VERSION" >> $GITHUB_ENV + echo "GRADLE_MATRIX_MAJOR=$GRADLE_MATRIX_MAJOR" >> $GITHUB_ENV + echo "GRADLE_VERSION=$GRADLE_VERSION" >> $GITHUB_ENV + echo "GRADLE_VERSION_MAJOR=$GRADLE_VERSION_MAJOR" >> $GITHUB_ENV + + # Make the version so with wrapper edit + sed -e 's/^distributionUrl=/\#\0/' -i gradle/wrapper/gradle-wrapper.properties + echo "distributionUrl=https\://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip" >> gradle/wrapper/gradle-wrapper.properties + + test -f gradle.properties + # Fixup gradle.properties based on Gradle major used to build + sed -e 's/^kotlinVersion=/\#\0/' -i gradle.properties + sed -e 's/^testSetsVersion=/\#\0/' -i gradle.properties + case "$GRADLE_VERSION_MAJOR" in + 5|6) echo "kotlinVersion=1.3.72" >> gradle.properties + echo "testSetsVersion=3.0.1" >> gradle.properties + ;; + 7) echo "kotlinVersion=1.6.21" >> gradle.properties + echo "testSetsVersion=4.0.0" >> gradle.properties + ;; + 8|*) echo "kotlinVersion=1.9.20" >> gradle.properties + if [ "${{ matrix.jvm }}" = "8" ] + then + # The official org.unbroken-dome.test-sets 4.1.0 Needs Java11+ and is the first version to support Gradle 8.x + #echo "testSetsVersion=4.0.0" >> gradle.properties + # So this is why this if[] exists, but the we now use unofficial: + #org.darrylmiles.repack.org.unbroken-dome.test-sets which a release in Java8 bytecode of 4.1.0 + echo "testSetsVersion=4.1.0" >> gradle.properties + else + # The official org.unbroken-dome.test-sets 4.1.0 Needs Java11+ + echo "testSetsVersion=4.1.0" >> gradle.properties + fi + ;; + esac + echo "### gradle.properties:" + cat gradle.properties + + - name: Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.jvm }} + + - name: Gradle - wrapper-validation-action + uses: gradle/wrapper-validation-action@v1 + + - name: Gradle - setup + uses: gradle/gradle-build-action@v2 + + - name: Show Diff + run: | + git diff || true + + - name: Report Versions + run: | + # Print verbose diagnostics into logs + java -version + + # download-artifact removes executable perm from files + test -x ./gradlew || chmod -c a+x ./gradlew + # Now run it + ./gradlew -v + + JAVA_ARG_VERSION=$(java -version 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + JAVA_ARG_VERSION_SUMMARY=$(java -version 2>&1 | head -n1 | sed -e 's#openjdk\s\+##' -e 's#version\s\+##' -e 's#"##g' -e 's#\s\+.*$##') + GRADLE_ARG_VERSION=$(./gradlew -v 2>&1 | sed -e ':a;N;$!ba;s/\n/
/g' -e 's#|#\\|#g') + + cat <> /tmp/GITHUB_STEP_SUMMARY$$.txt + Gradle Version $GRADLE_VERSION (${{ matrix.gradle }}) JDK $JAVA_ARG_VERSION_SUMMARY (${{ matrix.jvm }}) + + | Package | Details | + | ---------- | --------------------- | + | Java | ${JAVA_ARG_VERSION} | + | Gradle | ${GRADLE_ARG_VERSION} | + EOF + + cat /tmp/GITHUB_STEP_SUMMARY$$.txt + cat /tmp/GITHUB_STEP_SUMMARY$$.txt >> $GITHUB_STEP_SUMMARY + + - name: Gradle - dependencies + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew $GRADLE_EXTRA_ARGS dependencies + + - name: Gradle - check + run: | + if ! ./gradlew $GRADLE_EXTRA_ARGS check + then + ./gradlew $GRADLE_EXTRA_ARGS --stacktrace check + fi + + - name: Gradle - integrationTest [${{env.GRADLE_VERSION}}] + if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} + run: ./gradlew $GRADLE_EXTRA_ARGS "-Dorg.unbrokendome.gradle.plugins.xjc.testutil.GradleVersions=${GRADLE_VERSION}" integrationTest + + - name: Gradle - integrationTest [all] + if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} + run: ./gradlew $GRADLE_EXTRA_ARGS integrationTest + + - name: Upload - prepare + if: ${{ matrix.os == 'ubuntu-latest' }} + shell: bash + run: | + mkdir dist + _build_repo_list=$(find . -type d -path "*/build/repo") + if [ -n "${_build_repo_list}" ] + then + for dir in ${_build_repo_list} + do + cp -a "$dir" "dist/" + done + else + echo "$0: no **/build/repo directories found" 1>&2 + fi + find "dist" -type f -exec ls -ld {} \; + du -s "dist" + + mkdir -p build/gh-pages + [ -d build/reports/tests ] && cp -a build/reports/tests build/gh-pages/ + + docs_build_dir="build" + [ -d docs/build ] && docs_build_dir="docs/build" || true + [ -d $docs_build_dir/asciidoc/html5 ] && cp -a $docs_build_dir/asciidoc/html5/* build/gh-pages/ + [ -d $docs_build_dir/dokka ] && cp -a $docs_build_dir/dokka build/gh-pages/ + + mkdir -p build/gh-pages/maven2 + [ -d "build/repo" ] && cp -a build/repo/* build/gh-pages/maven2/ + + ls -lad build/gh-pages + du -s build/gh-pages + + - name: Upload - java${{ matrix.jvm }}-gradle${{ matrix.gradle }}-github-pages + uses: actions/upload-pages-artifact@main + if: false + with: + name: java${{ matrix.jvm }}-github-pages + path: build/gh-pages/ + retention-days: 1 + + - name: Upload - perform + uses: actions/upload-artifact@v4 + if: ${{ matrix.os == 'ubuntu-latest' }} + with: + name: java${{ matrix.jvm }}-gradle${{ matrix.gradle }}-${{ env.target_version }}-consume-artifacts + path: dist/repo/* + if-no-files-found: warn diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fa94918 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,210 @@ +name: publish + +on: + push: + branches: + - master + release: + workflow_dispatch: + inputs: + GITHUB_PACKAGES_PUBLISH: + description: 'Run publish Github Packages ?' + default: false + type: boolean + MAVEN_CENTRAL_PUBLISH: + description: 'Run publish Maven Central ?' + default: false + type: boolean + GAV_GROUP_ID: + description: 'GAV groupId ?' + default: org.darrylmiles.forked.org.unbroken-dome + type: string + GAV_VERSION: + description: 'GAV version ?' + default: + type: string + GRADLE_TARGET_integrationTest: + description: 'Run with integrationTest ?' + default: false + type: boolean + +jobs: + build: + runs-on: [ubuntu-latest] + + env: + GRADLE_EXTRA_ARGS: --no-daemon --warning-mode=all + JAVA_VERSION: 8 + GRADLE_TARGET_integrationTest: false + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Validate inputs + env: + GRADLE_TARGET_integrationTest: ${{ inputs.GRADLE_TARGET_integrationTest }} + GITHUB_PACKAGES_PUBLISH: ${{ inputs.GITHUB_PACKAGES_PUBLISH }} + MAVEN_CENTRAL_PUBLISH: ${{ inputs.MAVEN_CENTRAL_PUBLISH }} + GAV_GROUP_ID: ${{ inputs.GAV_GROUP_ID }} + GAV_VERSION: ${{ inputs.GAV_VERSION }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + run: | + # apply defaults for on.schedule + if [ -z "${GRADLE_TARGET_integrationTest}" ] && [ -n "${{ github.event.schedule }}" ]; then + # force this on for schedule build + # "${{ github.event.schedule }}" == "45 4 18 * *" + # $GITHUB_EVENT_NAME == "schedule" + echo "GRADLE_TARGET_integrationTest=true" >> $GITHUB_ENV + fi + + # apply defaults for on.push + if [ -z "$GRADLE_TARGET_integrationTest" ] + then + GRADLE_TARGET_integrationTest=true + echo "GRADLE_TARGET_integrationTest=$GRADLE_TARGET_integrationTest (default)" + fi + if [ -z "$GITHUB_PACKAGES_PUBLISH" ] + then + GITHUB_PACKAGES_PUBLISH=false + echo "GITHUB_PACKAGES_PUBLISH=$GITHUB_PACKAGES_PUBLISH (default)" + fi + if [ -z "$MAVEN_CENTRAL_PUBLISH" ] + then + MAVEN_CENTRAL_PUBLISH=false + echo "MAVEN_CENTRAL_PUBLISH=$MAVEN_CENTRAL_PUBLISH (default)" + fi + + # copy to env (as currently they maybe from inputs.* and need to be propagated) + if [ -n "$GRADLE_TARGET_integrationTest" ] + then + echo "GRADLE_TARGET_integrationTest=$GRADLE_TARGET_integrationTest" >> $GITHUB_ENV + fi + if [ -n "$GITHUB_PACKAGES_PUBLISH" ] + then + echo "GITHUB_PACKAGES_PUBLISH=$GITHUB_PACKAGES_PUBLISH" >> $GITHUB_ENV + fi + if [ -n "$MAVEN_CENTRAL_PUBLISH" ] + then + echo "MAVEN_CENTRAL_PUBLISH=$MAVEN_CENTRAL_PUBLISH" >> $GITHUB_ENV + fi + + echo "GITHUB_PACKAGES_PUBLISH=$GITHUB_PACKAGES_PUBLISH" + echo "MAVEN_CENTRAL_PUBLISH=$MAVEN_CENTRAL_PUBLISH" + echo "GRADLE_TARGET_integrationTest=$GRADLE_TARGET_integrationTest" + + # token check + + # synchronize variable names with your build.gradle + if [ "$GITHUB_PACKAGES_PUBLISH" = "true" ] + then + if [ -z "$GITHUB_TOKEN" ] + then + echo "$0: GITHUB_TOKEN is not set" 1>&2 + exit 1 + fi + if [ -z "$GITHUB_ACTOR" ] + then + echo "$0: GITHUB_ACTOR is not set" 1>&2 + exit 1 + fi + fi + + # synchronize variable names with your build.gradle + if [ "$MAVEN_CENTRAL_PUBLISH" = "true" ] + then + if [ -z "$MAVEN_PASSWORD" ] + then + echo "$0: MAVEN_PASSWORD is not set" 1>&2 + exit 1 + fi + if [ -z "$MAVEN_USERNAME" ] + then + echo "$0: MAVEN_USERNAME is not set" 1>&2 + exit 1 + fi + fi + + if [ -n "$GAV_GROUP_ID" ] + then + sed -e 's/^\s*group\s*=\s*/#\0/' -i gradle.properties + echo "group=$GAV_GROUP_ID" >> gradle.properties + echo "GAV_GROUP_ID=$GAV_GROUP_ID" + fi + + if [ -n "$GAV_VERSION" ] + then + sed -e 's/^\s*version\s*=\s*/#\0/' -i gradle.properties + echo "version=$GAV_VERSION" >> gradle.properties + echo "GAV_VERSION=$GAV_VERSION" + fi + + git diff || true + + - name: Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ env.JAVA_VERSION }} + + - name: Gradle - wrapper-validation-action + uses: gradle/wrapper-validation-action@v1 + + - name: Gradle - setup + uses: gradle/gradle-build-action@v2 + + - name: Gradle - assemble + env: # to resolve artifacts from GH packages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./gradlew $GRADLE_EXTRA_ARGS assemble + + - name: Gradle - check + run: | + ./gradlew $GRADLE_EXTRA_ARGS check + + - name: Gradle - integrationTest + if: ${{ env.GRADLE_TARGET_integrationTest != 'false' }} + run: | + ./gradlew $GRADLE_EXTRA_ARGS integrationTest + + - name: Gradle - asciidoctor + run: | + ./gradlew $GRADLE_EXTRA_ARGS asciidoctor + + - name: Gradle - dokka + run: | + ./gradlew $GRADLE_EXTRA_ARGS dokka + + - name: Gradle - publish local + run: | + ./gradlew $GRADLE_EXTRA_ARGS publish + find build/repo || true + + - name: Gradle - publish remote github packages + if: ${{ env.GITHUB_PACKAGES_PUBLISH == 'true' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./gradlew -PdoGitHubPackagesPublish=true $GRADLE_EXTRA_ARGS publish + + - name: Gradle - publish remote maven central + if: ${{ env.MAVEN_CENTRAL_PUBLISH == 'true' }} + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + run: | + ./gradlew -PdoMavenCentralPublish=true $GRADLE_EXTRA_ARGS publish + + - name: Upload - publish repo + uses: actions/upload-artifact@v4 + with: + name: java${{ env.JAVA_VERSION }}-artifacts + path: build/repo/* + if-no-files-found: error diff --git a/README.adoc b/README.adoc index 5ceac01..4e00a20 100644 --- a/README.adoc +++ b/README.adoc @@ -8,7 +8,7 @@ endif::[] :github-pages-uri: https://dlmiles.github.io/gradle-xjc-plugin :github-uri: https://github.com/dlmiles/gradle-xjc-plugin :github-m2-uri: https://maven.pkg.github.com/dlmiles/gradle-xjc-plugin -:maven-groupId: io.github.dlmiles +:maven-groupId: org.darrylmiles.forked.org.unbroken-dome :uri-build-status: https://github.com/dlmiles/gradle-xjc-plugin/actions/workflows/build.yml :img-build-status: https://github.com/dlmiles/gradle-xjc-plugin/actions/workflows/build.yml/badge.svg @@ -108,7 +108,7 @@ endif::[] .build.gradle(.kts) ---- plugins { - id("{maven-groupId}.xjc") version "2.1.0-SNAPSHOT" + id("{maven-groupId}.xjc") version "2.2.0-SNAPSHOT" } dependencies { diff --git a/build.gradle.kts b/build.gradle.kts index d78ea91..9954ce6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,10 +2,8 @@ plugins { kotlin("jvm") `java-gradle-plugin` `maven-publish` - id("org.unbroken-dome.test-sets") // version "$testSetsVersion" + id("org.darrylmiles.repack.org.unbroken-dome.test-sets") // version "$testSetsVersion" id("com.gradle.plugin-publish") version "0.21.0" - id("org.asciidoctor.convert") version "2.4.0" - id("org.jetbrains.dokka") version "0.10.1" } @@ -50,8 +48,19 @@ dependencies { for (xjcSourceSet in xjcSourceSets) { (xjcSourceSet.compileOnlyConfigurationName)(sourceSets["main"].output) - (xjcSourceSet.compileOnlyConfigurationName)(configurations["compileOnly"]) - (xjcSourceSet.implementationConfigurationName)(configurations["implementation"]) + + // Gradle 8.x does not allow referencing configurations[] like this anymore + // but it seems a convenience to unroll the deplist + + // for compileOnly() + //(xjcSourceSet.compileOnlyConfigurationName)(configurations["compileOnly"].allDependencies) + (xjcSourceSet.compileOnlyConfigurationName)(kotlin("stdlib-jdk8")) + (xjcSourceSet.compileOnlyConfigurationName)(gradleApi()) + + // for implementation() + //(xjcSourceSet.implementationConfigurationName)(configurations["implementation"].allDependencies) + (xjcSourceSet.implementationConfigurationName)("javax.activation:javax.activation-api:1.2.0") + (xjcSourceSet.implementationConfigurationName)("xml-resolver:xml-resolver:1.2") } "xjcCommonCompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.3") @@ -69,9 +78,9 @@ dependencies { "xjc22CompileOnly"("javax.xml.bind:jaxb-api:2.2.11") "xjc23CompileOnly"(xjcCommon.output) - "xjc23CompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.8") + "xjc23CompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.9") "xjc23CompileOnly"("com.sun.xml.bind:jaxb-core:2.3.0.1") - "xjc23CompileOnly"("com.sun.xml.bind:jaxb-impl:2.3.8") + "xjc23CompileOnly"("com.sun.xml.bind:jaxb-impl:2.3.9") "xjc23CompileOnly"("javax.xml.bind:jaxb-api:2.3.1") "xjc24CompileOnly"(xjcCommon.output) @@ -86,15 +95,19 @@ dependencies { "xjc30CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:3.0.1") "xjc40CompileOnly"(xjcCommon.output) - "xjc40CompileOnly"("com.sun.xml.bind:jaxb-xjc:4.0.2") - "xjc40CompileOnly"("com.sun.xml.bind:jaxb-core:4.0.2") - "xjc40CompileOnly"("com.sun.xml.bind:jaxb-impl:4.0.2") - "xjc40CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:4.0.0") + "xjc40CompileOnly"("com.sun.xml.bind:jaxb-xjc:4.0.4") + "xjc40CompileOnly"("com.sun.xml.bind:jaxb-core:4.0.4") + "xjc40CompileOnly"("com.sun.xml.bind:jaxb-impl:4.0.4") + "xjc40CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:4.0.1") "testLibApi"(kotlin("stdlib-jdk8")) - "testLibApi"("com.willowtreeapps.assertk:assertk-jvm:0.22") + // Bumping past 0.22 forces kotlin 1.4.x (Gradle 7+) + "testLibApi"("com.willowtreeapps.assertk:assertk-jvm:0.28.0") - "testImplementation"("org.spekframework.spek2:spek-dsl-jvm:2.0.9") + // Bumping these past 2.0.15 forces Gradle 7.x use for newer kotlin + "testImplementation"("org.spekframework.spek2:spek-dsl-jvm:2.0.15") + // 2.0.16 requires Java11 runtime, 2.0.17 reverted back to Java8 + // But needs Gradle 7.x kotlin "testRuntimeOnly"("org.spekframework.spek2:spek-runner-junit5:2.0.15") "integrationTestImplementation"(gradleTestKit()) @@ -116,7 +129,17 @@ configurations.all { tasks.withType { kotlinOptions.jvmTarget = "1.8" - kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable") + if(kotlinVersion >= "1.6.20") { + kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all-compatibility") + } else { + kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable") // 1.3 thru 1.6.0 (not 1.6.20) + } +} + +// There is no *.java code in this project but newer Gradle complains if there +// is a mismatch with kotlin due to the runtime JDK being newer than kotlin target. +tasks.withType { + targetCompatibility = "1.8" } @@ -227,51 +250,6 @@ pluginBundle { } -tasks.named("dokka", org.jetbrains.dokka.gradle.DokkaTask::class) { - outputFormat = "html" - configuration { - externalDocumentationLink { - url = uri("https://docs.gradle.org/current/javadoc/").toURL() - } - reportUndocumented = false - sourceLink { - path = "src/main/kotlin" - url = "https://github.com/${githubRepositoryOwner}/gradle-xjc-plugin/blob/v${project.version}/src/main/kotlin" - lineSuffix = "#L" - } - perPackageOption { - prefix = "org.unbrokendome.gradle.plugins.xjc.internal" - suppress = true - } - } -} - - -asciidoctorj { - version = "2.4.1" -} - -dependencies { - "asciidoctor"("com.bmuschko:asciidoctorj-tabbed-code-extension:0.3") -} - - -tasks.named("asciidoctor", org.asciidoctor.gradle.AsciidoctorTask::class) { - sourceDir("docs") - sources(delegateClosureOf { include("index.adoc") }) - - options(mapOf( - "doctype" to "book" - )) - attributes(mapOf( - "GITHUB_REPOSITORY_OWNER" to githubRepositoryOwner, - "github-pages-uri" to "https://${githubRepositoryOwner}.github.io/gradle-xjc-plugin", - "github-uri" to "https://github.com/${githubRepositoryOwner}/gradle-xjc-plugin", - "project-version" to project.version, - "source-highlighter" to "prettify" - )) -} - apply { - from("${rootDir}/publish.gradle.kts") + from("${rootDir}/publish.gradle.kts") } diff --git a/docs/build.gradle.kts b/docs/build.gradle.kts new file mode 100644 index 0000000..8dfed59 --- /dev/null +++ b/docs/build.gradle.kts @@ -0,0 +1,72 @@ +import org.jetbrains.dokka.gradle.DokkaTask +import org.asciidoctor.gradle.AsciidoctorTask + +plugins { + kotlin("jvm") + id("org.asciidoctor.convert") version "2.4.0" + id("org.jetbrains.dokka") version "0.10.1" +} + +val kotlinVersion: String by extra + + +repositories { + mavenCentral() +} + + +fun resolveSystemGetenv(name: String, defaultValue: String? = null): String? { + if(System.getenv().containsKey(name)) + return System.getenv(name) + return defaultValue +} + +val githubRepositoryOwner = resolveSystemGetenv("GITHUB_REPOSITORY_OWNER", "unbroken-dome") + + +tasks.named("dokka", org.jetbrains.dokka.gradle.DokkaTask::class) { +//tasks.withType().configureEach { + outputFormat = "html" + configuration { + externalDocumentationLink { + url = uri("https://docs.gradle.org/current/javadoc/").toURL() + } + reportUndocumented = false + sourceLink { + path = "src/main/kotlin" + url = "https://github.com/${githubRepositoryOwner}/gradle-xjc-plugin/blob/v${project.version}/src/main/kotlin" + lineSuffix = "#L" + } + perPackageOption { + prefix = "org.unbrokendome.gradle.plugins.xjc.internal" + suppress = true + } + } +} + + +asciidoctorj { + version = "2.4.1" +} + +dependencies { + "asciidoctor"("com.bmuschko:asciidoctorj-tabbed-code-extension:0.3") +} + + +tasks.named("asciidoctor", org.asciidoctor.gradle.AsciidoctorTask::class) { +//tasks.withType().configureEach { + sourceDir(".") + sources(delegateClosureOf { include("index.adoc") }) + + options(mapOf( + "doctype" to "book" + )) + attributes(mapOf( + "GITHUB_REPOSITORY_OWNER" to githubRepositoryOwner, + "github-pages-uri" to "https://${githubRepositoryOwner}.github.io/gradle-xjc-plugin", + "github-uri" to "https://github.com/${githubRepositoryOwner}/gradle-xjc-plugin", + "project-version" to project.version, + "source-highlighter" to "prettify" + )) +} diff --git a/gradle.properties b/gradle.properties index 923b30c..7d2acfa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,10 @@ ## Gradle 8.x building and testing #kotlinVersion=1.9.20 -# This needs Java11+ but is the first version to support Gradle 8.x +## The official org.unbroken-dome.test-sets 4.1.0 Needs Java11+ and is the first version to support Gradle 8.x +##testSetsVersion=4.0.0 +## So this is why these comments exist, but we now use unofficial: +##org.darrylmiles.repack.org.unbroken-dome.test-sets which a release in Java8 bytecode of 4.1.0 #testSetsVersion=4.1.0 ## Gradle 7.x building and testing @@ -23,4 +26,4 @@ testSetsVersion=3.0.1 # group=org.unbroken-dome.gradle-plugins -version=2.1.0-SNAPSHOT +version=2.2.0-SNAPSHOT diff --git a/publish.gradle.kts b/publish.gradle.kts index 5e780a6..bd29b83 100644 --- a/publish.gradle.kts +++ b/publish.gradle.kts @@ -22,6 +22,28 @@ allprojects { // Default is Maven buildDirectory publish only url = uri(layout.buildDirectory.dir("repo")) } + + + + if(findProperty("doGitHubPackagesPublish") == "true") { + val GITHUB_ACTOR = System.getenv("GITHUB_USERNAME") ?: System.getenv("GITHUB_ACTOR") ?: throw IllegalArgumentException() + val GITHUB_TOKEN = System.getenv("GITHUB_TOKEN") ?: System.getenv("GH_TOKEN") ?: throw IllegalArgumentException() + val GITHUB_REPOSITORY = System.getenv("GITHUB_REPOSITORY") + + assert(GITHUB_ACTOR.isNotEmpty() == true) + assert(GITHUB_TOKEN.isNotEmpty() == true) + assert(GITHUB_REPOSITORY.isNotEmpty() == true) + + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/${GITHUB_REPOSITORY}") + credentials { + username = GITHUB_ACTOR + password = GITHUB_TOKEN + } + } + } } } } + diff --git a/samples/groovy-dsl/basic/build.gradle b/samples/groovy-dsl/basic/build.gradle index f3afd62..fcd1e9f 100644 --- a/samples/groovy-dsl/basic/build.gradle +++ b/samples/groovy-dsl/basic/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/bindings/build.gradle b/samples/groovy-dsl/bindings/build.gradle index 52da711..6fc8666 100644 --- a/samples/groovy-dsl/bindings/build.gradle +++ b/samples/groovy-dsl/bindings/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/bindings_jakarta/build.gradle b/samples/groovy-dsl/bindings_jakarta/build.gradle index 731b25c..f4d974c 100644 --- a/samples/groovy-dsl/bindings_jakarta/build.gradle +++ b/samples/groovy-dsl/bindings_jakarta/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/catalogs/consumer/build.gradle b/samples/groovy-dsl/catalogs/consumer/build.gradle index 7dffdb2..1672e21 100644 --- a/samples/groovy-dsl/catalogs/consumer/build.gradle +++ b/samples/groovy-dsl/catalogs/consumer/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/complete/consumer/build.gradle b/samples/groovy-dsl/complete/consumer/build.gradle index c408abe..a9c9cfa 100644 --- a/samples/groovy-dsl/complete/consumer/build.gradle +++ b/samples/groovy-dsl/complete/consumer/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/complete/library/build.gradle b/samples/groovy-dsl/complete/library/build.gradle index 4de8d3d..70170b4 100644 --- a/samples/groovy-dsl/complete/library/build.gradle +++ b/samples/groovy-dsl/complete/library/build.gradle @@ -1,6 +1,6 @@ plugins { id('java-library') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/doclocale/build.gradle b/samples/groovy-dsl/doclocale/build.gradle index 5fc7e5e..68a0ad0 100644 --- a/samples/groovy-dsl/doclocale/build.gradle +++ b/samples/groovy-dsl/doclocale/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } repositories { diff --git a/samples/groovy-dsl/episodes/episode-consumer/build.gradle b/samples/groovy-dsl/episodes/episode-consumer/build.gradle index 5c54fba..3ec404e 100644 --- a/samples/groovy-dsl/episodes/episode-consumer/build.gradle +++ b/samples/groovy-dsl/episodes/episode-consumer/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/episodes/episode-producer/build.gradle b/samples/groovy-dsl/episodes/episode-producer/build.gradle index 92af77e..63568ec 100644 --- a/samples/groovy-dsl/episodes/episode-producer/build.gradle +++ b/samples/groovy-dsl/episodes/episode-producer/build.gradle @@ -1,6 +1,6 @@ plugins { id('java-library') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/remote-schema/build.gradle b/samples/groovy-dsl/remote-schema/build.gradle index f3afd62..fcd1e9f 100644 --- a/samples/groovy-dsl/remote-schema/build.gradle +++ b/samples/groovy-dsl/remote-schema/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/wsdl/build.gradle b/samples/groovy-dsl/wsdl/build.gradle new file mode 100644 index 0000000..633e19f --- /dev/null +++ b/samples/groovy-dsl/wsdl/build.gradle @@ -0,0 +1,29 @@ +plugins { + id('java') + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' +} + + +repositories { + mavenCentral() +} + +xjc { + // This maybe inferred from the filename extension provided to XJC + extraArgs.addAll "-wsdl" +} + +// With wsimport there is: +// cd src/main/schema +// mkdir out +// wsimport -verbose -keep -extension -b books.xjb -d out -wsdllocation "http://localhost/book/lookup/service" -Xdebug -XdisableAuthenticator books.wsdl +// But this is outside the scope of XJB see other gradle plugins for wsimport support + +// XJC seems able to produce JAXB for *.wsdl and *.xsd but it includes all eligible +// file extensions from src/main/schema/** so when imports are used it appears to +// need those file to be relocated outside of src/main/schema so this is the reason +// for the schema_other directory + +dependencies { + implementation 'javax.xml.bind:jaxb-api:2.3.0' +} diff --git a/samples/groovy-dsl/wsdl/settings.gradle b/samples/groovy-dsl/wsdl/settings.gradle new file mode 100644 index 0000000..7ba1915 --- /dev/null +++ b/samples/groovy-dsl/wsdl/settings.gradle @@ -0,0 +1,8 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenLocal() + } +} + +rootProject.name = 'wsdl' diff --git a/samples/groovy-dsl/wsdl/src/main/schema/books.wsdl b/samples/groovy-dsl/wsdl/src/main/schema/books.wsdl new file mode 100644 index 0000000..0736325 --- /dev/null +++ b/samples/groovy-dsl/wsdl/src/main/schema/books.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WSDL File Sample for Search_Service + + + + + + diff --git a/samples/groovy-dsl/wsdl/src/main/schema/books.xjb b/samples/groovy-dsl/wsdl/src/main/schema/books.xjb new file mode 100644 index 0000000..e0e6eb0 --- /dev/null +++ b/samples/groovy-dsl/wsdl/src/main/schema/books.xjb @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/samples/groovy-dsl/wsdl/src/main/schema/lookup.xsd b/samples/groovy-dsl/wsdl/src/main/schema/lookup.xsd new file mode 100644 index 0000000..6f4b791 --- /dev/null +++ b/samples/groovy-dsl/wsdl/src/main/schema/lookup.xsd @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/groovy-dsl/wsdl/src/main/schema_other/books.xsd b/samples/groovy-dsl/wsdl/src/main/schema_other/books.xsd new file mode 100644 index 0000000..50b82f0 --- /dev/null +++ b/samples/groovy-dsl/wsdl/src/main/schema_other/books.xsd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/samples/groovy-dsl/wsdl/src/main/schema_other/common.xsd b/samples/groovy-dsl/wsdl/src/main/schema_other/common.xsd new file mode 100644 index 0000000..c099e25 --- /dev/null +++ b/samples/groovy-dsl/wsdl/src/main/schema_other/common.xsd @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/samples/groovy-dsl/xjc-plugin/build.gradle b/samples/groovy-dsl/xjc-plugin/build.gradle index eb65192..1b04cb6 100644 --- a/samples/groovy-dsl/xjc-plugin/build.gradle +++ b/samples/groovy-dsl/xjc-plugin/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-2_1-legacy/build.gradle b/samples/groovy-dsl/xjc-tool-2_1-legacy/build.gradle index 3d9d20a..f9406e1 100644 --- a/samples/groovy-dsl/xjc-tool-2_1-legacy/build.gradle +++ b/samples/groovy-dsl/xjc-tool-2_1-legacy/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-2_2-legacy/build.gradle b/samples/groovy-dsl/xjc-tool-2_2-legacy/build.gradle index 734af32..bd54b5d 100644 --- a/samples/groovy-dsl/xjc-tool-2_2-legacy/build.gradle +++ b/samples/groovy-dsl/xjc-tool-2_2-legacy/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-2_2/build.gradle b/samples/groovy-dsl/xjc-tool-2_2/build.gradle index c97ecd9..f8bdd3b 100644 --- a/samples/groovy-dsl/xjc-tool-2_2/build.gradle +++ b/samples/groovy-dsl/xjc-tool-2_2/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-2_3/build.gradle b/samples/groovy-dsl/xjc-tool-2_3/build.gradle index ec57147..d554f50 100644 --- a/samples/groovy-dsl/xjc-tool-2_3/build.gradle +++ b/samples/groovy-dsl/xjc-tool-2_3/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-2_4/build.gradle b/samples/groovy-dsl/xjc-tool-2_4/build.gradle index d9334a3..cfdb705 100644 --- a/samples/groovy-dsl/xjc-tool-2_4/build.gradle +++ b/samples/groovy-dsl/xjc-tool-2_4/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-3_0-target-2_3/build.gradle b/samples/groovy-dsl/xjc-tool-3_0-target-2_3/build.gradle index aa729a5..c73d3e7 100644 --- a/samples/groovy-dsl/xjc-tool-3_0-target-2_3/build.gradle +++ b/samples/groovy-dsl/xjc-tool-3_0-target-2_3/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-3_0/build.gradle b/samples/groovy-dsl/xjc-tool-3_0/build.gradle index 532f682..59d1b2c 100644 --- a/samples/groovy-dsl/xjc-tool-3_0/build.gradle +++ b/samples/groovy-dsl/xjc-tool-3_0/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-4_0/build.gradle b/samples/groovy-dsl/xjc-tool-4_0/build.gradle index 82949dc..f625afc 100644 --- a/samples/groovy-dsl/xjc-tool-4_0/build.gradle +++ b/samples/groovy-dsl/xjc-tool-4_0/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-future-latest/build.gradle b/samples/groovy-dsl/xjc-tool-future-latest/build.gradle index ef5338e..ff6fd78 100644 --- a/samples/groovy-dsl/xjc-tool-future-latest/build.gradle +++ b/samples/groovy-dsl/xjc-tool-future-latest/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-tool-future/build.gradle b/samples/groovy-dsl/xjc-tool-future/build.gradle index 0bd96c1..bd2186a 100644 --- a/samples/groovy-dsl/xjc-tool-future/build.gradle +++ b/samples/groovy-dsl/xjc-tool-future/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-2_1-legacy/build.gradle b/samples/groovy-dsl/xjc-version-2_1-legacy/build.gradle index a2875d1..22d37f4 100644 --- a/samples/groovy-dsl/xjc-version-2_1-legacy/build.gradle +++ b/samples/groovy-dsl/xjc-version-2_1-legacy/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-2_2/build.gradle b/samples/groovy-dsl/xjc-version-2_2/build.gradle index 5ede3d0..348b2f4 100644 --- a/samples/groovy-dsl/xjc-version-2_2/build.gradle +++ b/samples/groovy-dsl/xjc-version-2_2/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-2_3/build.gradle b/samples/groovy-dsl/xjc-version-2_3/build.gradle index a5dc9ac..da36804 100644 --- a/samples/groovy-dsl/xjc-version-2_3/build.gradle +++ b/samples/groovy-dsl/xjc-version-2_3/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-2_4/build.gradle b/samples/groovy-dsl/xjc-version-2_4/build.gradle index 4094d20..4d17a95 100644 --- a/samples/groovy-dsl/xjc-version-2_4/build.gradle +++ b/samples/groovy-dsl/xjc-version-2_4/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-3_0-target-2_3/build.gradle b/samples/groovy-dsl/xjc-version-3_0-target-2_3/build.gradle index dc8f50e..348b580 100644 --- a/samples/groovy-dsl/xjc-version-3_0-target-2_3/build.gradle +++ b/samples/groovy-dsl/xjc-version-3_0-target-2_3/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-3_0/build.gradle b/samples/groovy-dsl/xjc-version-3_0/build.gradle index f94b59d..a4bac31 100644 --- a/samples/groovy-dsl/xjc-version-3_0/build.gradle +++ b/samples/groovy-dsl/xjc-version-3_0/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-4_0/build.gradle b/samples/groovy-dsl/xjc-version-4_0/build.gradle index dc69b57..fc2415f 100644 --- a/samples/groovy-dsl/xjc-version-4_0/build.gradle +++ b/samples/groovy-dsl/xjc-version-4_0/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-default/build.gradle b/samples/groovy-dsl/xjc-version-default/build.gradle index 2d77d3f..e09136e 100644 --- a/samples/groovy-dsl/xjc-version-default/build.gradle +++ b/samples/groovy-dsl/xjc-version-default/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-ext-basics-annox/build.gradle b/samples/groovy-dsl/xjc-version-ext-basics-annox/build.gradle index 5efb804..e4dade5 100644 --- a/samples/groovy-dsl/xjc-version-ext-basics-annox/build.gradle +++ b/samples/groovy-dsl/xjc-version-ext-basics-annox/build.gradle @@ -1,6 +1,6 @@ plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-ext-mark-generated/build.gradle b/samples/groovy-dsl/xjc-version-ext-mark-generated/build.gradle index edf08e5..a22c5a2 100644 --- a/samples/groovy-dsl/xjc-version-ext-mark-generated/build.gradle +++ b/samples/groovy-dsl/xjc-version-ext-mark-generated/build.gradle @@ -2,7 +2,7 @@ import org.gradle.util.VersionNumber plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/groovy-dsl/xjc-version-extensions/build.gradle b/samples/groovy-dsl/xjc-version-extensions/build.gradle index 6b54952..79cdf1c 100644 --- a/samples/groovy-dsl/xjc-version-extensions/build.gradle +++ b/samples/groovy-dsl/xjc-version-extensions/build.gradle @@ -2,7 +2,7 @@ import org.gradle.util.VersionNumber plugins { id('java') - id('org.unbroken-dome.xjc') version '2.1.0-SNAPSHOT' + id('org.unbroken-dome.xjc') version '2.2.0-SNAPSHOT' } diff --git a/samples/kotlin-dsl/basic/build.gradle.kts b/samples/kotlin-dsl/basic/build.gradle.kts index d28be5f..563a76e 100644 --- a/samples/kotlin-dsl/basic/build.gradle.kts +++ b/samples/kotlin-dsl/basic/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/bindings/build.gradle.kts b/samples/kotlin-dsl/bindings/build.gradle.kts index 8b85190..615f9d6 100644 --- a/samples/kotlin-dsl/bindings/build.gradle.kts +++ b/samples/kotlin-dsl/bindings/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/bindings_jakarta/build.gradle.kts b/samples/kotlin-dsl/bindings_jakarta/build.gradle.kts index d6599ff..028dd5b 100644 --- a/samples/kotlin-dsl/bindings_jakarta/build.gradle.kts +++ b/samples/kotlin-dsl/bindings_jakarta/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/catalogs/consumer/build.gradle.kts b/samples/kotlin-dsl/catalogs/consumer/build.gradle.kts index 5eda45b..818771c 100644 --- a/samples/kotlin-dsl/catalogs/consumer/build.gradle.kts +++ b/samples/kotlin-dsl/catalogs/consumer/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/complete/consumer/build.gradle.kts b/samples/kotlin-dsl/complete/consumer/build.gradle.kts index 1651ac4..dc91453 100644 --- a/samples/kotlin-dsl/complete/consumer/build.gradle.kts +++ b/samples/kotlin-dsl/complete/consumer/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/complete/library/build.gradle.kts b/samples/kotlin-dsl/complete/library/build.gradle.kts index b9f42c6..95e13e8 100644 --- a/samples/kotlin-dsl/complete/library/build.gradle.kts +++ b/samples/kotlin-dsl/complete/library/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `java-library` - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/doclocale/build.gradle.kts b/samples/kotlin-dsl/doclocale/build.gradle.kts index 83a3e6e..1bd7c54 100644 --- a/samples/kotlin-dsl/doclocale/build.gradle.kts +++ b/samples/kotlin-dsl/doclocale/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/episodes/episode-consumer/build.gradle.kts b/samples/kotlin-dsl/episodes/episode-consumer/build.gradle.kts index a2046e0..ca5f453 100644 --- a/samples/kotlin-dsl/episodes/episode-consumer/build.gradle.kts +++ b/samples/kotlin-dsl/episodes/episode-consumer/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/episodes/episode-producer/build.gradle.kts b/samples/kotlin-dsl/episodes/episode-producer/build.gradle.kts index 40b3f76..beb6000 100644 --- a/samples/kotlin-dsl/episodes/episode-producer/build.gradle.kts +++ b/samples/kotlin-dsl/episodes/episode-producer/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `java-library` - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/remote-schema/build.gradle.kts b/samples/kotlin-dsl/remote-schema/build.gradle.kts index d28be5f..563a76e 100644 --- a/samples/kotlin-dsl/remote-schema/build.gradle.kts +++ b/samples/kotlin-dsl/remote-schema/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/wsdl/build.gradle.kts b/samples/kotlin-dsl/wsdl/build.gradle.kts new file mode 100644 index 0000000..786a6c0 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/build.gradle.kts @@ -0,0 +1,29 @@ +plugins { + java + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" +} + + +repositories { + mavenCentral() +} + +xjc { + // This maybe inferred from the filename extension provided to XJC + extraArgs.addAll("-wsdl") +} + +// With wsimport there is: +// cd src/main/schema +// mkdir out +// wsimport -verbose -keep -extension -b books.xjb -d out -wsdllocation "http://localhost/book/lookup/service" -Xdebug -XdisableAuthenticator books.wsdl +// But this is outside the scope of XJB see other gradle plugins for wsimport support + +// XJC seems able to produce JAXB for *.wsdl and *.xsd but it includes all eligible +// file extensions from src/main/schema/** so when imports are used it appears to +// need those file to be relocated outside of src/main/schema so this is the reason +// for the schema_other directory + +dependencies { + implementation("javax.xml.bind:jaxb-api:2.3.0") +} diff --git a/samples/kotlin-dsl/wsdl/settings.gradle.kts b/samples/kotlin-dsl/wsdl/settings.gradle.kts new file mode 100644 index 0000000..c6d5d45 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/settings.gradle.kts @@ -0,0 +1,8 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenLocal() + } +} + +rootProject.name = "wsdl" diff --git a/samples/kotlin-dsl/wsdl/src/main/schema/books.wsdl b/samples/kotlin-dsl/wsdl/src/main/schema/books.wsdl new file mode 100644 index 0000000..0736325 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/src/main/schema/books.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WSDL File Sample for Search_Service + + + + + + diff --git a/samples/kotlin-dsl/wsdl/src/main/schema/books.xjb b/samples/kotlin-dsl/wsdl/src/main/schema/books.xjb new file mode 100644 index 0000000..e0e6eb0 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/src/main/schema/books.xjb @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/samples/kotlin-dsl/wsdl/src/main/schema/lookup.xsd b/samples/kotlin-dsl/wsdl/src/main/schema/lookup.xsd new file mode 100644 index 0000000..6f4b791 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/src/main/schema/lookup.xsd @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/kotlin-dsl/wsdl/src/main/schema_other/books.xsd b/samples/kotlin-dsl/wsdl/src/main/schema_other/books.xsd new file mode 100644 index 0000000..50b82f0 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/src/main/schema_other/books.xsd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/samples/kotlin-dsl/wsdl/src/main/schema_other/common.xsd b/samples/kotlin-dsl/wsdl/src/main/schema_other/common.xsd new file mode 100644 index 0000000..c099e25 --- /dev/null +++ b/samples/kotlin-dsl/wsdl/src/main/schema_other/common.xsd @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/samples/kotlin-dsl/xjc-plugin/build.gradle.kts b/samples/kotlin-dsl/xjc-plugin/build.gradle.kts index 575cba8..eded6c7 100644 --- a/samples/kotlin-dsl/xjc-plugin/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-plugin/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-2_1-legacy/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-2_1-legacy/build.gradle.kts index 127aaaa..238a41f 100644 --- a/samples/kotlin-dsl/xjc-tool-2_1-legacy/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-2_1-legacy/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-2_2-legacy/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-2_2-legacy/build.gradle.kts index e93dfe7..fc7f10d 100644 --- a/samples/kotlin-dsl/xjc-tool-2_2-legacy/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-2_2-legacy/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-2_2/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-2_2/build.gradle.kts index 4634f06..962f22b 100644 --- a/samples/kotlin-dsl/xjc-tool-2_2/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-2_2/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-2_3/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-2_3/build.gradle.kts index 095d608..43d22d8 100644 --- a/samples/kotlin-dsl/xjc-tool-2_3/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-2_3/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-2_4/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-2_4/build.gradle.kts index 763312a..f59d9b6 100644 --- a/samples/kotlin-dsl/xjc-tool-2_4/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-2_4/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-3_0-target-2_3/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-3_0-target-2_3/build.gradle.kts index 1a3a1f3..7902f5c 100644 --- a/samples/kotlin-dsl/xjc-tool-3_0-target-2_3/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-3_0-target-2_3/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-3_0/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-3_0/build.gradle.kts index dfbd596..dc6f4bd 100644 --- a/samples/kotlin-dsl/xjc-tool-3_0/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-3_0/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-4_0/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-4_0/build.gradle.kts index 95b5fb0..4bb6c82 100644 --- a/samples/kotlin-dsl/xjc-tool-4_0/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-4_0/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-future-latest/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-future-latest/build.gradle.kts index ea3efc6..7b2378f 100644 --- a/samples/kotlin-dsl/xjc-tool-future-latest/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-future-latest/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-tool-future/build.gradle.kts b/samples/kotlin-dsl/xjc-tool-future/build.gradle.kts index 9fff7b0..7e1dc53 100644 --- a/samples/kotlin-dsl/xjc-tool-future/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-tool-future/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-2_1-legacy/build.gradle.kts b/samples/kotlin-dsl/xjc-version-2_1-legacy/build.gradle.kts index b8e2063..b031ae3 100644 --- a/samples/kotlin-dsl/xjc-version-2_1-legacy/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-2_1-legacy/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-2_2/build.gradle.kts b/samples/kotlin-dsl/xjc-version-2_2/build.gradle.kts index 80abc3c..5577551 100644 --- a/samples/kotlin-dsl/xjc-version-2_2/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-2_2/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-2_3/build.gradle.kts b/samples/kotlin-dsl/xjc-version-2_3/build.gradle.kts index bc8e3e7..494fb35 100644 --- a/samples/kotlin-dsl/xjc-version-2_3/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-2_3/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-2_4/build.gradle.kts b/samples/kotlin-dsl/xjc-version-2_4/build.gradle.kts index 0498a6c..c894fe4 100644 --- a/samples/kotlin-dsl/xjc-version-2_4/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-2_4/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-3_0-target-2_3/build.gradle.kts b/samples/kotlin-dsl/xjc-version-3_0-target-2_3/build.gradle.kts index aecd2fd..c253b69 100644 --- a/samples/kotlin-dsl/xjc-version-3_0-target-2_3/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-3_0-target-2_3/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-3_0/build.gradle.kts b/samples/kotlin-dsl/xjc-version-3_0/build.gradle.kts index c8ff9f8..0aea490 100644 --- a/samples/kotlin-dsl/xjc-version-3_0/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-3_0/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-4_0/build.gradle.kts b/samples/kotlin-dsl/xjc-version-4_0/build.gradle.kts index 57596ed..0efe80a 100644 --- a/samples/kotlin-dsl/xjc-version-4_0/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-4_0/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-default/build.gradle.kts b/samples/kotlin-dsl/xjc-version-default/build.gradle.kts index 5034fe5..52901e3 100644 --- a/samples/kotlin-dsl/xjc-version-default/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-default/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-ext-basics-annox/build.gradle.kts b/samples/kotlin-dsl/xjc-version-ext-basics-annox/build.gradle.kts index 2cd5fdd..6674ae4 100644 --- a/samples/kotlin-dsl/xjc-version-ext-basics-annox/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-ext-basics-annox/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-ext-mark-generated/build.gradle.kts b/samples/kotlin-dsl/xjc-version-ext-mark-generated/build.gradle.kts index 4019d7d..a01f31d 100644 --- a/samples/kotlin-dsl/xjc-version-ext-mark-generated/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-ext-mark-generated/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/samples/kotlin-dsl/xjc-version-extensions/build.gradle.kts b/samples/kotlin-dsl/xjc-version-extensions/build.gradle.kts index ff92bcd..d404e0b 100644 --- a/samples/kotlin-dsl/xjc-version-extensions/build.gradle.kts +++ b/samples/kotlin-dsl/xjc-version-extensions/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("org.unbroken-dome.xjc") version "2.1.0-SNAPSHOT" + id("org.unbroken-dome.xjc") version "2.2.0-SNAPSHOT" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 6ec7f51..d618ab2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -11,7 +11,39 @@ pluginManagement { if (requested.id.id == "org.unbroken-dome.test-sets") { useVersion(testSetsVersion) } + if (requested.id.id == "org.darrylmiles.repack.org.unbroken-dome.test-sets") { + useVersion(testSetsVersion) + } + } + + repositories { + gradlePluginPortal() + maven { + url = uri("https://maven.pkg.github.com/dlmiles/gradle-testsets-plugin") + content { + // this repository only contains artifacts for specific groups + includeGroup("org.darrylmiles.repack.org.unbroken-dome.test-sets") + includeGroup("org.darrylmiles.repack.org.unbroken-dome") + } + + val GITHUB_USERNAME = System.getenv("GITHUB_USERNAME") ?: System.getenv("GITHUB_ACTOR") ?: "" + val GITHUB_TOKEN = System.getenv("GITHUB_TOKEN") ?: System.getenv("GH_TOKEN") ?: "" + if(GITHUB_USERNAME.isEmpty()) { logger.warn("\$GITHUB_USERNAME not set") } + if(GITHUB_TOKEN.isEmpty()) { logger.warn("\$GITHUB_TOKEN not set") } + // Any valid GH credentials are necessary to download dependencies from GitHubPackages + credentials { + username = GITHUB_USERNAME + password = GITHUB_TOKEN + } + } + mavenCentral() } } rootProject.name = "gradle-xjc-plugin" + +if(System.getProperty("excludeDocsTasks") == null) { + include(":docs") +} else { + logger.warn("systemProperty \"excludeDocsTasks\" is present, causing project :docs exclusion") +} diff --git a/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/WsdlIntegrationTest.kt b/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/WsdlIntegrationTest.kt new file mode 100644 index 0000000..8e13cee --- /dev/null +++ b/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/WsdlIntegrationTest.kt @@ -0,0 +1,43 @@ +package org.unbrokendome.gradle.plugins.xjc + +import assertk.assertThat +import org.gradle.testkit.runner.GradleRunner +import org.junit.platform.commons.annotation.Testable +import org.unbrokendome.gradle.plugins.xjc.samples.TestEachDslFlavor +import org.unbrokendome.gradle.plugins.xjc.samples.UseSampleProject +import org.unbrokendome.gradle.plugins.xjc.testutil.GradleProjectDir +import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.containsEntries +import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.resolve +import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.withJarFile +import java.io.File + + +@UseSampleProject("wsdl") +class WsdlIntegrationTest : AbstractBasicIntegrationTest() { + + @TestEachDslFlavor + @Testable + fun test(runner: GradleRunner, @GradleProjectDir projectDir: File) { + val projectName = "wsdl" + + super.test(runner, projectDir, projectName) + + assertThat(projectDir, "projectDir") + .resolve("build/libs/$projectName.jar") + .withJarFile { + containsEntries( + "org/unbroken_dome/gradle_xjc_plugin/samples/books/BookType.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/BooksType.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/ObjectFactory.class", + + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/common/BookId.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/common/ObjectFactory.class", + + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/lookup/ObjectFactory.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/lookup/SearchRequest.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/lookup/SearchResult.class", + "org/unbroken_dome/gradle_xjc_plugin/samples/books/alt/lookup/SearchResultItem.class" + ) + } + } +} diff --git a/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/BuildResult.kt b/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/BuildResult.kt index ec4b890..38024cd 100644 --- a/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/BuildResult.kt +++ b/src/integrationTest/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/BuildResult.kt @@ -13,7 +13,7 @@ import org.gradle.testkit.runner.TaskOutcome fun Assert.task(taskPath: String) = transform(name = "task $taskPath") { actual -> actual.task(taskPath) - ?: expected("to include task '$taskPath', but was: ${show(actual.tasks.map { it.path })}") + ?: this.expected("to include task '$taskPath', but was: ${show(actual.tasks.map { it.path })}") } diff --git a/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPlugin.kt b/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPlugin.kt index 2e725c6..ba4ffa7 100644 --- a/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPlugin.kt +++ b/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPlugin.kt @@ -6,10 +6,12 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Dependency import org.gradle.api.internal.HasConvention import org.gradle.api.plugins.JavaBasePlugin +import org.gradle.api.provider.Provider import org.gradle.api.tasks.SourceSetContainer import org.gradle.util.GradleVersion import org.unbrokendome.gradle.plugins.xjc.internal.GRADLE_VERSION_6_1 import org.unbrokendome.gradle.plugins.xjc.internal.MIN_REQUIRED_GRADLE_VERSION +import java.io.File class XjcPlugin : Plugin { @@ -153,12 +155,21 @@ class XjcPlugin : Plugin { val xjcOutputDir = generateTask.flatMap { it.outputDirectory } + // Gradle 6.1 introduced new API and 8.x removed the setOutputDir(File) method, so we can use reflection if (GradleVersion.current() >= GRADLE_VERSION_6_1) { - xjcSourceSetConvention.xjcSchema.destinationDirectory.set(xjcOutputDir) + val destinationDirectory = reflectMethodAndInvoke(xjcSourceSetConvention.xjcSchema, + "getDestinationDirectory") + reflectMethodAndInvoke(destinationDirectory!!, + "set", arrayOf(Provider::class.java), arrayOf(xjcOutputDir)) + // The intention is to maintain compatibility with Gradle 5.6+ and 8.x + //xjcSourceSetConvention.xjcSchema.destinationDirectory.set(xjcOutputDir) sourceSet.java.srcDir(xjcOutputDir) } else { - xjcSourceSetConvention.xjcSchema.outputDir = - project.file(generateTask.flatMap { it.outputDirectory }) + reflectMethodAndInvoke(xjcSourceSetConvention.xjcSchema, + "setOutputDir", arrayOf(File::class.java), arrayOf(project.file(generateTask.flatMap { it.outputDirectory }))) + // The intention is to maintain compatibility with Gradle 5.6+ and 8.x + //xjcSourceSetConvention.xjcSchema.outputDir = + // project.file(generateTask.flatMap { it.outputDirectory }) sourceSet.java.srcDir(xjcOutputDir) } @@ -170,6 +181,13 @@ class XjcPlugin : Plugin { } + // Perform method invocation via reflection API (to maintain compile time compatability with older Gradle versions) + private fun reflectMethodAndInvoke(target: Any, methodName: String, methodParameters: Array> = emptyArray(), values: Array = emptyArray()): Any? { + val method = if(methodParameters.isNotEmpty()) target.javaClass.getMethod(methodName, *methodParameters) else target.javaClass.getMethod(methodName) + return if(values.isNotEmpty()) method.invoke(target, *values) else method.invoke(target) + } + + private fun Project.defaultXjcDependencies(xjcVersion: String): List = checkNotNull(DefaultXjcToolDependenciesByVersion[xjcVersion]) { "Invalid XJC version: \"$version\". Valid values are: ${DefaultXjcToolDependenciesByVersion.keys}" diff --git a/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/resolver/ReflectionHelper.kt b/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/resolver/ReflectionHelper.kt index d2423e0..56115c1 100644 --- a/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/resolver/ReflectionHelper.kt +++ b/src/main/kotlin/org/unbrokendome/gradle/plugins/xjc/resolver/ReflectionHelper.kt @@ -5,6 +5,7 @@ import java.io.IOException import java.io.InputStream import java.lang.reflect.InvocationTargetException import java.util.concurrent.ConcurrentLinkedQueue +import java.util.regex.Pattern class ReflectionHelper { @@ -67,7 +68,10 @@ class ReflectionHelper { } catch(e: Throwable) { // we catch this as the reflection approach is a best-effort and should not // cause a terminal failure due to an obscure JVM being different here - logger.warn("{}", "", e) + if(logger.isDebugEnabled) + logger.debug("{}", "", e) + else if(isJre8OrEarlier()) + logger.warn("{}: {}", e.javaClass.name, e.message) } return null } @@ -86,7 +90,10 @@ class ReflectionHelper { } catch(e: Throwable) { // we catch this as the reflection approach is a best-effort and should not // cause a terminal failure due to an obscure JVM being different here - logger.warn("{}", "", e) + if(logger.isDebugEnabled) + logger.debug("{}", "", e) + else if(isJre8OrEarlier()) + logger.warn("{}: {}", e.javaClass.name, e.message) } return null } @@ -105,10 +112,22 @@ class ReflectionHelper { } catch(e: Throwable) { // we catch this as the reflection approach is a best-effort and should not // cause a terminal failure due to an obscure JVM being different here - logger.warn("{}", "", e) + if(logger.isDebugEnabled) + logger.debug("{}", "", e) + else if(isJre8OrEarlier()) + logger.warn("{}: {}", e.javaClass.name, e.message) } return false } + + private fun isJre8OrEarlier(): Boolean { + val sysPropJavaVersion = System.getProperty("java.version") + val pattern = Pattern.compile("^\\s*(\\d+).*") + val versionMajor = pattern.matcher(sysPropJavaVersion).let { + if(it.matches()) Integer.valueOf(it.group(1)) else 0 + } + return versionMajor <= 8 + } } } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcGenerateTest.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcGenerateTest.kt index 0d414a4..02546cf 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcGenerateTest.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcGenerateTest.kt @@ -54,16 +54,16 @@ object XjcGenerateTest : Spek({ } assertThat(task, "task").all { - prop(XjcGenerate::targetVersion).hasValueEqualTo("XYZ") - prop(XjcGenerate::encoding).hasValueEqualTo("ISO-8859-1") - prop(XjcGenerate::docLocale).hasValueEqualTo(Locale.ITALIAN.toString()) - prop(XjcGenerate::strictCheck).isFalse() - prop(XjcGenerate::packageLevelAnnotations).isFalse() - prop(XjcGenerate::noFileHeader).isFalse() - prop(XjcGenerate::enableIntrospection).isTrue() - prop(XjcGenerate::contentForWildcard).isTrue() - prop(XjcGenerate::readOnly).isTrue() - prop(XjcGenerate::extension).isTrue() + this.prop(XjcGenerate::targetVersion).hasValueEqualTo("XYZ") + this.prop(XjcGenerate::encoding).hasValueEqualTo("ISO-8859-1") + this.prop(XjcGenerate::docLocale).hasValueEqualTo(Locale.ITALIAN.toString()) + this.prop(XjcGenerate::strictCheck).isFalse() + this.prop(XjcGenerate::packageLevelAnnotations).isFalse() + this.prop(XjcGenerate::noFileHeader).isFalse() + this.prop(XjcGenerate::enableIntrospection).isTrue() + this.prop(XjcGenerate::contentForWildcard).isTrue() + this.prop(XjcGenerate::readOnly).isTrue() + this.prop(XjcGenerate::extension).isTrue() } } @@ -104,9 +104,9 @@ object XjcGenerateTest : Spek({ it("should create an XjcGenerate task for each existing source set") { assertThat(project.tasks, name = "tasks").all { - containsItem("xjcGenerate") + this.containsItem("xjcGenerate") .isInstanceOf(XjcGenerate::class) - containsItem("xjcGenerateTest") + this.containsItem("xjcGenerateTest") .isInstanceOf(XjcGenerate::class) } } @@ -125,13 +125,13 @@ object XjcGenerateTest : Spek({ } assertThat(task, name = "task").all { - prop(XjcGenerate::source) + this.prop(XjcGenerate::source) .containsOnly(project.file("src/main/schema/schema.xsd")) - prop(XjcGenerate::bindingFiles) + this.prop(XjcGenerate::bindingFiles) .containsOnly(project.file("src/main/schema/binding.xjb")) - prop(XjcGenerate::urlSources) + this.prop(XjcGenerate::urlSources) .containsOnly(project.file("src/main/schema/externals.url")) - prop(XjcGenerate::catalogs) + this.prop(XjcGenerate::catalogs) .containsOnly(project.file("src/main/schema/catalog.cat")) } } @@ -148,9 +148,9 @@ object XjcGenerateTest : Spek({ ) assertThat(task, name = "task").all { - prop(XjcGenerate::pluginClasspath) + this.prop(XjcGenerate::pluginClasspath) .containsOnly(project.file("custom-jaxb-plugin-1.2.3.jar")) - prop(XjcGenerate::episodes) + this.prop(XjcGenerate::episodes) .containsOnly(project.file("custom-episode-1.2.3.jar")) } } @@ -162,7 +162,7 @@ object XjcGenerateTest : Spek({ val resolved = XjcGenerate.resolveArtifactsForMavenUri(catalogResolutionConfig) assertThat(task, name = "task").all { - prop(XjcGenerate::catalogSerializableResolvedArtifact) + this.prop(XjcGenerate::catalogSerializableResolvedArtifact) .hasValueEqualTo(resolved) } } @@ -178,9 +178,9 @@ object XjcGenerateTest : Spek({ xjcSourceSetConvention.xjcGenerateEpisode.set(true) assertThat(task, name = "task").all { - prop(XjcGenerate::targetPackage) + this.prop(XjcGenerate::targetPackage) .hasValueEqualTo("com.example") - prop(XjcGenerate::generateEpisode) + this.prop(XjcGenerate::generateEpisode) .hasValueEqualTo(true) } } @@ -211,9 +211,9 @@ object XjcGenerateTest : Spek({ val task = project.tasks.getByName("xjcGenerate") as XjcGenerate assertThat(task, name = "task").all { - prop(XjcGenerate::outputDirectory) + this.prop(XjcGenerate::outputDirectory) .dirValue().isEqualTo(project.file("build/generated/sources/xjc/java/main")) - prop(XjcGenerate::episodeOutputDirectory) + this.prop(XjcGenerate::episodeOutputDirectory) .dirValue().isEqualTo(project.file("build/generated/resources/xjc/main")) } } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPluginTest.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPluginTest.kt index 854d569..f8f9b5b 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPluginTest.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcPluginTest.kt @@ -9,15 +9,9 @@ import org.gradle.api.plugins.JavaPlugin import org.gradle.api.tasks.SourceSetContainer import org.spekframework.spek2.Spek import org.spekframework.spek2.style.specification.describe -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.containsItem -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.hasConvention -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.hasExtension -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.hasValueEqualTo import org.unbrokendome.gradle.plugins.xjc.spek.applyPlugin import org.unbrokendome.gradle.plugins.xjc.spek.setupGradleProject -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.extendsOnlyFrom -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.isFalse -import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.isTrue +import org.unbrokendome.gradle.plugins.xjc.testutil.assertions.* import org.unbrokendome.gradle.plugins.xjc.testutil.evaluate import org.unbrokendome.gradle.plugins.xjc.testutil.requiredExtension import org.unbrokendome.gradle.plugins.xjc.testutil.sourceSets @@ -48,17 +42,17 @@ object XjcPluginTest : Spek({ it("xjc DSL extension should apply defaults") { assertThat(project) .hasExtension().all { - prop(XjcExtension::xjcVersion).hasValueEqualTo(XjcExtension.DEFAULT_XJC_VERSION) - prop(XjcExtension::xjcVersionUnsupportedStrategy).hasValueEqualTo(XjcExtension.DEFAULT_XJC_VERSION_UNSUPPORTED_STRATEGY) - prop(XjcExtension::srcDirName).hasValueEqualTo(XjcExtension.DEFAULT_SRC_DIR_NAME) - prop(XjcExtension::encoding).hasValueEqualTo("UTF-8") - prop(XjcExtension::strictCheck).isTrue() - prop(XjcExtension::packageLevelAnnotations).isTrue() - prop(XjcExtension::noFileHeader).isTrue() - prop(XjcExtension::enableIntrospection).isFalse() - prop(XjcExtension::contentForWildcard).isFalse() - prop(XjcExtension::readOnly).isFalse() - prop(XjcExtension::extension).isFalse() + this.prop(XjcExtension::xjcVersion).hasValueEqualTo(XjcExtension.DEFAULT_XJC_VERSION) + this.prop(XjcExtension::xjcVersionUnsupportedStrategy).hasValueEqualTo(XjcExtension.DEFAULT_XJC_VERSION_UNSUPPORTED_STRATEGY) + this.prop(XjcExtension::srcDirName).hasValueEqualTo(XjcExtension.DEFAULT_SRC_DIR_NAME) + this.prop(XjcExtension::encoding).hasValueEqualTo("UTF-8") + this.prop(XjcExtension::strictCheck).isTrue() + this.prop(XjcExtension::packageLevelAnnotations).isTrue() + this.prop(XjcExtension::noFileHeader).isTrue() + this.prop(XjcExtension::enableIntrospection).isFalse() + this.prop(XjcExtension::contentForWildcard).isFalse() + this.prop(XjcExtension::readOnly).isFalse() + this.prop(XjcExtension::extension).isFalse() } } @@ -81,28 +75,28 @@ object XjcPluginTest : Spek({ assertThat(project) .hasExtension().all { - prop(XjcExtension::xjcVersion).hasValueEqualTo("3.0") - prop(XjcExtension::xjcVersionUnsupportedStrategy).hasValueEqualTo("default") - prop(XjcExtension::srcDirName).hasValueEqualTo("xjc") - prop(XjcExtension::targetVersion).hasValueEqualTo("2.2") - prop(XjcExtension::encoding).hasValueEqualTo("ISO-8859-1") - prop(XjcExtension::docLocale).hasValueEqualTo(Locale.ITALIAN.toString()) - prop(XjcExtension::strictCheck).isFalse() - prop(XjcExtension::packageLevelAnnotations).isFalse() - prop(XjcExtension::noFileHeader).isFalse() - prop(XjcExtension::enableIntrospection).isTrue() - prop(XjcExtension::contentForWildcard).isTrue() - prop(XjcExtension::readOnly).isTrue() - prop(XjcExtension::extension).isTrue() + this.prop(XjcExtension::xjcVersion).hasValueEqualTo("3.0") + this.prop(XjcExtension::xjcVersionUnsupportedStrategy).hasValueEqualTo("default") + this.prop(XjcExtension::srcDirName).hasValueEqualTo("xjc") + this.prop(XjcExtension::targetVersion).hasValueEqualTo("2.2") + this.prop(XjcExtension::encoding).hasValueEqualTo("ISO-8859-1") + this.prop(XjcExtension::docLocale).hasValueEqualTo(Locale.ITALIAN.toString()) + this.prop(XjcExtension::strictCheck).isFalse() + this.prop(XjcExtension::packageLevelAnnotations).isFalse() + this.prop(XjcExtension::noFileHeader).isFalse() + this.prop(XjcExtension::enableIntrospection).isTrue() + this.prop(XjcExtension::contentForWildcard).isTrue() + this.prop(XjcExtension::readOnly).isTrue() + this.prop(XjcExtension::extension).isTrue() } } it("should create global XJC configurations") { assertThat(project.configurations, "configurations").all { - containsItem("xjcTool") - containsItem("xjcClasspathGlobal") - containsItem("xjcCatalogResolutionGlobal") + this.containsItem("xjcTool") + this.containsItem("xjcClasspathGlobal") + this.containsItem("xjcCatalogResolutionGlobal") } } } @@ -119,9 +113,9 @@ object XjcPluginTest : Spek({ val sourceSets = project.extensions.getByType(SourceSetContainer::class.java) assertThat(sourceSets).all { - containsItem("main") + this.containsItem("main") .hasConvention() - containsItem("test") + this.containsItem("test") .hasConvention() } } @@ -136,17 +130,17 @@ object XjcPluginTest : Spek({ it("should create XJC configurations for each existing source set") { assertThat(project.configurations, name = "configurations").all { - containsItem("xjcClasspath") + this.containsItem("xjcClasspath") .extendsOnlyFrom("xjcClasspathGlobal") - containsItem("xjcEpisodes") - containsItem("xjcCatalogResolution").all { + this.containsItem("xjcEpisodes") + this.containsItem("xjcCatalogResolution").all { extendsOnlyFrom("xjcCatalogResolutionGlobal", "compileClasspath") } - containsItem("testXjcClasspath") + this.containsItem("testXjcClasspath") .extendsOnlyFrom("xjcClasspathGlobal") - containsItem("testXjcEpisodes") - containsItem("testXjcCatalogResolution").all { + this.containsItem("testXjcEpisodes") + this.containsItem("testXjcCatalogResolution").all { extendsOnlyFrom("xjcCatalogResolutionGlobal", "testCompileClasspath") } } @@ -156,7 +150,7 @@ object XjcPluginTest : Spek({ it("should create XJC configurations for each new source set") { project.sourceSets.create("foo") assertThat(project.configurations, name = "configurations").all { - containsItem("fooXjcClasspath") + this.containsItem("fooXjcClasspath") .extendsOnlyFrom("xjcClasspathGlobal") } } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcSourceSetConventionTest.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcSourceSetConventionTest.kt index 1f1ee6f..2f2c53a 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcSourceSetConventionTest.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/XjcSourceSetConventionTest.kt @@ -40,13 +40,13 @@ object XjcSourceSetConventionTest : Spek({ it("should return the correct task and configuration names") { assertThat(xjcSourceSetConvention).all { - prop(XjcSourceSetConvention::xjcGenerateTaskName) + this.prop(XjcSourceSetConvention::xjcGenerateTaskName) .isEqualTo("xjcGenerate") - prop(XjcSourceSetConvention::xjcClasspathConfigurationName) + this.prop(XjcSourceSetConvention::xjcClasspathConfigurationName) .isEqualTo("xjcClasspath") - prop(XjcSourceSetConvention::xjcEpisodesConfigurationName) + this.prop(XjcSourceSetConvention::xjcEpisodesConfigurationName) .isEqualTo("xjcEpisodes") - prop(XjcSourceSetConvention::xjcCatalogResolutionConfigurationName) + this.prop(XjcSourceSetConvention::xjcCatalogResolutionConfigurationName) .isEqualTo("xjcCatalogResolution") } } @@ -66,13 +66,13 @@ object XjcSourceSetConventionTest : Spek({ it("should return the correct task and configuration names") { assertThat(xjcSourceSetConvention).all { - prop(XjcSourceSetConvention::xjcGenerateTaskName) + this.prop(XjcSourceSetConvention::xjcGenerateTaskName) .isEqualTo("xjcGenerateCustom") - prop(XjcSourceSetConvention::xjcClasspathConfigurationName) + this.prop(XjcSourceSetConvention::xjcClasspathConfigurationName) .isEqualTo("customXjcClasspath") - prop(XjcSourceSetConvention::xjcEpisodesConfigurationName) + this.prop(XjcSourceSetConvention::xjcEpisodesConfigurationName) .isEqualTo("customXjcEpisodes") - prop(XjcSourceSetConvention::xjcCatalogResolutionConfigurationName) + this.prop(XjcSourceSetConvention::xjcCatalogResolutionConfigurationName) .isEqualTo("customXjcCatalogResolution") } } @@ -80,13 +80,13 @@ object XjcSourceSetConventionTest : Spek({ it("should set default include filters") { assertThat(xjcSourceSetConvention).all { - prop("xjcSchema") { it.xjcSchema } + this.prop("xjcSchema") { it.xjcSchema } .prop("includes") { it.includes } .containsOnly("**/*.xsd") - prop("xjcBinding") { it.xjcBinding } + this.prop("xjcBinding") { it.xjcBinding } .prop("includes") { it.includes } .containsOnly("**/*.xjb") - prop("xjcUrl") { it.xjcUrl } + this.prop("xjcUrl") { it.xjcUrl } .prop("includes") { it.includes } .containsOnly("**/*.url") } @@ -98,13 +98,13 @@ object XjcSourceSetConventionTest : Spek({ xjc.srcDirName.set("xjc") assertThat(xjcSourceSetConvention).all { - prop("xjcSchema") { it.xjcSchema } + this.prop("xjcSchema") { it.xjcSchema } .prop("srcDirs") { it.srcDirs } .containsOnly(project.file("src/custom/xjc")) - prop("xjcBinding") { it.xjcBinding } + this.prop("xjcBinding") { it.xjcBinding } .prop("srcDirs") { it.srcDirs } .containsOnly(project.file("src/custom/xjc")) - prop("xjcUrl") { it.xjcUrl } + this.prop("xjcUrl") { it.xjcUrl } .prop("srcDirs") { it.srcDirs } .containsOnly(project.file("src/custom/xjc")) } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Configuration.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Configuration.kt index 91d3149..9537a48 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Configuration.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Configuration.kt @@ -10,7 +10,7 @@ import org.gradle.api.artifacts.Configuration fun Assert.extendsFrom(other: String) = given { actual -> if (other in actual.extendsFrom.map { it.name }) return - expected( + this.expected( "to extend from configuration \"$other\", but extends from: ${show(actual.extendsFrom)}", actual = actual.extendsFrom, expected = other ) @@ -21,7 +21,7 @@ fun Assert.extendsOnlyFrom(vararg others: String) = given { actua val extendsFromNames = actual.extendsFrom.map { it.name }.toSet() if (others.toSet() == extendsFromNames) return - expected( + this.expected( "to extend only from configuration(s) ${show(others)}, but extends from: ${show(extendsFromNames)}", actual = extendsFromNames, expected = others ) diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Container.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Container.kt index 60f4b87..810f33d 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Container.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Container.kt @@ -8,13 +8,13 @@ import org.gradle.api.NamedDomainObjectCollection fun Assert>.containsItem(name: String) = transform(name = "${this.name}[\"$name\"]") { actual -> - actual.findByName(name) ?: expected("to contain an item named \"$name\"", actual = actual.names) + actual.findByName(name) ?: this.expected("to contain an item named \"$name\"", actual = actual.names) } fun Assert>.doesNotContainItem(name: String) = given { actual -> val item = actual.findByName(name) if (item != null) { - expected("to contain no item named \"$name\", but did contain: ${show(item)}", actual = actual.names) + this.expected("to contain no item named \"$name\", but did contain: ${show(item)}", actual = actual.names) } } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Extension.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Extension.kt index fa146db..4a5c0e8 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Extension.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Extension.kt @@ -11,32 +11,32 @@ import kotlin.reflect.KClass fun Assert.hasExtensionNamed(name: String): Assert = transform("extension \"$name\"") { actual -> if (actual !is ExtensionAware) { - expected("to be ExtensionAware") + this.expected("to be ExtensionAware") } actual.extensions.findByName(name) - ?: expected("to have an extension named \"$name\"") + ?: this.expected("to have an extension named \"$name\"") } inline fun Assert.hasExtension(name: String? = null): Assert = transform("extension " + (name?.let { "\"$it\"" } ?: show(E::class))) { actual -> if (actual !is ExtensionAware) { - expected("to be ExtensionAware") + this.expected("to be ExtensionAware") } val extensions = actual.extensions if (name != null) { val extension = extensions.findByName(name) - ?: expected("to have an extension named \"$name\" of type ${show(E::class)}") + ?: this.expected("to have an extension named \"$name\" of type ${show(E::class)}") (extension as? E) - ?: expected( + ?: this.expected( "to have an extension named \"$name\" of type ${show(E::class)}, " + "but actual type was: ${show(extension.javaClass)}" ) } else { extensions.findByType(E::class.java) - ?: expected("to have an extension of type ${show(E::class)}") + ?: this.expected("to have an extension of type ${show(E::class)}") } } @@ -44,12 +44,12 @@ inline fun Assert.hasExtension(name: String? = null): Ass fun Assert.hasConvention(type: KClass): Assert = transform("convention ${show(type)}") { actual -> if (actual !is HasConvention) { - expected("to support conventions") + this.expected("to support conventions") } actual.convention.findPlugin(type.java) - ?: expected("to have a convention plugin of type ${show(type)}") + ?: this.expected("to have a convention plugin of type ${show(type)}") } inline fun Assert.hasConvention(): Assert = - hasConvention(C::class) + this.hasConvention(C::class) diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleProject.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleProject.kt index 8a2fa0d..21fe4e5 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleProject.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleProject.kt @@ -11,7 +11,7 @@ import kotlin.reflect.KClass private fun Assert.containsTaskInternal(taskName: String) = transform("task \"$taskName\"") { actual -> actual.tasks.findByName(taskName) - ?: expected("to contain a task named \"$taskName\"") + ?: this.expected("to contain a task named \"$taskName\"") } @@ -21,4 +21,4 @@ fun Assert.containsTask(taskName: String, taskType: KClass Assert.containsTask(taskName: String) = - containsTask(taskName, T::class) + this.containsTask(taskName, T::class) diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleTask.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleTask.kt index 6965bc3..9bd20f7 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleTask.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/GradleTask.kt @@ -18,7 +18,7 @@ val Assert.taskDependencies fun Assert.hasTaskDependency(taskName: String) = given { actual -> val dependencies = actual.taskDependencies.getDependencies(actual) if (dependencies.none { it.name == taskName }) { - expected("to have a dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") + this.expected("to have a dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") } } @@ -26,7 +26,7 @@ fun Assert.hasTaskDependency(taskName: String) = given { actual -> fun Assert.hasOnlyTaskDependency(taskName: String) = given { actual -> val dependencies = actual.taskDependencies.getDependencies(actual) if (dependencies.size != 1 || dependencies.firstOrNull()?.name != taskName) { - expected("to have a single dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") + this.expected("to have a single dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") } } @@ -49,20 +49,20 @@ fun Assert.hasTaskDependencies(vararg taskNames: String, exactly: Boolean fun Assert.doesNotHaveTaskDependency(taskName: String) = given { actual -> val dependencies = actual.taskDependencies.getDependencies(actual) if (dependencies.any { it.name == taskName }) { - expected("to have no dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") + this.expected("to have no dependency on task \"${taskName}\", but dependencies were: ${show(dependencies)}") } } fun Assert.isSkipped() = given { actual -> if (!actual.isSkipped()) { - expected("to be skipped, but was not skipped") + this.expected("to be skipped, but was not skipped") } } fun Assert.isNotSkipped() = given { actual -> if (actual.isSkipped()) { - expected("not to be skipped, but was skipped") + this.expected("not to be skipped, but was skipped") } } diff --git a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Provider.kt b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Provider.kt index c27a072..09614ff 100644 --- a/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Provider.kt +++ b/src/test/kotlin/org/unbrokendome/gradle/plugins/xjc/testutil/assertions/Provider.kt @@ -14,31 +14,31 @@ import org.gradle.api.provider.Provider fun Assert>.isPresent() = transform { actual -> - actual.orNull ?: expected("${show(actual)} to have a value", actual = actual) + actual.orNull ?: this.expected("${show(actual)} to have a value", actual = actual) } fun Assert>.isTrue() = - isPresent().isTrue() + this.isPresent().isTrue() fun Assert>.isFalse() = - isPresent().isFalse() + this.isPresent().isFalse() fun Assert>.hasValueEqualTo(value: T) = - isPresent().isEqualTo(value) + this.isPresent().isEqualTo(value) fun Assert>.fileValue() = - isPresent() + this.isPresent() .prop("file") { it.asFile } fun Assert>.dirValue() = - isPresent() + this.isPresent() .prop("directory") { it.asFile } fun Assert>>.contains(key: K, value: V) = - isPresent().contains(key, value) + this.isPresent().contains(key, value)