-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
171 lines (141 loc) · 4.36 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories { jcenter() }
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
}
}
apply plugin: 'license'
ext.projectName = 'Notifier'
ext.packaging = 'jar'
ext.author = 'ToppleTheNun'
ext.authorUrl = 'https://github.com/Nunnery'
ext.inceptionYear = '2015'
subprojects {
apply plugin: 'license'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven-publish'
group = 'com.tealcube.minecraft.sponge'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
maven {
name = 'sponge-repo'
url = 'http://repo.spongepowered.org/maven'
}
mavenCentral()
}
sourceSets {
// Creates a templates SourceSet in order to allow templates to be filtered
templates {
output.classesDir = "$buildDir/templates"
}
main {
// Adds the output of the templates SourceSet to the Java sources of the main SourceSet
java.srcDir(sourceSets.templates.output.classesDir)
}
}
processResources {
filter ReplaceTokens, tokens: [
VERSION : version + "-" + (System.getenv("BUILD_NUMBER") ?: "0"),
NAME : System.getenv("JOB_NAME") ?: project.name,
ARTIFACT: project.name
]
}
// Processes the Java templates and outputs them for the compiler to pick up
task processTemplates(type: Copy) {
from sourceSets.templates.java
into sourceSets.templates.output.classesDir
filter ReplaceTokens, tokens: [
VERSION : version + "+" + (System.getenv("BUILD_NUMBER") ?: "0"),
NAME : System.getenv("JOB_NAME") ?: project.name,
ARTIFACT: project.name
]
}
compileJava.dependsOn processTemplates
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
build.dependsOn(sourcesJar)
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
build.dependsOn(javadocJar)
license {
ext.name = rootProject.projectName
ext.author = rootProject.author
ext.url = rootProject.authorUrl
ext.year = rootProject.inceptionYear
header new File(rootProject.projectDir, 'HEADER')
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
publishing {
repositories {
maven {
url "http://maven.tealcube.com/content/repositories/${project.version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'}/"
name "TealCube"
credentials {
username System.getenv("nexus.username") ?: nexusUsername
password System.getenv("nexus.password") ?: nexusPassword
}
}
}
}
}
project(':notifier-api') {
version = '0.0.2-SNAPSHOT'
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
publishing {
publications {
java(MavenPublication) {
artifactId project.getName().toLowerCase()
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
}
project(':notifier-plugin') {
apply plugin: 'com.github.johnrengelman.shadow'
version = '0.0.1-SNAPSHOT'
artifacts {
archives jar
archives sourcesJar
archives javadocJar
archives shadowJar
}
build.dependsOn(shadowJar)
publishing {
publications {
java(MavenPublication) {
artifactId project.getName().toLowerCase()
from components.java
artifact sourcesJar
artifact javadocJar
artifact shadowJar
}
}
}
}
// If in a continuous integration environment (CI),
// refresh any modules marked as changing
configurations.all {
if (System.getenv("BUILD_NUMBER") != null) {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}