< prev index next >
modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/PackagerLib.java
Print this page
rev 9619 : imported patch 9-jake-fxpackager.patch
*** 26,36 ****
package com.sun.javafx.tools.packager;
import com.oracle.tools.packager.Bundlers;
import com.oracle.tools.packager.ConfigException;
import com.oracle.tools.packager.Log;
- import com.oracle.tools.packager.RelativeFileSet;
import com.oracle.tools.packager.UnsupportedPlatformException;
import com.sun.javafx.tools.packager.JarSignature.InputStreamSource;
import com.sun.javafx.tools.packager.bundlers.BundleParams;
import com.sun.javafx.tools.packager.bundlers.Bundler.BundleType;
import com.sun.javafx.tools.resource.PackagerResource;
--- 26,35 ----
*** 313,347 ****
}
try {
BundleParams bp = deployParams.getBundleParams();
if (bp != null) {
! generateNativeBundles(deployParams.outdir, bp.getBundleParamsAsMap(), "JNLP", "jnlp");
! generateNativeBundles(new File(deployParams.outdir, "bundles"), bp.getBundleParamsAsMap(), deployParams.getBundleType().toString(), deployParams.getTargetFormat());
}
} catch (PackagerException ex) {
throw ex;
} catch (Exception ex) {
throw new PackagerException(ex, "ERR_DeployFailed", ex.getMessage());
}
}
private void generateNativeBundles(File outdir, Map<String, ? super Object> params, String bundleType, String bundleFormat) throws PackagerException {
! if (params.containsKey(BundleParams.PARAM_RUNTIME)) {
! RelativeFileSet runtime = BundleParams.getRuntime(params);
! if (runtime == null) {
! com.oracle.tools.packager.Log.info(bundle.getString("MSG_NoJREPackaged"));
! } else {
! com.oracle.tools.packager.Log.info(MessageFormat.format(bundle.getString("MSG_UserProvidedJRE"), runtime.getBaseDirectory().getAbsolutePath()));
! if (com.oracle.tools.packager.Log.isDebug()) {
! runtime.dump();
! }
! }
! } else {
! com.oracle.tools.packager.Log.info(bundle.getString("MSG_UseSystemJRE"));
! }
for (com.oracle.tools.packager.Bundler bundler : Bundlers.createBundlersInstance().getBundlers(bundleType)) {
// if they specify the bundle format, require we match the ID
if (bundleFormat != null && !bundleFormat.equalsIgnoreCase(bundler.getID())) continue;
--- 312,352 ----
}
try {
BundleParams bp = deployParams.getBundleParams();
if (bp != null) {
! if (deployParams.getBundleType().equals(BundleType.ALL) && deployParams.getTargetFormat() == null) {
! // generate everything.
!
! // generate JNLP in the main directory
! generateNativeBundles(deployParams.outdir, bp.getBundleParamsAsMap(), BundleType.JNLP.toString(), "jnlp");
! // generate the rest in .../bundles
!
! // generate disk images
! generateNativeBundles(new File(deployParams.outdir, "bundles"), bp.getBundleParamsAsMap(), BundleType.IMAGE.toString(), deployParams.getTargetFormat());
!
! //TODO generate installers referencing disk image
! // for now just generate all images
! generateNativeBundles(new File(deployParams.outdir, "bundles"), bp.getBundleParamsAsMap(), BundleType.INSTALLER.toString(), deployParams.getTargetFormat());
! } else if (deployParams.getBundleType().equals(BundleType.NONE) && deployParams.getTargetFormat() == null) {
! // old school default. Just generate JNLP.
! generateNativeBundles(deployParams.outdir, bp.getBundleParamsAsMap(), BundleType.JNLP.toString(), "jnlp");
! } else {
! // a specefic output format, just generate that.
! generateNativeBundles(deployParams.outdir, bp.getBundleParamsAsMap(), deployParams.getBundleType().toString(), deployParams.getTargetFormat());
! }
}
} catch (PackagerException ex) {
throw ex;
} catch (Exception ex) {
throw new PackagerException(ex, "ERR_DeployFailed", ex.getMessage());
}
}
private void generateNativeBundles(File outdir, Map<String, ? super Object> params, String bundleType, String bundleFormat) throws PackagerException {
! //FIXME //TODO check for system JRE
for (com.oracle.tools.packager.Bundler bundler : Bundlers.createBundlersInstance().getBundlers(bundleType)) {
// if they specify the bundle format, require we match the ID
if (bundleFormat != null && !bundleFormat.equalsIgnoreCase(bundler.getID())) continue;
*** 521,531 ****
final File tmpFile = File.createTempFile("javac", "sources", new File("."));
tmpFile.deleteOnExit();
try (FileWriter sources = new FileWriter(tmpFile)) {
scanAndCopy(new PackagerResource(new File(srcDirName), "."), sources, compiledDir);
}
! String classpath = jfxHome + "/../rt/lib/ext/jfxrt.jar";
if (makeAllParams.classpath != null) {
classpath += File.pathSeparator + makeAllParams.classpath;
}
if (makeAllParams.verbose) {
System.out.println("Executing javac:");
--- 526,536 ----
final File tmpFile = File.createTempFile("javac", "sources", new File("."));
tmpFile.deleteOnExit();
try (FileWriter sources = new FileWriter(tmpFile)) {
scanAndCopy(new PackagerResource(new File(srcDirName), "."), sources, compiledDir);
}
! String classpath = jfxHome + "/../lib/jfxrt.jar";
if (makeAllParams.classpath != null) {
classpath += File.pathSeparator + makeAllParams.classpath;
}
if (makeAllParams.verbose) {
System.out.println("Executing javac:");
*** 829,839 ****
classUrl = classUrl.substring(0, classUrl.lastIndexOf("!"));
// Strip everything after the last "/" or "\" to get rid of the jar filename
int lastIndexOfSlash = Math.max(classUrl.lastIndexOf("/"), classUrl.lastIndexOf("\\"));
return classUrl.substring(0, lastIndexOfSlash)
! + "/../rt/lib/ext/jfxrt.jar!/";
}
private Class loadClassFromRuntime(String className) throws PackagerException {
try {
ClassLoader cl = getClassLoader();
--- 834,844 ----
classUrl = classUrl.substring(0, classUrl.lastIndexOf("!"));
// Strip everything after the last "/" or "\" to get rid of the jar filename
int lastIndexOfSlash = Math.max(classUrl.lastIndexOf("/"), classUrl.lastIndexOf("\\"));
return classUrl.substring(0, lastIndexOfSlash)
! + "/../lib/jfxrt.jar!/";
}
private Class loadClassFromRuntime(String className) throws PackagerException {
try {
ClassLoader cl = getClassLoader();
< prev index next >