Building the Codename One Netbeans plugin.

118 views
Skip to first unread message

Codrut Gusoi

unread,
Aug 8, 2015, 10:39:11 AM8/8/15
to CodenameOne Discussions
I figured the discussion forum is a better place than GitHub issues for this. Continuing from: https://github.com/codenameone/CodenameOne/issues/1561  
I commented out these lines:
diff --git a/CodenameOne/build.xml b/CodenameOne/build.xml
index eea4b2a..f0da628 100644
--- a/CodenameOne/build.xml
+++ b/CodenameOne/build.xml
@@ -118,14 +118,14 @@
             comment="This file is automatically generated - DO NOT EDIT">        
             <entry key="build" value="${tstamp}"/>
         </propertyfile>
-        <propertyfile file="../../CodenameOne/NBPlugin/CodenameOnePlugin/src/version.properties"
+<!--        <propertyfile file="../../CodenameOne/NBPlugin/CodenameOnePlugin/src/version.properties"
             comment="This file is automatically generated - DO NOT EDIT">        
             <entry key="build" value="${tstamp}"/>
         </propertyfile>
         <propertyfile file="../../CodenameOne/BuildClient/src/version.properties"
             comment="This file is automatically generated - DO NOT EDIT">        
             <entry key="build" value="${tstamp}"/>
-        </propertyfile>
+        </propertyfile>-->
     </target>
     
     <target name="release" depends="jar">

But now i get:


ant -f /home/shadowolf/Projects/CodenameOne/CodenameOne -Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/built-clean.properties
Factory.init:
Factory.deps-clean:
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/built-clean.properties
Deleting directory /home/shadowolf/Projects/CodenameOne/Factory/build
Factory.clean:
Deleting directory /home/shadowolf/Projects/CodenameOne/CodenameOne/build
clean:
init:
deps-jar:
Created dir: /home/shadowolf/Projects/CodenameOne/CodenameOne/build
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/built-jar.properties
Factory.init:
Factory.deps-jar:
Created dir: /home/shadowolf/Projects/CodenameOne/Factory/build
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/built-jar.properties
Created dir: /home/shadowolf/Projects/CodenameOne/Factory/build/classes
Created dir: /home/shadowolf/Projects/CodenameOne/Factory/build/empty
Created dir: /home/shadowolf/Projects/CodenameOne/Factory/build/generated-sources/ap-source-output
Compiling 1 source file to /home/shadowolf/Projects/CodenameOne/Factory/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
Factory.compile:
Created dir: /home/shadowolf/Projects/CodenameOne/Factory/dist
Building jar: /home/shadowolf/Projects/CodenameOne/Factory/dist/Factory.jar
Factory.jar:
Created dir: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/classes
stamp:
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOneDesigner/src/version.properties
Created dir: /home/shadowolf/Projects/CodenameOne/CodenameOne/build/empty
Compiling 458 source files to /home/shadowolf/Projects/CodenameOne/CodenameOne/build/classes
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
/home/shadowolf/Projects/CodenameOne/CodenameOne/nbproject/build-impl.xml:931: The following error occurred while executing this line:
/home/shadowolf/Projects/CodenameOne/CodenameOne/nbproject/build-impl.xml:303: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

Also when opening the project I get:



Shai Almog

unread,
Aug 8, 2015, 11:54:25 PM8/8/15
to CodenameOne Discussions
Check out the cn1-binaries project. It includes all the binaries required to build everything, the core vm JAR is just a set of stubs: http://github.com/codenameone/cn1-binaries

Codrut Gusoi

unread,
Aug 11, 2015, 3:10:43 PM8/11/15
to CodenameOne Discussions
Ok I've managed to build the CodenameOne.jar and I checked with a decompiler that my modifications are present there.
Now the only problem I have is how to use this CodenameOne.jar with an existing application. I've tried adding it to the https://github.com/sdwolf/AssertException/tree/master/lib folder but It does not seem to have any effect.

Shai Almog

unread,
Aug 12, 2015, 1:05:59 AM8/12/15
to CodenameOne Discussions
See: http://www.codenameone.com/blog/use-the-source.html

Generally you can just replace JavaSE.jar with the JavaSEPort build and the CodenameOne.jar to get this working.

Codrut Gusoi

unread,
Aug 17, 2015, 2:04:32 PM8/17/15
to CodenameOne Discussions
Holy flying meetballs, I finally managed to make it run, but not without some problems:
First, I had to add the JavaSE port to the Compile Tests tab in the Libraries menu (not documented in the blog post).
Then I also get the following error:

ant -f /home/shadowolf/Projects/AssertException -Dnb.internal.action.name=test -Dignore.failing.tests=true test
No GUI Entries available
init:
Deleting: /home/shadowolf/Projects/AssertException/build/built-jar.properties
deps-jar:
Updating property file: /home/shadowolf/Projects/AssertException/build/built-jar.properties
CodenameOne.init:
CodenameOne.deps-jar:
Updating property file: /home/shadowolf/Projects/AssertException/build/built-jar.properties
Factory.init:
Factory.deps-jar:
Updating property file: /home/shadowolf/Projects/AssertException/build/built-jar.properties
Factory.compile:
Factory.jar:
CodenameOne.stamp:
Updating property file: /home/shadowolf/Projects/CodenameOne/CodenameOneDesigner/src/version.properties
Compiling 6 source files to /home/shadowolf/Projects/CodenameOne/CodenameOne/build/classes

warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /home/shadowolf/Projects/CodenameOne/CodenameOne/src/com/codename1/processing/HashtableContent.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/shadowolf/Projects/CodenameOne/CodenameOne/src/com/codename1/processing/HashtableContent.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
CodenameOne.compile:
Building jar: /home/shadowolf/Projects/CodenameOne/CodenameOne/dist/CodenameOne.jar
CodenameOne.jar:
JavaSE.init:
JavaSE.deps-jar:
Updating property file: /home/shadowolf/Projects/AssertException/build/built-jar.properties
DEPRECATED - The copydir task is deprecated.  Use copy instead.
Copying 1 file to /home/shadowolf/Projects/CodenameOne/Ports/JavaSE/build/classes
Expanding: /home/shadowolf/Projects/cn1-binaries/javase/sqlite-jdbc-3.7.15-M1.jar into /home/shadowolf/Projects/CodenameOne/Ports/JavaSE/build/classes
JavaSE.compile:
Building jar: /home/shadowolf/Projects/CodenameOne/Ports/JavaSE/dist/JavaSE.jar
To run this application from the command line without Ant, try:
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -cp /home/shadowolf/Projects/cn1-binaries/javase/sqlitejdbc-v056.jar:/home/shadowolf/Projects/CodenameOne/CodenameOne/dist/CodenameOne.jar:/home/shadowolf/Projects/cn1-binaries/jfxrt.jar:/home/shadowolf/Projects/CodenameOne/Ports/JavaSE/dist/JavaSE.jar com.codename1.impl.javase.Simulator
JavaSE.jar:
Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
        code size and wider device support
compile:
Copying 1 file to /home/shadowolf/Projects/AssertException/build
Not copying library /home/shadowolf/Projects/AssertException/native/internal_tmp , it's a directory.
Copy libraries to /home/shadowolf/Projects/AssertException/dist/lib.
To run this application from the command line without Ant, try:
java -jar "/home/shadowolf/Projects/AssertException/dist/AssertException.jar"
jar:
compile-test:
Building jar: /home/shadowolf/Projects/AssertException/dist/unitTests.jar
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Preparing to execute 1 tests
java.lang.NullPointerException: in is null
at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:101)
at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:80)
at com.codename1.impl.javase.JavaSEPort.loadSkinFile(JavaSEPort.java:1232)
at com.codename1.impl.javase.JavaSEPort.loadSkinFile(JavaSEPort.java:2555)
at com.codename1.impl.javase.JavaSEPort.init(JavaSEPort.java:2686)
at com.codename1.impl.CodenameOneImplementation.initImpl(CodenameOneImplementation.java:163)
at com.codename1.ui.Display.init(Display.java:563)
at com.codename1.impl.javase.TestExecuter.runTest(TestExecuter.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.codename1.impl.javase.TestRunner.init(TestRunner.java:153)
at com.codename1.impl.javase.TestRunner.main(TestRunner.java:202)
[main] 0:0:0,0 - Starting test case FooTest
[main] 0:0:0,1 - Test prepared for execution on EDT
[main] 0:0:0,28 - FooTest passed
All tests passed. Total 1 tests passed
test:
BUILD SUCCESSFUL (total time: 2 seconds) 

Probabily related to the fact that I had to comment the following lines in order to build JavaSE:

diff --git a/Ports/JavaSE/build.xml b/Ports/JavaSE/build.xml
index 821313a..df43224 100644
--- a/Ports/JavaSE/build.xml
+++ b/Ports/JavaSE/build.xml
@@ -137,8 +137,8 @@
         </zip>
     </target>    
     
-    <target name="-pre-compile">
-        <!-- run manually the build-skins target to generate the skins-->
+<!--    <target name="-pre-compile">
+         run manually the build-skins target to generate the skins
         <copy file="../../../codenameone-skins/torch.skin" todir="src" />
         <copy file="../../../codenameone-skins/lumia.skin" todir="src" />
         <copy file="../../../codenameone-skins/android.skin" todir="src" />
@@ -149,7 +149,7 @@
         <copy file="../../../codenameone-skins/iphone4_os7.skin" tofile="src/iphone4.skin" />
         <copy file="../../../codenameone-skins/iphone5_os7.skin" tofile="src/iphone5.skin" />
         <copy file="../../../codenameone-skins/xoom.skin" todir="src" />
-    </target>
+    </target>-->
     
     <target name="-post-compile">
         <copydir src="${project.CodenameOne}/build/classes" dest="build/classes" />

I will create a pull request with the changes now that I could test them live.
Is it ok if I also create a pull request with a "contribution guide" in the project's README.md file?

Shai Almog

unread,
Aug 18, 2015, 12:03:02 AM8/18/15
to CodenameOne Discussions
I told you to copy the .skin files from an existing jar or run the build_skins ant target either one of which would have solved the issue with JavaSE.
The guide predated test support so it doesn't mention that.

Reply all
Reply to author
Forward
0 new messages