-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
38 lines (32 loc) · 1.13 KB
/
build.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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50"
}
}
def packageRootPath = new File(rootProject.projectDir, 'src').toPath()
subprojects { project ->
def relativePath = packageRootPath.relativize(project.projectDir.toPath()).toString()
project.buildDir = new File(new File(rootProject.buildDir, relativePath), project.buildFile.name[0..-8])
repositories {
mavenCentral()
}
}
def target(String query) {
if (!query.startsWith('//')) {
throw new IllegalArgumentException("Only absolute target queries are currently allowed (e.g., //foo/bar:baz)")
}
int colon = query.indexOf(':')
if (colon == -1 || query.indexOf(':', colon + 1) != -1) {
throw new IllegalArgumentException("Target query must contain a single target name separated by a colon (e.g., //foo/bar:baz)")
}
String packageQuery = query.substring(2, colon)
String targetQuery = query.substring(colon + 1)
String projectName = packageQuery.replace('/', '_') + '@' + targetQuery
return project(projectName)
}
task clean(type: Delete) {
delete(rootProject.buildDir)
}