From 53a0559ab8fe63429f421d282dd9549a20c78944 Mon Sep 17 00:00:00 2001 From: Wontak Kim Date: Fri, 6 Aug 2021 17:46:00 +0900 Subject: [PATCH] Apply android gradle 4.2.0 plugin support --- build.gradle | 24 ----------- build.gradle.kts | 40 +++++++++++++++++++ .../co/ab180/fatjar/FatJarProcessor.groovy | 2 +- .../groovy/co/ab180/fatjar/PathUtils.groovy | 4 +- .../groovy/co/ab180/fatjar/TaskUtils.groovy | 4 +- 5 files changed, 45 insertions(+), 29 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 6128df5..0000000 --- a/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: "groovy" -apply plugin: "maven" - -buildscript { - repositories { - - } - dependencies { - - } -} - -repositories { - google() - mavenCentral() -} - -dependencies { - implementation gradleApi() - implementation localGroovy() - implementation "com.android.tools.build:gradle:3.4.1" - implementation "org.zeroturnaround:zt-zip:1.13" - implementation "io.github.g00fy2:versioncompare:1.4.1" -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..b6592b1 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,40 @@ +plugins { + id("groovy") + id("maven-publish") +} + +repositories { + google() + mavenCentral() +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +publishing { + publications { + create("maven") { + from(components["java"]) + groupId = "com.github.ab180" + artifactId = "fatjar" + version = "2.0.0" + } + } + repositories { + maven { + name = "local" + url = uri("$buildDir/maven") + } + } +} + +dependencies { + implementation(gradleApi()) + implementation(localGroovy()) + + implementation("com.android.tools.build:gradle:4.2.2") + implementation("org.zeroturnaround:zt-zip:1.13") + implementation("io.github.g00fy2:versioncompare:1.4.1") +} \ No newline at end of file diff --git a/src/main/groovy/co/ab180/fatjar/FatJarProcessor.groovy b/src/main/groovy/co/ab180/fatjar/FatJarProcessor.groovy index 8dcab00..07e6a9b 100644 --- a/src/main/groovy/co/ab180/fatjar/FatJarProcessor.groovy +++ b/src/main/groovy/co/ab180/fatjar/FatJarProcessor.groovy @@ -1,8 +1,8 @@ package co.ab180.fatjar import com.android.build.gradle.api.LibraryVariant -import io.github.g00fy2.versioncompare.Version import com.tonicsystems.jarjar.Rule +import io.github.g00fy2.versioncompare.Version import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.artifacts.ResolvedArtifact diff --git a/src/main/groovy/co/ab180/fatjar/PathUtils.groovy b/src/main/groovy/co/ab180/fatjar/PathUtils.groovy index 06e0155..3db3059 100644 --- a/src/main/groovy/co/ab180/fatjar/PathUtils.groovy +++ b/src/main/groovy/co/ab180/fatjar/PathUtils.groovy @@ -18,7 +18,9 @@ class PathUtils { } static String buildBundleLibRuntimeTaskPath(LibraryVariant variant, Version gradleToolVersion) { - if (gradleToolVersion.isAtLeast("4.0.0")) { + if (gradleToolVersion.isAtLeast("4.2.0")) { + return "bundleLibRuntimeToDir${variant.name.capitalize()}" + } else if (gradleToolVersion.isAtLeast("4.0.0")) { return "bundleLibRuntimeToJar${variant.name.capitalize()}" } else { return "bundleLibRuntime${variant.name.capitalize()}" diff --git a/src/main/groovy/co/ab180/fatjar/TaskUtils.groovy b/src/main/groovy/co/ab180/fatjar/TaskUtils.groovy index cef050c..ff1aee8 100644 --- a/src/main/groovy/co/ab180/fatjar/TaskUtils.groovy +++ b/src/main/groovy/co/ab180/fatjar/TaskUtils.groovy @@ -1,15 +1,13 @@ package co.ab180.fatjar import com.android.build.gradle.api.LibraryVariant -import io.github.g00fy2.versioncompare.Version import com.tonicsystems.jarjar.MainProcessor import com.tonicsystems.jarjar.Rule import com.tonicsystems.jarjar.util.StandaloneJarProcessor import groovy.io.FileType +import io.github.g00fy2.versioncompare.Version import org.gradle.api.Project import org.gradle.api.Task -import org.gradle.api.file.FileTree -import org.gradle.api.tasks.bundling.Zip import java.lang.ref.WeakReference