Browse Source

Fixes #194 - Upgrade NBAndroid to NBAndroidV2. Always add the latest update source on start.

MeFisto94 6 years ago
parent
commit
5730546e8c

+ 1 - 1
jme3-android/manifest.mf

@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 Manifest-Version: 1.0
 OpenIDE-Module: com.jme3.gde.android
 OpenIDE-Module: com.jme3.gde.android
 OpenIDE-Module-Implementation-Version: 0
 OpenIDE-Module-Implementation-Version: 0
-OpenIDE-Module-Layer: com/jme3/gde/android/layer.xml
+OpenIDE-Module-Install: com/jme3/gde/android/Installer.class
 OpenIDE-Module-Localizing-Bundle: com/jme3/gde/android/Bundle.properties
 OpenIDE-Module-Localizing-Bundle: com/jme3/gde/android/Bundle.properties
 
 

+ 4 - 4
jme3-android/nbproject/genfiles.properties

@@ -1,8 +1,8 @@
-build.xml.data.CRC32=5676c1f4
+build.xml.data.CRC32=b5a33fdd
 build.xml.script.CRC32=6461359b
 build.xml.script.CRC32=6461359b
[email protected]1.1
[email protected]2.1
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # 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.
 # 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=5676c1f4
+nbproject/build-impl.xml.data.CRC32=b5a33fdd
 nbproject/build-impl.xml.script.CRC32=abd1e01a
 nbproject/build-impl.xml.script.CRC32=abd1e01a
-nbproject/[email protected]1.1
+nbproject/[email protected]2.1

+ 12 - 2
jme3-android/nbproject/project.xml

@@ -12,7 +12,7 @@
                     <compile-dependency/>
                     <compile-dependency/>
                     <run-dependency>
                     <run-dependency>
                         <release-version>1</release-version>
                         <release-version>1</release-version>
-                        <specification-version>3.2.0</specification-version>
+                        <specification-version>3.3.0</specification-version>
                     </run-dependency>
                     </run-dependency>
                 </dependency>
                 </dependency>
                 <dependency>
                 <dependency>
@@ -42,8 +42,10 @@
                 </dependency>
                 </dependency>
                 <dependency>
                 <dependency>
                     <code-name-base>org.netbeans.modules.autoupdate.services</code-name-base>
                     <code-name-base>org.netbeans.modules.autoupdate.services</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
                     <run-dependency>
                     <run-dependency>
-                        <specification-version>1.47.2</specification-version>
+                        <specification-version>1.52.1</specification-version>
                     </run-dependency>
                     </run-dependency>
                 </dependency>
                 </dependency>
                 <dependency>
                 <dependency>
@@ -140,6 +142,14 @@
                         <specification-version>7.57.2</specification-version>
                         <specification-version>7.57.2</specification-version>
                     </run-dependency>
                     </run-dependency>
                 </dependency>
                 </dependency>
+                <dependency>
+                    <code-name-base>org.openide.modules</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.48.1</specification-version>
+                    </run-dependency>
+                </dependency>
                 <dependency>
                 <dependency>
                     <code-name-base>org.openide.nodes</code-name-base>
                     <code-name-base>org.openide.nodes</code-name-base>
                     <build-prerequisite/>
                     <build-prerequisite/>

+ 0 - 2
jme3-android/src/com/jme3/gde/android/Bundle.properties

@@ -1,4 +1,3 @@
-com_jme3_gde_android_update_center=http://nbandroid.org/release81/updates/updates.xml
 android-base=android-base
 android-base=android-base
 OpenIDE-Module-Display-Category=jMonkeyEngine
 OpenIDE-Module-Display-Category=jMonkeyEngine
 OpenIDE-Module-Name=Android Support
 OpenIDE-Module-Name=Android Support
@@ -15,4 +14,3 @@ MobileCustomizerPanel.jTextField1.toolTipText=The package name used when creatin
 MobileCustomizerPanel.jComboBox1.toolTipText=The android target platform of this project
 MobileCustomizerPanel.jComboBox1.toolTipText=The android target platform of this project
 MobileCustomizerPanel.jButton2.toolTipText=Run the android target configuration utility
 MobileCustomizerPanel.jButton2.toolTipText=Run the android target configuration utility
 MobileCustomizerPanel.jCheckBox1.toolTipText=Creates a "mobile" folder with an android project that is embedded in the build process
 MobileCustomizerPanel.jCheckBox1.toolTipText=Creates a "mobile" folder with an android project that is embedded in the build process
-Services/AutoupdateType/com_jme3_gde_android_update_center.instance=NBAndroid Updates

+ 67 - 0
jme3-android/src/com/jme3/gde/android/Installer.java

@@ -0,0 +1,67 @@
+/*
+ *  Copyright (c) 2009-2019 jMonkeyEngine
+ *  All rights reserved.
+ * 
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ * 
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ *  * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ *  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.android;
+
+import com.jme3.gde.core.errorreport.ExceptionUtils;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.netbeans.api.autoupdate.UpdateUnitProvider;
+import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
+import org.openide.modules.ModuleInstall;
+import org.openide.modules.Modules;
+
+/**
+ * The Installer is responsible for adding the correct version of NBAndroidV2 
+ * to the Update Center. It uses the exact same mechanism as the
+ * NBAndroidUpdatePlugin
+ * 
+ * @see https://github.com/NBANDROIDTEAM/NBANDROID-V2-Autoupdate-plugin/blob/master/src/main/java/org/netbeans/modules/android/update/loader/Installer.java
+ * @author MeFisto94
+ */
+public class Installer extends ModuleInstall {
+    
+    @Override
+    public void restored() {
+            String implVers = Modules.getDefault().findCodeNameBase("org.netbeans.modules.projectui").getImplementationVersion();
+            if (implVers != null) {
+                try {
+                    UpdateUnitProvider updateUnitProvider = UpdateUnitProviderFactory.getDefault()
+                                .create("NBANDROID", "NBANDROID Update Center", new URL(
+                                        String.format("http://server.arsi.sk:8080/updates/%s-updates.xml", implVers)
+                                ));
+                    updateUnitProvider.setEnable(true);
+                } catch (MalformedURLException ex) {
+                    ExceptionUtils.caughtException(ex, "Note: This could be a problem related to your internet connection/firewall etc.");
+                }
+            }
+    }
+}

+ 0 - 15
jme3-android/src/com/jme3/gde/android/layer.xml

@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
-<filesystem>
-    <folder name="Services">
-        <folder name="AutoupdateType">
-            <file name="com_jme3_gde_android_update_center.instance">
-                <attr name="displayName" bundlevalue="com.jme3.gde.android.Bundle#Services/AutoupdateType/com_jme3_gde_android_update_center.instance"/>
-                <attr name="enabled" boolvalue="true"/>
-                <attr name="instanceCreate" methodvalue="org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogFactory.createUpdateProvider"/>
-                <attr name="instanceOf" stringvalue="org.netbeans.spi.autoupdate.UpdateProvider"/>
-                <attr name="url" bundlevalue="com.jme3.gde.android.Bundle#com_jme3_gde_android_update_center"/>
-            </file>
-        </folder>
-    </folder>
-</filesystem>