You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/09/07 04:54:40 UTC
[cordova-android] branch master updated: fix: clean command (#815)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new 1b11206 fix: clean command (#815)
1b11206 is described below
commit 1b1120617418f7152bc9d63f5a643b2fa19f0179
Author: Norman Breau <no...@normanbreau.com>
AuthorDate: Sat Sep 7 01:54:33 2019 -0300
fix: clean command (#815)
* fix clean command
* added unit tests for the getArgs clean
* Cleaned up ProjectBuilder.getArgs for readability
---
bin/templates/cordova/lib/builders/ProjectBuilder.js | 3 +--
spec/unit/builders/ProjectBuilder.spec.js | 14 ++++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/bin/templates/cordova/lib/builders/ProjectBuilder.js b/bin/templates/cordova/lib/builders/ProjectBuilder.js
index 35ce906..4db8bec 100644
--- a/bin/templates/cordova/lib/builders/ProjectBuilder.js
+++ b/bin/templates/cordova/lib/builders/ProjectBuilder.js
@@ -45,8 +45,8 @@ class ProjectBuilder {
getArgs (cmd, opts) {
let args;
+ let buildCmd = cmd;
if (opts.packageType === PackageType.BUNDLE) {
- let buildCmd;
if (cmd === 'release') {
buildCmd = ':app:bundleRelease';
} else if (cmd === 'debug') {
@@ -55,7 +55,6 @@ class ProjectBuilder {
args = [buildCmd, '-b', path.join(this.root, 'build.gradle')];
} else {
- let buildCmd;
if (cmd === 'release') {
buildCmd = 'cdvBuildRelease';
} else if (cmd === 'debug') {
diff --git a/spec/unit/builders/ProjectBuilder.spec.js b/spec/unit/builders/ProjectBuilder.spec.js
index 44769b5..7104271 100644
--- a/spec/unit/builders/ProjectBuilder.spec.js
+++ b/spec/unit/builders/ProjectBuilder.spec.js
@@ -100,6 +100,20 @@ describe('ProjectBuilder', () => {
expect(args).toContain(`-PcdvBuildArch=${arch}`);
});
+
+ it('should clean apk', () => {
+ const args = builder.getArgs('clean', {
+ packageType: 'apk'
+ });
+ expect(args[0]).toBe('clean');
+ });
+
+ it('should clean bundle', () => {
+ const args = builder.getArgs('clean', {
+ packageType: 'bundle'
+ });
+ expect(args[0]).toBe('clean');
+ });
});
describe('runGradleWrapper', () => {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org