Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for signing binaries #219

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ java {

allprojects {
group = "edu.wpi.first"
version = "2025.3.0"
version = "2025.4.0"

if (project.hasProperty('publishVersion')) {
version = project.publishVersion
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/edu/wpi/first/nativeutils/WPINativeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.nativeplatform.tasks.AbstractLinkTask;
import org.gradle.nativeplatform.tasks.LinkExecutable;

public class WPINativeUtils implements Plugin<Project> {
@Override
Expand All @@ -13,5 +15,21 @@ public void apply(Project project) {
nativeExt.addWpiExtension();

project.getPluginManager().apply(RpathRules.class);
}

if (project.hasProperty("developerID")) {
spacey-sooty marked this conversation as resolved.
Show resolved Hide resolved
project.getTasks().withType(AbstractLinkTask.class).forEach((task) -> {
// Don't sign any executables because codesign complains
// about relative rpath.
if (!(task instanceof LinkExecutable)) {
// Get path to binary.
String path = task.getLinkedFile().getAsFile().get().getAbsolutePath();
ProcessBuilder builder = new ProcessBuilder();
var codesigncommand = String.format("codesign --force --strict --timestamp --options=runtime "
+ "--version -s %s %s", project.findProperty("developerID"), path);
builder.command("sh", "-c", codesigncommand);
builder.directory(project.getRootDir());
}
});
}
}
}
2 changes: 1 addition & 1 deletion testing/cpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import edu.wpi.first.toolchain.NativePlatforms

plugins {
id "cpp"
id "edu.wpi.first.NativeUtils" version "2025.3.0"
id "edu.wpi.first.NativeUtils" version "2025.4.0"
}

nativeUtils.addWpiNativeUtils()
Expand Down