You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by vladimir-kotikov <gi...@git.apache.org> on 2015/10/12 17:30:26 UTC
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
GitHub user vladimir-kotikov opened a pull request:
https://github.com/apache/cordova-android/pull/226
CB-9782 Implements PlatformApi contract for Android platform
This is an implementation for [CB-9782](https://issues.apache.org/jira/browse/CB-9782) - PlatformApi compatible api for android platform, which could be used by cordova and other tools as a separate NodeJS module.
The main entry point for new API is [/bin/templates/cordova/Api.js](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/Api.js), which exposes all the methods, defined in PlatformApi spec at https://github.com/cordova/cordova-discuss/pull/12
Since the PR contains a lot of changes, here is the main points of interest:
1. [Api.js](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/Api.js) which looks similar to PlatformApi polyfill implementation, but contains only android-specific code.
2. `build`/`run`/`check_reqs` scripts are reworked, so they are used as corresponding `Api` methods implementations (bound to `Api` instance at runtime)
3. 'prepare' logic from cordova-lib/metadata/android_parser copied into [`prepare`](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/lib/prepare.js) module.
3. `build` script refactored and split into number of 'builders': [`GradleBuilder`](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/lib/builders/GradleBuilder.js), [`AntBuilder`](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/lib/builders/AntBuilder.js)
4. All the logic that deals with `Androidmanifest.xml` factored into [`AndroidManifest` class](https://github.com/MSOpenTech/cordova-android/blob/2023e87c93a7d2ea665b93e02a9034e3927c27c2/bin/templates/cordova/lib/AndroidManifest.js)
5. `exec` and `spawn` modules are removed in favor of `cordova-common`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/MSOpenTech/cordova-android CB-9782
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-android/pull/226.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #226
----
commit adc7b035fddaba3faf26ba77d2a8659f3f4926ff
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-09-29T14:51:29Z
Initial Api implementation:
* rework 'build' command
* Make build script working separately
commit 2f2c062eedbb82834ca6140f9a4b2603fb6ce418
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-09-30T08:15:14Z
Make `run` working through PlatformApi
commit d08b1d7b8f41095d2c240ff87f84daf393777c62
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-09-30T08:17:06Z
Make `clean` working through PlatformApi
commit b51d10c79710d181ea763e0405ccede6c39afec7
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-06T13:39:31Z
Cleaning up
* Adding .jshint and fixing multiple minor issues
* Remove excess merging logic in case when defaults.xml doesn't exists
* Got rid of internal getPlatformInfo usage
commit 4dc16e6c53398f94ed4db1b1b2502d206ad7117f
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-06T13:41:18Z
Enable 'requirements' command
commit eae3404bcccfe949953f35c02d4aa0e6cdf6f443
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-07T13:04:05Z
Refactor AndroidManifest manipulation to separate class
* Also slightly update java files manipulation to make more readable
commit 9696a48ed42db57047ebe9503afa5a3f38f41d68
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-07T13:54:34Z
Adding draft support for addPlugin/removePlugin
commit 5bd08d76df6afe6a927a45f0b21f961ba2cdd8ad
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-07T13:02:00Z
Switch to using cordova-common's superspawn
commit 2f9188a6277946cdd43cd24ce953142015cb4bca
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-07T13:39:12Z
Move node_modules to package's root
commit c190a933e398180dc9996dea8c5d87850be366be
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-07T13:47:31Z
JSHint fixups
commit 136ab87b5852ea0ca515a792be8dc4c583488b42
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T07:29:00Z
Introduce Adb wrapper
commit aa6c48dab279adec660e8102a9df90f4cf325c38
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T07:30:29Z
Switch to events and CordovaError from cordova-common
commit 10a335f91f6680959945b17ce6adb0665763b8db
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T09:55:40Z
Refactor builders to dedupe some code
commit b42d135773274b37c6c957d25f67fea99184758e
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T09:31:41Z
Rework create/update scripts to expose via PlatformApi
commit 9607ce7bb1ee6105c554116024a284355c1ab7f7
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T12:57:03Z
Revisit package dependencies
* Get rid of which dependency
* Bump shelljs depednency to prevent issues with copying linked node_modules on windows
commit b6cac2c0ce42c6b397fdfa8c528fe4c634228867
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T13:58:29Z
Rework create to copy cordova-js sources along with other javascript
commit a8278a1aa88e744b59dfa79419c047c9b300d32f
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-09T14:07:51Z
Adding bundled dependencies to repo
commit c4c75855367b09d6074308f6f01f4ed729b9da42
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-12T11:47:23Z
Got rid of simpleargs in favor of nopt
commit d7892f81fb31713582debaa9919ab8dd6d62e83a
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-12T11:48:19Z
Factor out prepare logic to separate file
commit 2023e87c93a7d2ea665b93e02a9034e3927c27c2
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-12T12:50:37Z
Update check_reqs to use CordovaError
commit 91878e9cb07c917c35e20234b40180b09a42d589
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-12T14:59:39Z
Round out all TODOs:
* Make getPackageName instance method of AndroidProject
* Retrieve version from VERSION instead of hardcoded value
* Rename pluginHandlers and move get* methods there
* Remove non-actual TODOs
commit c105a9bacadebd709caba66b91badea27f52e5bd
Author: Vladimir Kotikov <v-...@microsoft.com>
Date: 2015-10-12T15:07:52Z
Rename PlatformApiPoly -> Api
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by infil00p <gi...@git.apache.org>.
Github user infil00p commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-147458901
Why is all of element-tree and the other npm dependencies checked in? That seems very odd, and makes it harder to figure out what's going on.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-149436358
LGTM. Let's get this in! Is there a fix for the travis CI issue.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r42260468
--- Diff: bin/create ---
@@ -1,49 +1,56 @@
-#!/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 create = require('./lib/create');
-var argv = require('nopt')({
- 'help' : Boolean,
- 'cli' : Boolean,
- 'shared' : Boolean,
- 'link' : Boolean,
- 'activity-name' : [String, undefined]
-});
-
-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 project_path = argv.argv.remain[0];
-var package_name = argv.argv.remain[1];
-var project_name = argv.argv.remain[2];
-var template_path = argv.argv.remain[3];
-var activity_name = argv['activity-name'];
-
-create.createProject(project_path, package_name, project_name, activity_name, template_path, argv.link || argv.shared, argv.cli).done();
-
+#!/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]
+});
+
+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]');
--- End diff --
I did mean `events.emit`. Sounds good.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/cordova-android/pull/226
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-147747182
@alsorokin Can you please buddy test this? This is a significant change.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-147652157
@infil00p, the npm dependencies was already checked in (see https://github.com/apache/cordova-android/commit/7be1f018aa2729efaa569e422bee893686ad34b8 and https://github.com/apache/cordova-android/commit/fd6a1e5ed00baba902279dbc52cb9639b0e78eb3) as a part of [CB-3542](https://issues.apache.org/jira/browse/CB-3542). I just added two more dependencies (elementtree and nopt) and moved `node_modules` directory to repo root.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r42155780
--- Diff: bin/create ---
@@ -1,49 +1,56 @@
-#!/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 create = require('./lib/create');
-var argv = require('nopt')({
- 'help' : Boolean,
- 'cli' : Boolean,
- 'shared' : Boolean,
- 'link' : Boolean,
- 'activity-name' : [String, undefined]
-});
-
-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 project_path = argv.argv.remain[0];
-var package_name = argv.argv.remain[1];
-var project_name = argv.argv.remain[2];
-var template_path = argv.argv.remain[3];
-var activity_name = argv['activity-name'];
-
-create.createProject(project_path, package_name, project_name, activity_name, template_path, argv.link || argv.shared, argv.cli).done();
-
+#!/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]
+});
+
+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]');
--- End diff --
Would it make sense to use cordova logging instead of console.log here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r41837660
--- Diff: bin/templates/cordova/Api.js ---
@@ -0,0 +1,506 @@
+/**
+ 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 Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+
+var CordovaError = require('cordova-common').CordovaError;
+var PlatformJson = require('cordova-common').PlatformJson;
+var ActionStack = require('cordova-common').ActionStack;
+var AndroidProject = require('./lib/AndroidProject');
+var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+
+var pluginHandlers = require('./lib/pluginHandlers');
+
+var PLATFORM = 'android';
+var GENERIC_EVENTS = new (require('events').EventEmitter)()
+ .on('verbose', function (message) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0)
+ console.log(message);
+ })
+ .on('log', console.log)
+ .on('warn', console.warn)
+ .on('error', function (error) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0) {
+ console.error((error && error.message) || error);
--- End diff --
> Should this be flipped? We should stack for verbose output and not otherwise?
Yes, definitely. My bad.
> Also, does the message not show when we show stack?
The message is shown along with stack, yes. Just to clarify, the idea here is that until you don't have `-d` switch, you won't get full stacks, because they are only interesting for those, who working with cordova-lib/platform internals. Common users should see only meaningful error message , that explains what went wrong. This logic is borrowed [from CLI ](https://github.com/apache/cordova-cli/blob/c5acc3dcbea7ac736f778e58cde23a38b467572a/src/cli.js#L130)
> If I understand correctly, this is only for legacy scenarios - correct? Otherwise, the cli should eventually be doing the logging - correct?
This code is required for cases, when caller of PlatformApi doesn't provide logger/eventEmitter instance. In this case we still need to log some events. In particular, this code is used in non-CLI workflow. For CLI workflow - yes, logging is already handled by CLI.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r41843349
--- Diff: bin/templates/cordova/Api.js ---
@@ -0,0 +1,506 @@
+/**
+ 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 Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+
+var CordovaError = require('cordova-common').CordovaError;
+var PlatformJson = require('cordova-common').PlatformJson;
+var ActionStack = require('cordova-common').ActionStack;
+var AndroidProject = require('./lib/AndroidProject');
+var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+
+var pluginHandlers = require('./lib/pluginHandlers');
+
+var PLATFORM = 'android';
+var GENERIC_EVENTS = new (require('events').EventEmitter)()
+ .on('verbose', function (message) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0)
+ console.log(message);
+ })
+ .on('log', console.log)
+ .on('warn', console.warn)
+ .on('error', function (error) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0) {
+ console.error((error && error.message) || error);
--- End diff --
@nikhilkh, reworked this logic completely in https://github.com/MSOpenTech/cordova-android/commit/6d9d4f4beb7a437f38391f10017669953fadede4
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-148349982
@nikhilkh I have tested and reported found issues to @vladimir-kotikov
Everything that I found is fixed now, LGTM
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r41816415
--- Diff: bin/templates/cordova/Api.js ---
@@ -0,0 +1,506 @@
+/**
+ 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 Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+
+var CordovaError = require('cordova-common').CordovaError;
+var PlatformJson = require('cordova-common').PlatformJson;
+var ActionStack = require('cordova-common').ActionStack;
+var AndroidProject = require('./lib/AndroidProject');
+var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+
+var pluginHandlers = require('./lib/pluginHandlers');
+
+var PLATFORM = 'android';
+var GENERIC_EVENTS = new (require('events').EventEmitter)()
+ .on('verbose', function (message) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0)
+ console.log(message);
+ })
+ .on('log', console.log)
+ .on('warn', console.warn)
+ .on('error', function (error) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0) {
+ console.error((error && error.message) || error);
--- End diff --
Or cordova-lib needs to do the logging not to break existing users of cordova-lib.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r41816386
--- Diff: bin/templates/cordova/Api.js ---
@@ -0,0 +1,506 @@
+/**
+ 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 Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+
+var CordovaError = require('cordova-common').CordovaError;
+var PlatformJson = require('cordova-common').PlatformJson;
+var ActionStack = require('cordova-common').ActionStack;
+var AndroidProject = require('./lib/AndroidProject');
+var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+
+var pluginHandlers = require('./lib/pluginHandlers');
+
+var PLATFORM = 'android';
+var GENERIC_EVENTS = new (require('events').EventEmitter)()
+ .on('verbose', function (message) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0)
+ console.log(message);
+ })
+ .on('log', console.log)
+ .on('warn', console.warn)
+ .on('error', function (error) {
+ if (process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0) {
+ console.error((error && error.message) || error);
--- End diff --
Should this be flipped? We should `stack` for verbose output and not otherwise? Also, does the message not show when we show stack? If I understand correctly, this is only for legacy scenarios - correct? Otherwise, the cli should eventually be doing the logging - correct?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/226#discussion_r42167999
--- Diff: bin/create ---
@@ -1,49 +1,56 @@
-#!/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 create = require('./lib/create');
-var argv = require('nopt')({
- 'help' : Boolean,
- 'cli' : Boolean,
- 'shared' : Boolean,
- 'link' : Boolean,
- 'activity-name' : [String, undefined]
-});
-
-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 project_path = argv.argv.remain[0];
-var package_name = argv.argv.remain[1];
-var project_name = argv.argv.remain[2];
-var template_path = argv.argv.remain[3];
-var activity_name = argv['activity-name'];
-
-create.createProject(project_path, package_name, project_name, activity_name, template_path, argv.link || argv.shared, argv.cli).done();
-
+#!/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]
+});
+
+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]');
--- End diff --
You mean, use `events.emit`? I think no, because this code should not be `require`d from anywhere, it is a regular executable script. This means that there will be no subscribers for these events.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org
[GitHub] cordova-android pull request: CB-9782 Implements PlatformApi contr...
Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:
https://github.com/apache/cordova-android/pull/226#issuecomment-149491153
@nikhilkh, those failures fixed in https://github.com/apache/cordova-android/commit/789c505a88a6bd2c7c5be596908c85681e457132 and https://github.com/MSOpenTech/cordova-android/commit/9c2d3817cf39c20411ddad007a663e3ca161200b
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org