-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
93 lines (86 loc) · 3.19 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
plugins {
id 'java-library'
}
var moduleName = "SimpleRulesEngine"
allprojects {
sourceCompatibility = '11'
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
}
repositories {
mavenCentral()
maven {
url 'https://nexus.rnd.mendix.com/repository/maven-hosted'
}
}
}
configurations {
testImplementation.extendsFrom compileOnly // Make Mendix runtime classes available to unit tests
}
dependencies {
//Sub project dependency
implementation project(':simplerulesengine')
compileOnly fileTree(dir: 'userlib', include: ['commons-codec-1.13.jar','commons-io-2.11.0.jar','commons-lang3-3.12.0.jar','hamcrest-core-1.3.jar','httpclient5-5.0.3.jar','httpcore5-5.0.2.jar','httpcore5-h2-5.0.2.jar','junit-4.13.1.jar','slf4j-api-1.7.25.jar'])
// Mendix runtime APIs. MX_VERSION is defined in gradle.properties. Example: 8.14.1
compileOnly "com.mendix:public-api:${MX_VERSION}@jar"
compileOnly "com.mendix:logging-api:${MX_VERSION}@jar"
compileOnly "com.mendix:m2ee-api:${MX_VERSION}@jar"
compileOnly "com.mendix:json:${MX_VERSION}@jar"
compileOnly "javax.servlet:servlet-api:2.5"
compileOnly 'javax.websocket:javax.websocket-api:1.1'
}
sourceSets {
main{
java {
srcDirs 'javasource'
}
}
}
task copyJARsToUserLib(type: Copy) {
doFirst {
configurations.default.each {
delete fileTree(dir: "userlib", include: it.name+"*")
}
def reqLibFileName = ".".concat(moduleName).concat(".RequiredLib")
fileTree(dir: "userlib", include: "*".concat(reqLibFileName)).each {
delete fileTree(dir: "userlib", include: it.name.replace(reqLibFileName,""))
delete fileTree(dir: "userlib", include: it.name)
}
}
from configurations.default
{
exclude('jakarta.activation-api*')
}
into 'userlib'
}
task generateUserLib() {
dependsOn(copyJARsToUserLib)
doLast {
configurations.default.each {
if(!it.name.contains("jakarta.activation-api")) {
new File("userlib", it.name.concat(".").concat(moduleName).concat(".RequiredLib")).createNewFile()
}
}
}
}
task generateMigrationFile() {
doLast {
var file = new File("userlib", moduleName.concat(".migration"));
file.createNewFile();
file.text = ""
var implProjectDependencies = (Set<ResolvedDependency>) tasks.getByPath(":simplerulesengine:getAllFirstLevelDependencies").deps
implProjectDependencies.each {
file.append("dependency ".concat(it.module.id.group).concat(":").concat(it.module.id.name).concat(":").concat(it.module.id.version).concat("\n"))
}
configurations.default.resolvedConfiguration.resolvedArtifacts.each {
if (!it.moduleVersion.id.name.equals("Implementation")) {
file.append("delete ".concat(it.file.name).concat("\n"))
file.append("delete ".concat(it.file.name.concat(".").concat(moduleName).concat(".RequiredLib")).concat("\n"))
}
}
file.append("delete ".concat(file.name))
}
}