@@ -391,6 +391,7 @@ public String preprocess(File srcFolder,
391391 * for libraries that begin with a prefix like javax, since that includes
392392 * the OpenGL library, even though we're just returning true here, hrm...
393393 */
394+ @ SuppressWarnings ("RedundantIfStatement" )
394395 protected boolean ignorableImport (String pkg ) {
395396 if (pkg .startsWith ("java." )) return true ;
396397 if (pkg .startsWith ("javax." )) return true ;
@@ -572,59 +573,78 @@ protected boolean exportApplication() throws IOException, SketchException {
572573 return false ;
573574 }
574575
575- File folder = null ;
576- for (String platformName : PConstants .platformNames ) {
577- // int platform = Platform.getIndex(platformName);
576+ /*
577+ for (StringDict.Entry entry : Platform.getSupportedVariants().entries()) {
578+ String variant = entry.key;
579+ String name = entry.value;
580+ }
581+ */
578582
583+ final String hostVariant = Platform .getVariant ();
584+ for (String variant : Preferences .get ("export.variants" ).split ("," )) {
579585 // Can only embed Java on the native platform
580- boolean embedJava = ( platform == PApplet . platform ) &&
586+ boolean embedJava = variant . equals ( hostVariant ) &&
581587 Preferences .getBoolean ("export.application.embed_java" );
582588
583- if (Preferences .getBoolean (JavaEditor .EXPORT_PREFIX + platformName )) {
584- final int bits = Platform .getNativeBits ();
585- final String arch = Platform .getNativeArch ();
586-
587- if (Library .hasMultipleArch (platform , importedLibraries )) {
588- // removing 32-bit export for 4.0 alpha 3
589- /*
590- // Don't try to export 32-bit on macOS, because it doesn't exist.
591- if (platform != PConstants.MACOS) {
592- // export the 32-bit version
593- folder = new File(sketch.getFolder(), "application." + platformName + "32");
594- if (!exportApplication(folder, platform, "32", embedJava && (bits == 32) && ("x86".equals(arch) || "i386".equals(arch)))) {
595- return false;
596- }
597- }
598- */
599- // export the 64-bit version
600- //folder = new File(sketch.getFolder(), "application." + platformName + "64");
601- // No longer including the 64 suffix in 4.0a3 because it's all 64-bit
602- folder = new File (sketch .getFolder (), "application." + platformName );
603- if (!exportApplication (folder , platform , "64" , embedJava && (bits == 64 ) && "amd64" .equals (arch ))) {
604- return false ;
605- }
606- /*
607- if (platform == PConstants.LINUX) {
608- // export the arm versions as well
609- folder = new File(sketch.getFolder(), "application.linux-armv6hf");
610- if (!exportApplication(folder, platform, "armv6hf", embedJava && (bits == 32) && "arm".equals(arch))) {
611- return false;
612- }
613- folder = new File(sketch.getFolder(), "application.linux-arm64");
614- if (!exportApplication(folder, platform, "arm64", embedJava && (bits == 64) && "aarch64".equals(arch))) {
615- return false;
616- }
617- }
618- */
619- } else { // just make a single one for this platform
620- folder = new File (sketch .getFolder (), "application." + platformName );
621- if (!exportApplication (folder , platform , "" , embedJava )) {
622- return false ;
623- }
624- }
589+ File folder = new File (sketch .getFolder (), variant );
590+ if (!exportApplication (folder , variant , embedJava )) {
591+ return false ;
625592 }
626593 }
627594
595+ // File folder = null;
596+ // for (String platformName : PConstants.platformNames) {
597+ //// int platform = Platform.getIndex(platformName);
598+ //
599+ // // Can only embed Java on the native platform
600+ // boolean embedJava = (platform == PApplet.platform) &&
601+ // Preferences.getBoolean("export.application.embed_java");
602+ //
603+ // if (Preferences.getBoolean(JavaEditor.EXPORT_PREFIX + platformName)) {
604+ // final int bits = Platform.getNativeBits();
605+ // final String arch = Platform.getNativeArch();
606+ //
607+ // if (Library.hasMultipleArch(platform, importedLibraries)) {
608+ // // removing 32-bit export for 4.0 alpha 3
609+ // /*
610+ // // Don't try to export 32-bit on macOS, because it doesn't exist.
611+ // if (platform != PConstants.MACOS) {
612+ // // export the 32-bit version
613+ // folder = new File(sketch.getFolder(), "application." + platformName + "32");
614+ // if (!exportApplication(folder, platform, "32", embedJava && (bits == 32) && ("x86".equals(arch) || "i386".equals(arch)))) {
615+ // return false;
616+ // }
617+ // }
618+ // */
619+ // // export the 64-bit version
620+ // //folder = new File(sketch.getFolder(), "application." + platformName + "64");
621+ // // No longer including the 64 suffix in 4.0a3 because it's all 64-bit
622+ // folder = new File(sketch.getFolder(), "application." + platformName);
623+ // if (!exportApplication(folder, platform, "64", embedJava && (bits == 64) && "amd64".equals(arch))) {
624+ // return false;
625+ // }
626+ // /*
627+ // if (platform == PConstants.LINUX) {
628+ // // export the arm versions as well
629+ // folder = new File(sketch.getFolder(), "application.linux-armv6hf");
630+ // if (!exportApplication(folder, platform, "armv6hf", embedJava && (bits == 32) && "arm".equals(arch))) {
631+ // return false;
632+ // }
633+ // folder = new File(sketch.getFolder(), "application.linux-arm64");
634+ // if (!exportApplication(folder, platform, "arm64", embedJava && (bits == 64) && "aarch64".equals(arch))) {
635+ // return false;
636+ // }
637+ // }
638+ // */
639+ // } else { // just make a single one for this platform
640+ // folder = new File(sketch.getFolder(), "application." + platformName);
641+ // if (!exportApplication(folder, platform, "", embedJava)) {
642+ // return false;
643+ // }
644+ // }
645+ // }
646+ // }
647+
628648 return true ; // all good
629649 }
630650
@@ -646,8 +666,10 @@ protected boolean exportApplication(File destFolder,
646666 }
647667 }
648668
649- /// prep the output directory
650669
670+ /// getting started
671+
672+ int exportPlatform = Platform .getIndex (exportVariant );
651673 mode .prepareExportFolder (destFolder );
652674
653675
@@ -781,7 +803,7 @@ protected boolean exportApplication(File destFolder,
781803 /// add contents of 'library' folders to the export
782804 for (Library library : importedLibraries ) {
783805 // add each item from the library folder / export list to the output
784- for (File exportFile : library .getApplicationExports (exportPlatform , exportVariant )) {
806+ for (File exportFile : library .getApplicationExports (exportVariant )) {
785807 String exportName = exportFile .getName ();
786808 if (!exportFile .exists ()) {
787809 System .err .println (exportFile .getName () +
0 commit comments