mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Merge branch 'master' into StudioProjectCompat
This commit is contained in:
commit
245d9a1e46
36
.gitignore
vendored
36
.gitignore
vendored
@ -1,11 +1,21 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
.gradle
|
||||||
|
.metadata
|
||||||
|
Thumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*.class
|
||||||
|
*.jar
|
||||||
default.properties
|
default.properties
|
||||||
gen
|
gen
|
||||||
assets/www/cordova.js
|
assets/www/cordova.js
|
||||||
local.properties
|
local.properties
|
||||||
proguard.cfg
|
proguard.cfg
|
||||||
proguard.cfg
|
|
||||||
proguard-project.txt
|
proguard-project.txt
|
||||||
|
example
|
||||||
|
/coverage
|
||||||
/framework/lib
|
/framework/lib
|
||||||
/framework/build
|
/framework/build
|
||||||
/framework/bin
|
/framework/bin
|
||||||
@ -15,30 +25,23 @@ proguard-project.txt
|
|||||||
/framework/libs
|
/framework/libs
|
||||||
/framework/javadoc-public
|
/framework/javadoc-public
|
||||||
/framework/javadoc-private
|
/framework/javadoc-private
|
||||||
/test/libs
|
/test/.externalNativeBuild
|
||||||
example
|
/test/build.gradle
|
||||||
/test/bin
|
|
||||||
/test/assets/www/.tmp*
|
|
||||||
/test/assets/www/cordova.js
|
|
||||||
/test/gradle
|
/test/gradle
|
||||||
/test/gradlew
|
/test/gradlew
|
||||||
/test/gradlew.bat
|
/test/gradlew.bat
|
||||||
|
/test/assets/www/.tmp*
|
||||||
|
/test/assets/www/cordova.js
|
||||||
|
/test/bin
|
||||||
/test/build
|
/test/build
|
||||||
.gradle
|
/test/captures
|
||||||
|
/test/libs
|
||||||
tmp/**
|
tmp/**
|
||||||
.metadata
|
|
||||||
tmp/**/*
|
tmp/**/*
|
||||||
Thumbs.db
|
|
||||||
Desktop.ini
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*.class
|
|
||||||
*.jar
|
|
||||||
!/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestLib.jar
|
!/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestLib.jar
|
||||||
# IntelliJ IDEA files
|
# IntelliJ IDEA files
|
||||||
|
**/.idea/**/*
|
||||||
*.iml
|
*.iml
|
||||||
.idea
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
node_modules/jshint
|
node_modules/jshint
|
||||||
node_modules/promise-matchers
|
node_modules/promise-matchers
|
||||||
@ -130,4 +133,3 @@ node_modules/wordwrap/
|
|||||||
node_modules/yargs/
|
node_modules/yargs/
|
||||||
node_modules/jasmine-core/
|
node_modules/jasmine-core/
|
||||||
node_modules/fs.realpath/
|
node_modules/fs.realpath/
|
||||||
/coverage
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
bin/node_modules/*
|
|
||||||
bin/templates/project/*
|
|
||||||
spec/fixtures/*
|
|
10
.jshintrc
10
.jshintrc
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"node": true
|
|
||||||
, "bitwise": true
|
|
||||||
, "undef": true
|
|
||||||
, "trailing": true
|
|
||||||
, "quotmark": true
|
|
||||||
, "indent": 4
|
|
||||||
, "unused": "vars"
|
|
||||||
, "latedef": "nofunc"
|
|
||||||
}
|
|
@ -9,14 +9,12 @@ before_install:
|
|||||||
install:
|
install:
|
||||||
- npm install
|
- npm install
|
||||||
- npm install -g codecov
|
- npm install -g codecov
|
||||||
- echo y | android update sdk -u --filter android-22,android-23,android-24,android-25
|
- echo y | android --silent update sdk --no-ui --all --filter platform-tools,tools,build-tools-26.0.0,android-26,android-25,extra-google-m2repository,extra-android-m2repository
|
||||||
android:
|
android:
|
||||||
components:
|
components:
|
||||||
- tools
|
- tools
|
||||||
- tools
|
|
||||||
script:
|
script:
|
||||||
- npm run eslint
|
- npm test
|
||||||
- npm run cover
|
- npm run cover
|
||||||
- npm run test-build
|
|
||||||
after_script:
|
after_script:
|
||||||
- codecov
|
- codecov
|
||||||
|
25
appveyor.yml
25
appveyor.yml
@ -1,11 +1,29 @@
|
|||||||
environment:
|
environment:
|
||||||
|
ANDROID_HOME: "C:\\android"
|
||||||
matrix:
|
matrix:
|
||||||
- nodejs_version: "4"
|
- nodejs_version: "4"
|
||||||
- nodejs_version: "6"
|
- nodejs_version: "6"
|
||||||
|
|
||||||
|
init:
|
||||||
|
- mkdir "%ANDROID_HOME%
|
||||||
|
- cd "%ANDROID_HOME%"
|
||||||
|
- appveyor DownloadFile "https://dl.google.com/android/repository/tools_r25.2.3-windows.zip"
|
||||||
|
- 7z x "tools_r25.2.3-windows.zip" > nul
|
||||||
|
- cd "C:\projects\cordova-android"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# - cinst android-sdk
|
- choco install gradle -version 3.4.1
|
||||||
# - echo y | android update sdk -u --filter android-22,android-23
|
- gradle -version
|
||||||
|
- echo y | "%ANDROID_HOME%\tools\android.bat" --silent update sdk --no-ui --all --filter platform-tools,tools,build-tools-26.0.0,android-26,android-25,extra-google-m2repository,extra-android-m2repository
|
||||||
|
# on windows we need to accept sublicenses for the new tooling, wee. 30 is an arbitrary number,
|
||||||
|
# but should be the maximum number of licenses we explicitly need to type "Y ENTER" for.
|
||||||
|
# also, the sdkmanager in all its glory leaks a bit of output to stderr, and powershell
|
||||||
|
# and appveyor interpret that as errors, and blows up. so, when piping in our "Y ENTER"
|
||||||
|
# responses, we invoke cmd so we can redirect stderr to stdout, and tell it to --update itself.
|
||||||
|
- ps: for($i=0;$i -lt 30;$i++) { $response += "y`n"}; $response | cmd /c 'C:\android\tools\bin\sdkmanager.bat 2>&1' --update
|
||||||
|
- cd test
|
||||||
|
- gradle :wrapper -b build.gradle
|
||||||
|
- cd ..
|
||||||
- ps: Install-Product node $env:nodejs_version
|
- ps: Install-Product node $env:nodejs_version
|
||||||
- npm install
|
- npm install
|
||||||
|
|
||||||
@ -14,5 +32,4 @@ build: off
|
|||||||
test_script:
|
test_script:
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
- npm --version
|
||||||
- npm run test
|
- npm test
|
||||||
# - npm run test-build
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"node": true
|
|
||||||
, "bitwise": true
|
|
||||||
, "undef": true
|
|
||||||
, "trailing": true
|
|
||||||
, "quotmark": true
|
|
||||||
, "indent": 4
|
|
||||||
, "unused": "vars"
|
|
||||||
, "latedef": "nofunc"
|
|
||||||
}
|
|
@ -37,7 +37,7 @@ var TEMPLATE =
|
|||||||
function GradleBuilder (projectRoot) {
|
function GradleBuilder (projectRoot) {
|
||||||
GenericBuilder.call(this, projectRoot);
|
GenericBuilder.call(this, projectRoot);
|
||||||
|
|
||||||
this.binDirs = {gradle: this.binDirs.gradle};
|
this.binDirs = { gradle: this.binDirs.gradle };
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(GradleBuilder, GenericBuilder);
|
util.inherits(GradleBuilder, GenericBuilder);
|
||||||
@ -73,9 +73,12 @@ GradleBuilder.prototype.runGradleWrapper = function (gradle_cmd) {
|
|||||||
var gradlePath = path.join(this.root, 'gradlew');
|
var gradlePath = path.join(this.root, 'gradlew');
|
||||||
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
|
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
|
||||||
if (fs.existsSync(gradlePath)) {
|
if (fs.existsSync(gradlePath)) {
|
||||||
// Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
|
// Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
|
||||||
} else {
|
} else {
|
||||||
return superspawn.spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
|
return superspawn.spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], { stdio: 'pipe' })
|
||||||
|
.progress(function (stdio) {
|
||||||
|
suppressJavaOptionsInfo(stdio);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -270,33 +273,19 @@ GradleBuilder.prototype.build = function (opts) {
|
|||||||
var wrapper = path.join(this.root, 'gradlew');
|
var wrapper = path.join(this.root, 'gradlew');
|
||||||
var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
|
var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
|
||||||
|
|
||||||
return superspawn.spawn(wrapper, args, {stdio: 'pipe'}).progress(function (stdio) {
|
return superspawn.spawn(wrapper, args, { stdio: 'pipe' })
|
||||||
if (stdio.stderr) {
|
.progress(function (stdio) {
|
||||||
/*
|
suppressJavaOptionsInfo(stdio);
|
||||||
* Workaround for the issue with Java printing some unwanted information to
|
}).catch(function (error) {
|
||||||
* stderr instead of stdout.
|
if (error.toString().indexOf('failed to find target with hash string') >= 0) {
|
||||||
* This function suppresses 'Picked up _JAVA_OPTIONS' message from being
|
return check_reqs.check_android_target(error).then(function () {
|
||||||
* printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for
|
// If due to some odd reason - check_android_target succeeds
|
||||||
* explanation.
|
// we should still fail here.
|
||||||
*/
|
return Q.reject(error);
|
||||||
var suppressThisLine = /^Picked up _JAVA_OPTIONS: /i.test(stdio.stderr.toString());
|
});
|
||||||
if (suppressThisLine) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
process.stderr.write(stdio.stderr);
|
return Q.reject(error);
|
||||||
} else {
|
});
|
||||||
process.stdout.write(stdio.stdout);
|
|
||||||
}
|
|
||||||
}).catch(function (error) {
|
|
||||||
if (error.toString().indexOf('failed to find target with hash string') >= 0) {
|
|
||||||
return check_reqs.check_android_target(error).then(function () {
|
|
||||||
// If due to some odd reason - check_android_target succeeds
|
|
||||||
// we should still fail here.
|
|
||||||
return Q.reject(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Q.reject(error);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GradleBuilder.prototype.clean = function (opts) {
|
GradleBuilder.prototype.clean = function (opts) {
|
||||||
@ -304,7 +293,7 @@ GradleBuilder.prototype.clean = function (opts) {
|
|||||||
var wrapper = path.join(this.root, 'gradlew');
|
var wrapper = path.join(this.root, 'gradlew');
|
||||||
var args = builder.getArgs('clean', opts);
|
var args = builder.getArgs('clean', opts);
|
||||||
return Q().then(function () {
|
return Q().then(function () {
|
||||||
return superspawn.spawn(wrapper, args, {stdio: 'inherit'});
|
return superspawn.spawn(wrapper, args, { stdio: 'inherit' });
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
shell.rm('-rf', path.join(builder.root, 'out'));
|
shell.rm('-rf', path.join(builder.root, 'out'));
|
||||||
|
|
||||||
@ -319,6 +308,25 @@ GradleBuilder.prototype.clean = function (opts) {
|
|||||||
|
|
||||||
module.exports = GradleBuilder;
|
module.exports = GradleBuilder;
|
||||||
|
|
||||||
|
function suppressJavaOptionsInfo (stdio) {
|
||||||
|
if (stdio.stderr) {
|
||||||
|
/*
|
||||||
|
* Workaround for the issue with Java printing some unwanted information to
|
||||||
|
* stderr instead of stdout.
|
||||||
|
* This function suppresses 'Picked up _JAVA_OPTIONS' message from being
|
||||||
|
* printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for
|
||||||
|
* explanation.
|
||||||
|
*/
|
||||||
|
var suppressThisLine = /^Picked up _JAVA_OPTIONS: /i.test(stdio.stderr.toString());
|
||||||
|
if (suppressThisLine) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
process.stderr.write(stdio.stderr);
|
||||||
|
} else {
|
||||||
|
process.stdout.write(stdio.stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isAutoGenerated (file) {
|
function isAutoGenerated (file) {
|
||||||
return fs.existsSync(file) && fs.readFileSync(file, 'utf8').indexOf(MARKER) > 0;
|
return fs.existsSync(file) && fs.readFileSync(file, 'utf8').indexOf(MARKER) > 0;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
"apache"
|
"apache"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run eslint && jasmine",
|
"test": "npm run eslint && npm run unit-tests && npm run e2e-tests",
|
||||||
"cover": "istanbul cover --root bin/templates/cordova --print detail jasmine",
|
"unit-tests": "jasmine --config=spec/unit/jasmine.json",
|
||||||
"test-build": "jasmine --captureExceptions --color spec/e2e/*.spec.js",
|
"cover": "istanbul cover --root bin/templates/cordova --print detail jasmine -- --config=spec/unit/jasmine.json",
|
||||||
|
"e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
|
||||||
"eslint": "eslint bin && eslint spec"
|
"eslint": "eslint bin && eslint spec"
|
||||||
},
|
},
|
||||||
"author": "Apache Software Foundation",
|
"author": "Apache Software Foundation",
|
||||||
@ -51,7 +52,7 @@
|
|||||||
"eslint-plugin-promise": "^3.5.0",
|
"eslint-plugin-promise": "^3.5.0",
|
||||||
"eslint-plugin-standard": "^3.0.1",
|
"eslint-plugin-standard": "^3.0.1",
|
||||||
"istanbul": "^0.4.2",
|
"istanbul": "^0.4.2",
|
||||||
"jasmine": "^2.5.2",
|
"jasmine": "~2.6.0",
|
||||||
"promise-matchers": "~0",
|
"promise-matchers": "~0",
|
||||||
"rewire": "^2.1.3"
|
"rewire": "^2.1.3"
|
||||||
},
|
},
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"node": true
|
|
||||||
, "bitwise": true
|
|
||||||
, "undef": true
|
|
||||||
, "trailing": true
|
|
||||||
, "quotmark": true
|
|
||||||
, "indent": 4
|
|
||||||
, "unused": "vars"
|
|
||||||
, "latedef": "nofunc"
|
|
||||||
, "jasmine": true
|
|
||||||
}
|
|
8
spec/e2e/jasmine.json
Normal file
8
spec/e2e/jasmine.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"spec_dir": "spec",
|
||||||
|
"spec_files": [
|
||||||
|
"e2e/**/*[sS]pec.js"
|
||||||
|
],
|
||||||
|
"stopSpecOnExpectationFailure": false,
|
||||||
|
"random": false
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
var Gradle_builder = require('../../../bin/templates/cordova/lib/builders/GradleBuilder.js');
|
var Gradle_builder = require('../../../bin/templates/cordova/lib/builders/GradleBuilder.js');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var Q = require('q');
|
||||||
var superspawn = require('cordova-common').superspawn;
|
var superspawn = require('cordova-common').superspawn;
|
||||||
var builder;
|
var builder;
|
||||||
|
|
||||||
@ -8,7 +9,8 @@ describe('Gradle Builder', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
spyOn(fs, 'existsSync').and.returnValue(true);
|
spyOn(fs, 'existsSync').and.returnValue(true);
|
||||||
builder = new Gradle_builder('/root');
|
builder = new Gradle_builder('/root');
|
||||||
spyOn(superspawn, 'spawn');
|
var deferred = Q.defer();
|
||||||
|
spyOn(superspawn, 'spawn').and.returnValue(deferred.promise);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('runGradleWrapper method', function () {
|
describe('runGradleWrapper method', function () {
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
"unit/**/*[sS]pec.js"
|
"unit/**/*[sS]pec.js"
|
||||||
],
|
],
|
||||||
"stopSpecOnExpectationFailure": false,
|
"stopSpecOnExpectationFailure": false,
|
||||||
"random": false
|
"random": true
|
||||||
}
|
}
|
9
test/.gitignore
vendored
9
test/.gitignore
vendored
@ -1,9 +0,0 @@
|
|||||||
*.iml
|
|
||||||
.gradle
|
|
||||||
/local.properties
|
|
||||||
/.idea/workspace.xml
|
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
|
||||||
/build
|
|
||||||
/captures
|
|
||||||
.externalNativeBuild
|
|
Loading…
Reference in New Issue
Block a user