1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-10 06:20:27 -04:00

Build self-contained APP bundle (non-MAS)

This commit is contained in:
Reinhard Pointner 2018-06-12 03:48:52 +07:00
parent f932ac3901
commit 155c5cd5f9
3 changed files with 18 additions and 12 deletions

View File

@ -567,7 +567,7 @@
<get-macos-jre dest="${dir.staging}" /> <get-macos-jre dest="${dir.staging}" />
<bundleapp jvmrequired="${jvm.version}" minimumsystemversion="${mac.version}" outputdirectory="${dir.staging}" executablename="filebot.launcher" name="${application.name}" displayname="${application.name}.launcher" version="${revision}" shortversion="${application.version}" identifier="${package.identifier}" mainclassname="${main.class}" icon="${dir.installer}/app/filebot.icns" copyright="${tstamp.year} ${package.company}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true"> <bundleapp jvmrequired="${jvm.version}" minimumsystemversion="${mac.version}" outputdirectory="${dir.staging}" executablename="filebot.launcher" name="${application.name}" displayname="${application.name}.launcher" version="${revision}" shortversion="${application.version}" identifier="${package.identifier}" mainclassname="${main.class}" icon="${dir.installer}/icons/filebot.icns" copyright="${tstamp.year} ${package.company}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true">
<arch name="x86_64" /> <arch name="x86_64" />
<runtime dir="${dir.staging}/jre-${java.version}.jre/Contents/Home"> <runtime dir="${dir.staging}/jre-${java.version}.jre/Contents/Home">
<include name="**/*" /> <include name="**/*" />

View File

@ -114,9 +114,11 @@ public class Main {
// CLI mode => run command-line interface and then exit // CLI mode => run command-line interface and then exit
if (args.runCLI()) { if (args.runCLI()) {
// just import and print license when running with --license option // just import and print license when running with --license option
if (LICENSE.isFile() && args.getLicenseFile() != null) { if (LICENSE.isFile()) {
configureLicense(args); args.getLicenseFile().ifPresent(f -> {
configureLicense(f);
System.exit(0); System.exit(0);
});
} }
int status = new ArgumentProcessor().run(args); int status = new ArgumentProcessor().run(args);
@ -162,9 +164,9 @@ public class Main {
} }
} }
private static void configureLicense(ArgumentBean args) { private static void configureLicense(File f) {
try { try {
License license = License.configure(args.getLicenseFile()); License license = License.configure(f);
log.info(license + " has been activated."); log.info(license + " has been activated.");
} catch (Throwable e) { } catch (Throwable e) {
log.severe("License Error: " + e.getMessage()); log.severe("License Error: " + e.getMessage());
@ -180,9 +182,7 @@ public class Main {
if (LICENSE.isFile()) { if (LICENSE.isFile()) {
// import license if launched with license file // import license if launched with license file
if (args.getLicenseFile() != null) { args.getLicenseFile().ifPresent(f -> configureLicense(f));
configureLicense(args);
}
// make sure license is validated and cached // make sure license is validated and cached
try { try {
@ -252,7 +252,13 @@ public class Main {
// configure main window // configure main window
if (isMacApp()) { if (isMacApp()) {
// Mac specific configuration // Mac specific configuration
MacAppUtilities.initializeApplication(FileBotMenuBar.createHelp(), files -> SwingEventBus.getInstance().post(new FileTransferable(files))); MacAppUtilities.initializeApplication(FileBotMenuBar.createHelp(), files -> {
if (LICENSE.isFile() && files.size() == 1 && files.get(0).getName().endsWith(".psm")) {
configureLicense(files.get(0));
} else {
SwingEventBus.getInstance().post(new FileTransferable(files));
}
});
} else if (isUbuntuApp()) { } else if (isUbuntuApp()) {
// Ubuntu/Debian specific configuration // Ubuntu/Debian specific configuration
frame.setIconImages(ResourceManager.getApplicationIconImages()); frame.setIconImages(ResourceManager.getApplicationIconImages());

View File

@ -352,8 +352,8 @@ public class ArgumentBean {
}).orElseThrow(error("Illegal mode", mode)); }).orElseThrow(error("Illegal mode", mode));
} }
public File getLicenseFile() { public Optional<File> getLicenseFile() {
return license == null ? null : new File(license); return optional(license).map(File::new);
} }
private final String[] args; private final String[] args;