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 2
2
3
3
import org .gradle .api .Plugin ;
4
4
import org .gradle .api .Project ;
5
+ import org .gradle .nativeplatform .tasks .AbstractLinkTask ;
6
+ import org .gradle .nativeplatform .tasks .LinkExecutable ;
5
7
6
8
public class WPINativeUtils implements Plugin <Project > {
7
9
@ Override
@@ -13,5 +15,21 @@ public void apply(Project project) {
13
15
nativeExt .addWpiExtension ();
14
16
15
17
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
+ }
17
35
}
You can’t perform that action at this time.
0 commit comments