Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E82B910F4F for ; Tue, 11 Jun 2013 00:03:44 +0000 (UTC) Received: (qmail 27526 invoked by uid 500); 11 Jun 2013 00:03:41 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 27339 invoked by uid 500); 11 Jun 2013 00:03:41 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 25724 invoked by uid 99); 11 Jun 2013 00:03:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jun 2013 00:03:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BFD6A8A2F8E; Tue, 11 Jun 2013 00:03:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: commits@cordova.apache.org Date: Tue, 11 Jun 2013 00:04:22 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [46/52] [partial] start of lazy loading: axe all vendored-in libs http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/update ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/update b/lib/cordova-android/bin/update deleted file mode 100755 index 9a968b1..0000000 --- a/lib/cordova-android/bin/update +++ /dev/null @@ -1,146 +0,0 @@ -#! /bin/bash -# 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. -# -# update a cordova/android project's command line tools -# -# USAGE -# ./update [path] -# - -set -e - -if [ -z "$1" ] || [ "$1" == "-h" ] -then - echo 'usage: update path' - echo "Make sure the Android SDK tools folder is in your PATH!" - exit 0 -fi - -BUILD_PATH="$( cd "$( dirname "$0" )/.." && pwd )" -VERSION=$(cat "$BUILD_PATH"/VERSION) - -PROJECT_PATH="${1:-'./example'}" - -if [ ! -d "$PROJECT_PATH" ] -then - echo "The project path has to exist for it to be updated" - exit 0 -fi - - -# cleanup after exit and/or on error -function on_exit { - if [ -f "$BUILD_PATH"/framework/assets/www/cordova.js ] - then - rm "$BUILD_PATH"/framework/assets/www/cordova.js - fi - if [ -f "$BUILD_PATH"/framework/cordova-$VERSION.jar ] - then - rm "$BUILD_PATH"/framework/cordova-$VERSION.jar - fi -} - -function createAppInfoJar { - (cd "$BUILD_PATH"/bin/templates/cordova/ApplicationInfo && - javac ApplicationInfo.java && - jar -cfe ../appinfo.jar ApplicationInfo ApplicationInfo.class - ) -} - -function on_error { - echo "An unexpected error occurred: $previous_command exited with $?" - echo "Deleting project..." - [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH" - exit 1 -} - -function replace { - local pattern=$1 - local filename=$2 - # Mac OS X requires -i argument - if [[ "$OSTYPE" =~ "darwin" ]] - then - /usr/bin/sed -i '' -e $pattern "$filename" - elif [[ "$OSTYPE" =~ "linux" ]] - then - /bin/sed -i -e $pattern "$filename" - fi -} - -# we do not want the script to silently fail -trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG -trap on_error ERR -trap on_exit EXIT - -ANDROID_BIN="${ANDROID_BIN:=$( which android )}" - -TARGET=$("$ANDROID_BIN" list targets | grep id: | tail -1 | cut -f 2 -d ' ' ) -API_LEVEL=$("$ANDROID_BIN" list target | grep "API level:" | tail -n 1 | cut -f 2 -d ':' | tr -d ' ') - -# check that build targets exist -if [ -z "$TARGET" ] || [ -z "$API_LEVEL" ] -then - echo "No Android Targets are installed. Please install at least one via the android SDK" - exit 1 -fi - -# if this a distribution release no need to build a jar -if [ ! -e "$BUILD_PATH"/cordova-$VERSION.jar ] && [ -d "$BUILD_PATH"/framework ] -then -# update the cordova-android framework for the desired target - "$ANDROID_BIN" update project --target $TARGET --path "$BUILD_PATH"/framework &> /dev/null - - if [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.7.jar ]; then - # Use curl to get the jar (TODO: Support Apache Mirrors) - curl -OL http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip &> /dev/null - unzip commons-codec-1.7-bin.zip &> /dev/null - mkdir -p "$BUILD_PATH"/framework/libs - cp commons-codec-1.7/commons-codec-1.7.jar "$BUILD_PATH"/framework/libs - # cleanup yo - rm commons-codec-1.7-bin.zip && rm -rf commons-codec-1.7 - fi - -# compile cordova.js and cordova.jar - (cd "$BUILD_PATH"/framework && ant jar &> /dev/null ) -fi - -# copy cordova.js, cordova.jar and res/xml -if [ -d "$BUILD_PATH"/framework ] -then - cp "$BUILD_PATH"/framework/assets/www/cordova.js "$PROJECT_PATH"/assets/www/cordova.js - cp "$BUILD_PATH"/framework/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar -else - cp "$BUILD_PATH"/cordova.js "$PROJECT_PATH"/assets/www/cordova.js - cp "$BUILD_PATH"/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar -fi - -# creating cordova folder and copying run/build/log/launch scripts -mkdir "$PROJECT_PATH"/cordova -mkdir "$PROJECT_PATH"/cordova/lib -cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar -cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build -cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean -cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log -cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run -cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova -cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device -cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-devices "$PROJECT_PATH"/cordova/lib/list-devices -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-emulator-images "$PROJECT_PATH"/cordova/lib/list-emulator-images -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-started-emulators "$PROJECT_PATH"/cordova/lib/list-started-emulators -cp "$BUILD_PATH"/bin/templates/cordova/lib/start-emulator "$PROJECT_PATH"/cordova/lib/start-emulator http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/update.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/update.bat b/lib/cordova-android/bin/update.bat deleted file mode 100644 index a61fd26..0000000 --- a/lib/cordova-android/bin/update.bat +++ /dev/null @@ -1,32 +0,0 @@ -:: 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. - -@ECHO OFF -IF NOT DEFINED JAVA_HOME GOTO MISSING -FOR %%X in (java.exe javac.exe ant.bat android.bat) do ( - SET FOUND=%%~$PATH:X - IF NOT DEFINED FOUND GOTO MISSING -) -cscript "%~dp0\update.js" %* -GOTO END -:MISSING -ECHO Missing one of the following: -ECHO JDK: http://java.oracle.com -ECHO Android SDK: http://developer.android.com -ECHO Apache ant: http://ant.apache.org -EXIT /B 1 -:END http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/update.js ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/update.js b/lib/cordova-android/bin/update.js deleted file mode 100644 index 748d602..0000000 --- a/lib/cordova-android/bin/update.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - 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. -*/ - -/* - * create a cordova/android project - * - * USAGE - * ./update [path] - */ - -var fso = WScript.CreateObject('Scripting.FileSystemObject'); - -function read(filename) { - var fso=WScript.CreateObject("Scripting.FileSystemObject"); - var f=fso.OpenTextFile(filename, 1); - var s=f.ReadAll(); - f.Close(); - return s; -} - -function checkTargets(targets) { - if(!targets) { - WScript.Echo("You do not have any android targets setup. Please create at least one target with the `android` command"); - WScript.Quit(69); - } -} - -function setTarget() { - var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/id:\s\d+/g); - checkTargets(targets); - return targets[targets.length - 1].replace(/id: /, ""); // TODO: give users the option to set their target -} - -function setApiLevel() { - var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/API level:\s\d+/g); - checkTargets(targets); - return targets[targets.length - 1].replace(/API level: /, ""); -} - -function write(filename, contents) { - var fso=WScript.CreateObject("Scripting.FileSystemObject"); - var f=fso.OpenTextFile(filename, 2, true); - f.Write(contents); - f.Close(); -} - -function replaceInFile(filename, regexp, replacement) { - write(filename, read(filename).replace(regexp, replacement)); -} - -function exec(command) { - var oShell=shell.Exec(command); - while (oShell.Status == 0) { - if(!oShell.StdOut.AtEndOfStream) { - var line = oShell.StdOut.ReadLine(); - // XXX: Change to verbose mode - // WScript.StdOut.WriteLine(line); - } - WScript.sleep(100); - } -} - -function createAppInfoJar() { - if(!fso.FileExists(ROOT+"\\bin\\templates\\cordova\\appinfo.jar")) { - WScript.Echo("Creating appinfo.jar..."); - var cur = shell.CurrentDirectory; - shell.CurrentDirectory = ROOT+"\\bin\\templates\\cordova\\ApplicationInfo"; - exec("javac ApplicationInfo.java"); - exec("jar -cfe ..\\appinfo.jar ApplicationInfo ApplicationInfo.class"); - shell.CurrentDirectory = cur; - } -} - -function cleanup() { - if(fso.FileExists(ROOT + '\\framework\\cordova-'+VERSION+'.jar')) { - fso.DeleteFile(ROOT + '\\framework\\cordova-'+VERSION+'.jar'); - } - if(fso.FileExists(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js')) { - fso.DeleteFile(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js'); - } -} - -function downloadCommonsCodec() { - if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.7.jar')) { - // We need the .jar - var url = 'http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip'; - var libsPath = ROOT + '\\framework\\libs'; - var savePath = libsPath + '\\commons-codec-1.7-bin.zip'; - if (!fso.FileExists(savePath)) { - if(!fso.FolderExists(ROOT + '\\framework\\libs')) { - fso.CreateFolder(libsPath); - } - // We need the zip to get the jar - var xhr = WScript.CreateObject('MSXML2.XMLHTTP'); - xhr.open('GET', url, false); - xhr.send(); - if (xhr.status == 200) { - var stream = WScript.CreateObject('ADODB.Stream'); - stream.Open(); - stream.Type = 1; - stream.Write(xhr.ResponseBody); - stream.Position = 0; - stream.SaveToFile(savePath); - stream.Close(); - } else { - WScript.Echo('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.'); - } - } - var app = WScript.CreateObject('Shell.Application'); - var source = app.NameSpace(savePath).Items(); - var target = app.NameSpace(ROOT + '\\framework\\libs'); - target.CopyHere(source, 256); - - // Move the jar into libs - fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.7\\commons-codec-1.7.jar', ROOT + '\\framework\\libs\\commons-codec-1.7.jar'); - - // Clean up - fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.7-bin.zip'); - fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true); - } -} - -var args = WScript.Arguments, PROJECT_PATH="example", - shell=WScript.CreateObject("WScript.Shell"); - -// working dir -var ROOT = WScript.ScriptFullName.split('\\bin\\update.js').join(''); - -if (args.Count() == 1) { - PROJECT_PATH=args(0); -} - -if(!fso.FolderExists(PROJECT_PATH)) { - WScript.Echo("Project doesn't exist!"); - WScript.Quit(1); -} - -var TARGET=setTarget(); -var API_LEVEL=setApiLevel(); -var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''); - -// build from source. distro should have these files -if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') && - !fso.FileExists(ROOT+'\\cordova-'+VERSION+'.js')) { - WScript.Echo("Building jar and js files..."); - // update the cordova framework project to a target that exists on this machine - exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework'); - // pull down commons codec if necessary - downloadCommonsCodec(); - exec('ant.bat -f \"'+ ROOT +'\\framework\\build.xml\" jar'); -} - -// check if we have the source or the distro files -WScript.Echo("Copying js, jar & config.xml files..."); -if(fso.FolderExists(ROOT + '\\framework')) { - exec('%comspec% /c copy "'+ROOT+'"\\framework\\assets\\www\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y'); - exec('%comspec% /c copy "'+ROOT+'"\\framework\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y'); -} else { - // copy in cordova.js - exec('%comspec% /c copy "'+ROOT+'"\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y'); - // copy in cordova.jar - exec('%comspec% /c copy "'+ROOT+'"\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y'); - // copy in xml -} - -// update cordova scripts -createAppInfoJar(); -WScript.Echo("Copying cordova command tools..."); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\build.bat ' + PROJECT_PATH + '\\cordova\\build.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\log.bat ' + PROJECT_PATH + '\\cordova\\log.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\cordova.js ' + PROJECT_PATH + '\\cordova\\lib\\cordova.js /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-device.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-device.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-emulator.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-emulator-images.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-emulator-images.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-devices.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-devices.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-started-emulators.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-started-emulators.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\start-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\start-emulator.bat /Y'); - -cleanup(); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/framework/.classpath ---------------------------------------------------------------------- diff --git a/lib/cordova-android/framework/.classpath b/lib/cordova-android/framework/.classpath deleted file mode 100644 index 1b06df2..0000000 --- a/lib/cordova-android/framework/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/framework/.project ---------------------------------------------------------------------- diff --git a/lib/cordova-android/framework/.project b/lib/cordova-android/framework/.project deleted file mode 100644 index ed4a955..0000000 --- a/lib/cordova-android/framework/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - Cordova - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/framework/AndroidManifest.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-android/framework/AndroidManifest.xml b/lib/cordova-android/framework/AndroidManifest.xml deleted file mode 100755 index f1336ea..0000000 --- a/lib/cordova-android/framework/AndroidManifest.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/framework/ant.properties ---------------------------------------------------------------------- diff --git a/lib/cordova-android/framework/ant.properties b/lib/cordova-android/framework/ant.properties deleted file mode 100644 index 243b691..0000000 --- a/lib/cordova-android/framework/ant.properties +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -# -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. -