File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/main/java/edu/wpi/first/nativeutils Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 22
33import org .gradle .api .Plugin ;
44import org .gradle .api .Project ;
5+ import org .gradle .nativeplatform .tasks .AbstractLinkTask ;
6+ import org .gradle .nativeplatform .tasks .LinkExecutable ;
57
68public class WPINativeUtils implements Plugin <Project > {
79 @ Override
@@ -13,5 +15,21 @@ public void apply(Project project) {
1315 nativeExt .addWpiExtension ();
1416
1517 project .getPluginManager ().apply (RpathRules .class );
16- }
18+
19+ if (project .hasProperty ("developerID" )) {
20+ project .getTasks ().withType (AbstractLinkTask .class ).forEach ((task ) -> {
21+ // Don't sign any executables because codesign complains
22+ // about relative rpath.
23+ if (!(task instanceof LinkExecutable )) {
24+ // Get path to binary.
25+ String path = task .getLinkedFile ().getAsFile ().get ().getAbsolutePath ();
26+ ProcessBuilder builder = new ProcessBuilder ();
27+ var codesigncommand = String .format ("codesign --force --strict --timestamp --options=runtime "
28+ + "--version -s %s %s" , project .findProperty ("developerID" ), path );
29+ builder .command ("sh" , "-c" , codesigncommand );
30+ builder .directory (project .getRootDir ());
31+ }
32+ });
33+ }
34+ }
1735}
You can’t perform that action at this time.
0 commit comments