-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
92 lines (80 loc) · 3.07 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
plugins {
id 'java'
}
allprojects {
group "com.kasukusakura.kimiroyli"
version "0.0.1"
}
subprojects {
pluginManager.apply('java')
pluginManager.apply('java-library')
repositories {
mavenCentral()
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets.main.java.srcDirs.clear()
sourceSets.main.java.srcDirs(file('src'))
sourceSets.main.resources.srcDirs.clear()
sourceSets.main.resources.srcDirs(file('res'))
sourceSets.test.java.srcDirs.clear()
sourceSets.test.java.srcDirs(file('test'))
sourceSets.test.resources.srcDirs.clear()
sourceSets.test.resources.srcDirs(file('resTest'))
}
({
def versionOverrides = [
'=====================================': '',
'org.jetbrains:annotations' : '23.0.0',
'org.ow2.asm' : '9.2',
'io.github.karlatemp:unsafe-accessor' : '1.6.2',
'org.junit.jupiter' : '5.8.2',
]
allprojects {
afterEvaluate {
configurations.all { Configuration configuration ->
def lst = configuration.dependencies.matching { Dependency dependency ->
if (dependency.version != null) return false
return true
}.toList()
lst.forEach { dep ->
//noinspection GroovyAssignabilityCheck
def result1 = versionOverrides[dep.toString()]
if (result1 == null) {
//noinspection GroovyAssignabilityCheck
result1 = versionOverrides[dep.group]
}
if (result1 != null) {
configuration.dependencies.remove(dep)
configuration.dependencies.add(
project.dependencies.create(
group: dep.group,
name: dep.name,
version: result1,
)
)
}
}
}
}
configurations.all { Configuration configuration ->
configuration.resolutionStrategy.eachDependency { dependency ->
//noinspection GroovyAssignabilityCheck
def result1 = versionOverrides[dependency.requested.module.toString()]
if (result1 != null) {
dependency.useVersion(result1)
dependency.because("Custom override rule")
} else {
//noinspection GroovyAssignabilityCheck
def result2 = versionOverrides[dependency.requested.group]
if (result2 != null) {
dependency.useVersion(result2)
dependency.because("Custom override rule")
}
}
}
}
}
})();