From ff32ab1172c05cedb821c9ef54d314deed7dfca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Wed, 11 May 2022 20:53:04 +0200 Subject: [PATCH] build: Use download task output for dependency instead of hardcoding path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Brey --- app/build.gradle | 13 ++++++------- .../nextcloud/talk/gradle/DownloadWebRtcTask.groovy | 6 +++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e5f18c638..154fff78b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -167,6 +167,10 @@ ext { } def webRtcVersion = "96.4664.0" +tasks.register('downloadWebRtc', DownloadWebRtcTask){ + version = webRtcVersion +} +preBuild.dependsOn('downloadWebRtc') configurations.all { exclude group: 'com.google.firebase', module: 'firebase-core' @@ -241,7 +245,7 @@ dependencies { kapt "com.jakewharton:butterknife-compiler:${butterknifeVersion}" implementation 'eu.davidea:flexible-adapter:5.1.0' implementation 'eu.davidea:flexible-adapter-ui:1.0.0' - implementation files("${project.buildDir}/download/libwebrtc-${webRtcVersion}.aar") + implementation fileTree(downloadWebRtc.getOutputPath()) implementation 'com.yarolegovich:lovely-dialog:1.1.1' implementation 'com.yarolegovich:mp:1.1.6' implementation 'me.zhanghai.android.effortlesspermissions:library:1.1.0' @@ -347,9 +351,4 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { jvmTarget = "1.8" } -} - -tasks.register('downloadWebRtc', DownloadWebRtcTask){ - version = webRtcVersion -} -preBuild.dependsOn('downloadWebRtc') \ No newline at end of file +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/nextcloud/talk/gradle/DownloadWebRtcTask.groovy b/buildSrc/src/main/groovy/com/nextcloud/talk/gradle/DownloadWebRtcTask.groovy index 0c2c0f614..c0a677bec 100644 --- a/buildSrc/src/main/groovy/com/nextcloud/talk/gradle/DownloadWebRtcTask.groovy +++ b/buildSrc/src/main/groovy/com/nextcloud/talk/gradle/DownloadWebRtcTask.groovy @@ -35,7 +35,7 @@ abstract class DownloadWebRtcTask extends DefaultTask { @OutputFile File getLibFile() { - return new File("${project.buildDir}/download/${getFileName()}") + return new File(getOutputPath()) } private String getFileName() { @@ -48,6 +48,10 @@ abstract class DownloadWebRtcTask extends DefaultTask { return "https://github.com/nextcloud-releases/talk-clients-webrtc/releases/download/${webRtcVersion}-RC1/${getFileName()}" } + public String getOutputPath() { + return "${project.buildDir}/download/${getFileName()}" + } + @TaskAction def run() { libFile.parentFile.mkdirs()