Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Revert "Revert "Add temporary workaround for code signing issues with…
Browse files Browse the repository at this point in the history
… libjffi on Apple Silicon machines.""

This reverts commit 7eabe8d.

See jnr/jffi#116 (comment)
  • Loading branch information
charleskorn committed Nov 23, 2021
1 parent e170753 commit 71689b5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Expand Up @@ -305,9 +305,6 @@ jobs:
with:
flags: linux

- name: Assemble release
run: unset JAVA_TOOL_OPTIONS && ./gradlew --parallel assembleRelease

- name: Stop Gradle daemon
run: ./gradlew --stop

Expand All @@ -329,13 +326,6 @@ jobs:
rm -f $HOME/.gradle/caches/journal-1/file-access.bin
rm -f $HOME/.gradle/caches/journal-1/*.lock
- name: Upload artifacts
uses: actions/upload-artifact@v2.2.4
with:
name: Binaries
path: build/release
if-no-files-found: error

wrapper-test-linux:
name: "Run wrapper tests (Linux)"
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -569,6 +559,9 @@ jobs:
with:
flags: mac

- name: Assemble release
run: unset JAVA_TOOL_OPTIONS && ./gradlew --parallel assembleRelease

- name: Stop Gradle daemon
run: ./gradlew --stop

Expand All @@ -590,6 +583,13 @@ jobs:
rm -f $HOME/.gradle/caches/journal-1/file-access.bin
rm -f $HOME/.gradle/caches/journal-1/*.lock
- name: Upload artifacts
uses: actions/upload-artifact@v2.2.4
with:
name: Binaries
path: build/release
if-no-files-found: error

publish-release:
name: "Publish release"
needs:
Expand Down
33 changes: 33 additions & 0 deletions app/gradle/shadow.gradle
Expand Up @@ -14,6 +14,11 @@
limitations under the License.
*/

import java.nio.file.Files
import java.nio.file.Path

def buildIsRunningOnMacOS = org.gradle.internal.os.OperatingSystem.current().isMacOsX()

// See https://github.com/johnrengelman/shadow/issues/389#issuecomment-440431318 for an explanation of this.
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
Expand All @@ -26,4 +31,32 @@ tasks.withType(Jar).configureEach {

shadowJar {
classifier = null

doLast {
if (buildIsRunningOnMacOS) {
Path workingDirectory = project.buildDir.toPath().resolve("codesigning")
Files.createDirectories(workingDirectory)

String jarPath = it.archiveFile.get()
runProcessInDirectory(workingDirectory, "jar", "xf", jarPath, "jni/Darwin/libjffi-1.2.jnilib")
runProcessInDirectory(workingDirectory, "codesign", "-s", "-", "jni/Darwin/libjffi-1.2.jnilib")
runProcessInDirectory(workingDirectory, "jar", "uf", jarPath, "jni/Darwin/libjffi-1.2.jnilib")
}
}
}

static String runProcessInDirectory(Path workingDirectory, String... args) {
def process = new ProcessBuilder(args)
.directory(workingDirectory.toFile())
.redirectErrorStream(true)
.start()

def exitCode = process.waitFor()
def output = process.inputStream.getText()

if (exitCode != 0) {
throw new RuntimeException("\"${args.join(" ")}\" failed with exit code $exitCode. Output was: $output")
}

return output.trim()
}

0 comments on commit 71689b5

Please sign in to comment.