diff --git a/build.gradle b/build.gradle index 8ca7c9bb..c95665cd 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id "signing" id "io.github.gradle-nexus.publish-plugin" version "2.0.0" id "dex2jar.build-conventions" + alias libs.plugins.versions } description = 'Supermodule for dex2jar' diff --git a/buildSrc/src/main/groovy/dex2jar.build-conventions.gradle b/buildSrc/src/main/groovy/dex2jar.build-conventions.gradle index d58525ed..d0081a8d 100644 --- a/buildSrc/src/main/groovy/dex2jar.build-conventions.gradle +++ b/buildSrc/src/main/groovy/dex2jar.build-conventions.gradle @@ -4,15 +4,6 @@ plugins { id 'signing' } -ext.antlr3Version = '3.5.3' -ext.antlr4Version = '4.13.1' -ext.asmVersion = '9.7' -ext.baksmaliVersion = '3.0.7' -ext.commonsCompressVersion = '1.26.2' -ext.jUnitVersion = '5.10.3' -ext.jUnitPlatformVersion = '1.10.3' -ext.r8Version = '4.0.63' // Newer versions only for Java 11+ - group = 'de.femtopedia.dex2jar' version = project.findProperty('version') version = version == null || version == 'unspecified' ? '2.4-SNAPSHOT' : version @@ -41,8 +32,8 @@ javadoc { } dependencies { - testImplementation "org.junit.jupiter:junit-jupiter:${project.property('jUnitVersion')}" - testRuntimeOnly("org.junit.platform:junit-platform-launcher:${project.property('jUnitPlatformVersion')}") + testImplementation libs.junit.jupiter + testRuntimeOnly libs.junit.platform.launcher } [compileJava, compileTestJava]*.options.collect { options -> diff --git a/d2j-jasmin/build.gradle b/d2j-jasmin/build.gradle index 6f508985..c615bbd8 100644 --- a/d2j-jasmin/build.gradle +++ b/d2j-jasmin/build.gradle @@ -6,19 +6,19 @@ plugins { description = "Jasmin support for dex2jar" dependencies { - api(group: 'org.antlr', name: 'antlr-runtime', version: project.property('antlr3Version')) { + api(libs.antlr3.runtime) { exclude(module: 'stringtemplate') } api project(path: ':d2j-external', configuration: 'shadow') - // api group: 'org.ow2.asm', name: 'asm', version: project.property('asmVersion') // Fixed MethodCodeTooLargeException - api(group: 'org.ow2.asm', name: 'asm-tree', version: project.property('asmVersion')) { + // api libs.asm // Fixed MethodCodeTooLargeException + api(libs.asm.tree) { exclude(module: 'asm') } - api(group: 'org.ow2.asm', name: 'asm-util', version: project.property('asmVersion')) { + api(libs.asm.util) { exclude(module: 'asm') } api project(':d2j-base-cmd') - antlr "org.antlr:antlr:${project.property('antlr3Version')}" + antlr libs.antlr3 } sourceSets.main.antlr.srcDirs = ['src/main/antlr3'] diff --git a/d2j-smali/build.gradle b/d2j-smali/build.gradle index f8a909e8..101a636d 100644 --- a/d2j-smali/build.gradle +++ b/d2j-smali/build.gradle @@ -6,13 +6,13 @@ plugins { description = "Smali support for dex2jar" dependencies { - api "org.antlr:antlr4-runtime:${project.property('antlr4Version')}" + api libs.antlr4.runtime api project(':dex-reader-api') api project(':dex-reader') - antlr "org.antlr:antlr4:${project.property('antlr4Version')}" + antlr libs.antlr4 api project(':d2j-base-cmd') api project(':dex-writer') - testImplementation "com.android.tools.smali:smali-baksmali:${project.property('baksmaliVersion')}" + testImplementation libs.baksmali } generateGrammarSource { diff --git a/dex-reader-api/build.gradle b/dex-reader-api/build.gradle index 45d715a6..f313874d 100644 --- a/dex-reader-api/build.gradle +++ b/dex-reader-api/build.gradle @@ -6,5 +6,5 @@ description = 'Dex/Dalvik reader API for dex2jar' dependencies { api project(path: ':d2j-external', configuration: 'shadow') - // api group: 'org.ow2.asm', name: 'asm', version: project.property('asmVersion') // Fixed MethodCodeTooLargeException + // api libs.asm // Fixed MethodCodeTooLargeException } diff --git a/dex-reader/build.gradle b/dex-reader/build.gradle index ae195792..1b1aed02 100644 --- a/dex-reader/build.gradle +++ b/dex-reader/build.gradle @@ -6,5 +6,5 @@ description = 'Dex/Dalvik reader for dex2jar' dependencies { api project(':dex-reader-api') - testImplementation(group: 'org.apache.commons', name: 'commons-compress', version: project.property('commonsCompressVersion')) + testImplementation libs.commons.compress } diff --git a/dex-tools/build.gradle b/dex-tools/build.gradle index cb54dc91..62ca6a18 100644 --- a/dex-tools/build.gradle +++ b/dex-tools/build.gradle @@ -12,17 +12,17 @@ dependencies { api project(':dex-writer') api project(':d2j-base-cmd') api project(path: ':d2j-external', configuration: 'shadow') - // api group: 'org.ow2.asm', name: 'asm', version: project.property('asmVersion') // Fixed MethodCodeTooLargeException - api(group: 'org.ow2.asm', name: 'asm-tree', version: project.property('asmVersion')) { + // api libs.asm // Fixed MethodCodeTooLargeException + api(libs.asm.tree) { exclude(module: 'asm') } - api(group: 'org.ow2.asm', name: 'asm-util', version: project.property('asmVersion')) { + api(libs.asm.util) { exclude(module: 'asm') } - api(group: 'org.ow2.asm', name: 'asm-commons', version: project.property('asmVersion')) { + api(libs.asm.commons) { exclude(module: 'asm') } - testImplementation "org.antlr:antlr-runtime:${project.property('antlr3Version')}" + testImplementation libs.antlr3.runtime } tasks.register('bin_gen', JavaExec) { diff --git a/dex-translator/build.gradle b/dex-translator/build.gradle index bd07da72..021f934e 100644 --- a/dex-translator/build.gradle +++ b/dex-translator/build.gradle @@ -10,14 +10,14 @@ dependencies { api project(':dex-ir') api project(':d2j-base-cmd') api project(path: ':d2j-external', configuration: 'shadow') - // api group: 'org.ow2.asm', name: 'asm', version: project.property('asmVersion') // Fixed MethodCodeTooLargeException - api(group: 'org.ow2.asm', name: 'asm-tree', version: project.property('asmVersion')) { + // api libs.asm // Fixed MethodCodeTooLargeException + api(libs.asm.tree) { exclude(module: 'asm') } - api(group: 'org.ow2.asm', name: 'asm-util', version: project.property('asmVersion')) { + api(libs.asm.util) { exclude(module: 'asm') } - api(group: 'org.ow2.asm', name: 'asm-commons', version: project.property('asmVersion')) { + api(libs.asm.commons) { exclude(module: 'asm') } testImplementation project(':d2j-smali') diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..270de81c --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,27 @@ +[versions] +antlr3 = '3.5.3' +antlr4 = '4.13.1' +asm = '9.7' +smali = '3.0.7' +commons-compress = '1.26.2' +junit = '5.10.3' +junit-platform = '1.10.3' +r8 = '4.0.63' # Newer versions only for Java 11+ +versions-plugin = '0.51.0' + +[libraries] +antlr3 = { module = "org.antlr:antlr", version.ref = "antlr3" } +antlr3-runtime = { module = "org.antlr:antlr-runtime", version.ref = "antlr3" } +antlr4 = { module = "org.antlr:antlr4", version.ref = "antlr4" } +antlr4-runtime = { module = "org.antlr:antlr4-runtime", version.ref = "antlr4" } +asm-commons = { module = "org.ow2.asm:asm-commons", version.ref = "asm" } +asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "asm" } +asm-util = { module = "org.ow2.asm:asm-util", version.ref = "asm" } +baksmali = { module = "com.android.tools.smali:smali-baksmali", version.ref = "smali" } +commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "commons-compress" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } +junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" } +r8 = { module = "com.android.tools:r8", version.ref = "r8" } + +[plugins] +versions = { id = "com.github.ben-manes.versions", version.ref = "versions-plugin" }