-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
119 lines (101 loc) · 3.53 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
id 'groovy'
id 'idea'
}
import net.wti.gradle.system.spi.GradleServiceFinder
group = 'net.wetheinter'
apply from: "$rootDir/gradle/xapi-env.gradle"
version = findProperty('xapiVersion')
tasks.register 'publishRequired', { req ->
allprojects {
def pub = tasks.findByName('xapiPublish')
if (pub) {
req.dependsOn pub
}
}
}
File mvnRepo = new File(rootDir, 'repo')
File indexRoot = new File(rootDir, 'build/xindex')
gradle.beforeProject {
Project p ->
p.java.toolchain.languageVersion.set(JavaLanguageVersion.of(8))
if (p.group != 'net.wetheinter') {
p.logger.info "gradle.beforeProject group was: $p.group"
p.group = 'net.wetheinter'
}
if (p.buildscript.repositories.empty) {
p.buildscript.repositories.maven {
name = 'xapiLocal'
url = new File(rootDir, 'repo')
}
// TODO make this obsolete by priming all external dependencies to xapiLocal
p.buildscript.repositories.mavenCentral()
}
}
gradle.beforeProject {
Project p ->
if (p.group != 'net.wetheinter') {
p.logger.info "allprojects group was $p.group"
p.group = 'net.wetheinter'
}
p.version = findProperty('xapiVersion')
p.repositories {
maven {
name = 'xapiExternal'
File repo = new File("$project.rootDir/repoMvn".toString())
if (!repo.exists()) {
repo = new File("$project.rootDir.parent/xapi/repoMvn".toString())
}
url = repo.toURI()
metadataSources { sources ->
sources.mavenPom()
}
}
mavenCentral()
}
p.with {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
// explicitly empty sourcepath.
// If we want to recompile anything that isn't ours, we'll do so explicitly.
options.sourcepath = files()
}
tasks.withType(Test).configureEach {
Test test ->
test.systemProperty('xapi.mvn.repo', mvnRepo.absolutePath)
if (!test.maxHeapSize) {
test.maxHeapSize = '1G'
}
String compileForTest = "compile${test.name - "test" - "Main"}TestJava"
JavaCompile javac = project.tasks.findByName(compileForTest)
if (javac) {
File metaDir = javac.destinationDir
test.systemProperty('xapi.injector.cache', metaDir.absolutePath)
test.doFirst {
new File(metaDir, 'META-INF/singletons').mkdirs()
new File(metaDir, 'META-INF/instances').mkdirs()
}
} else {
test.logger.info "Could not find $compileForTest in $project.path"
}
}
return
}
}
//GradleServiceFinder.getService(project).configureWrapper(project)
wrapper {
gradleVersion = "8.11.1"
distributionType = 'ALL'
}
idea {
module {
excludeDirs = [mvnRepo, indexRoot] as Set
}
}
tasks.register('projectInfo') {
Task t ->
t.doLast {
t.logger.quiet("Total projects: " + allprojects.size())
// perhaps get some xapi schema stats about realized modules to print here?
}
}