-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal-aar.gradle
40 lines (35 loc) · 1.26 KB
/
local-aar.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ext {
localAARPublishConfig = [groupId: "local", version: "1.0"]
}
// Load local.properties if it is found
def propFile = file("${rootDir}/local.properties")
if (!propFile.exists()) propFile.createNewFile()
def props = new Properties()
propFile.withInputStream { props.load(it) }
//Give preference to command line params over local.properties
ext.useAAR = (hasProperty("useAAR")) ? getProperty("useAAR").toBoolean() : props.getProperty("useAAR", "false").toBoolean()
ext.inDevModules = (hasProperty("modules")) ? getProperty("modules").split(" ") : props.getProperty('modules', ":app").split(" ")
ext.modulePath = { moduleName ->
if (useAAR && !inDevModules.contains("$moduleName")) {
return "${localAARPublishConfig.groupId}$moduleName:${localAARPublishConfig.version}"
} else {
return project("$moduleName")
}
}
repositories {
maven {
url "$rootDir/mavenLocal"
content {
includeGroup "local"
}
}
}
configurations.all {
resolutionStrategy.dependencySubstitution {
if (useAAR) {
inDevModules.each { moduleName ->
substitute module("${localAARPublishConfig.groupId}$moduleName:${localAARPublishConfig.version}") with project(moduleName)
}
}
}
}