Update to the latest Gradle 5.6.3 and Gradle Android plugin 3.5.1

Fix issue with ANDROID_GRADLE_TASK. Set apk file  in separate folder ( from
gradle  4.x)
This commit is contained in:
flashultra
2019-10-29 10:04:46 +02:00
committed by Joshua Granick
parent 45e38dfca2
commit 72beeced30
5 changed files with 38 additions and 20 deletions

View File

@@ -3,6 +3,9 @@ buildscript {
jcenter { jcenter {
url "http://jcenter.bintray.com/" url "http://jcenter.bintray.com/"
} }
maven {
url 'https://maven.google.com/'
}
} }
dependencies { dependencies {
@@ -15,4 +18,4 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
} }

View File

@@ -66,19 +66,17 @@ android {
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.all { output ->
def outputFile = output.outputFile if (outputFileName != null && outputFileName.endsWith('.apk')) {
outputFileName = "::APP_FILE::-" + variant.buildType.name + ".apk"
if (outputFile != null && outputFile.name.endsWith('.apk')) {
output.outputFile = new File(outputFile.parent, "::APP_FILE::-" + variant.buildType.name + ".apk")
} }
} }
} }
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::compile project(':deps:::name::') ::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::api project(':deps:::name::')
::end::::end:: ::end::::end::
} }

View File

@@ -5,6 +5,9 @@ buildscript {
jcenter { jcenter {
url "http://jcenter.bintray.com/" url "http://jcenter.bintray.com/"
} }
maven {
url "https://maven.google.com/"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::' classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
@@ -30,7 +33,7 @@ task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
task wrapper(type: Wrapper) { wrapper {
gradleVersion = '::ANDROID_GRADLE_VERSION::' gradleVersion = '::ANDROID_GRADLE_VERSION::'
} }
@@ -38,7 +41,7 @@ configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('bui
buildscript { buildscript {
repositories { repositories {
maven { maven {
url "http://repo1.maven.org/maven2/" url "https://maven.google.com/"
} }
} }
@@ -63,7 +66,7 @@ configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('bui
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
compile project(':deps:extension-api') api project(':deps:extension-api')
} }
} }

View File

@@ -3,6 +3,9 @@ buildscript {
jcenter { jcenter {
url "http://jcenter.bintray.com/" url "http://jcenter.bintray.com/"
} }
maven {
url "https://maven.google.com/"
}
} }
dependencies { dependencies {
@@ -18,5 +21,5 @@ android {
} }
dependencies { dependencies {
compile project(':deps:extension-api') api project(':deps:extension-api')
} }

View File

@@ -236,25 +236,35 @@ class AndroidPlatform extends PlatformTarget
public override function install():Void public override function install():Void
{ {
var build = "-debug"; var build = "debug";
if (project.keystore != null) if (project.keystore != null)
{ {
build = "-release"; build = "release";
}
if (project.environment.exists("ANDROID_GRADLE_TASK"))
{
var task = project.environment.get("ANDROID_GRADLE_TASK");
if ( task == "assembleDebug" ) {
build = "debug";
} else {
build = "release";
}
} }
var outputDirectory = null; var outputDirectory = null;
if (project.config.exists("android.gradle-build-directory")) if (project.config.exists("android.gradle-build-directory"))
{ {
outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk"); outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk/"+build);
} }
else else
{ {
outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk"); outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk/"+build);
} }
var apkPath = Path.combine(outputDirectory, project.app.file + build + ".apk"); var apkPath = Path.combine(outputDirectory, project.app.file + "-" + build + ".apk");
deviceID = AndroidHelper.install(project, apkPath, deviceID); deviceID = AndroidHelper.install(project, apkPath, deviceID);
} }
@@ -371,8 +381,9 @@ class AndroidPlatform extends PlatformTarget
"android.permission.VIBRATE", "android.permission.VIBRATE",
"android.permission.ACCESS_NETWORK_STATE" "android.permission.ACCESS_NETWORK_STATE"
]); ]);
context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "2.10"); context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "5.6.3");
context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "2.1.0"); context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "3.5.1");
context.ANDROID_LIBRARY_PROJECTS = []; context.ANDROID_LIBRARY_PROJECTS = [];
if (!project.environment.exists("ANDROID_SDK") || !project.environment.exists("ANDROID_NDK_ROOT")) if (!project.environment.exists("ANDROID_SDK") || !project.environment.exists("ANDROID_NDK_ROOT"))