Skip to content

Commit 1f7b0a9

Browse files
author
Mihail Slavchev
committed
use absolute paths in gradle script
1 parent 5644fd9 commit 1f7b0a9

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

build/project-template-gradle/build.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ apply plugin: "com.android.application"
3333
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
3434
def metadataParams = new LinkedList <String> ()
3535
def allJarPaths = new LinkedList <String> ()
36-
def configurationsDir = "configurations"
36+
def configurationsDir = "$projectDir/configurations"
3737
def createPluginConfigFile = false
3838
def configStage = "\n:config phase: "
3939
def nodeModulesDir = "../../node_modules/"
40-
def libDir = "../../lib/Android/"
40+
def libDir = "$projectDir/../../lib/Android/"
4141
def pluginNames = new ArrayList<String>()
4242
def configDir = file(configurationsDir)
4343
def appResExists = false
@@ -102,7 +102,7 @@ android {
102102
}
103103

104104
sourceSets.main {
105-
jniLibs.srcDir "libs/jni"
105+
jniLibs.srcDir "$projectDir/libs/jni"
106106
}
107107

108108
signingConfigs {
@@ -278,7 +278,7 @@ task createPluginsConfigFile {
278278
task pluginExtend {
279279
description "applies additional configuration"
280280

281-
def pathToAppGradle = "../../app/App_Resources/Android/app.gradle"
281+
def pathToAppGradle = "$projectDir/../../app/App_Resources/Android/app.gradle"
282282
def appGradle = file(pathToAppGradle)
283283
if(appGradle.exists()) {
284284
apply from: pathToAppGradle
@@ -310,13 +310,13 @@ task pluginExtend {
310310
task copyAarDependencies (type: Copy) {
311311
println "$configStage copyAarDependencies"
312312
from fileTree(dir: nodeModulesDir, include: ["**/*.aar"], exclude: '**/.bin/**').files
313-
into "libs/aar"
313+
into "$projectDir/libs/aar"
314314
}
315315

316316
task addAarDependencies << {
317317
println "$configStage addAarDependencies"
318318
// manually traverse all the locally copied AAR files and add them to the project compilation dependencies list
319-
FileTree tree = fileTree(dir: "libs/aar", include: ["**/*.aar"])
319+
FileTree tree = fileTree(dir: "$projectDir/libs/aar", include: ["**/*.aar"])
320320
tree.each { File file ->
321321
// remove the extension of the file (.aar)
322322
def length = file.name.length() - 4
@@ -336,7 +336,7 @@ task cleanLocalAarFiles(type: Delete) {
336336
}
337337

338338
task ensureMetadataOutDir {
339-
def outputDir = file("$rootDir/metadata/output/assets/metadata")
339+
def outputDir = file("$projectDir/metadata/output/assets/metadata")
340340
outputDir.mkdirs()
341341
}
342342

@@ -361,12 +361,12 @@ task collectAllJars {
361361
}
362362

363363
metadataParams.add("metadata-generator.jar")
364-
metadataParams.add("../metadata/output/assets/metadata")
364+
metadataParams.add("$projectDir/metadata/output/assets/metadata")
365365
for(def i = 0; i < allJarPaths.size(); i++) {
366366
metadataParams.add(allJarPaths.get(i));
367367
}
368368

369-
def classesDir = "$rootDir/build/intermediates/classes"
369+
def classesDir = "$buildDir/intermediates/classes"
370370

371371
def classesSubDirs = new File(classesDir).listFiles()
372372

@@ -393,7 +393,7 @@ task buildMetadata (type: JavaExec) {
393393
description "builds metadata with provided jar dependencies"
394394

395395
inputs.files(allJarPaths)
396-
inputs.dir("build/intermediates/classes")
396+
inputs.dir("$buildDir/intermediates/classes")
397397

398398
outputs.files("metadata/output/assets/metadata/treeNodeStream.dat", "metadata/output/assets/metadata/treeStringsStream.dat", "metadata/output/assets/metadata/treeValueStream.dat")
399399

@@ -407,8 +407,8 @@ task buildMetadata (type: JavaExec) {
407407

408408
doLast {
409409
copy {
410-
from "metadata/output/assets/metadata"
411-
into "src/main/assets/metadata"
410+
from "$projectDir/metadata/output/assets/metadata"
411+
into "$projectDir/src/main/assets/metadata"
412412
}
413413

414414
def files = new File("${buildDir}/intermediates/res").listFiles()
@@ -432,14 +432,14 @@ task buildMetadata (type: JavaExec) {
432432

433433
exec {
434434
ignoreExitValue true
435-
workingDir "metadata/output"
435+
workingDir "$projectDir/metadata/output"
436436
commandLine removeCmdParams.toArray()
437437
}
438438

439439
def addCmdParams = new ArrayList<String>([aaptCommand, "add", tmpAPKPath, "assets/metadata/treeNodeStream.dat", "assets/metadata/treeStringsStream.dat", "assets/metadata/treeValueStream.dat"])
440440

441441
exec {
442-
workingDir "metadata/output"
442+
workingDir "$projectDir/metadata/output"
443443
commandLine addCmdParams.toArray()
444444
}
445445
}

0 commit comments

Comments
 (0)