From ea17f90f8769ac7b751f0d33bcf874d0d2b60336 Mon Sep 17 00:00:00 2001 From: Thad House Date: Tue, 29 Aug 2023 08:57:33 -0700 Subject: [PATCH] [build] Fix tool builds with multiple arm platforms installed (#5586) --- glass/publish.gradle | 86 +++++++++++++------------- roborioteamnumbersetter/publish.gradle | 86 +++++++++++++------------- 2 files changed, 84 insertions(+), 88 deletions(-) diff --git a/glass/publish.gradle b/glass/publish.gradle index 0e46c36ad1..0797fa15ef 100644 --- a/glass/publish.gradle +++ b/glass/publish.gradle @@ -84,51 +84,8 @@ model { def applicationPath = binary.executable.file def icon = file("$project.projectDir/src/app/native/mac/glass.icns") - // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleGlassOsxApp" + binary.targetPlatform.architecture.name, Copy) { - description("Creates a macOS application bundle for Glass") - from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/Contents")) - 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. - exec { - workingDir rootDir - def args = [ - "sh", - "-c", - "codesign --force --strict --deep " + - "--timestamp --options=runtime " + - "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/" - ] - commandLine args - } - } - } - } - - // Reset the application path if we are creating a bundle. - if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") - project.build.dependsOn bundleTask - } - // Create the ZIP. - def task = project.tasks.create("copyGlassExecutable" + binary.targetPlatform.architecture.name, Zip) { + def task = project.tasks.create("copyGlassExecutable" + binary.targetPlatform.operatingSystem.name + binary.targetPlatform.architecture.name, Zip) { description("Copies the Glass executable to the outputs directory.") destinationDirectory = outputsFolder @@ -153,6 +110,47 @@ model { } if (binary.targetPlatform.operatingSystem.isMacOsX()) { + // Create the macOS bundle. + def bundleTask = project.tasks.create("bundleGlassOsxApp" + binary.targetPlatform.architecture.name, Copy) { + description("Creates a macOS application bundle for Glass") + from(file("$project.projectDir/Info.plist")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/Contents")) + 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. + exec { + workingDir rootDir + def args = [ + "sh", + "-c", + "codesign --force --strict --deep " + + "--timestamp --options=runtime " + + "--verbose -s ${project.findProperty("developerID")} " + + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/" + ] + commandLine args + } + } + } + } + + // Reset the application path if we are creating a bundle. + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") + project.build.dependsOn bundleTask + bundleTask.dependsOn binary.tasks.link task.dependsOn(bundleTask) } diff --git a/roborioteamnumbersetter/publish.gradle b/roborioteamnumbersetter/publish.gradle index 77513427e6..824c2b9178 100644 --- a/roborioteamnumbersetter/publish.gradle +++ b/roborioteamnumbersetter/publish.gradle @@ -29,51 +29,8 @@ model { def applicationPath = binary.executable.file def icon = file("$project.projectDir/src/main/native/mac/rtns.icns") - // Create the macOS bundle. - def bundleTask = project.tasks.create("bundleroboRIOTeamNumberSetterOsxApp" + binary.targetPlatform.architecture.name, Copy) { - description("Creates a macOS application bundle for roboRIO Team Number Setter") - from(file("$project.projectDir/Info.plist")) - into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/Contents")) - 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. - exec { - workingDir rootDir - def args = [ - "sh", - "-c", - "codesign --force --strict --deep " + - "--timestamp --options=runtime " + - "--verbose -s ${project.findProperty("developerID")} " + - "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/" - ] - commandLine args - } - } - } - } - - // Reset the application path if we are creating a bundle. - if (binary.targetPlatform.operatingSystem.isMacOsX()) { - applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") - project.build.dependsOn bundleTask - } - // Create the ZIP. - def task = project.tasks.create("copyroboRIOTeamNumberSetterExecutable" + binary.targetPlatform.architecture.name, Zip) { + def task = project.tasks.create("copyroboRIOTeamNumberSetterExecutable" + binary.targetPlatform.operatingSystem.name + binary.targetPlatform.architecture.name, Zip) { description("Copies the roboRIOTeamNumberSetter executable to the outputs directory.") destinationDirectory = outputsFolder @@ -98,6 +55,47 @@ model { } if (binary.targetPlatform.operatingSystem.isMacOsX()) { + // Create the macOS bundle. + def bundleTask = project.tasks.create("bundleroboRIOTeamNumberSetterOsxApp" + binary.targetPlatform.architecture.name, Copy) { + description("Creates a macOS application bundle for roboRIO Team Number Setter") + from(file("$project.projectDir/Info.plist")) + into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/Contents")) + 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. + exec { + workingDir rootDir + def args = [ + "sh", + "-c", + "codesign --force --strict --deep " + + "--timestamp --options=runtime " + + "--verbose -s ${project.findProperty("developerID")} " + + "$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/roboRIOTeamNumberSetter.app/" + ] + commandLine args + } + } + } + } + + // Reset the application path if we are creating a bundle. + applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name") + project.build.dependsOn bundleTask + bundleTask.dependsOn binary.tasks.link task.dependsOn(bundleTask) }