mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Merge branch 'master' into 4.0.x (gradle fixes)
This commit is contained in:
commit
8f27b2ab56
@ -110,10 +110,13 @@ module.exports.check_java = function() {
|
|||||||
}
|
}
|
||||||
} else if (isWindows) {
|
} else if (isWindows) {
|
||||||
// Try to auto-detect java in the default install paths.
|
// Try to auto-detect java in the default install paths.
|
||||||
|
var oldSilent = shelljs.config.silent;
|
||||||
|
shelljs.config.silent = true;
|
||||||
var firstJdkDir =
|
var firstJdkDir =
|
||||||
shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] ||
|
shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] ||
|
||||||
shelljs.ls('C:\\Program Files\\java\\jdk*')[0] ||
|
shelljs.ls('C:\\Program Files\\java\\jdk*')[0] ||
|
||||||
shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0];
|
shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0];
|
||||||
|
shelljs.config.silent = oldSilent;
|
||||||
if (firstJdkDir) {
|
if (firstJdkDir) {
|
||||||
// shelljs always uses / in paths.
|
// shelljs always uses / in paths.
|
||||||
firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
|
firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
|
||||||
@ -195,7 +198,7 @@ module.exports.check_android = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAbsoluteAndroidCmd = function() {
|
module.exports.getAbsoluteAndroidCmd = function() {
|
||||||
return forgivingWhichSync('android').replace(/([ \\])/g, '\\$1');
|
return forgivingWhichSync('android').replace(/(\s)/g, '\\$1');
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.check_android_target = function(valid_target) {
|
module.exports.check_android_target = function(valid_target) {
|
||||||
@ -209,9 +212,12 @@ module.exports.check_android_target = function(valid_target) {
|
|||||||
.then(function(output) {
|
.then(function(output) {
|
||||||
if (output.split('\n').indexOf(valid_target) == -1) {
|
if (output.split('\n').indexOf(valid_target) == -1) {
|
||||||
var androidCmd = module.exports.getAbsoluteAndroidCmd();
|
var androidCmd = module.exports.getAbsoluteAndroidCmd();
|
||||||
throw new Error('Please install Android target: "' + valid_target + '".\n' +
|
throw new Error('Please install Android target: "' + valid_target + '".\n\n' +
|
||||||
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
|
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
|
||||||
'Or install directly via: ' + androidCmd + ' update sdk --no-ui --all --filter "' + valid_target + '"');
|
'You will require:\n' +
|
||||||
|
'1. "SDK Platform" for ' + valid_target + '\n' +
|
||||||
|
'2. "Android SDK Platform-tools (latest)\n' +
|
||||||
|
'3. "Android SDK Build-tools" (latest)');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
2
bin/templates/cordova/lib/build.js
vendored
2
bin/templates/cordova/lib/build.js
vendored
@ -236,7 +236,7 @@ var builders = {
|
|||||||
// Find the recently-generated output APK files
|
// Find the recently-generated output APK files
|
||||||
// Gradle can generate multiple output files; return all of them.
|
// Gradle can generate multiple output files; return all of them.
|
||||||
getOutputFiles: function(build_type) {
|
getOutputFiles: function(build_type) {
|
||||||
var binDir = path.join(ROOT, 'build', 'apk');
|
var binDir = path.join(ROOT, 'build', 'outputs', 'apk');
|
||||||
var candidates = find_files(binDir, function(candidate) {
|
var candidates = find_files(binDir, function(candidate) {
|
||||||
// Need to choose between release and debug .apk.
|
// Need to choose between release and debug .apk.
|
||||||
if (build_type === 'debug') {
|
if (build_type === 'debug') {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||||
android:hardwareAccelerated="true">
|
android:hardwareAccelerated="true" android:supportsRtl="true">
|
||||||
<activity android:name="__ACTIVITY__"
|
<activity android:name="__ACTIVITY__"
|
||||||
android:label="@string/activity_name"
|
android:label="@string/activity_name"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
@ -29,7 +29,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:0.10.+'
|
classpath 'com.android.tools.build:gradle:0.12.0+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +89,26 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_7
|
targetCompatibility JavaVersion.VERSION_1_7
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (System.env.RELEASE_SIGNING_PROPERTIES_FILE) {
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
// These must be set or Gradle will complain (even if they are overridden).
|
||||||
|
keyAlias = ""
|
||||||
|
keyPassword = ""
|
||||||
|
storeFile = null
|
||||||
|
storePassword = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addSigningProps(System.env.RELEASE_SIGNING_PROPERTIES_FILE, signingConfigs.release)
|
||||||
|
}
|
||||||
|
if (System.env.DEBUG_SIGNING_PROPERTIES_FILE) {
|
||||||
|
addSigningProps(System.env.DEBUG_SIGNING_PROPERTIES_FILE, signingConfigs.debug)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
@ -109,7 +129,28 @@ def getProjectList() {
|
|||||||
def matcher = pattern.matcher(manifestFile.getText())
|
def matcher = pattern.matcher(manifestFile.getText())
|
||||||
def projects = []
|
def projects = []
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
projects.add(":" + matcher.group(2).replace("/",":"))
|
projects.add(":" + matcher.group(2).replace("/",":"))
|
||||||
}
|
}
|
||||||
return projects
|
return projects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def ensureValueExists(filePath, props, key) {
|
||||||
|
if (props.get(key) == null) {
|
||||||
|
throw new GradleException(filePath + ': Missing key required "' + key + '"')
|
||||||
|
}
|
||||||
|
return props.get(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
def addSigningProps(propsFilePath, signingConfig) {
|
||||||
|
def propsFile = file(propsFilePath)
|
||||||
|
propsFile.withReader { reader ->
|
||||||
|
def props = new Properties()
|
||||||
|
props.load(reader)
|
||||||
|
signingConfig.keyAlias = ensureValueExists(propsFilePath, props, 'keyAlias')
|
||||||
|
signingConfig.keyPassword = ensureValueExists(propsFilePath, props, 'keyPassword')
|
||||||
|
signingConfig.storeFile = RelativePath.parse(true, ensureValueExists(propsFilePath, props, 'storeFile')).getFile(propsFile.getParentFile())
|
||||||
|
signingConfig.storePassword = ensureValueExists(propsFilePath, props, 'storePassword')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,5 +116,5 @@ String getAndroidSdkDir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cordovaSdkVersion = getProjectTarget("android-19")
|
cordovaSdkVersion = getProjectTarget("android-19")
|
||||||
cordovaBuildToolsVersion = latestBuildToolsAvailable("19.0.0")
|
cordovaBuildToolsVersion = latestBuildToolsAvailable("19.1.0")
|
||||||
|
|
||||||
|
@ -25,7 +25,12 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:0.10.+'
|
// This should be updated with each cordova-android release.
|
||||||
|
// It can affect things like where the .apk is generated.
|
||||||
|
// It also dictates what the minimum android build-tools version
|
||||||
|
// that you need (Set in bin/templates/project/cordova.gradle).
|
||||||
|
// Be sure to also update the value in bin/templates/project.
|
||||||
|
classpath 'com.android.tools.build:gradle:0.12.+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user