@@ -4,14 +4,25 @@ import java.util.jar.JarFile
44
55apply plugin : ' java-library'
66
7- sourceCompatibility = JavaVersion . VERSION_1_8
8- targetCompatibility = JavaVersion . VERSION_1_8
7+ sourceCompatibility = JavaVersion . VERSION_17
8+ targetCompatibility = JavaVersion . VERSION_17
99
10- def version = " 3 .0.0"
10+ def version = " 4 .0.0"
1111
1212def hasProject = file(" $project . rootDir /gradle.properties" ). exists();
1313
14- if (! project. hasProperty(" loadedProjectDeps" ) && hasProject){
14+ repositories {
15+ google()
16+ mavenCentral()
17+ maven {
18+ url ' https://maven.google.com/'
19+ name ' Google'
20+ }
21+ maven { url " https://repo1.maven.org/maven2/" }
22+ maven { url " https://repo.maven.apache.org/maven2/" }
23+ }
24+
25+ if (! project. hasProperty(" loadedProjectDeps" ) && hasProject) {
1526 Properties projectDeps = new Properties ()
1627 projectDeps. load(new FileInputStream (" $project . rootDir /gradle.properties" ))
1728 projectDeps. each { prop ->
@@ -21,12 +32,13 @@ if(!project.hasProperty("loadedProjectDeps") && hasProject){
2132}
2233
2334if (! hasProject){
24- project. ext. set(" ns_default_bcel_version" , " 6.5.0 " );
35+ project. ext. set(" ns_default_bcel_version" , " 6.8.2 " );
2536 project. ext. set(" ns_default_commons_io_version" , " 2.6" );
2637 project. ext. set(" ns_default_spotbugs_version" , " 3.1.12" );
2738}
2839
2940
41+
3042// todo: check if still needed
3143// if(!project.hasProperty("loadedProjectDeps")){
3244// Properties projectDeps = new Properties()
@@ -38,19 +50,17 @@ if(!hasProject){
3850// }
3951
4052project. ext. extractedDependenciesDir = " jar-files"
41- if (project. hasProperty(" jarsOutput" )) {
53+ if (project. hasProperty(" jarsOutput" )) {
4254 project. ext. extractedDependenciesDir = project. ext. jarsOutput
4355}
4456
45- repositories {
46- google()
47- mavenCentral()
48- }
4957
5058allprojects {
5159 gradle. projectsEvaluated {
52- tasks. withType(JavaCompile ) {
53- options. compilerArgs << " -Xlint:all" << " -Werror"
60+ tasks. withType(JavaCompile ). tap {
61+ configureEach {
62+ options. compilerArgs << " -Xlint:all" << " -Werror"
63+ }
5464 }
5565 }
5666}
@@ -70,31 +80,41 @@ dependencies {
7080 // testCompileOnly "androidx.appcompat:appcompat:1.0.0"
7181 // testCompileOnly "com.google.android.material:material:1.0.0"
7282
73- def androidXLegacyVersion = " 1.0.0"
74- def androidXAppCompatVersion = " 1.4.1"
75- def androidXMaterialVersion = " 1.5.0"
76- def androidXExifInterfaceVersion = " 1.3.3"
77- def androidXViewPagerVersion = " 1.0.0"
78- def androidXFragmentVersion = " 1.4.1"
79- def androidXTransitionVersion = " 1.4.1"
80-
81- testCompileOnly " androidx.multidex:multidex:2.0.1"
82- testCompileOnly " androidx.legacy:legacy-support-v4:$androidXLegacyVersion "
83- testCompileOnly " androidx.appcompat:appcompat:$androidXAppCompatVersion "
84- testCompileOnly " com.google.android.material:material:$androidXMaterialVersion "
85- testCompileOnly " androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion "
86- testCompileOnly " androidx.viewpager2:viewpager2:$androidXViewPagerVersion "
87- testCompileOnly " androidx.fragment:fragment:$androidXFragmentVersion "
88- testCompileOnly " androidx.transition:transition:$androidXTransitionVersion "
83+ // def androidXLegacyVersion = "1.0.0"
84+ // def androidXAppCompatVersion = "1.6.1"
85+ // def androidXMaterialVersion = "1.8.0"
86+ // def androidXExifInterfaceVersion = "1.3.7"
87+ // def androidXViewPagerVersion = "1.0.0"
88+ // def androidXFragmentVersion = "1.4.1"
89+ def androidXTransitionVersion = " 1.4.1"
90+ //
91+ // testCompileOnly "androidx.legacy:legacy-support-v4:$androidXLegacyVersion"
92+ // testCompileOnly "androidx.appcompat:appcompat:$androidXAppCompatVersion"
93+ // testCompileOnly "com.google.android.material:material:$androidXMaterialVersion"
94+ // testCompileOnly "androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
95+ // testCompileOnly "androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
96+ // testCompileOnly "androidx.fragment:fragment:$androidXFragmentVersion"
97+ testCompileOnly " androidx.transition:transition:$androidXTransitionVersion "
98+ }
99+
100+ configurations. create(" dtsGeneratorImplementation" ) {
101+ extendsFrom configurations. implementation
102+ setCanBeResolved(true )
103+ }
104+
105+ configurations. create(" dtsGeneratorTestCompileOnly" ) {
106+ extendsFrom configurations. testCompileOnly
107+ setCanBeResolved(true )
89108}
90109
91110jar {
92111 // pack jar dependencies into the final jar
93- configurations. implementation. setCanBeResolved(true )
94- from configurations. implementation. collect { it. isDirectory() ? it : zipTree(it) }
112+ from {
113+ configurations. dtsGeneratorImplementation. collect { it. isDirectory() ? it : zipTree(it) }
114+ }
95115 from(' src/main/resources' ) {
96- include ' generics.txt'
97- }
116+ include ' generics.txt'
117+ }
98118 // set main class for the jar
99119 manifest {
100120 attributes ' Main-Class' : ' com.telerik.Main'
@@ -110,11 +130,11 @@ task extractAllJars {
110130 outputs. dir extractedDependenciesDir
111131
112132 doLast {
113- def iter = configurations. testCompileOnly . resolvedConfiguration. resolvedArtifacts. iterator()
133+ def iter = configurations. dtsGeneratorTestCompileOnly . resolvedConfiguration. resolvedArtifacts. iterator()
114134 def dependencyCounter = 0
115135 while (iter. hasNext()) {
116136 // declaring variable as specific class for getting code completion in Android Studio
117- ResolvedDependency nextDependency = iter. next()
137+ def nextDependency = iter. next()
118138
119139 def outputDir = Paths . get(extractedDependenciesDir, nextDependency. toString()). normalize(). toString(). replace(' :' , ' _' )
120140 explodeAar(nextDependency. file, outputDir)
@@ -152,3 +172,10 @@ def explodeAar(File compileDependency, String outputDir) {
152172 }
153173 }
154174}
175+
176+ def buildMetadata = tasks. findByPath(" :app:buildMetadata" )
177+
178+ if (buildMetadata != null ) {
179+ processResources. dependsOn(buildMetadata)
180+ compileJava. dependsOn(buildMetadata)
181+ }
0 commit comments