Skip to content

Commit 102edea

Browse files
authored
Merge pull request #1307 from NativeScript/trifonov/gradle-build-improvements
Refactor build.gradle not to add configuration:'default'
2 parents 58e0cae + 923a0fd commit 102edea

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

test-app/app/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ dependencies {
339339
println "\t + adding nativescript runtime package dependency: $runtime"
340340
project.dependencies.add("implementation", [name: runtime, ext: "aar"])
341341
} else {
342-
implementation project(path: ':runtime', configuration: 'default')
342+
implementation project(':runtime')
343343
}
344344

345345
}
@@ -475,12 +475,17 @@ task extractAllJars {
475475
def buildType = project.selectedBuildType == "release" ? "Release" : "Debug"
476476
def iter = []
477477
Pattern pattern = Pattern.compile("^(.+)${buildType}CompileClasspath\$")
478+
def artifactType = Attribute.of('artifactType', String)
478479
configurations.all { config ->
479480
Matcher matcher = pattern.matcher(config.name)
480481
if (matcher.find() || config.name == "${buildType.toLowerCase()}CompileClasspath") {
481-
config.resolve().each {
482-
if (!iter.contains(it)) {
483-
iter.push(it)
482+
config.incoming.artifactView {
483+
attributes {
484+
it.attribute(artifactType, 'jar')
485+
}
486+
}.artifacts.each {
487+
if (!iter.contains(it.file)) {
488+
iter.push(it.file)
484489
}
485490
}
486491
}

test-app/runtime/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ project.ext._buildToolsVersion = "28.0.3"
2525
android {
2626
sourceSets {
2727
main {
28-
def defaultSrcPath = "src/main/java";
28+
def defaultSrcPath = "src/main/java"
2929
def bindingGeneratorSourcePath = new File(project(":runtime-binding-generator").projectDir, defaultSrcPath)
3030

31-
// embedd runtime binding generator in runtime, while keeping it in a sperate project
31+
// embed runtime binding generator in runtime, while keeping it in a separate project
3232
java.srcDirs = [bindingGeneratorSourcePath, defaultSrcPath]
3333
}
3434
}

0 commit comments

Comments
 (0)