SDK NBI Installer:

- Add distribution formats windows-x86, windows-x68, linux-x86, linux-x64, macosx
- Add way to package JDK to NBI installer
- Add workaround to standard NBI JDK packaging for OSX
- Add way to download and package Blender for all platforms when creating SDK installers
- Fix code completion in NBI projects

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10146 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 455a621384
commit e88c86e168
  1. 24
      sdk/nbi/README
  2. 1
      sdk/nbi/antlib/version
  3. 89
      sdk/nbi/stub/build.xml
  4. 987
      sdk/nbi/stub/ext/components/products/helloworld/nbproject/build-impl.xml
  5. 4
      sdk/nbi/stub/ext/components/products/helloworld/nbproject/genfiles.properties
  6. 1
      sdk/nbi/stub/ext/components/products/helloworld/nbproject/private/private.xml
  7. 4
      sdk/nbi/stub/ext/components/products/helloworld/nbproject/project.properties
  8. 44
      sdk/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java
  9. 958
      sdk/nbi/stub/ext/engine/nbproject/build-impl.xml
  10. 6
      sdk/nbi/stub/ext/engine/nbproject/genfiles.properties
  11. 4
      sdk/nbi/stub/ext/engine/nbproject/project.properties
  12. 105
      sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/actions/CopyInstallLocationAction.java
  13. 11
      sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/sequences/MainSequence.java

@ -0,0 +1,24 @@
DO NOT TRY TO FIX THE IMPORT ERRORS IN THE PROJECTS!!
See also http://platform.netbeans.org/tutorials/nbm-nbi.html#bundling
The product has to be a zip file with a single folder containing the needed files.
To make a new product item, copy an existing item by copying a folder from
stub/ext/components/products and stub/ext/infra/build/products and adapt
the properties files, especially the path to the zip file (product.data.1.path)
as well as the subfolder in the zip containing the files (product.data.sub.dir).
The folder in stub/ext/infra/build/products can be duplicated and adapted for
each platform w/o copying the main project under stub/ext/components/products.
Do not use the helloworld item as a template, this is the main item and has
some more stuff going!
Then adapt the main stub/build.xml in the -build and -clean targets by duplicating
the entries.
The existing JDK item is only used on MacOSX! On other platforms the jdk that is
bundled with the installer is used instead.
Normen

@ -14,6 +14,19 @@
<delete dir="${output.dir}"/>
<delete dir="${nbi.ext.dir}/products/helloworld/build"/>
<delete dir="${nbi.ext.dir}/products/helloworld/dist"/>
<!--normen-->
<delete dir="${nbi.ext.dir}/products/jdk/build"/>
<delete dir="${nbi.ext.dir}/products/jdk/dist"/>
<delete dir="${nbi.ext.dir}/products/blender-osx/build"/>
<delete dir="${nbi.ext.dir}/products/blender-osx/dist"/>
<delete dir="${nbi.ext.dir}/products/blender-win32/build"/>
<delete dir="${nbi.ext.dir}/products/blender-win32/dist"/>
<delete dir="${nbi.ext.dir}/products/blender-win64/build"/>
<delete dir="${nbi.ext.dir}/products/blender-win64/dist"/>
<delete dir="${nbi.ext.dir}/products/blender-linux32/build"/>
<delete dir="${nbi.ext.dir}/products/blender-linux32/dist"/>
<delete dir="${nbi.ext.dir}/products/blender-linux64/build"/>
<delete dir="${nbi.ext.dir}/products/blender-linux64/dist"/>
<delete dir="${nbi.ext.dir}/engine/build"/>
<delete dir="${nbi.ext.dir}/engine/dist"/>
@ -140,6 +153,30 @@ jarsigner.enabled=${jarsigner.enabled}
</ant>
<!--normen-->
<echo message="BUILDING MAC JDK PRODUCT =================================="/>
<ant dir="${nbi.ext.dir}/infra/build/products/jdk" target="release-all">
<property name="basedir" value="${nbi.ext.dir}/infra/build/products/jdk"/>
<property name="environment.properties" value="${environment.properties}"/>
<property name="dist.dir" value="${output.dir}/components"/>
<property name="release.parent.uid" value=""/>
<property name="release.parent.version" value=""/>
<property name="release.parent.platforms" value=""/>
<property name="engine.dist.file" value="${output.dir}/registry-temp/engine.jar"/>
</ant>
<!--normen-build blender for platforms-->
<for-each property="platform" list="${target.platforms}" separator=" ">
<echo message="BUILDING BLENDER ${platform} PRODUCT =================================="/>
<ant dir="${nbi.ext.dir}/infra/build/products/blender-${platform}" target="release-all">
<property name="basedir" value="${nbi.ext.dir}/infra/build/products/blender-${platform}"/>
<property name="environment.properties" value="${environment.properties}"/>
<property name="dist.dir" value="${output.dir}/components"/>
<property name="release.parent.uid" value=""/>
<property name="release.parent.version" value=""/>
<property name="release.parent.platforms" value=""/>
<property name="engine.dist.file" value="${output.dir}/registry-temp/engine.jar"/>
</ant>
</for-each>
</target>
<target name="-generate-bundles">
@ -160,12 +197,52 @@ jarsigner.enabled=${jarsigner.enabled}
<set property="bundle.extention" source="bundle.extention.${platform}"/>
<create-bundle root="${output.dir}/registry-temp"
platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<!--normen-->
<component uid="${main.product.uid}" version="${main.product.version}"/><!--0.8.0.0.0-->
</create-bundle>
<!--normen-->
<!-- Linux installers -->
<if property="platform" value="linux-x86">
<create-bundle root="${output.dir}/registry-temp" platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<component uid="${main.product.uid}" version="${main.product.version}"/>
<component uid="blender" version="${main.product.version}"/>
<property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.bin"/>
</create-bundle>
</if>
<if property="platform" value="linux-x64">
<create-bundle root="${output.dir}/registry-temp" platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<component uid="${main.product.uid}" version="${main.product.version}"/>
<component uid="blender" version="${main.product.version}"/>
<property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.bin"/>
</create-bundle>
</if>
<!-- Windows installers -->
<if property="platform" value="windows-x86">
<create-bundle root="${output.dir}/registry-temp" platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<component uid="${main.product.uid}" version="${main.product.version}"/>
<component uid="blender" version="${main.product.version}"/>
<property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.exe"/>
</create-bundle>
</if>
<if property="platform" value="windows-x64">
<create-bundle root="${output.dir}/registry-temp" platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<component uid="${main.product.uid}" version="${main.product.version}"/>
<component uid="blender" version="${main.product.version}"/>
<property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/jdk-${platform}.exe"/>
</create-bundle>
</if>
<!-- Mac installer -->
<if property="platform" value="macosx">
<create-bundle root="${output.dir}/registry-temp" platform="${platform}"
target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
<component uid="${main.product.uid}" version="${main.product.version}"/>
<component uid="blender" version="${main.product.version}"/>
<component uid="jdk" version="${main.product.version}"/>
<!--property name="nbi.bundled.jvm.file" value="${basedir}/../../jdks/mac_jdk.bin"/-->
</create-bundle>
</if>
<if property="bundle.extention" value="zip">
<antcall target="zip-to-tgz">
<param name="input.file" value="${bundles.release.dir}/${bundle.files.prefix}-${platform}.zip"/>

@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=b5c7f54a
nbproject/build-impl.xml.script.CRC32=815f74ea
nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
nbproject/build-impl.xml.script.CRC32=5e5a5ed4
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
</project-private>

@ -5,6 +5,7 @@ build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
@ -21,7 +22,8 @@ excludes=
includes=**
jar.compress=false
javac.classpath=\
${reference.Core_NBI_Engine.jar}
${reference.Core_NBI_Engine.jar}:\
../../../../../antlib/nbi-engine.jar
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

@ -28,6 +28,8 @@ import org.netbeans.installer.utils.StringUtils;
import org.netbeans.installer.utils.exceptions.NativeException;
import org.netbeans.installer.wizard.Wizard;
import org.netbeans.installer.wizard.components.WizardComponent;
//normen - JDK launchers
import org.netbeans.installer.utils.system.launchers.LauncherResource;
public class ConfigurationLogic extends ProductConfigurationLogic {
@ -74,7 +76,13 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
//normen: rename executable
File shortcut=new File(installLocation.getParentFile().getParent()+"/MacOS/executable");
if(shortcut.exists()){
shortcut.renameTo(new File(installLocation.getParentFile().getParent()+"/MacOS/"+appName));
try {
shortcut.renameTo(new File(installLocation.getParentFile().getParent()+"/MacOS/"+appName));
getProduct().getInstalledFiles().add(shortcut.getAbsoluteFile());
} catch (IOException e) {
LogManager.log(
"... cannot rename executable " + f, e); // NOI18N
}
}
//normen: replace icon + app in Info.plist
@ -178,7 +186,25 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
LogManager.logUnindent(
"... done"); // NOI18N
}
//normen - JDK install - uses package on OSX
if (!SystemUtils.isMacOS()) {
File javaHome = new File(System.getProperty("java.home"));
File target = new File(installLocation, "jdk");
try {
FileUtils.copyFile(javaHome, target, true); //FileUtils is one of the NBI core classes, already imported in ConfigurationLogic.java
} catch (IOException e) {
throw new InstallationException("Cannot copy JDK",e);
}
// set permissions:
File binDir = new File(target, "bin");
for (File file : binDir.listFiles()) {
try {
file.setExecutable(true);
} catch (Exception ex) { ex.printStackTrace(); }
}
// to add uninstaller logic:
SystemUtils.getNativeUtils().addUninstallerJVM(new LauncherResource(false, target));
}
}
@Override
@ -262,6 +288,20 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
}
}
//normen - JDK uninstall
if (!SystemUtils.isMacOS()) {
File jre = new File(installLocation, "jdk");
if (jre.exists()) {
try {
for (File file : FileUtils.listFiles(jre).toList()) {
FileUtils.deleteOnExit(file);
}
FileUtils.deleteOnExit(installLocation);
} catch (IOException e) {
//ignore
}
}
}
/////////////////////////////////////////////////////////////////////////////
//remove cluster/update files
/*

File diff suppressed because it is too large Load Diff

@ -3,6 +3,6 @@ build.xml.script.CRC32=f2f0e306
build.xml.stylesheet.CRC32=a12b3d02
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=32036222
nbproject/build-impl.xml.script.CRC32=ff4c3c7b
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21
nbproject/build-impl.xml.data.CRC32=a04276f0
nbproject/build-impl.xml.script.CRC32=0d96e5f4
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46

@ -44,6 +44,7 @@ build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
@ -61,7 +62,8 @@ file.reference.reglib-src=../../reglib/src
includes=**
jar.compress=false
javac.classpath=\
${reference.NBI_Engine.jar}
${reference.NBI_Engine.jar}:\
../../../antlib/nbi-engine.jar
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

@ -0,0 +1,105 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU General
* Public License Version 2 only ("GPL") or the Common Development and Distribution
* License("CDDL") (collectively, the "License"). You may not use this file except in
* compliance with the License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
* License for the specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header Notice in
* each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
* designates this particular file as subject to the "Classpath" exception as
* provided by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License Header,
* with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]"
*
* Contributor(s):
*
* The Original Software is NetBeans. The Initial Developer of the Original Software
* is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
* Rights Reserved.
*
* If you wish your version of this file to be governed by only the CDDL or only the
* GPL Version 2, indicate your decision by adding "[Contributor] elects to include
* this software in this distribution under the [CDDL or GPL Version 2] license." If
* you do not indicate a single choice of license, a recipient has the option to
* distribute your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above. However, if
* you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
* the option applies only if the new code is made subject to such option by the
* copyright holder.
*/
package org.mycompany.installer.wizard.components.actions;
import java.io.File;
import org.netbeans.installer.utils.SystemUtils;
import org.netbeans.installer.product.components.Product;
import org.netbeans.installer.utils.ResourceUtils;
import org.netbeans.installer.wizard.components.WizardAction;
/**
*
* @author Normen Hansen
*/
public class CopyInstallLocationAction extends WizardAction {
/////////////////////////////////////////////////////////////////////////////////
// Instance
final Product from, to;
public CopyInstallLocationAction(Product from, Product to) {
this.from = from;
this.to = to;
setProperty(TITLE_PROPERTY,
DEFAULT_TITLE);
setProperty(DESCRIPTION_PROPERTY,
DEFAULT_DESCRIPTION);
}
public void execute() {
File fromFile = from.getInstallationLocation();
File toFile;
String name = to.getUid();
if (SystemUtils.isMacOS()) {
toFile = new File(
fromFile.getPath() +
"/Contents/Resources/" +
fromFile.getName().replace(".app", "") +
"/" +
name);
} else {
toFile = new File(fromFile.getPath() + File.separator + name);
}
if (toFile != null) {
to.setInstallationLocation(toFile);
}
}
@Override
public boolean isCancelable() {
return false;
}
public WizardActionUi getWizardUi() {
return null; // this action does not have a ui
}
/////////////////////////////////////////////////////////////////////////////////
// Constants
public static final String DEFAULT_TITLE = ResourceUtils.getString(
CopyInstallLocationAction.class,
"IA.title"); // NOI18N
public static final String PROGRESS_TITLE_PROPERTY = ResourceUtils.getString(
CopyInstallLocationAction.class,
"IA.progress.title"); // NOI18N
public static final String DEFAULT_DESCRIPTION = ResourceUtils.getString(
CopyInstallLocationAction.class,
"IA.description"); // NOI18N
}

@ -44,6 +44,7 @@ import java.util.List;
import java.util.Map;
import org.mycompany.installer.wizard.components.panels.PostInstallSummaryPanel;
import org.mycompany.installer.wizard.components.panels.PreInstallSummaryPanel;
import org.mycompany.installer.wizard.components.actions.CopyInstallLocationAction;
import org.netbeans.installer.product.components.Product;
import org.netbeans.installer.product.Registry;
import org.netbeans.installer.utils.ResourceUtils;
@ -106,14 +107,20 @@ public class MainSequence extends WizardSequence {
if (toInstall.size() > 0) {
addChild(downloadConfigurationLogicAction);
addChild(licensesPanel);
Product initProduct = null;
for (Product product : toInstall) {
if (!productSequences.containsKey(product)) {
productSequences.put(
product,
new ProductWizardSequence(product));
}
//normen - use first product path for all projects -> no separate path
// wizards needed
if(initProduct == null){
initProduct = product;
}else{
addChild(new CopyInstallLocationAction(initProduct, product));
}
addChild(productSequences.get(product));
}
}

Loading…
Cancel
Save