forked from mendix/CommunityCommons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
109 lines (91 loc) · 2.83 KB
/
build.gradle
File metadata and controls
109 lines (91 loc) · 2.83 KB
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
apply plugin: 'java'
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
import org.gradle.api.internal.file.copy.CopySpecInternal
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.owasp:dependency-check-gradle:4.0.1'
}
}
apply plugin: 'org.owasp.dependencycheck'
project.ext {
CC_VERSION = '7.4.1'
MXBUILD_VERSION = '7.1.0'
}
def runtimeLibs = "$buildDir/runtime/bundles"
def userLibDir = "$projectDir/src/CommunityCommons/userlib"
configurations {
tar
}
repositories {
mavenCentral()
ivy {
url 'https://cdn.mendix.com/'
layout 'pattern', {
artifact '/[organisation]/[module]-[revision].[ext]'
}
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile fileTree(dir: "$runtimeLibs")
compile group: 'com.googlecode.owasp-java-html-sanitizer', name: 'owasp-java-html-sanitizer', version: '20181114.1'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.13'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compileOnly fileTree(dir: "$runtimeLibs")
tar "runtime:mxbuild:${project.MXBUILD_VERSION}@tar.gz"
}
// https://stackoverflow.com/a/48724412/412834
configurations.each {
c -> c.resolutionStrategy.dependencySubstitution {
all { DependencySubstitution dependency ->
if (dependency.requested.group == 'com.google.guava') {
dependency.useTarget 'com.google.guava:guava:27.0-jre'
}
}
}
}
sourceSets {
main {
java {
srcDirs = ["src/CommunityCommons/javasource"]
}
resources {
srcDirs = ["src/CommunityCommons/resources"]
}
}
test {
java {
srcDirs = ["src/test"]
}
}
}
task copyToUserlib( type: Copy ) {
into userLibDir
from configurations.runtime
eachFile { fileCopyDetails ->
def requiredLibFlag = new File( destinationDir, "${fileCopyDetails.name}.${project.name}.RequiredLib")
requiredLibFlag.write ''
}
}
task untarMxbuild( type: Copy ) {
configurations.tar.findAll{it.name.endsWith('tar.gz')}.each {
from tarTree(resources.gzip(it))
into buildDir
include('**/runtime/bundles/com.mendix.public-api.jar')
include('**/runtime/bundles/com.mendix.logging-api.jar')
include('**/runtime/bundles/biz.aQute.bnd.bndlib.jar')
includeEmptyDirs = false
}
}
task prepareDeps {
dependsOn 'clean', 'copyToUserlib', 'untarMxbuild'
}
clean {
delete "$projectDir/src/CommunityCommons/userlib"
}
tasks.untarMxbuild.shouldRunAfter tasks.copyToUserlib