Skip to content

Commit 7fd5f0a

Browse files
committed
fix(project-build-script): change compile -> implementation dependency declaring
1 parent 69abb30 commit 7fd5f0a

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

test-app/app/build.gradle

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def nativescriptDependencies = new JsonSlurper().parseText(dependenciesJson.text
6363
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 26 }
6464
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 26 }
6565
def computeBuildToolsVersion = { ->
66-
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "27.0.1"
66+
"25.2.5"
6767
}
6868

6969
project.ext.selectedBuildType = project.hasProperty("release") ? "release" : "debug"
@@ -198,9 +198,9 @@ dependencies {
198198
if (project.hasProperty("supportVersion")) {
199199
supportVer = supportVersion
200200
}
201-
compile "com.android.support:support-v4:$supportVer"
202-
compile "com.android.support:appcompat-v7:$supportVer"
203-
debugCompile "com.android.support:design:$supportVer"
201+
implementation "com.android.support:support-v4:$supportVer"
202+
implementation "com.android.support:appcompat-v7:$supportVer"
203+
debugImplementation "com.android.support:design:$supportVer"
204204
def sbgProjectExists = !findProject(':static-binding-generator').is(null)
205205
if (sbgProjectExists) {
206206
provided project(':static-binding-generator')
@@ -222,7 +222,7 @@ dependencies {
222222
if (!externalRuntimeExists) {
223223
def runtime = useV8Symbols ? "nativescript-regular" : "nativescript-optimized"
224224
println "\t + adding nativescript runtime package dependency: $runtime"
225-
project.dependencies.add("compile", [name: runtime, ext: "aar"])
225+
project.dependencies.add("implementation", [name: runtime, ext: "aar"])
226226
} else {
227227
implementation project(':runtime')
228228

@@ -240,7 +240,7 @@ task addDependenciesFromNativeScriptPlugins {
240240
def length = aarFile.name.length() - 4
241241
def fileName = aarFile.name[0..<length]
242242
println "\t + adding aar plugin dependency: " + aarFile.getAbsolutePath()
243-
project.dependencies.add("compile", [name: fileName, ext: "aar"])
243+
project.dependencies.add("implementation", [name: fileName, ext: "aar"])
244244
}
245245

246246
def jarFiles = fileTree(dir: file("$rootDir/${dep.directory}/$PLATFORMS_ANDROID"), include: ["**/*.jar"])
@@ -263,7 +263,7 @@ task addDependenciesFromAppResourcesLibraries {
263263
def length = aarFile.name.length() - 4
264264
def fileName = aarFile.name[0..<length]
265265
println "\t + adding aar library dependency: " + aarFile.getAbsolutePath()
266-
project.dependencies.add("compile", [name: fileName, ext: "aar"])
266+
project.dependencies.add("implementation", [name: fileName, ext: "aar"])
267267
}
268268

269269
def jarFiles = fileTree(dir: appResourcesLibraries, include: ["**/*.jar"])
@@ -273,7 +273,7 @@ task addDependenciesFromAppResourcesLibraries {
273273
pluginsJarLibraries.add(jarFile.getAbsolutePath())
274274
}
275275

276-
project.dependencies.add("compile", jarFiles)
276+
project.dependencies.add("implementation", jarFiles)
277277
}
278278
}
279279

@@ -346,18 +346,20 @@ def explodeAar(File compileDependency, String outputDir) {
346346
}
347347

348348
task extractAllJars {
349-
350349
outputs.dir extractedDependenciesDir
351350

352351
doLast {
353-
def iter = configurations.compile.resolvedConfiguration.resolvedArtifacts.iterator()
352+
def iter;
353+
if (project.selectedBuildType == "release") {
354+
iter = configurations.releaseCompileClasspath.resolve()
355+
} else {
356+
iter = configurations.debugCompileClasspath.resolve()
357+
}
354358
def dependencyCounter = 0
355-
while (iter.hasNext()) {
356-
//declaring variable as specific class for getting code completion in Android Studio
357-
org.gradle.api.internal.artifacts.DefaultResolvedArtifact nextDependency = iter.next()
358-
359+
iter.each {
360+
def nextDependency = it
359361
def outputDir = java.nio.file.Paths.get(extractedDependenciesDir, "" + dependencyCounter).normalize().toString()
360-
explodeAar(nextDependency.file, outputDir)
362+
explodeAar(nextDependency, outputDir)
361363
dependencyCounter++
362364
}
363365
}

0 commit comments

Comments
 (0)