mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
CB-11244: Android Studio 3 work, things have changed with how the platform is built
This commit is contained in:
parent
8ba0109e55
commit
18d6884522
@ -154,7 +154,7 @@ StudioBuilder.prototype.prepBuildFiles = function () {
|
|||||||
'include ":"\n' + settingsGradlePaths.join(''));
|
'include ":"\n' + settingsGradlePaths.join(''));
|
||||||
|
|
||||||
// Update dependencies within build.gradle.
|
// Update dependencies within build.gradle.
|
||||||
var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8');
|
var buildGradle = fs.readFileSync(path.join(this.root, 'app', 'build.gradle'), 'utf8');
|
||||||
var depsList = '';
|
var depsList = '';
|
||||||
var root = this.root;
|
var root = this.root;
|
||||||
var insertExclude = function (p) {
|
var insertExclude = function (p) {
|
||||||
@ -170,8 +170,10 @@ StudioBuilder.prototype.prepBuildFiles = function () {
|
|||||||
subProjects.forEach(function (p) {
|
subProjects.forEach(function (p) {
|
||||||
console.log('Subproject Path: ' + p);
|
console.log('Subproject Path: ' + p);
|
||||||
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
|
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
|
||||||
depsList += ' implementation(project(path: "' + libName + '", configuration: "release"))';
|
if(libName !== 'app') {
|
||||||
|
depsList += ' implementation(project(path: ":' + libName + '"))';
|
||||||
insertExclude(p);
|
insertExclude(p);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
|
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
|
||||||
var SYSTEM_LIBRARY_MAPPINGS = [
|
var SYSTEM_LIBRARY_MAPPINGS = [
|
||||||
@ -223,7 +225,7 @@ StudioBuilder.prototype.prepEnv = function (opts) {
|
|||||||
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
|
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
|
||||||
// For some reason, using ^ and $ don't work. This does the job, though.
|
// For some reason, using ^ and $ don't work. This does the job, though.
|
||||||
var distributionUrlRegex = /distributionUrl.*zip/;
|
var distributionUrlRegex = /distributionUrl.*zip/;
|
||||||
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip';
|
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip';
|
||||||
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
|
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
|
||||||
shell.chmod('u+w', gradleWrapperPropertiesPath);
|
shell.chmod('u+w', gradleWrapperPropertiesPath);
|
||||||
shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath);
|
shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath);
|
||||||
|
@ -23,10 +23,13 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven {
|
||||||
|
url "https://maven.google.com"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +42,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = '3.3.0'
|
gradleVersion = '4.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
||||||
@ -227,7 +230,7 @@ android {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: '*.jar')
|
implementation fileTree(dir: 'libs', include: '*.jar')
|
||||||
// SUB-PROJECT DEPENDENCIES START
|
// SUB-PROJECT DEPENDENCIES START
|
||||||
debugCompile(project(path: ":CordovaLib", configuration: "debug"))
|
debugCompile(project(path: ":CordovaLib", configuration: "debug"))
|
||||||
releaseCompile(project(path: ":CordovaLib", configuration: "release"))
|
releaseCompile(project(path: ":CordovaLib", configuration: "release"))
|
||||||
|
Loading…
Reference in New Issue
Block a user