Build: Applied launch4j to generate emulator-manager.exe
authorminkee.lee <minkee.lee@samsung.com>
Wed, 20 Aug 2014 13:55:25 +0000 (22:55 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Tue, 26 Aug 2014 05:23:59 +0000 (14:23 +0900)
- Existing emulator-manager.exe has some problem with malware,
  so I changed to use Launch4j to generate emulator-manager.exe.
  Launch4j runs on DIBS. If you perform a local build, you can skip Launch4j
  by setting environment variable 'EM_EXE_GEN' as 'false'.

Change-Id: Ia3c2b6ccb333eac32e09159362d28c19cc72aec6
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/supplement/em-wrapper-config.xml [new file with mode: 0644]
common-project/supplement/genExe.sh [new file with mode: 0755]
package/build.windows

diff --git a/common-project/supplement/em-wrapper-config.xml b/common-project/supplement/em-wrapper-config.xml
new file mode 100644 (file)
index 0000000..2ea1c43
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launch4jConfig>
+  <dontWrapJar>true</dontWrapJar>
+  <headerType>gui</headerType>
+  <jar>emulator-manager.jar</jar>
+  <outfile>..\..\emulator-manager.exe</outfile>
+  <errTitle></errTitle>
+  <cmdLine></cmdLine>
+  <chdir></chdir>
+  <priority>normal</priority>
+  <downloadUrl>http://java.com/download</downloadUrl>
+  <supportUrl></supportUrl>
+  <stayAlive>false</stayAlive>
+  <manifest></manifest>
+  <icon>..\resource\res\em.ico</icon>
+  <classPath>
+    <mainClass>org.tizen.emulator.manager.EmulatorManager</mainClass>
+    <cp>swt.jar</cp>
+    <cp>jsch-0.1.50.jar</cp>
+    <cp>protobuf.jar</cp>
+  </classPath>
+  <jre>
+    <path></path>
+    <bundledJre64Bit>false</bundledJre64Bit>
+    <minVersion>1.6.0</minVersion>
+    <maxVersion></maxVersion>
+    <jdkPreference>preferJre</jdkPreference>
+    <runtimeBits>64/32</runtimeBits>
+  </jre>
+</launch4jConfig>
diff --git a/common-project/supplement/genExe.sh b/common-project/supplement/genExe.sh
new file mode 100755 (executable)
index 0000000..385a8a8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+LAUNCH4J_RUN=0
+LAUNCH4J_NOT_FOUND=1
+SKIP_EXE=2
+
+if [ "$EM_EXE_GEN" = "false" ] ; then
+       echo "Skip generating emulator-manager.exe..."
+       exit $SKIP_EXE
+fi
+
+if [ "`which launch4jc 2>/dev/null`" ] ; then
+       echo "Launch4j found. Make emulator-manager.exe ..."
+       launch4jc $1
+       exit $LAUNCH4J_RUN
+else
+       echo "Launch4j not found. Build will be stop..."
+       echo " -- Please install launch4j and add to path."
+       echo " -- Or, if you want to skip generating EXE, set 'EM_EXE_GEN' as 'false'"
+       echo " -- ex) $ export EM_EXE_GEN=false"
+       echo "And try build again."
+       exit $LAUNCH4J_NOT_FOUND
+fi
index 36dc1af..6d0ef68 100755 (executable)
@@ -35,28 +35,53 @@ build()
        #$ANT_PATH/ant -buildfile plugin-project/mobile-plugin/build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin -Dem.dir=${SRCDIR}/common-project make-jar-dibs
        #$ANT_PATH/ant -buildfile plugin-project/ivi-plugin/build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin -Dem.dir=${SRCDIR}/common-project make-jar-dibs
 
-       echo 'id ICON "common-project/resource/res/em.ico"' > icon.rc
-        windres icon.rc -O coff -o icon.res
-        gcc $SRCDIR/common-project/supplement/emulator-manager.c icon.res -o $SRCDIR/emulator-manager.exe -mwindows
-        rm icon.rc icon.res
-
-         # Add signing to emulator-manager.exe
-        java -jar $SIGNTOOL_JAR $SRCDIR/emulator-manager.exe $SRCDIR/emulator-manager.exe emulator-manager.exe
-        if [ ! -f "$SRCDIR/emulator-manager.exe" ]; then
-                echo "Codesigning fail"
-                exit 1
-        fi
-
-        cd $SRCDIR
-        /C/sign/signtool.exe verify "//pa" "emulator-manager.exe"
-        CODESIGN_RET=$?
-        echo $CODESIGN_RET
-        if [ "$CODESIGN_RET" = "0" ]; then
-                echo "The signature is vaild"
-        else
-                echo "The signature is invalid : return value = $CODESIGN_RET"
-                exit 1
-        fi
+       #echo 'id ICON "common-project/resource/res/em.ico"' > icon.rc
+        #windres icon.rc -O coff -o icon.res
+        #gcc $SRCDIR/common-project/supplement/emulator-manager.c icon.res -o $SRCDIR/emulator-manager.exe -mwindows
+        #rm icon.rc icon.res
+
+       # make emulator-manager.exe with Launch4j
+       LAUNCH4J_RUN=0
+       LAUNCH4J_NOT_FOUND=1
+       SKIP_EXE=2
+       common-project/supplement/genExe.sh common-project/supplement/em-wrapper-config.xml
+       RET=$?
+       if [ "$RET" = "$LAUNCH4J_NOT_FOUND" ]; then
+               echo "Launch4j not found. Exit."
+               exit 1
+       fi
+
+       if [ "$RET" = "$SKIP_EXE" ]; then
+               echo "Skip add signing to emulator-manager.exe ..."
+       fi
+
+       if [ "$RET" = "$LAUNCH4J_RUN" ]; then
+               if [ ! -f "emulator-manager.exe" ]; then
+                       echo "Generating emulator-manager.exe FAILED.."
+                       exit 1
+               else
+                       echo "Generating emulator-manager.exe SUCCESS."
+                       # Add signing to emulator-manager.exe
+                       java -jar $SIGNTOOL_JAR $SRCDIR/emulator-manager.exe $SRCDIR/emulator-manager.exe emulator-manager.exe
+                       if [ ! -f "$SRCDIR/emulator-manager.exe" ]; then
+                               echo "Codesigning fail"
+                               exit 1
+                       fi
+
+                       cd $SRCDIR
+                       /C/sign/signtool.exe verify "//pa" "emulator-manager.exe"
+                       CODESIGN_RET=$?
+                       echo $CODESIGN_RET
+                       if [ "$CODESIGN_RET" = "0" ]; then
+                               echo "The signature is vaild"
+                       else
+                               echo "The signature is invalid : return value = $CODESIGN_RET"
+                               exit 1
+                       fi
+               fi
+       fi
+
+
 #    if [ "$SIGNTOOL_PATH" != "" ]  && [ -f "$SIGNTOOL_PATH" ]
 #    then
 #        if [ "$SIGNFILE_PATH" != "" ] && [ -f "$SIGNFILE_PATH" ]