33
33
import processing .app .exec .ProcessResult ;
34
34
import processing .core .PApplet ;
35
35
import processing .mode .java .JavaBuild ;
36
+ import sun .security .tools .JarSigner ;
36
37
37
38
import java .io .*;
38
39
@@ -273,7 +274,7 @@ public File exportProject() throws IOException, SketchException {
273
274
return null ;
274
275
}
275
276
276
- public File exportPackage () throws IOException , SketchException , InterruptedException {
277
+ public File exportPackage () throws Exception {
277
278
File projectFolder = build ("release" );
278
279
if (projectFolder == null ) return null ;
279
280
@@ -285,7 +286,7 @@ public File exportPackage() throws IOException, SketchException, InterruptedExce
285
286
return new File (exportFolder , "/bin/" );
286
287
}
287
288
288
- private File signPackage () throws IOException , InterruptedException {
289
+ private File signPackage () throws Exception {
289
290
File keyStore = getKeyStore ();
290
291
if (keyStore == null ) return null ;
291
292
@@ -297,9 +298,6 @@ private File signPackage() throws IOException, InterruptedException {
297
298
String password = "generatedpasswordhere" ;
298
299
299
300
String [] args = {
300
- System .getProperty ("java.home" ) + System .getProperty ("file.separator" ) + ".."
301
- + System .getProperty ("file.separator" ) + "bin"
302
- + System .getProperty ("file.separator" ) + "jarsigner" ,
303
301
"-sigalg" , "SHA1withRSA" ,
304
302
"-digestalg" , "SHA1" ,
305
303
"-keypass" , password ,
@@ -309,8 +307,8 @@ private File signPackage() throws IOException, InterruptedException {
309
307
sketch .getName ()
310
308
};
311
309
312
- Process signingProcess = Runtime . getRuntime (). exec ( args );
313
- signingProcess . waitFor ( );
310
+ // TODO remove hardcoded tools.jar path from build.xml
311
+ JarSigner . main ( args );
314
312
315
313
if (verifySignedPackage (unsignedPackage )) {
316
314
File signedPackage = new File (sketch .getFolder (), "android/bin/" + sketch .getName () + "-release-signed.apk" );
0 commit comments