forked from transferwise/spring-icu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
139 lines (123 loc) · 4.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//It all starts here
buildscript {
repositories {
mavenLocal()
gradlePluginPortal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.9"
classpath "org.yakworks:gradle-plugins:$vShipyak"
classpath "io.github.gradle-nexus:publish-plugin:$vMavenNexus"
}
}
group = "org.yakworks"
//our opinionated defaults for gradle groovy & grails projects
apply plugin: 'yakworks.shipyak'
apply plugin: "io.github.gradle-nexus.publish-plugin"
// only setup publishing if its not a snapshot
if(!isSnapshot) {
nexusPublishing {
repositories {
sonatype()
}
}
}
subprojects { subprj ->
apply plugin: 'java'
group = "org.yakworks"
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
maven {
url "http://repo.9ci.com/oss-snapshots"
allowInsecureProtocol = true
mavenContent { snapshotsOnly() }
}
maven { url "http://repo.9ci.com/public-libs"; allowInsecureProtocol = true }
}
// get prop with default if null, converts to boolean
Closure getProp = { pname, defualtv -> (subprj.findProperty(pname)?:defualtv).toBoolean() }
ext { // see gradle.properties in sub-projects
//default true for isGormLibrary and isPublishable, set to false in gradle.props
isPublishable = getProp('isPublishable', true)
isGormLibrary = getProp('isGormLibrary', true)
isExample = getProp('isExample', false)
}
plugins.withId('java') {
sourceCompatibility = "$javaCompatibility"
targetCompatibility = "$javaCompatibility"
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
plugins.withId('groovy') {
tasks.withType(GroovyCompile) {
configure(groovyOptions) {
// sets the path to sys properties so we can use it find grails-app/conf during AST
forkOptions.jvmArgs = ['-Xmx1524m', '-XX:+UseSerialGC', '-Dgradle.projectDir=' + project.projectDir.absolutePath]
}
}
}
// if its a lib then setup gpg signing, see signing.gnupg.keyName
if (isPublishable){
// println "${subprj} isPublishable ${subprj.findProperty('isPublishable')}"
apply plugin: 'java-library'
// gpg signing required by nexus/sonatype
apply plugin: 'signing'
afterEvaluate {
if(!isSnapshot) {
signing {
required { gradle.taskGraph.hasTask("publish") }
useGpgCmd()
sign publishing.publications.javaLibrary
}
}
}
} // end isPublishable
configurations {
testImplementation.extendsFrom compileOnly
// compile.extendsFrom implementation
all {
resolutionStrategy.cacheChangingModulesFor 1, 'seconds' //when changing = true this sets the cache time
}
}
tasks.withType(Test) {
//so that we can use in config and share resources/rootlocation across projects for testing
systemProperty "gradle.rootProjectDir", rootProject.projectDir.absolutePath
systemProperty "gradle.projectDir", project.projectDir.absolutePath
}
}
//overrides for the yakworks shipkit configs
ext.codenarcRuleset= '''
// getRule('Println').enabled = false
getRule('ClosureAsLastMethodParameter').enabled = false
getRule('EmptyCatchBlock').enabled = false
getRule('UnnecessaryToString').enabled = false
getRule('ExplicitHashMapInstantiation').enabled = false
'''
//TEST logging config for the logger plugin
subprojects { subprj ->
test {
// Defaults from https://github.com/radarsh/gradle-test-logger-plugin
testlogger {
// theme 'standard'
showExceptions true
showStandardStreams = true //shows the printlns in console
showPassed true
showSkipped true
showFailed true
// slowThreshold 2000 //if tests take longer than this will show time it took
// showSummary true
// showSimpleNames false
// showPassed true
// showSkipped true
// showFailed true
// showPassedStandardStreams true
// showSkippedStandardStreams true
// showFailedStandardStreams true
}
}
}