From b7ca8604176b4e34439fea1530e93fae7aa2e6f2 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 14 Nov 2022 19:23:13 -0800 Subject: [PATCH] [build] Use build cache for sign step (#4635) The signing step does not get passed the username and password to the server, so it will just read from the build cache. Then to make sure the tasks are all updated correctly, use if developerid exists as a property to all sign tasks, so it will see the new variable value, and relink. Additionally only update the archives during signing, which will speed up signing. --- .github/workflows/gradle.yml | 2 +- build.gradle | 6 ++++-- datalogtool/publish.gradle | 2 ++ glass/publish.gradle | 2 ++ outlineviewer/publish.gradle | 2 ++ roborioteamnumbersetter/publish.gradle | 2 ++ 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bab5d67798..622a79e9bc 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -111,7 +111,7 @@ jobs: ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - name: Sign Libraries with Developer ID - run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + run: ./gradlew copyAllOutputs --build-cache -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} if: | matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) diff --git a/build.gradle b/build.gradle index ad0eb6b067..29f578034c 100644 --- a/build.gradle +++ b/build.gradle @@ -136,8 +136,10 @@ subprojects { } // Sign outputs with Developer ID - if (project.hasProperty("developerID")) { - tasks.withType(AbstractLinkTask) { task -> + tasks.withType(AbstractLinkTask) { task -> + task.inputs.property "HasDeveloperId", project.hasProperty("developerID") + + if (project.hasProperty("developerID")) { // Don't sign any executables because codesign complains // about relative rpath. if (!(task instanceof LinkExecutable)) { diff --git a/datalogtool/publish.gradle b/datalogtool/publish.gradle index 9608bef7b6..e8228429fb 100644 --- a/datalogtool/publish.gradle +++ b/datalogtool/publish.gradle @@ -37,6 +37,8 @@ model { into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } + inputs.property "HasDeveloperId", project.hasProperty("developerID") + doLast { if (project.hasProperty("developerID")) { // Get path to binary. diff --git a/glass/publish.gradle b/glass/publish.gradle index b127c11321..5e7cbaf7d5 100644 --- a/glass/publish.gradle +++ b/glass/publish.gradle @@ -92,6 +92,8 @@ model { into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } + inputs.property "HasDeveloperId", project.hasProperty("developerID") + doLast { if (project.hasProperty("developerID")) { // Get path to binary. diff --git a/outlineviewer/publish.gradle b/outlineviewer/publish.gradle index 85bb26c69a..9c53ae5b60 100644 --- a/outlineviewer/publish.gradle +++ b/outlineviewer/publish.gradle @@ -37,6 +37,8 @@ model { into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } + inputs.property "HasDeveloperId", project.hasProperty("developerID") + doLast { if (project.hasProperty("developerID")) { // Get path to binary. diff --git a/roborioteamnumbersetter/publish.gradle b/roborioteamnumbersetter/publish.gradle index 10b9de1d0f..da6a0f6d63 100644 --- a/roborioteamnumbersetter/publish.gradle +++ b/roborioteamnumbersetter/publish.gradle @@ -37,6 +37,8 @@ model { into("MacOS") { with copySpec { from binary.executable.file } } into("Resources") { with copySpec { from icon } } + inputs.property "HasDeveloperId", project.hasProperty("developerID") + doLast { if (project.hasProperty("developerID")) { // Get path to binary.