diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 807ab3ee3500..0b5c0029e05e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,7 +16,7 @@ ######################### /hapi/ @hashgraph/hedera-services @hashgraph/hedera-smart-contracts-core @hashgraph/platform-hashgraph @hashgraph/platform-data @hashgraph/platform-base @hashgraph/platform-architects -/hapi/hedera-protobufs/services @hashgraph/hedera-services @hashgraph/hedera-smart-contracts-core @jsync-swirlds +/hapi/hedera-protobufs/services @hashgraph/hedera-services @hashgraph/hedera-smart-contracts-core @jsync-swirlds @hashgraph/mirror-node ######################### diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3aa14155bf85..9bca0086f871 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,7 @@ version: 2 updates: - package-ecosystem: "gradle" - directory: "/hedera-dependency-versions" - schedule: - interval: "daily" - open-pull-requests-limit: 10 - - package-ecosystem: "gradle" - directory: "/gradle/plugins" + directory: "/hiero-dependency-versions" schedule: interval: "daily" open-pull-requests-limit: 10 diff --git a/.github/workflows/config/node-release.yaml b/.github/workflows/config/node-release.yaml index fd24a53f35db..6be706bec502 100644 --- a/.github/workflows/config/node-release.yaml +++ b/.github/workflows/config/node-release.yaml @@ -3,9 +3,9 @@ release: execution: time: "20:00:00" schedule: - - on: "2024-11-22" - name: release/0.57 + - on: "2024-12-20" + name: release/0.58 initial-tag: create: true - name: v0.57.0-alpha.0 + name: v0.58.0-alpha.0 diff --git a/.github/workflows/node-flow-deploy-release-artifact.yaml b/.github/workflows/node-flow-deploy-release-artifact.yaml index 836f754e54f0..50e13ca7da0d 100644 --- a/.github/workflows/node-flow-deploy-release-artifact.yaml +++ b/.github/workflows/node-flow-deploy-release-artifact.yaml @@ -201,7 +201,7 @@ jobs: - name: Checkout Hedera Protobufs Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - token: ${{ secrets.GH_ACCESS_TOKEN }} + token: ${{ secrets.PROTOBUFS_GH_ACCESS_TOKEN }} fetch-depth: '0' repository: hashgraph/hedera-protobufs path: hedera-protobufs @@ -220,8 +220,8 @@ jobs: id: gpg_import uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0 with: - gpg_private_key: ${{ secrets.SVCS_GPG_KEY_CONTENTS }} - passphrase: ${{ secrets.SVCS_GPG_KEY_PASSPHRASE }} + gpg_private_key: ${{ secrets.PROTOBUFS_GPG_KEY_CONTENTS }} + passphrase: ${{ secrets.PROTOBUFS_GPG_KEY_PASSPHRASE }} git_user_signingkey: true git_commit_gpgsign: true git_tag_gpgsign: true @@ -231,7 +231,7 @@ jobs: with: cwd: 'hedera-protobufs' author_name: swirlds-eng-automation - author_email: ${{ secrets.SVCS_GIT_USER_EMAIL }} + author_email: ${{ secrets.PROTOBUFS_GPG_USER_EMAIL }} commit: --signoff message: "ci: Copied recent protobuf changes from hedera-services" new_branch: "update-recent-protobuf-changes-${{ github.run_number }}" diff --git a/.github/workflows/node-zxc-build-release-artifact.yaml b/.github/workflows/node-zxc-build-release-artifact.yaml index 797181f6df28..bd079e5fc89c 100644 --- a/.github/workflows/node-zxc-build-release-artifact.yaml +++ b/.github/workflows/node-zxc-build-release-artifact.yaml @@ -1,5 +1,5 @@ ## -# Copyright (C) 2022-2024 Hedera Hashgraph, LLC +# Copyright (C) 2024 Hedera Hashgraph, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -420,7 +420,7 @@ jobs: uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - name: Setup Docker Buildx Support - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 with: version: v0.16.2 driver-opts: network=host @@ -575,7 +575,7 @@ jobs: service_account: "swirlds-automation@hedera-registry.iam.gserviceaccount.com" - name: Setup JFrog CLI - uses: jfrog/setup-jfrog-cli@96153976e4e81b3701e9cc0a5b9597e80614af81 # v4.5.1 + uses: jfrog/setup-jfrog-cli@dff217c085c17666e8849ebdbf29c8fe5e3995e6 # v4.5.2 env: JF_URL: ${{ secrets.jf-url }} JF_ACCESS_TOKEN: ${{ secrets.jf-access-token }} @@ -658,7 +658,7 @@ jobs: fi - name: Upload Manifests - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ (steps.gcp.outcome == 'success' || steps.jfrog.outcome == 'success') && !cancelled() && always() }} with: name: Production Image Manifests diff --git a/.github/workflows/node-zxc-compile-application-code.yaml b/.github/workflows/node-zxc-compile-application-code.yaml index 055047eb0d90..258bac714ab0 100644 --- a/.github/workflows/node-zxc-compile-application-code.yaml +++ b/.github/workflows/node-zxc-compile-application-code.yaml @@ -219,7 +219,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload Unit Test Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: Unit Test Report @@ -241,7 +241,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload Unit Test (Timing Sensitive) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-timing-sensitive-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: Unit Test Report (Timing Sensitive) @@ -263,7 +263,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload Unit Test (Time Consuming) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-time-consuming-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: Unit Test Report (Time Consuming) @@ -285,7 +285,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload Hammer Test Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hammer-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: Hammer Test Report @@ -311,7 +311,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Misc) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-misc && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Misc) Reports @@ -319,7 +319,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Misc) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-misc && inputs.enable-network-log-capture && steps.gradle-hapi-misc.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Misc) Network Logs @@ -345,7 +345,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Crypto) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-crypto && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Crypto) Report @@ -353,7 +353,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (crypto) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-crypto && inputs.enable-network-log-capture && steps.gradle-hapi-crypto.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Crypto) Network Logs @@ -379,7 +379,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Token) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-token && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Token) Report @@ -387,7 +387,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Token) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-token && inputs.enable-network-log-capture && steps.gradle-hapi-token.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Token) Network Logs @@ -413,7 +413,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Smart Contract) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-smart-contract && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Smart Contract) Report @@ -421,7 +421,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Smart Contract) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-smart-contract && inputs.enable-network-log-capture && steps.gradle-hapi-smart-contract.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Smart Contract) Network Logs @@ -447,7 +447,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Time Consuming) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-time-consuming && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Time Consuming) Report @@ -455,7 +455,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Time Consuming) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-time-consuming && inputs.enable-network-log-capture && steps.gradle-hapi-time-consuming.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Time Consuming) Network Logs @@ -481,7 +481,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Restart) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-restart && steps.gradle-build.conclusion == 'success' && !cancelled() }} with: name: HAPI Test (Restart) Report @@ -489,7 +489,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Restart) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-restart && inputs.enable-network-log-capture && steps.gradle-hapi-restart.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Restart) Network Logs @@ -516,7 +516,7 @@ jobs: comment_mode: errors # only comment if we could not find or parse the JUnit XML files - name: Upload HAPI Test (Node Death Reconnect) Report Artifacts - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-nd-reconnect && steps.gradle-build.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Node Death Reconnect) Report @@ -524,7 +524,7 @@ jobs: retention-days: 7 - name: Upload HAPI Test (Node Death Reconnect) Network Logs - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-hapi-tests-nd-reconnect && inputs.enable-network-log-capture && steps.gradle-hapi-nd-reconnect.conclusion == 'failure' && !cancelled() }} with: name: HAPI Test (Node Death Reconnect) Network Logs @@ -547,7 +547,7 @@ jobs: run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r gradle/aggregation/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml - name: Upload Test Reports - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ inputs.enable-unit-tests && !cancelled() }} with: name: Test Reports diff --git a/.github/workflows/node-zxcron-release-fsts-regression.yaml b/.github/workflows/node-zxcron-release-fsts-regression.yaml index 5b062f275bf1..439de9d9064b 100644 --- a/.github/workflows/node-zxcron-release-fsts-regression.yaml +++ b/.github/workflows/node-zxcron-release-fsts-regression.yaml @@ -57,7 +57,7 @@ jobs: major="${BASH_REMATCH[1]}" minor="${BASH_REMATCH[2]}" - if [[ "${major}" -eq 0 && "${minor}" -lt 55 ]]; then + if [[ "${major}" -eq 0 && "${minor}" -lt 57 ]]; then continue fi diff --git a/.github/workflows/platform-zxcron-release-jrs-regression.yaml b/.github/workflows/platform-zxcron-release-jrs-regression.yaml index a46717c63c9d..7d5a29343336 100644 --- a/.github/workflows/platform-zxcron-release-jrs-regression.yaml +++ b/.github/workflows/platform-zxcron-release-jrs-regression.yaml @@ -59,7 +59,7 @@ jobs: major="${BASH_REMATCH[1]}" minor="${BASH_REMATCH[2]}" - if [[ "${major}" -eq 0 && "${minor}" -lt 55 ]]; then + if [[ "${major}" -eq 0 && "${minor}" -lt 57 ]]; then continue fi diff --git a/.github/workflows/zxc-publish-production-image.yaml b/.github/workflows/zxc-publish-production-image.yaml index 86c105218075..c9e24795a909 100644 --- a/.github/workflows/zxc-publish-production-image.yaml +++ b/.github/workflows/zxc-publish-production-image.yaml @@ -1,19 +1,4 @@ -## -# Copyright (C) 2024 Hedera Hashgraph, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -## - +# SPDX-License-Identifier: Apache-2.0 name: "ZXC: Publish Production Image" on: workflow_call: @@ -112,7 +97,7 @@ jobs: service_account: "swirlds-automation@hedera-registry.iam.gserviceaccount.com" - name: Setup JFrog CLI - uses: jfrog/setup-jfrog-cli@96153976e4e81b3701e9cc0a5b9597e80614af81 # v4.5.1 + uses: jfrog/setup-jfrog-cli@dff217c085c17666e8849ebdbf29c8fe5e3995e6 # v4.5.2 if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'jfrog' && !cancelled() && !failure() }} env: JF_URL: ${{ secrets.jf-url }} @@ -155,7 +140,7 @@ jobs: uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - name: Setup Docker Buildx Support - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 with: version: v0.16.2 driver-opts: network=host diff --git a/.github/workflows/zxc-verify-docker-build-determinism.yaml b/.github/workflows/zxc-verify-docker-build-determinism.yaml index 95d1a461de0c..5c4c1d0876a1 100644 --- a/.github/workflows/zxc-verify-docker-build-determinism.yaml +++ b/.github/workflows/zxc-verify-docker-build-determinism.yaml @@ -197,7 +197,7 @@ jobs: if: ${{ steps.baseline.outputs.exists == 'false' && !failure() && !cancelled() }} - name: Setup Docker Buildx Support - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 if: ${{ steps.baseline.outputs.exists == 'false' && !failure() && !cancelled() }} with: version: v0.16.2 @@ -426,7 +426,7 @@ jobs: uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - name: Setup Docker Buildx Support - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 with: version: v0.16.2 driver-opts: network=host @@ -499,7 +499,7 @@ jobs: fi - name: Publish Manifests - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ steps.regen-manifest.conclusion == 'success' && failure() && !cancelled() }} with: name: Docker Manifests [${{ join(matrix.os, ', ') }}] diff --git a/.github/workflows/zxc-verify-gradle-build-determinism.yaml b/.github/workflows/zxc-verify-gradle-build-determinism.yaml index e30e60bd93a0..76f00b1f7972 100644 --- a/.github/workflows/zxc-verify-gradle-build-determinism.yaml +++ b/.github/workflows/zxc-verify-gradle-build-determinism.yaml @@ -247,7 +247,7 @@ jobs: fi - name: Publish Manifests - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: ${{ steps.regen-manifest.conclusion == 'success' && failure() && !cancelled() }} with: name: Gradle Manifests [${{ join(matrix.os, ', ') }}] diff --git a/.github/workflows/zxcron-extended-test-suite.yaml b/.github/workflows/zxcron-extended-test-suite.yaml index 0f3e1de0b793..53b467047dfa 100644 --- a/.github/workflows/zxcron-extended-test-suite.yaml +++ b/.github/workflows/zxcron-extended-test-suite.yaml @@ -281,7 +281,7 @@ jobs: done - name: Upload log as artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: path: run.log diff --git a/.github/workflows/zxf-collect-workflow-logs.yaml b/.github/workflows/zxf-collect-workflow-logs.yaml index 812bf49d3305..14d12a8e4a35 100644 --- a/.github/workflows/zxf-collect-workflow-logs.yaml +++ b/.github/workflows/zxf-collect-workflow-logs.yaml @@ -60,7 +60,7 @@ jobs: - name: Upload log as artifact id: upload-log - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: path: workflow-run.log diff --git a/example-apps/swirlds-platform-base-example/build.gradle.kts b/example-apps/swirlds-platform-base-example/build.gradle.kts index 7f3e5f02a809..d7db028f8a6f 100644 --- a/example-apps/swirlds-platform-base-example/build.gradle.kts +++ b/example-apps/swirlds-platform-base-example/build.gradle.kts @@ -1,23 +1,5 @@ -/* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("application") - id("com.hedera.gradle.platform") -} +// SPDX-License-Identifier: Apache-2.0 +plugins { id("org.hiero.gradle.module.application") } mainModuleInfo { annotationProcessor("com.swirlds.config.processor") @@ -25,4 +7,4 @@ mainModuleInfo { runtimeOnly("com.swirlds.config.impl") } -application.mainClass.set("com.swirlds.platform.base.example.Application") +application.mainClass = "com.swirlds.platform.base.example.Application" diff --git a/gradle/aggregation/build.gradle.kts b/gradle/aggregation/build.gradle.kts index c553de85fb04..e03445d5ff03 100644 --- a/gradle/aggregation/build.gradle.kts +++ b/gradle/aggregation/build.gradle.kts @@ -1,20 +1,10 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.hedera.gradle.reports") } +// SPDX-License-Identifier: Apache-2.0 +plugins { + id("org.hiero.gradle.base.lifecycle") + id("org.hiero.gradle.report.code-coverage") + id("org.hiero.gradle.check.spotless") + id("org.hiero.gradle.check.spotless-kotlin") +} dependencies { implementation(project(":app")) @@ -29,9 +19,26 @@ dependencies { implementation(project(":test-clients")) } -tasks.named("testCodeCoverageReport") { - val exclusions = listOf("test-clients", "testFixtures", "statedumpers", "example-apps") - classDirectories.setFrom( - classDirectories.files.filterNot { file -> exclusions.any { file.path.contains(it) } } - ) +tasks.testCodeCoverageReport { + // Redo the setup done in 'JacocoReportAggregationPlugin', but gather the class files in the + // file tree and filter out selected classes by path. + val filteredClassFiles = + configurations.aggregateCodeCoverageReportResults + .get() + .incoming + .artifactView { + componentFilter { id -> id is ProjectComponentIdentifier } + attributes.attribute( + LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, + objects.named(LibraryElements.CLASSES) + ) + } + .files + .asFileTree + .filter { file -> + listOf("test-clients", "testFixtures", "statedumpers", "example-apps").none { + file.path.contains(it) + } + } + classDirectories.setFrom(filteredClassFiles) } diff --git a/gradle/development-branch.txt b/gradle/development-branch.txt new file mode 100644 index 000000000000..ce57f6456319 --- /dev/null +++ b/gradle/development-branch.txt @@ -0,0 +1 @@ +develop \ No newline at end of file diff --git a/gradle/license-header.txt b/gradle/license-header.txt new file mode 100644 index 000000000000..2e707c37f3d4 --- /dev/null +++ b/gradle/license-header.txt @@ -0,0 +1,13 @@ +Copyright (C) $YEAR Hedera Hashgraph, LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts deleted file mode 100644 index 70d4000e5813..000000000000 --- a/gradle/plugins/build.gradle.kts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - // Support convention plugins written in Kotlin. Convention plugins are build scripts in - // 'src/main' that automatically become available as plugins in the main build. - `kotlin-dsl` -} - -repositories { gradlePluginPortal() } - -dependencies { - implementation("com.adarshr:gradle-test-logger-plugin:4.0.0") - implementation("com.autonomousapps:dependency-analysis-gradle-plugin:2.5.0") - implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") - implementation("com.github.johnrengelman:shadow:8.1.1") - implementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4") - implementation("com.gradle:develocity-gradle-plugin:3.18") - implementation( - "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.2" - ) - implementation("io.freefair.gradle:maven-plugin:8.11") // for POM validation - implementation("io.github.gradle-nexus:publish-plugin:1.3.0") - implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2") - implementation("net.swiftzer.semver:semver:1.3.0") - implementation("org.gradlex:extra-java-module-info:1.9") - implementation("org.gradlex:jvm-dependency-conflict-resolution:2.1.2") - implementation("org.gradlex:java-module-dependencies:1.8") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.application.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.application.gradle.kts deleted file mode 100644 index b821df2958c4..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.application.gradle.kts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("application") - id("com.hedera.gradle.java") -} - -// Find the central SDK deployment dir by searching up the folder hierarchy -fun sdkDir(dir: Directory): Directory = - if (dir.dir("sdk").asFile.exists()) dir.dir("sdk") else sdkDir(dir.dir("..")) - -// Copy dependencies into `sdk/data/lib` -val copyLib = - tasks.register("copyLib") { - from(project.configurations.runtimeClasspath) - into(sdkDir(layout.projectDirectory).dir("data/lib")) - } - -// Copy built jar into `data/apps` and rename -val copyApp = - tasks.register("copyApp") { - inputs.property("projectName", project.name) - - from(tasks.jar) - into(sdkDir(layout.projectDirectory).dir("data/apps")) - rename { "${inputs.properties["projectName"]}.jar" } - } - -tasks.assemble { - dependsOn(copyLib) - dependsOn(copyApp) -} - -// The 'application' plugin activates the following tasks as part of 'assemble'. -// As we do not use these results right now, disable them: -tasks.startScripts { enabled = false } - -tasks.distTar { enabled = false } - -tasks.distZip { enabled = false } - -tasks.jar { manifest { attributes("Main-Class" to application.mainClass) } } diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.benchmark.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.benchmark.gradle.kts deleted file mode 100644 index 22388926226e..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.benchmark.gradle.kts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import me.champeau.jmh.JMHTask - -plugins { id("me.champeau.jmh") } - -jmh { - jmhVersion = "1.37" - includeTests = false - // Filter JMH tests from command line via -PjmhTests=... - val commandLineIncludes = providers.gradleProperty("jmhTests") - if (commandLineIncludes.isPresent) { - includes.add(commandLineIncludes.get()) - } -} - -dependencies { - // Required for the JMH IDEA plugin: - // https://plugins.jetbrains.com/plugin/7529-jmh-java-microbenchmark-harness - jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:${jmh.jmhVersion.get()}") -} - -tasks.jmh { outputs.upToDateWhen { false } } - -tasks.withType().configureEach { - group = "jmh" - jarArchive = tasks.jmhJar.flatMap { it.archiveFile } - jvm = javaToolchains.launcherFor(java.toolchain).map { it.executablePath }.get().asFile.path -} - -tasks.jmhJar { manifest { attributes(mapOf("Multi-Release" to true)) } } - -configurations { - // Disable module Jar patching for the JMH runtime classpath. - // The way the JMH plugin interacts with this in the 'jmhJar' task triggers this Gradle issue: - // https://github.com/gradle/gradle/issues/27372 - // And since 'jmhJar' builds a fat jar, module information is not needed here anyway. - val javaModule = Attribute.of("javaModule", Boolean::class.javaObjectType) - jmhRuntimeClasspath { attributes { attribute(javaModule, false) } } - jmhCompileClasspath { attributes { attribute(javaModule, false) } } - jmhAnnotationProcessor { attributes { attribute(javaModule, false) } } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-hammer.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-hammer.gradle.kts deleted file mode 100644 index 2d9aaba59527..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-hammer.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.hedera.gradle.services.TaskLockService - -plugins { id("java") } - -// Test functionally correct behavior under stress/loads with many repeated iterations. -@Suppress("UnstableApiUsage") -testing.suites { - register("hammer") { - testType = "hammer" - targets.all { - testTask { - group = "build" - usesService( - gradle.sharedServices.registerIfAbsent("lock", TaskLockService::class) { - maxParallelUsages = 1 - } - ) - maxHeapSize = "8g" - } - } - } -} - -tasks.assemble { dependsOn(tasks.named("hammerClasses")) } diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-timing-sensitive.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-timing-sensitive.gradle.kts deleted file mode 100644 index c567609a0422..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.feature.test-timing-sensitive.gradle.kts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.hedera.gradle.services.TaskLockService - -plugins { id("java") } - -// Tests that are resource sensitive (e.g. use Thread.sleep()) and thus need to run without anything -// in parallel. -@Suppress("UnstableApiUsage") -testing.suites { - register("timingSensitive") { - testType = "timing-sensitive" - targets.all { - testTask { - group = "build" - maxHeapSize = "4g" - usesService( - gradle.sharedServices.registerIfAbsent("lock", TaskLockService::class) { - maxParallelUsages = 1 - } - ) - } - } - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.java.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.java.gradle.kts deleted file mode 100644 index 5a4e2fd4cd2c..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.java.gradle.kts +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.adarshr.gradle.testlogger.theme.ThemeType -import com.autonomousapps.DependencyAnalysisSubExtension -import com.hedera.gradle.services.TaskLockService -import com.hedera.gradle.utils.Utils.versionTxt -import org.gradlex.javamodule.dependencies.tasks.ModuleDirectivesOrderingCheck -import org.gradlex.javamodule.dependencies.tasks.ModuleDirectivesScopeCheck - -plugins { - id("java") - id("jacoco") - id("checkstyle") - id("com.adarshr.test-logger") - id("com.autonomousapps.dependency-analysis") - id("com.hedera.gradle.lifecycle") - id("com.hedera.gradle.jpms-modules") - id("com.hedera.gradle.repositories") - id("com.hedera.gradle.spotless-java") - id("com.hedera.gradle.spotless-kotlin") -} - -version = - providers.fileContents(rootProject.layout.projectDirectory.versionTxt()).asText.get().trim() - -val javaVersionMajor = JavaVersion.VERSION_21 -val javaVersionPatch = "0.4" - -val currentJavaVersionMajor = JavaVersion.current() -val currentJavaVersion = providers.systemProperty("java.version").get() -val expectedJavaVersion = "$javaVersionMajor.$javaVersionPatch" - -if (currentJavaVersion != expectedJavaVersion) { - val message = - "Gradle runs with Java $currentJavaVersion. This project works best running with Java $expectedJavaVersion. " + - "\n - From commandline: change JAVA_HOME and/or PATH to point at Java $expectedJavaVersion installation." + - "\n - From IntelliJ: change 'Gradle JVM' in 'Gradle Settings' to point at Java $expectedJavaVersion installation." - - if (currentJavaVersionMajor.ordinal < javaVersionMajor.ordinal) { // fail if version is too old - throw (RuntimeException(message)) - } else { - logger.lifecycle("WARN: $message") - } -} - -java { - sourceCompatibility = javaVersionMajor - targetCompatibility = javaVersionMajor -} - -configurations.all { - // In case published versions of a module are also available, always prefer the local one - resolutionStrategy.preferProjectModules() -} - -jvmDependencyConflicts { - consistentResolution { - providesVersions(":aggregation") - platform(":hedera-dependency-versions") - } -} - -val consistentResolutionAttribute = Attribute.of("consistent-resolution", String::class.java) - -configurations.create("allDependencies") { - isCanBeConsumed = true - isCanBeResolved = false - sourceSets.all { - extendsFrom( - configurations[this.implementationConfigurationName], - configurations[this.compileOnlyConfigurationName], - configurations[this.runtimeOnlyConfigurationName], - configurations[this.annotationProcessorConfigurationName] - ) - } - attributes { - attribute(consistentResolutionAttribute, "global") - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) - attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) - attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL)) - } -} - -configurations.getByName("mainRuntimeClasspath") { - attributes.attribute(consistentResolutionAttribute, "global") -} - -tasks.buildDependents { setGroup(null) } - -tasks.buildNeeded { setGroup(null) } - -tasks.jar { setGroup(null) } - -sourceSets.all { - // Remove 'classes' tasks from 'build' group to keep it cleaned up - tasks.named(classesTaskName) { group = null } - - // 'assemble' compiles all sources, including all test sources - tasks.assemble { dependsOn(tasks.named(classesTaskName)) } -} - -val writeGitProperties = - tasks.register("writeGitProperties") { - property("git.build.version", project.version) - @Suppress("UnstableApiUsage") - property( - "git.commit.id", - providers - .exec { commandLine("git", "rev-parse", "HEAD") } - .standardOutput - .asText - .map { it.trim() } - ) - @Suppress("UnstableApiUsage") - property( - "git.commit.id.abbrev", - providers - .exec { commandLine("git", "rev-parse", "HEAD") } - .standardOutput - .asText - .map { it.trim().substring(0, 7) } - ) - - destinationFile = layout.buildDirectory.file("generated/git/git.properties") - } - -tasks.processResources { from(writeGitProperties) } - -// ignore the content of 'git.properties' when using a classpath as task input -normalization.runtimeClasspath { ignore("git.properties") } - -tasks.withType().configureEach { - isPreserveFileTimestamps = false - isReproducibleFileOrder = true - filePermissions { unix("0664") } - dirPermissions { unix("0775") } -} - -tasks.jar { exclude("**/classpath.index") } - -val deactivatedCompileLintOptions = - listOf( - // In Gradle, a module does not see the upstream (not-yet-compiled) modules. This could - // only be solved by calling 'javac' with '--source-module-path' to make other sources - // known. But this is at odds with how Gradle's incremental compilation calls the - // compiler for a subset of Java files for each project individually. - "module", // module not found when doing 'exports to ...' - "serial", // serializable class ... has no definition of serialVersionUID - "processing", // No processor claimed any of these annotations: ... - "try", // auto-closeable resource ignore is never referenced... (AutoClosableLock) - "missing-explicit-ctor", // class ... declares no explicit constructors - - // Needed because we use deprecation internally and do not fix all uses right away - "removal", - "deprecation", - - // The following checks could be activated and fixed: - "this-escape", // calling public/protected method in constructor - "overrides", // overrides equals, but neither it ... overrides hashCode method - "unchecked", - "rawtypes" - ) - -tasks.withType().configureEach { - // Track the full Java version as input (e.g. 17.0.3 vs. 17.0.9). - // By default, Gradle only tracks the major version as defined in the toolchain (e.g. 17). - // Since the full version is encoded in 'module-info.class' files, it should be tracked as - // it otherwise leads to wrong build cache hits. - inputs.property("fullJavaVersion", currentJavaVersion) - - options.encoding = "UTF-8" - options.isFork = true // run compiler in separate JVM process (independent of toolchain setup) - options.compilerArgs.add("-implicit:none") - options.compilerArgs.add("-Werror") - options.compilerArgs.add("-Xlint:all,-" + deactivatedCompileLintOptions.joinToString(",-")) - - doLast { - // Make sure consistent line ending are used in files generated by annotation processors by - // rewriting generated files. - // To fix this problem at the root, one of these issues needs to be addressed upstream: - // - https://github.com/google/auto/issues/1656 - // - https://github.com/gradle/gradle/issues/27385 - if (System.lineSeparator() != "\n") { - destinationDirectory - .get() - .asFileTree - .filter { it.extension != "class" } - .forEach { - val content = it.readText() - val normalizedContent = content.replace(System.lineSeparator(), "\n") - if (content != normalizedContent) { - it.writeText(normalizedContent) - } - } - } - } -} - -tasks.withType().configureEach { - options { - this as StandardJavadocDocletOptions - encoding = "UTF-8" - tags( - "apiNote:a:API Note:", - "implSpec:a:Implementation Requirements:", - "implNote:a:Implementation Note:" - ) - options.windowTitle = "Hedera Consensus Node" - options.memberLevel = JavadocMemberLevel.PACKAGE - addStringOption("Xdoclint:all,-missing", "-Xwerror") - } -} - -@Suppress("UnstableApiUsage") -testing.suites { - named("test") { - useJUnitJupiter() - targets.all { - testTask { - group = "build" - maxHeapSize = "4g" - // Some tests overlap due to using the same temp folders within one project - // maxParallelForks = 4 <- set this, once tests can run in parallel - - // Enable dynamic agent loading for tests - eg: Mockito, ByteBuddy - jvmArgs("-XX:+EnableDynamicAgentLoading") - } - } - } - // remove automatically added compile time dependencies, as we want to define them all - // explicitly - withType { - configurations.getByName(sources.implementationConfigurationName) { - withDependencies { - removeIf { it.group == "org.junit.jupiter" && it.name == "junit-jupiter" } - } - } - dependencies { runtimeOnly("org.junit.jupiter:junit-jupiter-engine") } - } -} - -// If user gave the argument '-PactiveProcessorCount', then do: -// - run all test tasks in sequence -// - give the -XX:ActiveProcessorCount argument to the test JVMs -val activeProcessorCount = providers.gradleProperty("activeProcessorCount") - -if (activeProcessorCount.isPresent) { - tasks.withType().configureEach { - usesService( - gradle.sharedServices.registerIfAbsent("lock", TaskLockService::class) { - maxParallelUsages = 1 - } - ) - jvmArgs("-XX:ActiveProcessorCount=${activeProcessorCount.get()}") - } -} - -tasks.jacocoTestReport { - // Configure Jacoco so it outputs XML reports (needed by SonarCloud) - reports { - xml.required = true - html.required = true - } -} - -testlogger { - theme = ThemeType.MOCHA_PARALLEL - slowThreshold = 10000 - showPassed = false - showSkipped = false - showStandardStreams = true - showPassedStandardStreams = false - showSkippedStandardStreams = false - showFailedStandardStreams = true -} - -tasks.assemble { dependsOn(tasks.javadoc) } - -tasks.check { dependsOn(tasks.jacocoTestReport) } - -tasks.named("qualityGate") { dependsOn(tasks.withType()) } - -// ordering check is done by SortModuleInfoRequiresStep -tasks.withType { enabled = false } - -tasks.withType().configureEach { - // When doing a 'qualityGate' run, make sure spotlessApply is done before doing compilation and - // other checks based on compiled code - mustRunAfter(tasks.spotlessApply) -} - -// Do not report dependencies from one source set to another as 'required'. -// In particular, in case of test fixtures, the analysis would suggest to -// add as testModuleInfo { require(...) } to the main module. This is -// conceptually wrong, because in whitebox testing the 'main' and 'test' -// module are conceptually considered one module (main module extended with tests) -configure { issues { onAny { exclude(project.path) } } } - -checkstyle { toolVersion = "10.12.7" } - -tasks.withType().configureEach { - reports { - xml.required = true - html.required = true - sarif.required = true - } -} - -tasks.withType().configureEach { - // Do not yet run things on the '--module-path' - modularity.inferModulePath = false - if (name.endsWith("main()")) { - notCompatibleWithConfigurationCache("JavaExec created by IntelliJ") - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.jpms-modules.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.jpms-modules.gradle.kts deleted file mode 100644 index 7a53b9644424..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.jpms-modules.gradle.kts +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("org.gradlex.jvm-dependency-conflict-resolution") - id("org.gradlex.extra-java-module-info") -} - -// Fix or enhance the metadata of third-party Modules. This is about the metadata in the -// repositories: '*.pom' and '*.module' files. -jvmDependencyConflicts.patch { - // These compile time annotation libraries are not of interest in our setup and are thus removed - // from the dependencies of all components that bring them in. - val annotationLibraries = - listOf( - "com.google.android:annotations", - "com.google.code.findbugs:annotations", - "com.google.code.findbugs:jsr305", - "com.google.errorprone:error_prone_annotations", - "com.google.guava:listenablefuture", - "org.checkerframework:checker-compat-qual", - "org.checkerframework:checker-qual", - "org.codehaus.mojo:animal-sniffer-annotations" - ) - - module("io.netty:netty-transport-native-epoll") { - addFeature("linux-x86_64") - addFeature("linux-aarch_64") - } - module("io.grpc:grpc-api") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-core") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-context") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-netty") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-protobuf") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-protobuf-lite") { - annotationLibraries.forEach { removeDependency(it) } - removeDependency("com.google.protobuf:protobuf-javalite") - addApiDependency("com.google.protobuf:protobuf-java") - } - module("io.grpc:grpc-services") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-stub") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-testing") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-util") { annotationLibraries.forEach { removeDependency(it) } } - module("com.github.ben-manes.caffeine:caffeine") { - annotationLibraries.forEach { removeDependency(it) } - } - module("com.google.dagger:dagger-compiler") { - annotationLibraries.forEach { removeDependency(it) } - } - module("com.google.dagger:dagger-producers") { - annotationLibraries.forEach { removeDependency(it) } - } - module("com.google.dagger:dagger-spi") { annotationLibraries.forEach { removeDependency(it) } } - module("com.google.guava:guava") { - (annotationLibraries - - "com.google.code.findbugs:jsr305" - - "com.google.errorprone:error_prone_annotations" - - "org.checkerframework:checker-qual") - .forEach { removeDependency(it) } - } - module("com.google.protobuf:protobuf-java-util") { - annotationLibraries.forEach { removeDependency(it) } - } - module("org.apache.tuweni:tuweni-bytes") { removeDependency("com.google.code.findbugs:jsr305") } - module("org.apache.tuweni:tuweni-units") { removeDependency("com.google.code.findbugs:jsr305") } - module("io.prometheus:simpleclient") { - removeDependency("io.prometheus:simpleclient_tracer_otel") - removeDependency("io.prometheus:simpleclient_tracer_otel_agent") - } - module("org.jetbrains.kotlin:kotlin-stdlib") { - removeDependency("org.jetbrains.kotlin:kotlin-stdlib-common") - } - module("junit:junit") { removeDependency("org.hamcrest:hamcrest-core") } - module("org.hyperledger.besu:secp256k1") { addApiDependency("net.java.dev.jna:jna") } -} - -// Fix or enhance the 'module-info.class' of third-party Modules. This is about the -// 'module-info.class' inside the Jar files. In our full Java Modules setup every -// Jar needs to have this file. If it is missing, it is added by what is configured here. -extraJavaModuleInfo { - failOnAutomaticModules = true // Only allow Jars with 'module-info' on all module paths - versionsProvidingConfiguration = "mainRuntimeClasspath" - - module("io.grpc:grpc-api", "io.grpc") - module("io.grpc:grpc-core", "io.grpc.internal") - module("io.grpc:grpc-context", "io.grpc.context") - module("io.grpc:grpc-netty", "io.grpc.netty") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("io.grpc:grpc-stub", "io.grpc.stub") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("io.grpc:grpc-util", "io.grpc.util") - module("io.grpc:grpc-protobuf", "io.grpc.protobuf") - module("io.grpc:grpc-protobuf-lite", "io.grpc.protobuf.lite") - module("io.helidon.common:helidon-common", "io.helidon.common") { - exportAllPackages() - patchRealModule() - } - module("io.helidon.webclient:helidon-webclient", "io.helidon.webclient") { - requireAllDefinedDependencies() - patchRealModule() - } - module("io.helidon.webclient:helidon-webclient-grpc", "io.helidon.webclient.grpc") { - exportAllPackages() - requireAllDefinedDependencies() - patchRealModule() - } - module("com.github.spotbugs:spotbugs-annotations", "com.github.spotbugs.annotations") - module("com.google.code.findbugs:jsr305", "java.annotation") - module("com.google.protobuf:protobuf-java", "com.google.protobuf") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("com.google.guava:guava", "com.google.common") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("com.google.guava:failureaccess", "com.google.common.util.concurrent.internal") - module("com.google.api.grpc:proto-google-common-protos", "com.google.api.grpc.common") - module("com.google.dagger:dagger", "dagger") - module("io.perfmark:perfmark-api", "io.perfmark") - module("javax.inject:javax.inject", "javax.inject") - module("commons-codec:commons-codec", "org.apache.commons.codec") - module("com.esaulpaugh:headlong", "headlong") - module("org.checkerframework:checker-qual", "org.checkerframework.checker.qual") - module("org.connid:framework", "org.connid.framework") - module("org.connid:framework-internal", "org.connid.framework.internal") { - exportAllPackages() - requires("org.connid.framework") // this is missing in POM - } - module("org.jetbrains:annotations", "org.jetbrains.annotations") - module("io.tmio:tuweni-units", "tuweni.units") - module("io.tmio:tuweni-bytes", "tuweni.bytes") - module("net.i2p.crypto:eddsa", "net.i2p.crypto.eddsa") - module("io.netty:netty-codec-http", "io.netty.codec.http") - module("io.netty:netty-codec-http2", "io.netty.codec.http2") - module("io.netty:netty-codec-socks", "io.netty.codec.socks") - module("io.netty:netty-handler-proxy", "io.netty.handler.proxy") - module("io.netty:netty-transport-native-unix-common", "io.netty.transport.unix.common") - module("io.netty:netty-buffer", "io.netty.buffer") - module("io.netty:netty-codec", "io.netty.codec") - module("io.netty:netty-common", "io.netty.common") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - requires("jdk.unsupported") - ignoreServiceProvider("reactor.blockhound.integration.BlockHoundIntegration") - } - module("io.netty:netty-handler", "io.netty.handler") - module("io.netty:netty-resolver", "io.netty.resolver") - module("io.netty:netty-transport", "io.netty.transport") - module("io.netty:netty-transport-classes-epoll", "io.netty.transport.classes.epoll") - module("org.antlr:antlr4-runtime", "org.antlr.antlr4.runtime") - module("org.hyperledger.besu.internal:algorithms", "org.hyperledger.besu.internal.crypto") - module("org.hyperledger.besu.internal:rlp", "org.hyperledger.besu.internal.rlp") - module("org.hyperledger.besu:arithmetic", "org.hyperledger.besu.nativelib.arithmetic") - module("org.hyperledger.besu:blake2bf", "org.hyperledger.besu.nativelib.blake2bf") - module("org.hyperledger.besu:bls12-381", "org.hyperledger.besu.nativelib.bls12_381") - module("org.hyperledger.besu:besu-datatypes", "org.hyperledger.besu.datatypes") - module("org.hyperledger.besu:evm", "org.hyperledger.besu.evm") { - exportAllPackages() - requireAllDefinedDependencies() - requiresStatic("com.fasterxml.jackson.annotation") - } - module("org.hyperledger.besu:secp256k1", "org.hyperledger.besu.nativelib.secp256k1") - module("org.hyperledger.besu:secp256r1", "org.hyperledger.besu.nativelib.secp256r1") - module("com.goterl:resource-loader", "resource.loader") - module("com.goterl:lazysodium-java", "lazysodium.java") - module("tech.pegasys:jc-kzg-4844", "tech.pegasys.jckzg4844") - module("net.java.dev.jna:jna", "com.sun.jna") { - exportAllPackages() - requires("java.logging") - } - module("org.eclipse.collections:eclipse-collections-api", "org.eclipse.collections.api") - module("org.eclipse.collections:eclipse-collections", "org.eclipse.collections.impl") - module("io.prometheus:simpleclient", "io.prometheus.simpleclient") - module("io.prometheus:simpleclient_common", "io.prometheus.simpleclient_common") - module("io.prometheus:simpleclient_httpserver", "io.prometheus.simpleclient.httpserver") { - exportAllPackages() - requireAllDefinedDependencies() - requires("jdk.httpserver") - } - - // Need to use Jar file names here as there is currently no other way to address Jar with - // classifier directly for patching - module( - "io.netty:netty-transport-native-epoll|linux-x86_64", - "io.netty.transport.epoll.linux.x86_64" - ) - module( - "io.netty:netty-transport-native-epoll|linux-aarch_64", - "io.netty.transport.epoll.linux.aarch_64" - ) - - // Annotation processing only - module("com.google.auto.service:auto-service-annotations", "com.google.auto.service") - module("com.google.auto.service:auto-service", "com.google.auto.service.processor") - module("com.google.auto:auto-common", "com.google.auto.common") - module("com.google.dagger:dagger-compiler", "dagger.compiler") - module("com.google.dagger:dagger-producers", "dagger.producers") - module("com.google.dagger:dagger-spi", "dagger.spi") - module( - "com.google.devtools.ksp:symbol-processing-api", - "com.google.devtools.ksp.symbolprocessingapi" - ) - module("com.google.errorprone:javac-shaded", "com.google.errorprone.javac.shaded") - module("com.google.googlejavaformat:google-java-format", "com.google.googlejavaformat") - module("net.ltgt.gradle.incap:incap", "net.ltgt.gradle.incap") - module("org.jetbrains.kotlinx:kotlinx-metadata-jvm", "kotlinx.metadata.jvm") - - // Testing only - module("com.google.jimfs:jimfs", "com.google.jimfs") - module("org.awaitility:awaitility", "awaitility") - module("uk.org.webcompere:system-stubs-core", "uk.org.webcompere.systemstubs.core") - module("uk.org.webcompere:system-stubs-jupiter", "uk.org.webcompere.systemstubs.jupiter") - - // Test clients only - module("com.github.docker-java:docker-java-api", "com.github.dockerjava.api") - module("com.github.docker-java:docker-java-transport", "com.github.docker.java.transport") - module( - "com.github.docker-java:docker-java-transport-zerodep", - "com.github.docker.transport.zerodep" - ) - module("com.google.protobuf:protobuf-java-util", "com.google.protobuf.util") - module("com.squareup:javapoet", "com.squareup.javapoet") { - exportAllPackages() - requires("java.compiler") - } - module("junit:junit", "junit") - module("org.hamcrest:hamcrest", "org.hamcrest") - module("org.json:json", "org.json") - module("org.mockito:mockito-core", "org.mockito") - module("org.objenesis:objenesis", "org.objenesis") - module("org.rnorth.duct-tape:duct-tape", "org.rnorth.ducttape") - module("org.testcontainers:testcontainers", "org.testcontainers") - module("org.mockito:mockito-junit-jupiter", "org.mockito.junit.jupiter") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.lifecycle.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.lifecycle.gradle.kts deleted file mode 100644 index 1c74e298998c..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.lifecycle.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("base") - id("com.diffplug.spotless") -} - -// Convenience for local development: when running './gradlew' without any parameters just show the -// tasks from the 'build' group -defaultTasks("tasks") - -tasks.register("qualityGate") { - group = "build" - description = "Apply spotless rules and run all quality checks." - dependsOn(tasks.spotlessApply) - dependsOn(tasks.assemble) -} - -tasks.register("releaseMavenCentral") diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.maven-publish.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.maven-publish.gradle.kts deleted file mode 100644 index 32e73b2f57b3..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.maven-publish.gradle.kts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.util.Properties - -plugins { - id("java") - id("maven-publish") - id("signing") - id("io.freefair.maven-central.validate-poms") -} - -tasks.withType().configureEach { - // Publishing tasks are only enabled if we publish to the matching group. - // Otherwise, Nexus configuration and credentials do not fit. - val publishingPackageGroup = providers.gradleProperty("publishingPackageGroup").orNull - enabled = publishingPackageGroup == project.group -} - -java { - withJavadocJar() - withSourcesJar() -} - -tasks.withType().configureEach { setGroup(null) } - -tasks.named("releaseMavenCentral") { - group = "release" - dependsOn(tasks.named("publishToSonatype")) -} - -val maven = - publishing.publications.create("maven") { - from(components["java"]) - versionMapping { - // Everything published takes the versions from the resolution result. - // These are the versions we define in 'hedera-dependency-versions' - // and use consistently in all modules. - allVariants { fromResolutionResult() } - } - - suppressAllPomMetadataWarnings() - - pom { - val devGroups = Properties() - val developerProperties = layout.projectDirectory.file("../developers.properties") - devGroups.load( - providers - .fileContents(developerProperties) - .asText - .orElse( - provider { - throw RuntimeException("${developerProperties.asFile} does not exist") - } - ) - .get() - .reader() - ) - - name.set(project.name) - url = "https://www.hashgraph.com/" - inceptionYear = "2016" - - // this field must be present. Default to empty string. - description = - providers - .fileContents(layout.projectDirectory.file("../description.txt")) - .asText - .orElse(provider(project::getDescription)) - .map { it.replace("\n", " ").trim() } - .orElse("") - - organization { - name = "Hedera Hashgraph, LLC" - url = "https://www.hedera.com" - } - - val repoName = isolated.rootProject.name - - issueManagement { - system = "GitHub" - url = "https://github.com/hashgraph/$repoName/issues" - } - - licenses { - license { - name = "Apache License, Version 2.0" - url = "https://raw.githubusercontent.com/hashgraph/$repoName/main/LICENSE" - } - } - - scm { - connection = "scm:git:git://github.com/hashgraph/$repoName.git" - developerConnection = "scm:git:ssh://github.com:hashgraph/$repoName.git" - url = "https://github.com/hashgraph/$repoName" - } - - developers { - devGroups.forEach { mail, team -> - developer { - id = team as String - name = team as String - email = mail as String - organization = "Hedera Hashgraph" - organizationUrl = "https://www.hedera.com" - } - } - } - } - } - -val publishSigningEnabled = - providers.gradleProperty("publishSigningEnabled").getOrElse("false").toBoolean() - -if (publishSigningEnabled) { - signing { - sign(maven) - useGpgCmd() - } -} - -tasks.named("qualityGate") { dependsOn(tasks.validatePomFiles) } diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.nexus-publish.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.nexus-publish.gradle.kts deleted file mode 100644 index 429566cb793a..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.nexus-publish.gradle.kts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("com.hedera.gradle.lifecycle") - id("io.github.gradle-nexus.publish-plugin") -} - -nexusPublishing { - val s01SonatypeHost = providers.gradleProperty("s01SonatypeHost").getOrElse("false").toBoolean() - packageGroup = providers.gradleProperty("publishingPackageGroup").getOrElse("") - - repositories { - sonatype { - username = System.getenv("NEXUS_USERNAME") - password = System.getenv("NEXUS_PASSWORD") - if (s01SonatypeHost) { - nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") - snapshotRepositoryUrl = - uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") - } - } - } -} - -tasks.named("closeSonatypeStagingRepository") { - // The publishing of all components to Maven Central is automatically done before close (which - // is done before release). - dependsOn(subprojects.map { ":${it.name}:releaseMavenCentral" }) -} - -tasks.named("releaseMavenCentral") { - group = "release" - dependsOn(tasks.closeAndReleaseStagingRepository) -} - -tasks.register("releaseMavenCentralSnapshot") { - group = "release" - dependsOn(subprojects.map { ":${it.name}:releaseMavenCentral" }) -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform-publish.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform-publish.gradle.kts deleted file mode 100644 index e2983169da5f..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform-publish.gradle.kts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java") - id("com.hedera.gradle.maven-publish") -} - -if ( - gradle.startParameter.taskNames.any { it.startsWith("release") || it.contains("MavenCentral") } -) { - // We apply the 'artifactregistry' plugin conditionally, as there are two issues: - // 1. It does not support configuration cache. - // https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/issues/85 - // 2. It does not interact well with the 'gradle-nexus.publish-plugin' plugin, causing: - // 'No staging repository with name sonatype created' during IDE import - publishing.repositories.remove(publishing.repositories.getByName("sonatype")) - apply(plugin = "com.google.cloud.artifactregistry.gradle-plugin") -} - -publishing.repositories { - maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-prerelease-channel") { - name = "prereleaseChannel" - } - maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-develop-snapshots") { - name = "developSnapshot" - } - maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-develop-daily-snapshots") { - name = "developDailySnapshot" - } - maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-develop-commits") { - name = "developCommit" - } - maven("artifactregistry://us-maven.pkg.dev/swirlds-registry/maven-adhoc-commits") { - name = "adhocCommit" - } -} - -// Register one 'release*' task for each publishing repository -publishing.repositories.all { - val ucName = name.replaceFirstChar { it.titlecase() } - tasks.register("release$ucName") { - group = "release" - dependsOn(tasks.named("publishMavenPublicationTo${ucName}Repository")) - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform.gradle.kts deleted file mode 100644 index b12ff59f1ee7..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.platform.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java-library") - id("com.hedera.gradle.java") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.protobuf.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.protobuf.gradle.kts deleted file mode 100644 index 1ef21c4c2ea0..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.protobuf.gradle.kts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.google.protobuf.gradle.id - -plugins { - id("com.hedera.gradle.services") - id("com.google.protobuf") -} - -// Configure Protobuf Plugin to download protoc executable rather than using local installed version -protobuf { - protoc { artifact = "com.google.protobuf:protoc" } - plugins { - // Add GRPC plugin as we need to generate GRPC services - id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java" } - } - generateProtoTasks { - all().configureEach { plugins { id("grpc") { option("@generated=omit") } } } - } -} - -configurations.configureEach { - if (name.startsWith("protobufToolsLocator") || name.endsWith("ProtoPath")) { - @Suppress("UnstableApiUsage") - shouldResolveConsistentlyWith(configurations.getByName("mainRuntimeClasspath")) - attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API)) } - exclude(group = project.group.toString(), module = project.name) - withDependencies { - isTransitive = true - extendsFrom(configurations["internal"]) - } - } -} - -tasks.javadoc { - options { - this as StandardJavadocDocletOptions - // There are violations in the generated protobuf code - addStringOption("Xdoclint:-reference,-html", "-quiet") - } -} - -// Give JUnit more ram and make it execute tests in parallel -tasks.test { - // We are running a lot of tests 10s of thousands, so they need to run in parallel. Make each - // class run in parallel. - systemProperties["junit.jupiter.execution.parallel.enabled"] = true - systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent" - // limit amount of threads, so we do not use all CPU - systemProperties["junit.jupiter.execution.parallel.config.dynamic.factor"] = "0.9" - // us parallel GC to keep up with high temporary garbage creation, - // and allow GC to use 40% of CPU if needed - jvmArgs("-XX:+UseParallelGC", "-XX:GCTimeRatio=90") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.reports.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.reports.gradle.kts deleted file mode 100644 index 3cef369974a5..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.reports.gradle.kts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.gradlex.javamodule.dependencies.tasks.ModuleDirectivesScopeCheck - -plugins { - id("com.hedera.gradle.java") - id("jacoco-report-aggregation") -} - -tasks.withType { enabled = false } - -// Make aggregation "classpath" use the platform for versions (gradle/versions) -configurations.aggregateCodeCoverageReportResults { extendsFrom(configurations["internal"]) } diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.repositories.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.repositories.gradle.kts deleted file mode 100644 index 734cf240f7eb..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.repositories.gradle.kts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -repositories { - mavenCentral() - maven { url = uri("https://us-maven.pkg.dev/swirlds-registry/maven-prerelease-channel") } - maven { url = uri("https://us-maven.pkg.dev/swirlds-registry/maven-develop-commits") } - maven { url = uri("https://us-maven.pkg.dev/swirlds-registry/maven-adhoc-commits") } - maven { url = uri("https://us-maven.pkg.dev/swirlds-registry/maven-develop-daily-snapshots") } - maven { url = uri("https://us-maven.pkg.dev/swirlds-registry/maven-develop-snapshots") } - maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } - maven { - url = uri("https://hyperledger.jfrog.io/artifactory/besu-maven") - content { includeGroupByRegex("org\\.hyperledger\\..*") } - } - maven { - url = uri("https://artifacts.consensys.net/public/maven/maven/") - content { includeGroupByRegex("tech\\.pegasys(\\..*)?") } - } - maven { url = uri("https://oss.sonatype.org/content/repositories/comhederahashgraph-1502") } - maven { url = uri("https://oss.sonatype.org/content/repositories/comhederahashgraph-1531") } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.root.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.root.gradle.kts deleted file mode 100644 index a429661c9721..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.root.gradle.kts +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.hedera.gradle.utils.Utils.generateProjectVersionReport -import com.hedera.gradle.utils.Utils.versionTxt -import net.swiftzer.semver.SemVer - -plugins { - id("com.hedera.gradle.lifecycle") - id("com.hedera.gradle.repositories") - id("com.hedera.gradle.nexus-publish") - id("com.hedera.gradle.spotless-kotlin") - id("com.hedera.gradle.spotless-markdown") -} - -spotless { - kotlinGradle { target("gradle/plugins/**/*.gradle.kts") } - kotlin { - // For the Kotlin classes (*.kt files) - ktfmt().kotlinlangStyle() - target("gradle/plugins/**/*.kt") - } -} - -val productVersion = layout.projectDirectory.versionTxt().asFile.readText().trim() - -tasks.register("githubVersionSummary") { - group = "github" - - inputs.property("version", productVersion) - - if (!providers.environmentVariable("GITHUB_STEP_SUMMARY").isPresent) { - // Do not throw an exception if running the `gradlew tasks` task - if (project.gradle.startParameter.taskNames.contains("githubVersionSummary")) { - throw IllegalArgumentException( - "This task may only be run in a Github Actions CI environment! " + - "Unable to locate the GITHUB_STEP_SUMMARY environment variable." - ) - } - } - outputs.file(providers.environmentVariable("GITHUB_STEP_SUMMARY")) - - doLast { - generateProjectVersionReport( - inputs.properties["version"] as String, - outputs.files.singleFile.outputStream().buffered() - ) - } -} - -tasks.register("showVersion") { - group = "versioning" - - inputs.property("version", productVersion) - - doLast { println(inputs.properties["version"]) } -} - -tasks.register("versionAsPrefixedCommit") { - group = "versioning" - - @Suppress("UnstableApiUsage") - inputs.property( - "commit", - providers - .exec { commandLine("git", "rev-parse", "HEAD") } - .standardOutput - .asText - .map { it.trim().substring(0, 7) } - ) - inputs.property("commitPrefix", providers.gradleProperty("commitPrefix").orElse("adhoc")) - inputs.property("version", productVersion) - outputs.file(layout.projectDirectory.versionTxt()) - - doLast { - val newPrerel = - inputs.properties["commitPrefix"].toString() + - ".x" + - inputs.properties["commit"].toString().take(8) - val currVer = SemVer.parse(inputs.properties["version"] as String) - val newVer = SemVer(currVer.major, currVer.minor, currVer.patch, newPrerel) - outputs.files.singleFile.writeText(newVer.toString()) - } -} - -tasks.register("versionAsSnapshot") { - group = "versioning" - - inputs.property("version", productVersion) - outputs.file(layout.projectDirectory.versionTxt()) - - doLast { - val currVer = SemVer.parse(inputs.properties["version"] as String) - val newVer = SemVer(currVer.major, currVer.minor, currVer.patch, "SNAPSHOT") - - outputs.files.singleFile.writeText(newVer.toString()) - } -} - -tasks.register("versionAsSpecified") { - group = "versioning" - - inputs.property("newVersion", providers.gradleProperty("newVersion").orNull) - - if (inputs.properties["newVersion"] == null) { - // Do not throw an exception if running the `gradlew tasks` task - if (project.gradle.startParameter.taskNames.contains("versionAsSpecified")) { - throw IllegalArgumentException( - "No newVersion property provided! " + - "Please add the parameter -PnewVersion= when running this task." - ) - } - } - outputs.file(layout.projectDirectory.versionTxt()) - - doLast { - val newVer = SemVer.parse(inputs.properties["newVersion"] as String) - outputs.files.singleFile.writeText(newVer.toString()) - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.services-publish.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.services-publish.gradle.kts deleted file mode 100644 index 57ed149ed3de..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.services-publish.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java") - id("com.hedera.gradle.maven-publish") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.services.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.services.gradle.kts deleted file mode 100644 index b12ff59f1ee7..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.services.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java-library") - id("com.hedera.gradle.java") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.settings.settings.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.settings.settings.gradle.kts deleted file mode 100644 index 5da00ecb2321..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.settings.settings.gradle.kts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.gradlex.javamodule.dependencies.initialization.JavaModulesExtension -import org.gradlex.javamodule.dependencies.initialization.RootPluginsExtension - -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } - } -} - -plugins { - id("com.gradle.develocity") - id("org.gradlex.java-module-dependencies") -} - -// Plugins that are global, but are applied to the "root project" instead of settings. -// by having this block here, we do not require a "build.gradle.kts" in the repository roots. -configure { id("com.hedera.gradle.root") } - -// Enable Gradle Build Scan -develocity { - buildScan { - termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use" - termsOfUseAgree = "yes" - publishing.onlyIf { false } // only publish with explicit '--scan' - } -} - -val isCiServer = System.getenv().containsKey("CI") -val gradleCacheUsername: String? = System.getenv("GRADLE_CACHE_USERNAME") -val gradleCachePassword: String? = System.getenv("GRADLE_CACHE_PASSWORD") -val gradleCacheAuthorized = - (gradleCacheUsername?.isNotEmpty() ?: false) && (gradleCachePassword?.isNotEmpty() ?: false) - -buildCache { - remote { - url = uri("https://cache.gradle.hedera.svcs.eng.swirldslabs.io/cache/") - isPush = isCiServer && gradleCacheAuthorized - - isUseExpectContinue = true - isEnabled = !gradle.startParameter.isOffline - - if (isCiServer && gradleCacheAuthorized) { - credentials { - username = gradleCacheUsername - password = gradleCachePassword - } - } - } -} - -// Allow projects inside a build to be addressed by dependency coordinates notation. -// https://docs.gradle.org/current/userguide/composite_builds.html#included_build_declaring_substitutions -// Some functionality of the 'java-module-dependencies' plugin relies on this. -includeBuild(".") - -configure { - // Project to aggregate code coverage data for the whole repository into one report - module("gradle/aggregation") - - // "BOM" with versions of 3rd party dependencies - versions("hedera-dependency-versions") -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.shadow-jar.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.shadow-jar.gradle.kts deleted file mode 100644 index d2bf1148e4d5..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.shadow-jar.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.github.jengelman.gradle.plugins.shadow.internal.DefaultDependencyFilter -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -plugins { - id("java") - id("com.github.johnrengelman.shadow") -} - -tasks.withType().configureEach { - group = "shadow" - from(sourceSets.main.get().output) - mergeServiceFiles() - - // There is an issue in the shadow plugin that it automatically accesses the - // files in 'runtimeClasspath' while Gradle is building the task graph. - // See: https://github.com/johnrengelman/shadow/issues/882 - dependencyFilter = NoResolveDependencyFilter() -} - -class NoResolveDependencyFilter : DefaultDependencyFilter(project) { - override fun resolve(configuration: FileCollection): FileCollection { - return configuration - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-java.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-java.gradle.kts deleted file mode 100644 index 984b2cece001..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-java.gradle.kts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.hedera.gradle.spotless.RepairDashedCommentsFormatterStep -import com.hedera.gradle.spotless.SortModuleInfoRequiresStep -import com.hedera.gradle.spotless.StripOldLicenseFormatterStep - -plugins { id("com.hedera.gradle.spotless") } - -spotless { - java { - targetExclude("build/generated/sources/**/*.java", "build/generated/source/**/*.java") - - // fix errors due to dashed comment blocks (eg: /*-, /*--, etc) - addStep(RepairDashedCommentsFormatterStep.create()) - // Remove the old license headers as the spotless licenseHeader formatter - // cannot find them if they are located between the package and import statements. - addStep(StripOldLicenseFormatterStep.create()) - // Sort the 'requires' entries in Module Info files - addStep(SortModuleInfoRequiresStep.create()) - // enable toggle comment support - toggleOffOn() - // don't need to set target, it is inferred from java - // apply a specific flavor of google-java-format - palantirJavaFormat() - // make sure every file has the following copyright header. - // optionally, Spotless can set copyright years by digging - // through git history (see "license" section below). - // The delimiter override below is required to support some - // of our test classes which are in the default package. - licenseHeader( - """ - /* - * Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */${"\n\n"} - """ - .trimIndent(), - "(package|import)" - ) - .updateYearWithLatest(true) - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-kotlin.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-kotlin.gradle.kts deleted file mode 100644 index 68fcb3923015..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-kotlin.gradle.kts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.hedera.gradle.spotless") } - -spotless { - kotlinGradle { - ktfmt().kotlinlangStyle() - - licenseHeader( - """ - /* - * Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */${"\n\n"} - """ - .trimIndent(), - "(import|plugins|pluginManagement|dependencyResolutionManagement|repositories|tasks|allprojects|subprojects)" - ) - .updateYearWithLatest(true) - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-markdown.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-markdown.gradle.kts deleted file mode 100644 index 1505c1a7c80e..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless-markdown.gradle.kts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.hedera.gradle.spotless") } - -spotless { - flexmark { - target("**/*.md") - flexmark() - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } -} diff --git a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless.gradle.kts b/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless.gradle.kts deleted file mode 100644 index 4c027596fe37..000000000000 --- a/gradle/plugins/src/main/kotlin/com.hedera.gradle.spotless.gradle.kts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.diffplug.spotless") } - -spotless { - // Disable the automatic application of Spotless to all source sets when the check task is run. - isEnforceCheck = false - - // optional: limit format enforcement to just the files changed by this feature branch - ratchetFrom("origin/develop") - - format("misc") { - // define the files to apply `misc` to - target(".gitignore") - - // define the steps to apply to those files - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } - - format("actionYaml") { - target(".github/workflows/*.yaml") - /* - * Prettier requires NodeJS and NPM installed; however, the NodeJS Gradle plugin and Spotless do not yet - * integrate with each other. Currently there is an open issue report against spotless. - * - * *** Please see for more information: https://github.com/diffplug/spotless/issues/728 *** - * - * The workaround provided in the above issue does not work in Gradle 7.5+ and therefore is not a viable solution. - */ - // prettier() - - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - - licenseHeader( - """ - ## - # Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - ##${"\n\n"} - """ - .trimIndent(), - "(name)" - ) - .updateYearWithLatest(true) - } -} diff --git a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/RepairDashedCommentsFormatterStep.kt b/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/RepairDashedCommentsFormatterStep.kt deleted file mode 100644 index 5a3efd96c1c2..000000000000 --- a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/RepairDashedCommentsFormatterStep.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.gradle.spotless - -import com.diffplug.spotless.FormatterFunc -import com.diffplug.spotless.FormatterStep - -/** - * Adds self-correcting behavior as spotless step which properly removes the comments which causes - * the google-java-formatter plugin to rupture (eg: \/\*-). - */ -class RepairDashedCommentsFormatterStep { - companion object { - private const val NAME = "RepairDashedComments" - private const val OPENING_COMMENT_REGEX = "/\\*-+" - private const val CLOSING_COMMENT_REGEX = "-+\\*/" - - fun create(): FormatterStep { - val openingCommentRegex = Regex(OPENING_COMMENT_REGEX, setOf(RegexOption.IGNORE_CASE)) - val closingCommentRegex = Regex(CLOSING_COMMENT_REGEX, setOf(RegexOption.IGNORE_CASE)) - return FormatterStep.create( - NAME, - State(openingCommentRegex, closingCommentRegex), - State::toFormatter - ) - } - } - - private class State(val openingCommentRegex: Regex, val closingCommentRegex: Regex) : - java.io.Serializable { - - fun toFormatter(): FormatterFunc { - return FormatterFunc { unixStr -> - val lines = unixStr.split('\n') - val result = ArrayList(lines.size) - var inLicenseBlock = false - - lines.forEach { s -> - if (!inLicenseBlock && s.trim().equals("/*-")) { - inLicenseBlock = true - } else if (inLicenseBlock && s.trim().equals("*/")) { - inLicenseBlock = false - } - - if (inLicenseBlock) { - result.add(s) - } else { - result.add( - s.replace(openingCommentRegex, "/*").replace(closingCommentRegex, "*/") - ) - } - } - - val finalStr = result.joinToString("\n") - finalStr - } - } - } -} diff --git a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/SortModuleInfoRequiresStep.kt b/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/SortModuleInfoRequiresStep.kt deleted file mode 100644 index e744208eb681..000000000000 --- a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/SortModuleInfoRequiresStep.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.gradle.spotless - -import com.diffplug.spotless.FormatterFunc -import com.diffplug.spotless.FormatterStep - -class SortModuleInfoRequiresStep { - companion object { - private const val NAME = "SortModuleInfoRequires" - private val OWN_PACKAGES = listOf("com.swirlds.", "com.hedera.node.", "com.hedera.storage.") - - fun create(): FormatterStep { - return FormatterStep.create(NAME, State(), State::toFormatter) - } - } - - private class State : java.io.Serializable { - - fun toFormatter(): FormatterFunc { - return FormatterFunc { unixStr -> - val lines = unixStr.split('\n') - val blockStartIndex = lines.indexOfFirst { it.trim().startsWith("requires") } - val blockEndIndex = lines.indexOfLast { it.trim().startsWith("requires") } - - if (blockStartIndex == -1) { - unixStr // not a module-info.java or no 'requires' - } else { - val nonRequiresLines = mutableListOf() - - val requiresTransitive = mutableListOf() - val requires = mutableListOf() - val requiresStaticTransitive = mutableListOf() - val requiresStatic = mutableListOf() - - lines.subList(blockStartIndex, blockEndIndex + 1).forEach { line -> - when { - line.trim().startsWith("requires static transitive") -> - requiresStaticTransitive.add(line) - line.trim().startsWith("requires static") -> requiresStatic.add(line) - line.trim().startsWith("requires transitive") -> - requiresTransitive.add(line) - line.trim().startsWith("requires") -> requires.add(line) - line.isNotBlank() && !line.trim().startsWith("requires") -> - nonRequiresLines.add(line) - } - } - - val comparator = - Comparator { a, b -> - val nameA = a.split(" ").first { it.endsWith(";") } - val nameB = b.split(" ").first { it.endsWith(";") } - if ( - OWN_PACKAGES.any { nameA.startsWith(it) } && - OWN_PACKAGES.none { nameB.startsWith(it) } - ) { - -1 - } else if ( - OWN_PACKAGES.none { nameA.startsWith(it) } && - OWN_PACKAGES.any { nameB.startsWith(it) } - ) { - 1 - } else { - nameA.compareTo(nameB) - } - } - - requiresTransitive.sortWith(comparator) - requires.sortWith(comparator) - requiresStaticTransitive.sortWith(comparator) - requiresStatic.sortWith(comparator) - - val blockStart = lines.subList(0, blockStartIndex) - val blockEnd = lines.subList(blockEndIndex + 1, lines.size) - - (blockStart + - nonRequiresLines + - requiresTransitive + - requires + - requiresStaticTransitive + - requiresStatic + - blockEnd) - .joinToString("\n") - } - } - } - } -} diff --git a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/StripOldLicenseFormatterStep.kt b/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/StripOldLicenseFormatterStep.kt deleted file mode 100644 index e9aedfac0bdb..000000000000 --- a/gradle/plugins/src/main/kotlin/com/hedera/gradle/spotless/StripOldLicenseFormatterStep.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.gradle.spotless - -import com.diffplug.spotless.FormatterFunc -import com.diffplug.spotless.FormatterStep - -/** - * Removes the old copyright statements which were incorrectly located between the package and - * import statements. These legacy copyright blocks also uses with an unexpected opening comment - * tag. This FormatterStep removes those comment blocks using a very conservative approach to avoid - * mutilating actual code. - */ -class StripOldLicenseFormatterStep { - companion object { - private const val NAME = "StripOldLicense" - - fun create(): FormatterStep { - return FormatterStep.create(NAME, State(), State::toFormatter) - } - } - - private class State : java.io.Serializable { - - fun toFormatter(): FormatterFunc { - return FormatterFunc { unixStr -> - val lines = unixStr.split('\n') - val result = ArrayList(lines.size) - var inComment = false - lines.forEach { s -> - if (!inComment && s.trim().startsWith("/*-")) { - inComment = true - } else if (inComment && s.trim().startsWith("*/")) { - inComment = false - } else if (!inComment) { - result.add(s) - } - } - - result.joinToString("\n") - } - } - } -} diff --git a/gradle/plugins/src/main/kotlin/com/hedera/gradle/utils/Utils.kt b/gradle/plugins/src/main/kotlin/com/hedera/gradle/utils/Utils.kt deleted file mode 100644 index 948ce171e8b6..000000000000 --- a/gradle/plugins/src/main/kotlin/com/hedera/gradle/utils/Utils.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.gradle.utils - -import java.io.OutputStream -import java.io.PrintStream -import org.gradle.api.file.Directory -import org.gradle.api.file.RegularFile - -object Utils { - // Find the version.txt in the root of the repository, independent of - // which build is started from where. - @JvmStatic - fun Directory.versionTxt(): RegularFile = - file("version.txt").let { if (it.asFile.exists()) it else this.dir("..").versionTxt() } - - @JvmStatic - fun generateProjectVersionReport(version: String, ostream: OutputStream) { - val writer = PrintStream(ostream, false, Charsets.UTF_8) - - ostream.use { - writer.use { - // Writer headers - writer.println("### Deployed Version Information") - writer.println() - writer.println("| Artifact Name | Version Number |") - writer.println("| --- | --- |") - // Write table rows - writer.printf("| %s | %s |\n", "hedera-node", version) - writer.printf("| %s | %s |\n", "platform-sdk", version) - writer.flush() - ostream.flush() - } - } - } -} diff --git a/gradle/toolchain-versions.properties b/gradle/toolchain-versions.properties new file mode 100644 index 000000000000..04e458faeff5 --- /dev/null +++ b/gradle/toolchain-versions.properties @@ -0,0 +1 @@ +jdk=21.0.4 diff --git a/hapi/build.gradle.kts b/hapi/build.gradle.kts index 4f27c86b57eb..812f5752b0ea 100644 --- a/hapi/build.gradle.kts +++ b/hapi/build.gradle.kts @@ -1,23 +1,8 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +// SPDX-License-Identifier: Apache-2.0 plugins { - id("com.hedera.gradle.protobuf") - id("com.hedera.gradle.services-publish") - id("com.hedera.gradle.feature.test-fixtures") + id("org.hiero.gradle.module.library") + id("org.hiero.gradle.feature.protobuf") + id("org.hiero.gradle.feature.test-fixtures") id("com.hedera.pbj.pbj-compiler") version "0.9.2" } @@ -56,3 +41,15 @@ testModuleInfo { requires("org.junit.jupiter.api") requires("org.junit.jupiter.params") } + +tasks.test { + // We are running a lot of tests (10s of thousands), so they need to run in parallel. Make each + // class run in parallel. + systemProperties["junit.jupiter.execution.parallel.enabled"] = true + systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent" + // limit amount of threads, so we do not use all CPU + systemProperties["junit.jupiter.execution.parallel.config.dynamic.factor"] = "0.9" + // us parallel GC to keep up with high temporary garbage creation, + // and allow GC to use 40% of CPU if needed + jvmArgs("-XX:+UseParallelGC", "-XX:GCTimeRatio=90") +} diff --git a/hapi/hedera-protobufs/block/stream/output/smart_contract_service.proto b/hapi/hedera-protobufs/block/stream/output/smart_contract_service.proto index 4967147916e2..193fc3202cc3 100644 --- a/hapi/hedera-protobufs/block/stream/output/smart_contract_service.proto +++ b/hapi/hedera-protobufs/block/stream/output/smart_contract_service.proto @@ -40,7 +40,7 @@ option java_package = "com.hedera.hapi.block.stream.output.protoc"; // <<>> This comment is special code for setting PBJ Compiler java package option java_multiple_files = true; -import "contract_call_local.proto"; +import "contract_types.proto"; import "sidecar_file.proto"; /** diff --git a/hapi/hedera-protobufs/block/stream/output/state_changes.proto b/hapi/hedera-protobufs/block/stream/output/state_changes.proto index 924f8dfdbe9d..28040854aeab 100644 --- a/hapi/hedera-protobufs/block/stream/output/state_changes.proto +++ b/hapi/hedera-protobufs/block/stream/output/state_changes.proto @@ -64,12 +64,11 @@ import "state/token/token.proto"; import "state/token/token_relation.proto"; import "state/platform_state.proto"; import "timestamp.proto"; -import "auxiliary/tss/tss_encryption_key.proto"; import "auxiliary/tss/tss_message.proto"; import "auxiliary/tss/tss_vote.proto"; +import "state/tss/tss_encryption_keys.proto"; import "state/tss/tss_message_map_key.proto"; import "state/tss/tss_vote_map_key.proto"; -import "state/tss/tss_status.proto"; /** * A set of state changes. @@ -609,11 +608,6 @@ message SingletonUpdateChange { * A change to the roster state singleton. */ com.hedera.hapi.node.state.roster.RosterState roster_state_value = 13; - - /** - * A change to the tss status state singleton. - */ - com.hedera.hapi.node.state.tss.TssStatus tss_status_state_value = 14; } } @@ -892,7 +886,7 @@ message MapChangeValue { /** * The value of a map that stores tss encryption keys for each node. */ - com.hedera.hapi.services.auxiliary.tss.TssEncryptionKeyTransactionBody tss_encryption_key_value = 20; + com.hedera.hapi.node.state.tss.TssEncryptionKeys tss_encryption_keys_value = 20; /** * The value of a map that stores tss messages submitted for each share of nodes. diff --git a/hapi/hedera-protobufs/block/stream/output/transaction_output.proto b/hapi/hedera-protobufs/block/stream/output/transaction_output.proto index 7730c60f86c2..308bf005cfbb 100644 --- a/hapi/hedera-protobufs/block/stream/output/transaction_output.proto +++ b/hapi/hedera-protobufs/block/stream/output/transaction_output.proto @@ -51,7 +51,7 @@ import "stream/output/smart_contract_service.proto"; * >> Only a few transactions produce output that is not in the transaction * >> and also not reflected in state changes. All other transaction types * >> are _currently_ not included here. We have, however, allocated names - * >> and indexes for those transaction types to preserve consistency if we + * >> for those transaction types to preserve consistency if we * >> add them later. * *