Skip to content

Commit

Permalink
Updated launchers with versions that will launch in process. Added su…
Browse files Browse the repository at this point in the history
…pport for fork attribute in app.xml which, when set to false, explicitly, will trigger the launcher to launch in process instead of launching a new process.
  • Loading branch information
shannah committed Jan 22, 2022
1 parent 64bf78a commit eb4f50c
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cli/src/main/java/ca/weblite/jdeploy/JDeploy.java
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,8 @@ private void loadAppInfo(AppInfo appInfo) throws IOException {
appInfo.setMacAppBundleId(getString("macAppBundleId", null));
appInfo.setTitle(getString("displayName", appInfo.getNpmPackage()));
appInfo.setNpmAllowPrerelease("true".equals(getenv("JDEPLOY_BUNDLE_PRERELEASE", getString("prerelease", "false"))));
appInfo.setFork("true".equals(getString("fork", "false")));

if (rj().getAsBoolean("codesign") && rj().getAsBoolean("notarize")) {
appInfo.setCodeSignSettings(AppInfo.CodeSignSettings.CodeSignAndNotarize);
} else if (rj().getAsBoolean("codesign")) {
Expand Down
3 changes: 2 additions & 1 deletion installer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"bundles" : ["mac", "win", "linux"],
"macAppBundleId" : "HRNMHC7527.ca.weblite.jdeploy.installer",
"codesign" : true,
"notarize" : false
"notarize" : false,
"fork" : true
},
"dependencies": {"shelljs": "^0.8.4"},
"license": "ISC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ private void loadAppInfo() throws IOException {
appInfo.setAppURL(appXml.toURI().toURL());
appInfo.setTitle(ifEmpty(root.getAttribute("title"), root.getAttribute("package"), null));
appInfo.setNpmPackage(ifEmpty(root.getAttribute("package"), null));
appInfo.setFork(false);

String installerVersion = ifEmpty(root.getAttribute("version"), "latest");

Expand Down
2 changes: 1 addition & 1 deletion jar-runner/src/JarRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void run(File jarFile, String[] args) throws Exception {
//URLClassLoader classPathLoader = new URLClassLoader(classURLs.toArray(new URL[classURLs.size()]));
//Thread.currentThread().setContextClassLoader(classPathLoader);

Class clsMain = JarRunner.class.getClassLoader().loadClass(mainClass);
Class clsMain = Thread.currentThread().getContextClassLoader().loadClass(mainClass);
Method mainMethod = clsMain.getMethod("main", String[].class);
mainMethod.invoke(null, (Object)args);
}
Expand Down
9 changes: 9 additions & 0 deletions shared/src/main/java/ca/weblite/jdeploy/app/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class AppInfo {
private String npmVersion;
private boolean npmAllowPrerelease;
private String jdeployBundleCode;
private boolean fork;



Expand Down Expand Up @@ -225,6 +226,14 @@ public void setJdeployBundleCode(String jdeployBundleCode) {
this.jdeployBundleCode = jdeployBundleCode;
}

public boolean isFork() {
return fork;
}

public void setFork(boolean fork) {
this.fork = fork;
}


public static enum Updates {
Auto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class AppDescription {
private String npmPackage;
private String npmVersion;
private boolean npmPrerelease;
private boolean fork;
private String url;
private List<Jar> jars;
private String name;
Expand Down Expand Up @@ -227,4 +228,12 @@ public boolean isNpmPrerelease() {
public void setNpmPrerelease(boolean npmPrerelease) {
this.npmPrerelease = npmPrerelease;
}

public boolean isFork() {
return fork;
}

public void setFork(boolean fork) {
this.fork = fork;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static BundlerResult runit(AppInfo appInfo, String url,
AppDescription app = new AppDescription();
app.setNpmPrerelease(appInfo.isNpmAllowPrerelease());
app.setName(appInfo.getTitle());
app.setFork(appInfo.isFork());
URL iconURL = URLUtil.url(appInfo.getAppURL(), "icon.png");
app.setIconDataURI(toDataURI(iconURL));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ private static void processAppXml(AppDescription app, File dest) throws Exceptio
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease()+""
"prerelease", app.isNpmPrerelease()+"",
"fork", ""+app.isFork()
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ private static void processAppXml(AppDescription app, File contentsDir) throws E
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease() ? "true" : "false"
"prerelease", app.isNpmPrerelease() ? "true" : "false",
"fork", ""+app.isFork()
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ private static void processAppXml(AppDescription app, File dest) throws Exceptio
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease()+""
"prerelease", app.isNpmPrerelease()+"",
"fork", ""+app.isFork()
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit eb4f50c

Please sign in to comment.