incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [3/6] webworks commit: added initial building support for bb10
Date Fri, 24 Aug 2012 00:36:15 GMT
added initial building support for bb10


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/dad90afc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/dad90afc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/dad90afc

Branch: refs/heads/master
Commit: dad90afcdb3cdfbe6d7215e57e7b17de8f78e602
Parents: 62a9301
Author: Gord Tanner <gtanner@gmail.com>
Authored: Tue Aug 21 11:43:40 2012 -0400
Committer: Tim Kim <tim.kim@nitobi.com>
Committed: Thu Aug 23 11:48:37 2012 -0700

----------------------------------------------------------------------
 bin/templates/project/build.xml          |   18 +-
 bin/templates/project/playbook.xml       |    2 +-
 bin/templates/project/project.properties |   33 +++-
 bin/templates/project/qnx.xml            |  280 +++++++++++++++++++++++++
 bin/templates/project/www/config.xml     |    4 +-
 build.xml                                |   32 +++-
 framework/ext-qnx/readme.md              |    1 +
 javascript/cordova.qnx.js                |    1 +
 8 files changed, 360 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/bin/templates/project/build.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.xml b/bin/templates/project/build.xml
index bde73c0..44c93be 100644
--- a/bin/templates/project/build.xml
+++ b/bin/templates/project/build.xml
@@ -39,6 +39,10 @@
     <target name="playbook" >
         <property name="subant.file"  value="playbook.xml" />
     </target>
+
+    <target name="qnx" >
+        <property name="subant.file"  value="qnx.xml" />
+    </target>
     
     <target name="load-device">
         <subant target="load-device">
@@ -100,27 +104,29 @@ TARGETS
  
   playbook .......... Builds a bar file and deploys to a device or simulator
 
+  qnx ............... Builds a bar file and deploys to a device or simulator
+
 COMMANDS
   help .............. Show this help menu.
                         ant, ant help
 
   load-device ....... Builds and deploys project to a connected USB device.
-                        ant load-device
+                        ant TARGET load-device
 
   load-simulator .... Builds and deploys project to default simulator.
-                        ant load-simulator
+                        ant TARGET load-simulator
 
   build ............. Compiles and packages the project for deployment.
-                        ant build
+                        ant TARGET build
 
   clean ............. Remove all files from the build/ directory.
-                        ant clean
+                        ant TARGET clean
 
   clean-device ...... Remove this project from the connected USB device.
-                        ant clean-device
+                        ant TARGET clean-device
 
   clean-simulator ... Remove this project from the simulator (takes a while).
-                        ant clean-simulator
+                        ant TARGET clean-simulator
 
 GETTING STARTED
   1. Edit project.properties

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/bin/templates/project/playbook.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/playbook.xml b/bin/templates/project/playbook.xml
index 2cce58d..1e4b4b4 100644
--- a/bin/templates/project/playbook.xml
+++ b/bin/templates/project/playbook.xml
@@ -201,7 +201,7 @@
     
     <!-- CLEAN SIMULATOR -->
     
-    <target name="clean-simulator">
+    <target name="clean-simulator" depends="generate-cod-name">
         <exec executable="${blackberry-deploy}" dir="." failonerror="true">
             <arg value="-uninstallApp" />
             <arg value="-device" />

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/bin/templates/project/project.properties
----------------------------------------------------------------------
diff --git a/bin/templates/project/project.properties b/bin/templates/project/project.properties
index 72c3841..8b5b815 100644
--- a/bin/templates/project/project.properties
+++ b/bin/templates/project/project.properties
@@ -22,8 +22,8 @@
 #     - Do not add a trailing slash (e.g. C:\some\path)
 #
 blackberry.bbwp.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks Packager
-
 playbook.bbwp.dir=C:\\Program Files\\Research In Motion\\BlackBerry WebWorks SDK for TabletOS
2.1.0.6\\bbwp
+qnx.bbwp.dir=/Developer/SDKs/Research In Motion/BlackBerry 10 WebWorks SDK 1.0.1.8
 
 # (Optional) Simulator Directory 
 # 
@@ -61,6 +61,9 @@ blackberry.sigtool.password=
 playbook.sigtool.csk.password=
 playbook.sigtool.p12.password=
 
+# BB10 Code Signing Password
+qnx.sigtool.password=
+
 # BlackBerry Simulator Password
 #
 #   If you leave this field blank, then
@@ -95,3 +98,31 @@ playbook.device.ip=
 #   you cannot deploy to device
 #
 playbook.device.password=
+
+# QNX Simulator IP
+#
+#   If you leave this field blank, then
+#   you cannot deploy to simulator
+#
+qnx.sim.ip=
+
+# QNX Simulator Password
+#
+#   If you leave this field blank, then
+#   you cannot deploy to simulator
+#
+qnx.sim.password=
+
+# QNX Device IP
+#
+#   If you leave this field blank, then
+#   you cannot deploy to device
+#
+qnx.device.ip=
+
+# QNX Device Password
+#
+#   If you leave this field blank, then
+#   you cannot deploy to device
+#
+qnx.device.password=

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/bin/templates/project/qnx.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/qnx.xml b/bin/templates/project/qnx.xml
new file mode 100644
index 0000000..a67f54a
--- /dev/null
+++ b/bin/templates/project/qnx.xml
@@ -0,0 +1,280 @@
+<project default="help">
+<!-- 
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->    
+    <!-- LOAD PROPERTIES -->
+    
+    <property prefix="properties" file="project.properties" />
+    <property name="build.dir"    location="build" />
+    <property name="widget.dir"   location="${build.dir}/widget" />
+    <property name="code.sign"    value="false" />
+    <property name="generate.ext"   value="cod" />
+    <property name="build.num.file" value="buildId.txt" />
+    
+    <!-- BlackBerry WebWorks Packager for Tablets directory is required. -->
+    <fail unless="properties.qnx.bbwp.dir" message="Please specify BlackBerry WebWorks
Packager directory using 'qnx.bbwp.dir' in your 'project.properties' file." />
+
+    <!-- OS identification -->
+    <condition property="isMacOSX" else="false">
+        <and>
+            <os family="mac" />
+            <os family="unix" />
+        </and>
+    </condition>
+
+    <condition property="bbwp" value="${properties.qnx.bbwp.dir}/bbwp" else="${properties.qnx.bbwp.dir}/bbwp.exe">
+        <equals arg1="${isMacOSX}" arg2="true" />
+    </condition>
+
+    <condition property="blackberry-deploy" value="${properties.qnx.bbwp.dir}/dependencies/tools/bin/blackberry-deploy"
else="${properties.qnx.bbwp.dir}/dependencies/tools/bin/blackberry-deploy.bat">
+        <equals arg1="${isMacOSX}" arg2="true" />
+    </condition>
+
+    <!-- LOAD DEVICE -->
+    
+    <target name="load-device" depends="package-app">
+        <bbwp code-sign="true" />
+
+        <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+            <arg value="-installApp" />
+            <arg value="-launchApp" />
+            <arg value="-device" />
+            <arg value="${properties.qnx.device.ip}" />
+            <arg value="-password" />
+            <arg value="${properties.qnx.device.password}" />
+            <arg value="-package" />
+            <arg file="${build.dir}/device/${cod.name}.bar" />
+        </exec>
+    </target>
+    
+    <!-- DEBUG-LOAD DEVICE -->
+    
+    <target name="debug-device" depends="package-app">
+        <bbwp code-sign="true" debug="true" />
+
+        <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+            <arg value="-installApp" />
+            <arg value="-launchApp" />
+            <arg value="-device" />
+            <arg value="${properties.qnx.device.ip}" />
+            <arg value="-password" />
+            <arg value="${properties.qnx.device.password}" />
+            <arg value="-package" />
+            <arg file="${build.dir}/device/${cod.name}.bar" />
+        </exec>
+    </target>
+    
+    <!-- LOAD SIMULATOR -->
+    
+    <target name="load-simulator" depends="build">
+
+        <echo>This tool will not open the simulator for you </echo>
+
+        <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+            <arg value="-installApp" />
+            <arg value="-launchApp" />
+            <arg value="-device" />
+            <arg value="${properties.qnx.sim.ip}" />
+            <arg value="-password" />
+            <arg value="${properties.qnx.sim.password}" />
+            <arg value="-package" />
+            <arg file="${build.dir}/simulator/${cod.name}.bar" />
+        </exec>
+    </target>
+    
+    <!-- PACKAGE-APP -->
+    
+    <target name="package-app" depends="generate-cod-name, clean">
+        <!-- Copy the WebWorks application -->
+        <mkdir dir="${widget.dir}" />
+        <copy todir="${widget.dir}" overwrite="true">
+            <fileset dir="www" >
+                <exclude name="ext/**"/>
+                <exclude name="ext-air/**"/>
+                <exclude name="playbook/**"/>
+            </fileset>
+        </copy>
+        
+        <!-- Overwrite the cordova js with the qnx specific cordova js -->
+        <copy todir="${widget.dir}" overwrite="true">
+            <fileset dir="www/playbook">
+                <include name="*.js" />
+            </fileset>
+        </copy>
+        
+        <!-- Update WebWorks Packager with the QNX APIs -->
+        <copy todir="${properties.qnx.bbwp.dir}\ext" overwrite="true">
+            <fileset dir="www/ext-qnx" excludes="README.md" />
+        </copy>
+        
+        <!-- Package the WebWorks app by zipping the widget dir. -->
+        <mkdir dir="${build.dir}" />
+        <zip compress="false" destfile="${build.dir}/${cod.name}.zip" basedir="${widget.dir}"
excludes="**/build/**,**/.settings/**,**/.project" />
+    </target>
+    
+    <!-- BUILD -->
+
+    <target name="build" depends="package-app">
+        <bbwp code-sign="${code.sign}" />
+    </target>
+
+    <!-- BBWP MACRO -->
+
+    <macrodef name="bbwp">
+        <attribute name="code-sign" default="false" />
+        <attribute name="debug" default="false" />
+        <sequential>
+            <!-- check if debug flag was passed in and set an appropriate flag for CLI
exec of bbwp -->
+            <if>
+                <equals arg1="@{debug}" arg2="true" />
+                <then>
+                    <property name="debug.flag" value="-d" />
+                </then>
+                <else>
+                    <property name="debug.flag" value="" />
+                </else>
+            </if>
+            <buildnumber file="${build.num.file}" />
+            <if>
+                <equals arg1="@{code-sign}" arg2="true" />
+                <then>
+                    <exec executable="${bbwp}">
+                        <arg file="${build.dir}/${cod.name}.zip" />
+                        <arg value="-g" />
+                        <arg value="${properties.qnx.sigtool.password}" />
+                        <arg value="-o" />
+                        <arg file="${build.dir}" />
+                        <arg line="${debug.flag} -b" />
+                        <arg value="${build.number}" />
+                    </exec>
+                </then>
+                <else>
+                    <exec executable="${bbwp}">
+                        <arg file="${build.dir}/${cod.name}.zip" />
+                        <arg value="-o" />
+                        <arg file="${build.dir}" />
+                        <arg line="${debug.flag}" />
+                    </exec>
+                </else>
+            </if>
+        </sequential>
+    </macrodef>
+
+    <!-- CLEAN -->
+    
+    <target name="clean">
+        <delete dir="${build.dir}" />
+        <delete dir="${widget.dir}" />
+    </target>
+    
+    <!-- CLEAN DEVICE -->
+    
+    <target name="clean-device" depends="generate-cod-name">
+        <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+            <arg value="-uninstallApp" />
+            <arg value="-device" />
+            <arg value="${properties.qnx.device.ip}" />
+            <arg value="-password" />
+            <arg value="${properties.qnx.device.password}" />
+            <arg value="-package" />
+            <arg file="${build.dir}/device/${cod.name}.bar" />
+        </exec>
+    </target>
+    
+    <!-- CLEAN SIMULATOR -->
+    
+    <target name="clean-simulator" depends="generate-cod-name">
+        <exec executable="${blackberry-deploy}" dir="." failonerror="true">
+            <arg value="-uninstallApp" />
+            <arg value="-device" />
+            <arg value="${properties.qnx.sim.ip}" />
+            <arg value="-password" />
+            <arg value="${properties.qnx.sim.password}" />
+            <arg value="-package" />
+            <arg file="${build.dir}/simulator/${cod.name}.bar" />
+        </exec>
+    </target>
+    
+        <!-- HELPER TASKS -->
+    
+    <target name="generate-cod-name">
+        <xmlproperty file="www/config.xml" prefix="config.xml" />
+        <propertyregex property="cod.name"
+                       input="${config.xml.widget.name}"
+                       regexp="(\W+)"
+                       replace=""
+                       casesensitive="false"
+                       global="true"
+                       defaultValue="${config.xml.widget.name}" />
+        <echo message="Generated name: ${cod.name}.bar" />
+    </target>
+
+    <!-- HELP -->
+
+    <target name="help">
+        <echo>
+NAME
+  ${ant.project.name}
+
+SYNOPSIS
+  ant TARGET COMMAND [-D&lt;argument&gt;=&lt;value&gt;]...
+
+DESCRIPTION
+  You can build and deploy your project to a device or simulator.
+  
+TARGETS
+  blackberry ........ Builds a cod file and deploys to a device or simulator
+ 
+  playbook .......... Builds a bar file and deploys to a device or simulator
+
+COMMANDS
+  help .............. Show this help menu.
+                        ant, ant help
+
+  load-device ....... Builds and deploys project to a connected USB device.
+                        ant load-device
+
+  load-simulator .... Builds and deploys project to default simulator.
+                        ant load-simulator
+
+  build ............. Compiles and packages the project for deployment.
+                        ant build
+
+  clean ............. Remove all files from the build/ directory.
+                        ant clean
+
+  clean-device ...... Remove this project from the connected USB device.
+                        ant clean-device
+
+  clean-simulator ... Remove this project from the simulator (takes a while).
+                        ant clean-simulator
+
+GETTING STARTED
+  1. Edit project.properties
+
+  2. &lt;ant &lt;TARGET&gt; load-simulator&gt; to run the project on the
simulator
+
+  3. Customize your project by editing www/config.xml
+
+  4. To run the project on a BlackBerry device, you will need to obtain
+     code signing keys from RIM. Once you have the key, a project is
+     installed by connecting a BlackBerry via USB and running
+     &lt;ant &lt;TARGET&gt; load-device&gt;.
+        </echo>
+    </target>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/bin/templates/project/www/config.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/www/config.xml b/bin/templates/project/www/config.xml
index 1cc24e1..d9d33d3 100644
--- a/bin/templates/project/www/config.xml
+++ b/bin/templates/project/www/config.xml
@@ -24,10 +24,12 @@
 
 <widget xmlns="http://www.w3.org/ns/widgets"
         xmlns:rim="http://www.blackberry.com/ns/widgets"
-	version="1.0.0.0">
+	version="1.0.0.0" id="__NAME__">
 
   <name>__NAME__</name>
 
+  <author>Your Name Here</author>
+
   <description>
        A sample Apache Cordova application that responds to the deviceready event.
   </description>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 4a45756..e9976bc 100644
--- a/build.xml
+++ b/build.xml
@@ -45,6 +45,10 @@
     <property name="playbook.js.path"   value="javascript/playbook" />
     <property name="playbook.ext.src"   location="framework/ext-air" />
     <property name="playbook.ext.path"  value="ext-air" />
+
+    <property name="qnx.js.path"   value="javascript/qnx" />
+    <property name="qnx.ext.src"   location="framework/ext-qnx" />
+    <property name="qnx.ext.path"  value="ext-qnx" />
     
     <property name="js.src"          location="javascript" />
     <property name="js.path"         value="javascript" />
@@ -62,6 +66,9 @@
         <mkdir dir="${build.dir}/${playbook.js.path}" />
         <copy file="${js.src}/cordova.playbook.js" tofile="${build.dir}/${playbook.js.path}/${js.basename}"
/>
 
+        <!-- QNX Javascript -->
+        <mkdir dir="${build.dir}/${qnx.js.path}" />
+        <copy file="${js.src}/cordova.qnx.js" tofile="${build.dir}/${qnx.js.path}/${js.basename}"
/>
     </target>
 
     <!-- BUILD BLACKBERRY EXTENSION -->
@@ -85,9 +92,20 @@
             <fileset dir="${playbook.ext.src}" />
         </copy>
     </target>
+
+    <!-- BUILD QNX EXTENSION -->
+    
+    <target name="build-qnx-extension">
+
+        <!-- Copy Ext -->
+        <mkdir dir="${build.dir}/${qnx.ext.path}" />
+        <copy todir="${build.dir}/${qnx.ext.path}">
+            <fileset dir="${qnx.ext.src}" />
+        </copy>
+    </target>
     
     <!-- CREATE A PROJECT -->
-    <target name="create" depends="clean, build-javascript, build-bb-extension, build-pb-extension">
+    <target name="create" depends="clean, build-javascript, build-bb-extension, build-pb-extension,
build-qnx-extension">
         <fail unless="project.path" message="You must give a project PATH. Use the argument
-Dproject.path=&#34;C:\dev\my_project&#34;" />
         
         <available file="${project.path}" property="project.exists" />
@@ -122,6 +140,11 @@
         <copy todir="${project.path}/www/ext-air">
             <fileset dir="${build.dir}/${playbook.ext.path}" />
         </copy>
+
+        <!-- copy ext-qnx/ -->
+        <copy todir="${project.path}/www/ext-qnx">
+            <fileset dir="${build.dir}/${qnx.ext.path}" />
+        </copy>
         
         <!-- save release -->
         <mkdir dir="${project.path}/${update.dir}" />
@@ -166,6 +189,11 @@ Getting Started:
         <copy todir="${dist.www.path}/ext-air">
             <fileset dir="${build.dir}/${playbook.ext.path}" />
         </copy>
+
+        <!-- copy ext-qnx/ -->
+        <copy todir="${dist.www.path}/ext-qnx">
+            <fileset dir="${build.dir}/${qnx.ext.path}" />
+        </copy>
         
         <!-- copy cordova.js -->
         <copy todir="${dist.www.path}">
@@ -227,7 +255,7 @@ Remember to:
     
     <!-- UPDATE A PROJECT -->
     
-    <target name="update" depends="clean, build-javascript, build-bb-extension, build-pb-extension">
+    <target name="update" depends="clean, build-javascript, build-bb-extension, build-pb-extension,
build-qnx-extension">
         <fail unless="project.path" message="You must give a project PATH. Use the argument
-Dproject.path=&#34;C:\dev\my_project&#34;" />
         
         <available file="${project.path}" property="project.exists" />

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/framework/ext-qnx/readme.md
----------------------------------------------------------------------
diff --git a/framework/ext-qnx/readme.md b/framework/ext-qnx/readme.md
new file mode 100644
index 0000000..6527192
--- /dev/null
+++ b/framework/ext-qnx/readme.md
@@ -0,0 +1 @@
+Placeholder for native extensions needed on qnx

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/dad90afc/javascript/cordova.qnx.js
----------------------------------------------------------------------
diff --git a/javascript/cordova.qnx.js b/javascript/cordova.qnx.js
new file mode 100644
index 0000000..abf904b
--- /dev/null
+++ b/javascript/cordova.qnx.js
@@ -0,0 +1 @@
+alert('Real Javascript should go here from cordova.js");


Mime
View raw message