CB-11346: added tests for support of 3rd party platforms
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/da952e07 Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/da952e07 Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/da952e07 Branch: refs/heads/common-2.0.x Commit: da952e074d36bd917beb041dc4e49abc760f5561 Parents: 4e3d6ca Author: Steve Gill <[email protected]> Authored: Fri Mar 17 17:40:42 2017 -0700 Committer: Steve Gill <[email protected]> Committed: Fri Mar 17 17:40:42 2017 -0700 ---------------------------------------------------------------------- .../fixtures/platforms/atari/README.md | 22 + .../fixtures/platforms/atari/VERSION | 1 + .../platforms/atari/bin/android_sdk_version | 29 + .../platforms/atari/bin/android_sdk_version.bat | 26 + .../fixtures/platforms/atari/bin/check_reqs | 31 + .../fixtures/platforms/atari/bin/check_reqs.bat | 26 + .../fixtures/platforms/atari/bin/create | 58 + .../fixtures/platforms/atari/bin/create.bat | 26 + .../atari/bin/lib/android_sdk_version.js | 64 + .../platforms/atari/bin/lib/check_reqs.js | 375 +++ .../fixtures/platforms/atari/bin/lib/create.js | 333 +++ .../atari/bin/templates/cordova/.jshintrc | 10 + .../atari/bin/templates/cordova/Api.js | 415 ++++ .../platforms/atari/bin/templates/cordova/build | 50 + .../atari/bin/templates/cordova/build.bat | 26 + .../platforms/atari/bin/templates/cordova/clean | 51 + .../atari/bin/templates/cordova/clean.bat | 26 + .../atari/bin/templates/cordova/defaults.xml | 26 + .../atari/bin/templates/cordova/lib/Adb.js | 105 + .../templates/cordova/lib/AndroidManifest.js | 161 ++ .../bin/templates/cordova/lib/AndroidProject.js | 210 ++ .../bin/templates/cordova/lib/AndroidStudio.js | 42 + .../atari/bin/templates/cordova/lib/build.js | 301 +++ .../cordova/lib/builders/AntBuilder.js | 156 ++ .../cordova/lib/builders/GenericBuilder.js | 147 ++ .../cordova/lib/builders/GradleBuilder.js | 279 +++ .../templates/cordova/lib/builders/builders.js | 47 + .../atari/bin/templates/cordova/lib/device.js | 120 + .../atari/bin/templates/cordova/lib/emulator.js | 443 ++++ .../bin/templates/cordova/lib/install-device | 42 + .../templates/cordova/lib/install-device.bat | 26 + .../bin/templates/cordova/lib/install-emulator | 38 + .../templates/cordova/lib/install-emulator.bat | 26 + .../bin/templates/cordova/lib/list-devices | 34 + .../bin/templates/cordova/lib/list-devices.bat | 26 + .../templates/cordova/lib/list-emulator-images | 34 + .../cordova/lib/list-emulator-images.bat | 26 + .../cordova/lib/list-started-emulators | 34 + .../cordova/lib/list-started-emulators.bat | 26 + .../atari/bin/templates/cordova/lib/log.js | 56 + .../templates/cordova/lib/plugin-build.gradle | 70 + .../bin/templates/cordova/lib/pluginHandlers.js | 308 +++ .../atari/bin/templates/cordova/lib/prepare.js | 431 ++++ .../atari/bin/templates/cordova/lib/retry.js | 68 + .../atari/bin/templates/cordova/lib/run.js | 141 ++ .../bin/templates/cordova/lib/start-emulator | 39 + .../templates/cordova/lib/start-emulator.bat | 26 + .../platforms/atari/bin/templates/cordova/log | 36 + .../atari/bin/templates/cordova/log.bat | 26 + .../bin/templates/cordova/loggingHelper.js | 18 + .../platforms/atari/bin/templates/cordova/run | 53 + .../atari/bin/templates/cordova/run.bat | 26 + .../atari/bin/templates/cordova/version | 29 + .../atari/bin/templates/cordova/version.bat | 26 + .../atari/bin/templates/project/Activity.java | 41 + .../bin/templates/project/AndroidManifest.xml | 49 + .../bin/templates/project/assets/www/cordova.js | 2208 ++++++++++++++++++ .../templates/project/assets/www/css/index.css | 115 + .../project/assets/www/img/cordova.png | Bin 0 -> 19932 bytes .../templates/project/assets/www/img/logo.png | Bin 0 -> 21814 bytes .../bin/templates/project/assets/www/index.html | 49 + .../templates/project/assets/www/js/index.js | 51 + .../atari/bin/templates/project/build.gradle | 311 +++ .../atari/bin/templates/project/gitignore | 14 + .../bin/templates/project/project.properties | 15 + .../project/res/drawable-land-hdpi/screen.png | Bin 0 -> 218302 bytes .../project/res/drawable-land-ldpi/screen.png | Bin 0 -> 42616 bytes .../project/res/drawable-land-mdpi/screen.png | Bin 0 -> 92347 bytes .../project/res/drawable-land-xhdpi/screen.png | Bin 0 -> 489604 bytes .../project/res/drawable-land-xxhdpi/screen.png | Bin 0 -> 1135414 bytes .../res/drawable-land-xxxhdpi/screen.png | Bin 0 -> 1460298 bytes .../project/res/drawable-port-hdpi/screen.png | Bin 0 -> 222148 bytes .../project/res/drawable-port-ldpi/screen.png | Bin 0 -> 42034 bytes .../project/res/drawable-port-mdpi/screen.png | Bin 0 -> 90555 bytes .../project/res/drawable-port-xhdpi/screen.png | Bin 0 -> 504508 bytes .../project/res/drawable-port-xxhdpi/screen.png | Bin 0 -> 1166124 bytes .../res/drawable-port-xxxhdpi/screen.png | Bin 0 -> 1595731 bytes .../templates/project/res/mipmap-hdpi/icon.png | Bin 0 -> 6080 bytes .../templates/project/res/mipmap-ldpi/icon.png | Bin 0 -> 3096 bytes .../templates/project/res/mipmap-mdpi/icon.png | Bin 0 -> 4090 bytes .../templates/project/res/mipmap-xhdpi/icon.png | Bin 0 -> 7685 bytes .../project/res/mipmap-xxhdpi/icon.png | Bin 0 -> 14189 bytes .../project/res/mipmap-xxxhdpi/icon.png | Bin 0 -> 17965 bytes .../templates/project/res/values/strings.xml | 9 + .../bin/templates/project/res/xml/config.xml | 58 + .../atari/bin/templates/project/wrapper.gradle | 1 + .../fixtures/platforms/atari/bin/update | 37 + .../fixtures/platforms/atari/bin/update.bat | 26 + .../cordova-js-src/android/nativeapiprovider.js | 36 + .../android/promptbasednativeapi.js | 35 + .../platforms/atari/cordova-js-src/exec.js | 297 +++ .../platforms/atari/cordova-js-src/platform.js | 125 + .../atari/cordova-js-src/plugin/android/app.js | 108 + .../platforms/atari/framework/.classpath | 9 + .../.gradle/2.10/taskArtifacts/cache.properties | 1 + .../2.10/taskArtifacts/cache.properties.lock | Bin 0 -> 17 bytes .../.gradle/2.10/taskArtifacts/fileHashes.bin | Bin 0 -> 30709 bytes .../2.10/taskArtifacts/fileSnapshots.bin | Bin 0 -> 99110 bytes .../2.10/taskArtifacts/outputFileStates.bin | Bin 0 -> 20012 bytes .../2.10/taskArtifacts/taskArtifacts.bin | Bin 0 -> 36774 bytes .../localClassSetAnalysis.bin | Bin 0 -> 46538 bytes .../localClassSetAnalysis.lock | Bin 0 -> 17 bytes .../localJarClasspathSnapshot.bin | Bin 0 -> 18542 bytes .../localJarClasspathSnapshot.lock | Bin 0 -> 17 bytes .../2.14.1/taskArtifacts/cache.properties | 1 + .../2.14.1/taskArtifacts/cache.properties.lock | Bin 0 -> 17 bytes .../.gradle/2.14.1/taskArtifacts/fileHashes.bin | Bin 0 -> 31945 bytes .../2.14.1/taskArtifacts/fileSnapshots.bin | Bin 0 -> 122294 bytes .../fileSnapshotsToTreeSnapshotsIndex.bin | Bin 0 -> 21710 bytes .../2.14.1/taskArtifacts/taskArtifacts.bin | Bin 0 -> 44273 bytes .../localClassSetAnalysis.bin | Bin 0 -> 47020 bytes .../localClassSetAnalysis.lock | Bin 0 -> 17 bytes .../localJarClasspathSnapshot.bin | Bin 0 -> 18542 bytes .../localJarClasspathSnapshot.lock | Bin 0 -> 17 bytes .../localClassSetAnalysis.bin | Bin 0 -> 47020 bytes .../localClassSetAnalysis.lock | Bin 0 -> 17 bytes .../localJarClasspathSnapshot.bin | Bin 0 -> 18542 bytes .../localJarClasspathSnapshot.lock | Bin 0 -> 17 bytes .../.gradle/3.4/file-changes/last-build.bin | Bin 0 -> 1 bytes .../.gradle/3.4/fileContent/fileContent.lock | Bin 0 -> 17 bytes .../.gradle/3.4/javaCompile/classAnalysis.bin | Bin 0 -> 49949 bytes .../.gradle/3.4/javaCompile/javaCompile.lock | Bin 0 -> 17 bytes .../.gradle/3.4/javaCompile/taskHistory.bin | Bin 0 -> 63974 bytes .../.gradle/3.4/javaCompile/taskJars.bin | Bin 0 -> 18547 bytes .../.gradle/3.4/taskHistory/fileHashes.bin | Bin 0 -> 30497 bytes .../.gradle/3.4/taskHistory/fileSnapshots.bin | Bin 0 -> 121360 bytes .../.gradle/3.4/taskHistory/taskHistory.bin | Bin 0 -> 52638 bytes .../.gradle/3.4/taskHistory/taskHistory.lock | Bin 0 -> 17 bytes .../.gradle/buildOutputCleanup/built.bin | 0 .../.gradle/buildOutputCleanup/cache.properties | 2 + .../buildOutputCleanup/cache.properties.lock | 1 + .../fixtures/platforms/atari/framework/.project | 33 + .../.settings/org.eclipse.jdt.core.prefs | 4 + .../atari/framework/AndroidManifest.xml | 23 + .../platforms/atari/framework/ant.properties | 34 + .../platforms/atari/framework/build.gradle | 135 ++ .../platforms/atari/framework/build.xml | 192 ++ .../debug/org/apache/cordova/BuildConfig.java | 13 + .../release/org/apache/cordova/BuildConfig.java | 13 + .../bundles/debug/AndroidManifest.xml | 27 + .../bundles/release/AndroidManifest.xml | 27 + .../apache/cordova/AuthenticationToken.class | Bin 0 -> 776 bytes .../debug/org/apache/cordova/BuildConfig.class | Bin 0 -> 711 bytes .../org/apache/cordova/CallbackContext.class | Bin 0 -> 3328 bytes .../debug/org/apache/cordova/CallbackMap.class | Bin 0 -> 1491 bytes .../debug/org/apache/cordova/Config.class | Bin 0 -> 1841 bytes .../org/apache/cordova/ConfigXmlParser.class | Bin 0 -> 4919 bytes .../org/apache/cordova/CordovaActivity$1.class | Bin 0 -> 943 bytes .../org/apache/cordova/CordovaActivity$2.class | Bin 0 -> 1019 bytes .../org/apache/cordova/CordovaActivity$3.class | Bin 0 -> 1522 bytes .../apache/cordova/CordovaActivity$4$1.class | Bin 0 -> 1090 bytes .../org/apache/cordova/CordovaActivity$4.class | Bin 0 -> 2012 bytes .../org/apache/cordova/CordovaActivity.class | Bin 0 -> 11826 bytes .../debug/org/apache/cordova/CordovaArgs.class | Bin 0 -> 2561 bytes .../org/apache/cordova/CordovaBridge.class | Bin 0 -> 5458 bytes .../cordova/CordovaClientCertRequest.class | Bin 0 -> 1426 bytes .../apache/cordova/CordovaDialogsHelper$1.class | Bin 0 -> 1221 bytes .../apache/cordova/CordovaDialogsHelper$2.class | Bin 0 -> 1201 bytes .../apache/cordova/CordovaDialogsHelper$3.class | Bin 0 -> 1352 bytes .../apache/cordova/CordovaDialogsHelper$4.class | Bin 0 -> 1223 bytes .../apache/cordova/CordovaDialogsHelper$5.class | Bin 0 -> 1223 bytes .../apache/cordova/CordovaDialogsHelper$6.class | Bin 0 -> 1203 bytes .../apache/cordova/CordovaDialogsHelper$7.class | Bin 0 -> 1354 bytes .../apache/cordova/CordovaDialogsHelper$8.class | Bin 0 -> 1506 bytes .../apache/cordova/CordovaDialogsHelper$9.class | Bin 0 -> 1240 bytes .../cordova/CordovaDialogsHelper$Result.class | Bin 0 -> 277 bytes .../apache/cordova/CordovaDialogsHelper.class | Bin 0 -> 3796 bytes .../apache/cordova/CordovaHttpAuthHandler.class | Bin 0 -> 821 bytes .../org/apache/cordova/CordovaInterface.class | Bin 0 -> 725 bytes ...dovaInterfaceImpl$ActivityResultHolder.class | Bin 0 -> 1064 bytes .../apache/cordova/CordovaInterfaceImpl.class | Bin 0 -> 7854 bytes .../org/apache/cordova/CordovaPlugin.class | Bin 0 -> 6873 bytes .../org/apache/cordova/CordovaPreferences.class | Bin 0 -> 3223 bytes .../CordovaResourceApi$OpenForReadResult.class | Bin 0 -> 905 bytes .../org/apache/cordova/CordovaResourceApi.class | Bin 0 -> 12703 bytes .../org/apache/cordova/CordovaWebView.class | Bin 0 -> 2239 bytes .../cordova/CordovaWebViewEngine$Client.class | Bin 0 -> 549 bytes .../CordovaWebViewEngine$EngineView.class | Bin 0 -> 308 bytes .../apache/cordova/CordovaWebViewEngine.class | Bin 0 -> 1170 bytes .../apache/cordova/CordovaWebViewImpl$1.class | Bin 0 -> 1660 bytes .../apache/cordova/CordovaWebViewImpl$2.class | Bin 0 -> 1560 bytes .../apache/cordova/CordovaWebViewImpl$3.class | Bin 0 -> 1468 bytes .../CordovaWebViewImpl$EngineClient$1$1.class | Bin 0 -> 1256 bytes .../CordovaWebViewImpl$EngineClient$1.class | Bin 0 -> 1482 bytes .../CordovaWebViewImpl$EngineClient.class | Bin 0 -> 4953 bytes .../org/apache/cordova/CordovaWebViewImpl.class | Bin 0 -> 16044 bytes .../org/apache/cordova/CoreAndroid$1.class | Bin 0 -> 1027 bytes .../org/apache/cordova/CoreAndroid$2.class | Bin 0 -> 748 bytes .../org/apache/cordova/CoreAndroid$3.class | Bin 0 -> 737 bytes .../org/apache/cordova/CoreAndroid$4.class | Bin 0 -> 748 bytes .../org/apache/cordova/CoreAndroid$5.class | Bin 0 -> 1988 bytes .../debug/org/apache/cordova/CoreAndroid.class | Bin 0 -> 9479 bytes .../debug/org/apache/cordova/ExposedJsApi.class | Bin 0 -> 442 bytes .../cordova/ICordovaClientCertRequest.class | Bin 0 -> 443 bytes .../apache/cordova/ICordovaCookieManager.class | Bin 0 -> 345 bytes .../cordova/ICordovaHttpAuthHandler.class | Bin 0 -> 229 bytes .../classes/debug/org/apache/cordova/LOG.class | Bin 0 -> 3616 bytes .../NativeToJsMessageQueue$BridgeMode.class | Bin 0 -> 814 bytes ...ativeToJsMessageQueue$EvalBridgeMode$1.class | Bin 0 -> 1456 bytes .../NativeToJsMessageQueue$EvalBridgeMode.class | Bin 0 -> 1544 bytes .../NativeToJsMessageQueue$JsMessage.class | Bin 0 -> 4055 bytes ...veToJsMessageQueue$LoadUrlBridgeMode$1.class | Bin 0 -> 1594 bytes ...tiveToJsMessageQueue$LoadUrlBridgeMode.class | Bin 0 -> 1562 bytes .../NativeToJsMessageQueue$NoOpBridgeMode.class | Bin 0 -> 712 bytes ...sMessageQueue$OnlineEventsBridgeMode$1.class | Bin 0 -> 1407 bytes ...sMessageQueue$OnlineEventsBridgeMode$2.class | Bin 0 -> 1733 bytes ...dgeMode$OnlineEventsBridgeModeDelegate.class | Bin 0 -> 499 bytes ...oJsMessageQueue$OnlineEventsBridgeMode.class | Bin 0 -> 2619 bytes .../apache/cordova/NativeToJsMessageQueue.class | Bin 0 -> 7448 bytes .../debug/org/apache/cordova/PluginEntry.class | Bin 0 -> 1042 bytes .../org/apache/cordova/PluginManager.class | Bin 0 -> 12314 bytes .../apache/cordova/PluginResult$Status.class | Bin 0 -> 1651 bytes .../debug/org/apache/cordova/PluginResult.class | Bin 0 -> 5908 bytes .../org/apache/cordova/ResumeCallback.class | Bin 0 -> 2995 bytes .../apache/cordova/Whitelist$URLPattern.class | Bin 0 -> 3129 bytes .../debug/org/apache/cordova/Whitelist.class | Bin 0 -> 2952 bytes .../cordova/engine/SystemCookieManager.class | Bin 0 -> 1843 bytes .../cordova/engine/SystemExposedJsApi.class | Bin 0 -> 1433 bytes .../engine/SystemWebChromeClient$1.class | Bin 0 -> 1202 bytes .../engine/SystemWebChromeClient$2.class | Bin 0 -> 1204 bytes .../engine/SystemWebChromeClient$3.class | Bin 0 -> 1270 bytes .../engine/SystemWebChromeClient$4.class | Bin 0 -> 1707 bytes .../engine/SystemWebChromeClient$5.class | Bin 0 -> 1787 bytes .../cordova/engine/SystemWebChromeClient.class | Bin 0 -> 10992 bytes .../apache/cordova/engine/SystemWebView.class | Bin 0 -> 2658 bytes .../cordova/engine/SystemWebViewClient.class | Bin 0 -> 9561 bytes .../cordova/engine/SystemWebViewEngine$1.class | Bin 0 -> 1841 bytes .../cordova/engine/SystemWebViewEngine$2.class | Bin 0 -> 1050 bytes .../cordova/engine/SystemWebViewEngine.class | Bin 0 -> 12173 bytes .../apache/cordova/AuthenticationToken.class | Bin 0 -> 776 bytes .../org/apache/cordova/BuildConfig.class | Bin 0 -> 576 bytes .../org/apache/cordova/CallbackContext.class | Bin 0 -> 3328 bytes .../org/apache/cordova/CallbackMap.class | Bin 0 -> 1491 bytes .../release/org/apache/cordova/Config.class | Bin 0 -> 1841 bytes .../org/apache/cordova/ConfigXmlParser.class | Bin 0 -> 4919 bytes .../org/apache/cordova/CordovaActivity$1.class | Bin 0 -> 943 bytes .../org/apache/cordova/CordovaActivity$2.class | Bin 0 -> 1019 bytes .../org/apache/cordova/CordovaActivity$3.class | Bin 0 -> 1522 bytes .../apache/cordova/CordovaActivity$4$1.class | Bin 0 -> 1090 bytes .../org/apache/cordova/CordovaActivity$4.class | Bin 0 -> 2012 bytes .../org/apache/cordova/CordovaActivity.class | Bin 0 -> 11826 bytes .../org/apache/cordova/CordovaArgs.class | Bin 0 -> 2561 bytes .../org/apache/cordova/CordovaBridge.class | Bin 0 -> 5458 bytes .../cordova/CordovaClientCertRequest.class | Bin 0 -> 1426 bytes .../apache/cordova/CordovaDialogsHelper$1.class | Bin 0 -> 1221 bytes .../apache/cordova/CordovaDialogsHelper$2.class | Bin 0 -> 1201 bytes .../apache/cordova/CordovaDialogsHelper$3.class | Bin 0 -> 1352 bytes .../apache/cordova/CordovaDialogsHelper$4.class | Bin 0 -> 1223 bytes .../apache/cordova/CordovaDialogsHelper$5.class | Bin 0 -> 1223 bytes .../apache/cordova/CordovaDialogsHelper$6.class | Bin 0 -> 1203 bytes .../apache/cordova/CordovaDialogsHelper$7.class | Bin 0 -> 1354 bytes .../apache/cordova/CordovaDialogsHelper$8.class | Bin 0 -> 1506 bytes .../apache/cordova/CordovaDialogsHelper$9.class | Bin 0 -> 1240 bytes .../cordova/CordovaDialogsHelper$Result.class | Bin 0 -> 277 bytes .../apache/cordova/CordovaDialogsHelper.class | Bin 0 -> 3796 bytes .../apache/cordova/CordovaHttpAuthHandler.class | Bin 0 -> 821 bytes .../org/apache/cordova/CordovaInterface.class | Bin 0 -> 725 bytes ...dovaInterfaceImpl$ActivityResultHolder.class | Bin 0 -> 1064 bytes .../apache/cordova/CordovaInterfaceImpl.class | Bin 0 -> 7854 bytes .../org/apache/cordova/CordovaPlugin.class | Bin 0 -> 6873 bytes .../org/apache/cordova/CordovaPreferences.class | Bin 0 -> 3223 bytes .../CordovaResourceApi$OpenForReadResult.class | Bin 0 -> 905 bytes .../org/apache/cordova/CordovaResourceApi.class | Bin 0 -> 12703 bytes .../org/apache/cordova/CordovaWebView.class | Bin 0 -> 2239 bytes .../cordova/CordovaWebViewEngine$Client.class | Bin 0 -> 549 bytes .../CordovaWebViewEngine$EngineView.class | Bin 0 -> 308 bytes .../apache/cordova/CordovaWebViewEngine.class | Bin 0 -> 1170 bytes .../apache/cordova/CordovaWebViewImpl$1.class | Bin 0 -> 1660 bytes .../apache/cordova/CordovaWebViewImpl$2.class | Bin 0 -> 1560 bytes .../apache/cordova/CordovaWebViewImpl$3.class | Bin 0 -> 1468 bytes .../CordovaWebViewImpl$EngineClient$1$1.class | Bin 0 -> 1256 bytes .../CordovaWebViewImpl$EngineClient$1.class | Bin 0 -> 1482 bytes .../CordovaWebViewImpl$EngineClient.class | Bin 0 -> 4953 bytes .../org/apache/cordova/CordovaWebViewImpl.class | Bin 0 -> 16044 bytes .../org/apache/cordova/CoreAndroid$1.class | Bin 0 -> 1027 bytes .../org/apache/cordova/CoreAndroid$2.class | Bin 0 -> 748 bytes .../org/apache/cordova/CoreAndroid$3.class | Bin 0 -> 737 bytes .../org/apache/cordova/CoreAndroid$4.class | Bin 0 -> 748 bytes .../org/apache/cordova/CoreAndroid$5.class | Bin 0 -> 1988 bytes .../org/apache/cordova/CoreAndroid.class | Bin 0 -> 9479 bytes .../org/apache/cordova/ExposedJsApi.class | Bin 0 -> 442 bytes .../cordova/ICordovaClientCertRequest.class | Bin 0 -> 443 bytes .../apache/cordova/ICordovaCookieManager.class | Bin 0 -> 345 bytes .../cordova/ICordovaHttpAuthHandler.class | Bin 0 -> 229 bytes .../release/org/apache/cordova/LOG.class | Bin 0 -> 3616 bytes .../NativeToJsMessageQueue$BridgeMode.class | Bin 0 -> 814 bytes ...ativeToJsMessageQueue$EvalBridgeMode$1.class | Bin 0 -> 1456 bytes .../NativeToJsMessageQueue$EvalBridgeMode.class | Bin 0 -> 1544 bytes .../NativeToJsMessageQueue$JsMessage.class | Bin 0 -> 4055 bytes ...veToJsMessageQueue$LoadUrlBridgeMode$1.class | Bin 0 -> 1594 bytes ...tiveToJsMessageQueue$LoadUrlBridgeMode.class | Bin 0 -> 1562 bytes .../NativeToJsMessageQueue$NoOpBridgeMode.class | Bin 0 -> 712 bytes ...sMessageQueue$OnlineEventsBridgeMode$1.class | Bin 0 -> 1407 bytes ...sMessageQueue$OnlineEventsBridgeMode$2.class | Bin 0 -> 1733 bytes ...dgeMode$OnlineEventsBridgeModeDelegate.class | Bin 0 -> 499 bytes ...oJsMessageQueue$OnlineEventsBridgeMode.class | Bin 0 -> 2619 bytes .../apache/cordova/NativeToJsMessageQueue.class | Bin 0 -> 7448 bytes .../org/apache/cordova/PluginEntry.class | Bin 0 -> 1042 bytes .../org/apache/cordova/PluginManager.class | Bin 0 -> 12314 bytes .../apache/cordova/PluginResult$Status.class | Bin 0 -> 1651 bytes .../org/apache/cordova/PluginResult.class | Bin 0 -> 5908 bytes .../org/apache/cordova/ResumeCallback.class | Bin 0 -> 2995 bytes .../apache/cordova/Whitelist$URLPattern.class | Bin 0 -> 3129 bytes .../release/org/apache/cordova/Whitelist.class | Bin 0 -> 2952 bytes .../cordova/engine/SystemCookieManager.class | Bin 0 -> 1843 bytes .../cordova/engine/SystemExposedJsApi.class | Bin 0 -> 1433 bytes .../engine/SystemWebChromeClient$1.class | Bin 0 -> 1202 bytes .../engine/SystemWebChromeClient$2.class | Bin 0 -> 1204 bytes .../engine/SystemWebChromeClient$3.class | Bin 0 -> 1270 bytes .../engine/SystemWebChromeClient$4.class | Bin 0 -> 1707 bytes .../engine/SystemWebChromeClient$5.class | Bin 0 -> 1787 bytes .../cordova/engine/SystemWebChromeClient.class | Bin 0 -> 10992 bytes .../apache/cordova/engine/SystemWebView.class | Bin 0 -> 2658 bytes .../cordova/engine/SystemWebViewClient.class | Bin 0 -> 9561 bytes .../cordova/engine/SystemWebViewEngine$1.class | Bin 0 -> 1841 bytes .../cordova/engine/SystemWebViewEngine$2.class | Bin 0 -> 1050 bytes .../cordova/engine/SystemWebViewEngine.class | Bin 0 -> 12173 bytes .../incremental-safeguard/debug/tag.txt | 1 + .../incremental-safeguard/release/tag.txt | 1 + .../compileDebugAidl/dependency.store | Bin 0 -> 5 bytes .../compileReleaseAidl/dependency.store | Bin 0 -> 5 bytes .../incremental/mergeDebugAssets/merger.xml | 2 + .../mergeDebugJniLibFolders/merger.xml | 2 + .../incremental/mergeDebugShaders/merger.xml | 2 + .../incremental/mergeReleaseAssets/merger.xml | 2 + .../mergeReleaseJniLibFolders/merger.xml | 2 + .../incremental/mergeReleaseShaders/merger.xml | 2 + .../compile-file-map.properties | 1 + .../packageDebugResources/merger.xml | 2 + .../compile-file-map.properties | 1 + .../packageReleaseResources/merger.xml | 2 + .../manifests/aapt/debug/AndroidManifest.xml | 27 + .../manifests/aapt/release/AndroidManifest.xml | 27 + .../build/outputs/aar/framework-debug.aar | Bin 0 -> 117310 bytes .../build/outputs/aar/framework-release.aar | Bin 0 -> 117232 bytes .../atari/framework/build/poms/pom-default.xml | 28 + .../framework/build/tmp/sourcesJar/MANIFEST.MF | 2 + .../platforms/atari/framework/cordova.gradle | 201 ++ .../atari/framework/default.properties | 14 + .../platforms/atari/framework/framework.iml | 6 + .../gradle/wrapper/gradle-wrapper.properties | 6 + .../fixtures/platforms/atari/framework/gradlew | 160 ++ .../platforms/atari/framework/gradlew.bat | 90 + .../platforms/atari/framework/local.properties | 11 + .../atari/framework/project.properties | 16 + .../org/apache/cordova/AuthenticationToken.java | 69 + .../src/org/apache/cordova/CallbackContext.java | 142 ++ .../src/org/apache/cordova/CallbackMap.java | 65 + .../src/org/apache/cordova/Config.java | 71 + .../src/org/apache/cordova/ConfigXmlParser.java | 145 ++ .../src/org/apache/cordova/CordovaActivity.java | 518 ++++ .../src/org/apache/cordova/CordovaArgs.java | 113 + .../src/org/apache/cordova/CordovaBridge.java | 182 ++ .../cordova/CordovaClientCertRequest.java | 96 + .../apache/cordova/CordovaDialogsHelper.java | 152 ++ .../apache/cordova/CordovaHttpAuthHandler.java | 51 + .../org/apache/cordova/CordovaInterface.java | 88 + .../apache/cordova/CordovaInterfaceImpl.java | 241 ++ .../src/org/apache/cordova/CordovaPlugin.java | 422 ++++ .../org/apache/cordova/CordovaPreferences.java | 101 + .../org/apache/cordova/CordovaResourceApi.java | 471 ++++ .../src/org/apache/cordova/CordovaWebView.java | 142 ++ .../apache/cordova/CordovaWebViewEngine.java | 85 + .../org/apache/cordova/CordovaWebViewImpl.java | 613 +++++ .../src/org/apache/cordova/CoreAndroid.java | 390 ++++ .../src/org/apache/cordova/ExposedJsApi.java | 31 + .../cordova/ICordovaClientCertRequest.java | 66 + .../apache/cordova/ICordovaCookieManager.java | 33 + .../apache/cordova/ICordovaHttpAuthHandler.java | 38 + .../framework/src/org/apache/cordova/LOG.java | 244 ++ .../apache/cordova/NativeToJsMessageQueue.java | 524 +++++ .../src/org/apache/cordova/PluginEntry.java | 70 + .../src/org/apache/cordova/PluginManager.java | 526 +++++ .../src/org/apache/cordova/PluginResult.java | 198 ++ .../src/org/apache/cordova/ResumeCallback.java | 76 + .../src/org/apache/cordova/Whitelist.java | 170 ++ .../cordova/engine/SystemCookieManager.java | 69 + .../cordova/engine/SystemExposedJsApi.java | 53 + .../cordova/engine/SystemWebChromeClient.java | 292 +++ .../apache/cordova/engine/SystemWebView.java | 88 + .../cordova/engine/SystemWebViewClient.java | 374 +++ .../cordova/engine/SystemWebViewEngine.java | 350 +++ .../fixtures/platforms/atari/package.json | 49 + cordova-lib/spec-cordova/platform.spec.js | 64 +- cordova-lib/spec-plugman/install.spec.js | 4 +- 385 files changed, 17452 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/README.md ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/README.md b/cordova-lib/spec-cordova/fixtures/platforms/atari/README.md new file mode 100644 index 0000000..6f07f21 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/README.md @@ -0,0 +1,22 @@ +<!-- +# +# 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 is a test repo, ignore it please http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/VERSION ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/VERSION b/cordova-lib/spec-cordova/fixtures/platforms/atari/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/VERSION @@ -0,0 +1 @@ +1.0.0 http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version new file mode 100755 index 0000000..547f41b --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version @@ -0,0 +1,29 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +var android_sdk_version = require('./lib/android_sdk_version'); + +android_sdk_version.run().done(null, function(err) { + console.log(err); + process.exit(2); +}); + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version.bat ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version.bat b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version.bat new file mode 100644 index 0000000..33a1fa2 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/android_sdk_version.bat @@ -0,0 +1,26 @@ +:: 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 +SET script_path="%~dp0android_sdk_version" +IF EXIST %script_path% ( + node "%script_path%" %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'android_sdk_version' script in 'bin' folder, aborting...>&2 + EXIT /B 1 +) http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs new file mode 100755 index 0000000..372a383 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs @@ -0,0 +1,31 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +var check_reqs = require('./lib/check_reqs'); + +check_reqs.run().done( + function success() { + console.log('Looks like your environment fully supports cordova-android development!'); + }, function fail(err) { + console.log(err); + process.exit(2); + } +); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs.bat ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs.bat b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs.bat new file mode 100644 index 0000000..cb2c6f5 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/check_reqs.bat @@ -0,0 +1,26 @@ +:: 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 +SET script_path="%~dp0check_reqs" +IF EXIST %script_path% ( + node "%script_path%" %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2 + EXIT /B 1 +) http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create new file mode 100755 index 0000000..b1e4d5a --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create @@ -0,0 +1,58 @@ +#!/usr/bin/env node + +/* + 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. +*/ +var path = require('path'); +var ConfigParser = require('cordova-common').ConfigParser; +var Api = require('./templates/cordova/Api'); + +var argv = require('nopt')({ + 'help' : Boolean, + 'cli' : Boolean, + 'shared' : Boolean, + 'link' : Boolean, + 'activity-name' : [String, undefined] +}, { 'd' : '--verbose' }); + +if (argv.help || argv.argv.remain.length === 0) { + console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--activity-name <activity_name>] [--link]'); + console.log(' <path_to_new_project>: Path to your new Cordova Android project'); + console.log(' <package_name>: Package name, following reverse-domain style convention'); + console.log(' <project_name>: Project name'); + console.log(' <template_path>: Path to a custom application template to use'); + console.log(' --activity-name <activity_name>: Activity name'); + console.log(' --link will use the CordovaLib project directly instead of making a copy.'); + process.exit(1); +} + +var config = new ConfigParser(path.resolve(__dirname, 'templates/project/res/xml/config.xml')); + +if (argv.argv.remain[1]) config.setPackageName(argv.argv.remain[1]); +if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]); +if (argv['activity-name']) config.setName(argv['activity-name']); + +var options = { + link: argv.link || argv.shared, + customTemplate: argv.argv.remain[3], + activityName: argv['activity-name'] +}; + +require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv); + +Api.createPlatform(argv.argv.remain[0], config, options).done(); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create.bat ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create.bat b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create.bat new file mode 100644 index 0000000..4b475a2 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/create.bat @@ -0,0 +1,26 @@ +:: 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 +SET script_path="%~dp0create" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2 + EXIT /B 1 +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/android_sdk_version.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/android_sdk_version.js b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/android_sdk_version.js new file mode 100755 index 0000000..79af272 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/android_sdk_version.js @@ -0,0 +1,64 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +var child_process = require('child_process'), + Q = require('q'); + +var get_highest_sdk = function(results){ + var reg = /\d+/; + var apiLevels = []; + for(var i=0;i<results.length;i++){ + apiLevels[i] = parseInt(results[i].match(reg)[0]); + } + apiLevels.sort(function(a,b){return b-a;}); + console.log(apiLevels[0]); +}; + +var get_sdks = function() { + var d = Q.defer(); + child_process.exec('android list targets', function(err, stdout, stderr) { + if (err) d.reject(stderr); + else d.resolve(stdout); + }); + + return d.promise.then(function(output) { + var reg = /android-\d+/gi; + var results = output.match(reg); + if(results.length===0){ + return Q.reject(new Error('No android sdks installed.')); + }else{ + get_highest_sdk(results); + } + + return Q(); + }, function(stderr) { + if (stderr.match(/command\snot\sfound/) || stderr.match(/'android' is not recognized/)) { + return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.')); + } else { + return Q.reject(new Error('An error occurred while listing Android targets')); + } + }); +}; + +module.exports.run = function() { + return Q.all([get_sdks()]); +}; + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/check_reqs.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/check_reqs.js b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/check_reqs.js new file mode 100644 index 0000000..93d2906 --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/check_reqs.js @@ -0,0 +1,375 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +/* jshint sub:true */ + +var shelljs = require('shelljs'), + child_process = require('child_process'), + Q = require('q'), + path = require('path'), + fs = require('fs'), + os = require('os'), + ROOT = path.join(__dirname, '..', '..'); +var CordovaError = require('cordova-common').CordovaError; + +var isWindows = process.platform == 'win32'; + +function forgivingWhichSync(cmd) { + try { + return fs.realpathSync(shelljs.which(cmd)); + } catch (e) { + return ''; + } +} + +function tryCommand(cmd, errMsg, catchStderr) { + var d = Q.defer(); + child_process.exec(cmd, function(err, stdout, stderr) { + if (err) d.reject(new CordovaError(errMsg)); + // Sometimes it is necessary to return an stderr instead of stdout in case of success, since + // some commands prints theirs output to stderr instead of stdout. 'javac' is the example + else d.resolve((catchStderr ? stderr : stdout).trim()); + }); + return d.promise; +} + +// Get valid target from framework/project.properties +module.exports.get_target = function() { + function extractFromFile(filePath) { + var target = shelljs.grep(/\btarget=/, filePath); + if (!target) { + throw new Error('Could not find android target within: ' + filePath); + } + return target.split('=')[1].trim(); + } + if (fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) { + return extractFromFile(path.join(ROOT, 'framework', 'project.properties')); + } + if (fs.existsSync(path.join(ROOT, 'project.properties'))) { + // if no target found, we're probably in a project and project.properties is in ROOT. + return extractFromFile(path.join(ROOT, 'project.properties')); + } + throw new Error('Could not find android target. File missing: ' + path.join(ROOT, 'project.properties')); +}; + +// Returns a promise. Called only by build and clean commands. +module.exports.check_ant = function() { + return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.') + .then(function (output) { + // Parse Ant version from command output + return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1]; + }); +}; + +module.exports.get_gradle_wrapper = function() { + var androidStudioPath; + if(os.platform() == 'darwin') { + androidStudioPath = path.join('/Applications', 'Android Studio.app', 'Contents', 'gradle'); + } else if (os.platform() == 'win32') { + androidStudioPath = path.join(process.env['ProgramFiles'],'Android', 'Android Studio', 'gradle'); + } + + if(androidStudioPath !== null && fs.existsSync(androidStudioPath)) { + var dirs = fs.readdirSync(androidStudioPath); + if(dirs[0].split('-')[0] == 'gradle') + { + return path.join(androidStudioPath, dirs[0], 'bin', 'gradle'); + } + } else { + //OK, let's try to check for Gradle! + return forgivingWhichSync('gradle'); + } +}; + +// Returns a promise. Called only by build and clean commands. +module.exports.check_gradle = function() { + var sdkDir = process.env['ANDROID_HOME']; + var d = Q.defer(); + if (!sdkDir) + return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' + + 'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.')); + + var gradlePath = this.get_gradle_wrapper(); + if(gradlePath.length !== 0) + d.resolve(gradlePath); + else + d.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' + + 'or on your system to install the gradle wrapper. Please include gradle \n' + + 'in your path, or install Android Studio')); + return d.promise; +}; + + +// Returns a promise. +module.exports.check_java = function() { + var javacPath = forgivingWhichSync('javac'); + var hasJavaHome = !!process.env['JAVA_HOME']; + return Q().then(function() { + if (hasJavaHome) { + // Windows java installer doesn't add javac to PATH, nor set JAVA_HOME (ugh). + if (!javacPath) { + process.env['PATH'] += path.delimiter + path.join(process.env['JAVA_HOME'], 'bin'); + } + } else { + if (javacPath) { + var msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.'; + // OS X has a command for finding JAVA_HOME. + if (fs.existsSync('/usr/libexec/java_home')) { + return tryCommand('/usr/libexec/java_home', msg) + .then(function(stdout) { + process.env['JAVA_HOME'] = stdout.trim(); + }); + } else { + // See if we can derive it from javac's location. + // fs.realpathSync is require on Ubuntu, which symplinks from /usr/bin -> JDK + var maybeJavaHome = path.dirname(path.dirname(javacPath)); + if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) { + process.env['JAVA_HOME'] = maybeJavaHome; + } else { + throw new CordovaError(msg); + } + } + } else if (isWindows) { + // Try to auto-detect java in the default install paths. + var oldSilent = shelljs.config.silent; + shelljs.config.silent = true; + var firstJdkDir = + shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] || + shelljs.ls('C:\\Program Files\\java\\jdk*')[0] || + shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0]; + shelljs.config.silent = oldSilent; + if (firstJdkDir) { + // shelljs always uses / in paths. + firstJdkDir = firstJdkDir.replace(/\//g, path.sep); + if (!javacPath) { + process.env['PATH'] += path.delimiter + path.join(firstJdkDir, 'bin'); + } + process.env['JAVA_HOME'] = firstJdkDir; + } + } + } + }).then(function() { + var msg = + 'Failed to run "javac -version", make sure that you have a JDK installed.\n' + + 'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n'; + if (process.env['JAVA_HOME']) { + msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n'; + } + // We use tryCommand with catchStderr = true, because + // javac writes version info to stderr instead of stdout + return tryCommand('javac -version', msg, true) + .then(function (output) { + //Let's check for at least Java 8, and keep it future proof so we can support Java 10 + var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output); + return match && match[1]; + }); + }); +}; + +// Returns a promise. +module.exports.check_android = function() { + return Q().then(function() { + var androidCmdPath = forgivingWhichSync('android'); + var adbInPath = !!forgivingWhichSync('adb'); + var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']); + function maybeSetAndroidHome(value) { + if (!hasAndroidHome && fs.existsSync(value)) { + hasAndroidHome = true; + process.env['ANDROID_HOME'] = value; + } + } + if (!hasAndroidHome && !androidCmdPath) { + if (isWindows) { + // Android Studio 1.0 installer + maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'sdk')); + maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'sdk')); + // Android Studio pre-1.0 installer + maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-studio', 'sdk')); + maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-studio', 'sdk')); + // Stand-alone installer + maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk')); + maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk')); + } else if (process.platform == 'darwin') { + // Android Studio 1.0 installer + maybeSetAndroidHome(path.join(process.env['HOME'], 'Library', 'Android', 'sdk')); + // Android Studio pre-1.0 installer + maybeSetAndroidHome('/Applications/Android Studio.app/sdk'); + // Stand-alone zip file that user might think to put under /Applications + maybeSetAndroidHome('/Applications/android-sdk-macosx'); + maybeSetAndroidHome('/Applications/android-sdk'); + } + if (process.env['HOME']) { + // Stand-alone zip file that user might think to put under their home directory + maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk-macosx')); + maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk')); + } + } + if (hasAndroidHome && !androidCmdPath) { + process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools'); + } + if (androidCmdPath && !hasAndroidHome) { + var parentDir = path.dirname(androidCmdPath); + var grandParentDir = path.dirname(parentDir); + if (path.basename(parentDir) == 'tools') { + process.env['ANDROID_HOME'] = path.dirname(parentDir); + hasAndroidHome = true; + } else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) { + process.env['ANDROID_HOME'] = grandParentDir; + hasAndroidHome = true; + } else { + throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' + + 'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' + + 'Try reinstall Android SDK or update your PATH to include path to valid SDK directory.'); + } + } + if (hasAndroidHome && !adbInPath) { + process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools'); + } + if (!process.env['ANDROID_HOME']) { + throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' + + 'Failed to find \'android\' command in your \'PATH\'. Try update your \'PATH\' to include path to valid SDK directory.'); + } + if (!fs.existsSync(process.env['ANDROID_HOME'])) { + throw new CordovaError('\'ANDROID_HOME\' environment variable is set to non-existent path: ' + process.env['ANDROID_HOME'] + + '\nTry update it manually to point to valid SDK directory.'); + } + return hasAndroidHome; + }); +}; + +module.exports.getAbsoluteAndroidCmd = function () { + var cmd = forgivingWhichSync('android'); + if(cmd.length === 0) + cmd = forgivingWhichSync('avdmanager'); + if (process.platform === 'win32') { + return '"' + cmd + '"'; + } + return cmd.replace(/(\s)/g, '\\$1'); +}; + +module.exports.check_android_target = function(originalError) { + // valid_target can look like: + // android-19 + // android-L + // Google Inc.:Google APIs:20 + // Google Inc.:Glass Development Kit Preview:20 + var valid_target = module.exports.get_target(); + var msg = 'Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.'; + // Changing "targets" to "target" is stupid and makes more code. Thanks Google! + var cmd = 'android list targets --compact'; + if(forgivingWhichSync('avdmanager').length > 0) + cmd = 'avdmanager list target --compact'; + return tryCommand(cmd, msg) + .then(function(output) { + var targets = output.split('\n'); + if (targets.indexOf(valid_target) >= 0) { + return targets; + } + + var androidCmd = module.exports.getAbsoluteAndroidCmd(); + var msg = 'Please install Android target: "' + valid_target + '".\n\n' + + 'Hint: Open the SDK manager by running: ' + androidCmd + '\n' + + 'You will require:\n' + + '1. "SDK Platform" for ' + valid_target + '\n' + + '2. "Android SDK Platform-tools (latest)\n' + + '3. "Android SDK Build-tools" (latest)'; + if (originalError) { + msg = originalError + '\n' + msg; + } + throw new CordovaError(msg); + }); +}; + +// Returns a promise. +module.exports.run = function() { + return Q.all([this.check_java(), this.check_android()]) + .then(function(values) { + console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']); + console.log('JAVA_HOME=' + process.env['JAVA_HOME']); + + if (!values[0]) { + throw new CordovaError('Requirements check failed for JDK 1.8 or greater'); + } + + + if (!values[1]) { + throw new CordovaError('Requirements check failed for Android SDK'); + } + }); +}; + + +/** + * Object thar represents one of requirements for current platform. + * @param {String} id The unique identifier for this requirements. + * @param {String} name The name of requirements. Human-readable field. + * @param {String} version The version of requirement installed. In some cases could be an array of strings + * (for example, check_android_target returns an array of android targets installed) + * @param {Boolean} installed Indicates whether the requirement is installed or not + */ +var Requirement = function (id, name, version, installed) { + this.id = id; + this.name = name; + this.installed = installed || false; + this.metadata = { + version: version, + }; +}; + +/** + * Methods that runs all checks one by one and returns a result of checks + * as an array of Requirement objects. This method intended to be used by cordova-lib check_reqs method + * + * @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled. + */ +module.exports.check_all = function() { + + var requirements = [ + new Requirement('java', 'Java JDK'), + new Requirement('androidSdk', 'Android SDK'), + new Requirement('androidTarget', 'Android target'), + new Requirement('gradle', 'Gradle') + ]; + + var checkFns = [ + this.check_java, + this.check_android, + this.check_android_target, + this.check_gradle + ]; + + // Then execute requirement checks one-by-one + return checkFns.reduce(function (promise, checkFn, idx) { + // Update each requirement with results + var requirement = requirements[idx]; + return promise.then(checkFn) + .then(function (version) { + requirement.installed = true; + requirement.metadata.version = version; + }, function (err) { + requirement.metadata.reason = err instanceof Error ? err.message : err; + }); + }, Q()) + .then(function () { + // When chain is completed, return requirements array to upstream API + return requirements; + }); +}; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/create.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/create.js b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/create.js new file mode 100755 index 0000000..ef5827a --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/lib/create.js @@ -0,0 +1,333 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +var shell = require('shelljs'), + Q = require('q'), + path = require('path'), + fs = require('fs'), + check_reqs = require('./check_reqs'), + ROOT = path.join(__dirname, '..', '..'); + +var MIN_SDK_VERSION = 16; + +var CordovaError = require('cordova-common').CordovaError; +var AndroidManifest = require('../templates/cordova/lib/AndroidManifest'); + +function setShellFatal(value, func) { + var oldVal = shell.config.fatal; + shell.config.fatal = value; + func(); + shell.config.fatal = oldVal; +} + +function getFrameworkDir(projectPath, shared) { + return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib'); +} + +function copyJsAndLibrary(projectPath, shared, projectName) { + var nestedCordovaLibPath = getFrameworkDir(projectPath, false); + var srcCordovaJsPath = path.join(ROOT, 'bin', 'templates', 'project', 'assets', 'www', 'cordova.js'); + shell.cp('-f', srcCordovaJsPath, path.join(projectPath, 'assets', 'www', 'cordova.js')); + + // Copy the cordova.js file to platforms/<platform>/platform_www/ + // The www dir is nuked on each prepare so we keep cordova.js in platform_www + shell.mkdir('-p', path.join(projectPath, 'platform_www')); + shell.cp('-f', srcCordovaJsPath, path.join(projectPath, 'platform_www')); + + // Copy cordova-js-src directory into platform_www directory. + // We need these files to build cordova.js if using browserify method. + shell.cp('-rf', path.join(ROOT, 'cordova-js-src'), path.join(projectPath, 'platform_www')); + + // Don't fail if there are no old jars. + setShellFatal(false, function() { + shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) { + console.log('Deleting ' + oldJar); + shell.rm('-f', oldJar); + }); + var wasSymlink = true; + try { + // Delete the symlink if it was one. + fs.unlinkSync(nestedCordovaLibPath); + } catch (e) { + wasSymlink = false; + } + // Delete old library project if it existed. + if (shared) { + shell.rm('-rf', nestedCordovaLibPath); + } else if (!wasSymlink) { + // Delete only the src, since Eclipse / Android Studio can't handle their project files being deleted. + shell.rm('-rf', path.join(nestedCordovaLibPath, 'src')); + } + }); + if (shared) { + var relativeFrameworkPath = path.relative(projectPath, getFrameworkDir(projectPath, true)); + fs.symlinkSync(relativeFrameworkPath, nestedCordovaLibPath, 'dir'); + } else { + shell.mkdir('-p', nestedCordovaLibPath); + shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath); + shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath); + shell.cp('-f', path.join(ROOT, 'framework', 'build.gradle'), nestedCordovaLibPath); + shell.cp('-f', path.join(ROOT, 'framework', 'cordova.gradle'), nestedCordovaLibPath); + shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath); + } +} + +function extractSubProjectPaths(data) { + var ret = {}; + var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg; + var m; + while ((m = r.exec(data))) { + ret[m[1]] = 1; + } + return Object.keys(ret); +} + +function writeProjectProperties(projectPath, target_api) { + var dstPath = path.join(projectPath, 'project.properties'); + var templatePath = path.join(ROOT, 'bin', 'templates', 'project', 'project.properties'); + var srcPath = fs.existsSync(dstPath) ? dstPath : templatePath; + + var data = fs.readFileSync(srcPath, 'utf8'); + data = data.replace(/^target=.*/m, 'target=' + target_api); + var subProjects = extractSubProjectPaths(data); + subProjects = subProjects.filter(function(p) { + return !(/^CordovaLib$/m.exec(p) || + /[\\\/]cordova-android[\\\/]framework$/m.exec(p) || + /^(\.\.[\\\/])+framework$/m.exec(p) + ); + }); + subProjects.unshift('CordovaLib'); + data = data.replace(/^\s*android\.library\.reference\.\d+=.*\n/mg, ''); + if (!/\n$/.exec(data)) { + data += '\n'; + } + for (var i = 0; i < subProjects.length; ++i) { + data += 'android.library.reference.' + (i+1) + '=' + subProjects[i] + '\n'; + } + fs.writeFileSync(dstPath, data); +} + +function prepBuildFiles(projectPath) { + var buildModule = require(path.resolve(projectPath, 'cordova/lib/builders/builders')); + buildModule.getBuilder('gradle').prepBuildFiles(); +} + +function copyBuildRules(projectPath) { + var srcDir = path.join(ROOT, 'bin', 'templates', 'project'); + + shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath); + shell.cp('-f', path.join(srcDir, 'wrapper.gradle'), projectPath); +} + +function copyScripts(projectPath) { + var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova'); + var destScriptsDir = path.join(projectPath, 'cordova'); + // Delete old scripts directory if this is an update. + shell.rm('-rf', destScriptsDir); + // Copy in the new ones. + shell.cp('-r', srcScriptsDir, projectPath); + shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir); + shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir); + shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js')); + shell.cp(path.join(ROOT, 'bin', 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version')); + shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk_version.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk_version.js')); +} + +/** + * Test whether a package name is acceptable for use as an android project. + * Returns a promise, fulfilled if the package name is acceptable; rejected + * otherwise. + */ +function validatePackageName(package_name) { + //Make the package conform to Java package types + //http://developer.android.com/guide/topics/manifest/manifest-element.html#package + //Enforce underscore limitation + var msg = 'Error validating package name. '; + if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) { + return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name')); + } + + //Class is a reserved word + if(/\b[Cc]lass\b/.test(package_name)) { + return Q.reject(new CordovaError(msg + '"class" is a reserved word')); + } + + return Q.resolve(); +} + +/** + * Test whether a project name is acceptable for use as an android class. + * Returns a promise, fulfilled if the project name is acceptable; rejected + * otherwise. + */ +function validateProjectName(project_name) { + var msg = 'Error validating project name. '; + //Make sure there's something there + if (project_name === '') { + return Q.reject(new CordovaError(msg + 'Project name cannot be empty')); + } + + //Enforce stupid name error + if (project_name === 'CordovaActivity') { + return Q.reject(new CordovaError(msg + 'Project name cannot be CordovaActivity')); + } + + //Classes in Java don't begin with numbers + if (/^[0-9]/.test(project_name)) { + return Q.reject(new CordovaError(msg + 'Project name must not begin with a number')); + } + + return Q.resolve(); +} + +/** + * Creates an android application with the given options. + * + * @param {String} project_path Path to the new Cordova android project. + * @param {ConfigParser} config Instance of ConfigParser to retrieve basic + * project properties. + * @param {Object} [options={}] Various options + * @param {String} [options.activityName='MainActivity'] Name for the + * activity + * @param {Boolean} [options.link=false] Specifies whether javascript files + * and CordovaLib framework will be symlinked to created application. + * @param {String} [options.customTemplate] Path to project template + * (override) + * @param {EventEmitter} [events] An EventEmitter instance for logging + * events + * + * @return {Promise<String>} Directory where application has been created + */ +exports.create = function(project_path, config, options, events) { + + options = options || {}; + + // Set default values for path, package and name + project_path = path.relative(process.cwd(), (project_path || 'CordovaExample')); + // Check if project already exists + if(fs.existsSync(project_path)) { + return Q.reject(new CordovaError('Project already exists! Delete and recreate')); + } + + var package_name = config.packageName() || 'my.cordova.project'; + var project_name = config.name() ? + config.name().replace(/[^\w.]/g,'_') : 'CordovaExample'; + + var safe_activity_name = config.android_activityName() || options.activityName || 'MainActivity'; + var target_api = check_reqs.get_target(); + + //Make the package conform to Java package types + return validatePackageName(package_name) + .then(function() { + validateProjectName(project_name); + }).then(function() { + // Log the given values for the project + events.emit('log', 'Creating Cordova project for the Android platform:'); + events.emit('log', '\tPath: ' + project_path); + events.emit('log', '\tPackage: ' + package_name); + events.emit('log', '\tName: ' + project_name); + events.emit('log', '\tActivity: ' + safe_activity_name); + events.emit('log', '\tAndroid target: ' + target_api); + + events.emit('verbose', 'Copying android template project to ' + project_path); + + setShellFatal(true, function() { + var project_template_dir = options.customTemplate || path.join(ROOT, 'bin', 'templates', 'project'); + // copy project template + shell.cp('-r', path.join(project_template_dir, 'assets'), project_path); + shell.cp('-r', path.join(project_template_dir, 'res'), project_path); + shell.cp(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore')); + + // Manually create directories that would be empty within the template (since git doesn't track directories). + shell.mkdir(path.join(project_path, 'libs')); + + // copy cordova.js, cordova.jar + copyJsAndLibrary(project_path, options.link, safe_activity_name); + + // interpolate the activity name and package + var packagePath = package_name.replace(/\./g, path.sep); + var activity_dir = path.join(project_path, 'src', packagePath); + var activity_path = path.join(activity_dir, safe_activity_name + '.java'); + shell.mkdir('-p', activity_dir); + shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path); + shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path); + shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml')); + shell.sed('-i', /__ID__/, package_name, activity_path); + + var manifest = new AndroidManifest(path.join(project_template_dir, 'AndroidManifest.xml')); + manifest.setPackageId(package_name) + .setTargetSdkVersion(target_api.split('-')[1]) + .getActivity().setName(safe_activity_name); + + var manifest_path = path.join(project_path, 'AndroidManifest.xml'); + manifest.write(manifest_path); + + copyScripts(project_path); + copyBuildRules(project_path); + }); + // Link it to local android install. + writeProjectProperties(project_path, target_api); + prepBuildFiles(project_path); + events.emit('log', generateDoneMessage('create', options.link)); + }).thenResolve(project_path); +}; + +function generateDoneMessage(type, link) { + var pkg = require('../../package'); + var msg = 'Android project ' + (type == 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version; + if (link) { + msg += ' and has a linked CordovaLib'; + } + return msg; +} + +// Returns a promise. +exports.update = function(projectPath, options, events) { + options = options || {}; + + return Q() + .then(function() { + + var manifest = new AndroidManifest(path.join(projectPath, 'AndroidManifest.xml')); + + if (Number(manifest.getMinSdkVersion()) < MIN_SDK_VERSION) { + events.emit('verbose', 'Updating minSdkVersion to ' + MIN_SDK_VERSION + ' in AndroidManifest.xml'); + manifest.setMinSdkVersion(MIN_SDK_VERSION); + } + + manifest.setDebuggable(false).write(); + + var projectName = manifest.getActivity().getName(); + var target_api = check_reqs.get_target(); + + copyJsAndLibrary(projectPath, options.link, projectName); + copyScripts(projectPath); + copyBuildRules(projectPath); + writeProjectProperties(projectPath, target_api); + prepBuildFiles(projectPath); + events.emit('log', generateDoneMessage('update', options.link)); + }).thenResolve(projectPath); +}; + + +// For testing +exports.validatePackageName = validatePackageName; +exports.validateProjectName = validateProjectName; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/da952e07/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/templates/cordova/.jshintrc ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/templates/cordova/.jshintrc b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/templates/cordova/.jshintrc new file mode 100644 index 0000000..89a121c --- /dev/null +++ b/cordova-lib/spec-cordova/fixtures/platforms/atari/bin/templates/cordova/.jshintrc @@ -0,0 +1,10 @@ +{ + "node": true + , "bitwise": true + , "undef": true + , "trailing": true + , "quotmark": true + , "indent": 4 + , "unused": "vars" + , "latedef": "nofunc" +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
