-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
123 lines (105 loc) · 2.94 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
plugins {
id 'maven-publish'
id 'net.minecrell.licenser' version '0.4.1'
id 'fabric-loom' version '0.5.25' apply false
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id "com.diffplug.gradle.spotless" version "4.3.0"
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
}
repositories {
maven { // modmaven, maven proxy
name 'modmaven'
url "https://modmaven.k-4u.nl/"
}
}
// Create version number
ext.pr = System.getenv('PR_NUMBER') ?: ""
if (ext.pr) {
version = version + "+pr." + ext.pr
}
ext.branch = System.getenv('BRANCH') ?: ""
if (ext.branch) {
version = version + "+branch." + ext.branch
}
ext.release = System.getenv('RELEASE') ?: ""
if (ext.release) {
version = ext.release
}
// Maven group and artifact name
group = artifact_group
archivesBaseName = artifact_basename
subprojects {
apply plugin: 'java'
repositories {
mavenLocal()
mavenCentral()
}
group = parent.group
archivesBaseName = name
version = parent.version
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
options.deprecation = false
}
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
javadoc {
classpath = sourceSets.main.compileClasspath
source = sourceSets.main.java
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
}
task javadocJar(type: Jar) {
from javadoc
classifier = "javadoc"
}
task sourcesJar(type: Jar) {
classifier = "sources"
from sourceSets.main.allJava
}
artifacts {
archives javadocJar
archives sourcesJar
}
publishing {
if(["api", "fabric", "forge"].contains(project.name)) {
publications {
"$project.name"(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}
}
}
publishing {
repositories {
maven {
credentials {
username System.getenv("GITHUB_ACTOR")
password System.getenv("GITHUB_TOKEN")
}
name = "GitHubPackages"
url = "https://maven.pkg.github.com/AppliedEnergistics/MEtrics"
}
}
}
spotless {
java {
target '**/*.java'
indentWithSpaces()
eclipse().configFile 'codeformat/codeformat.xml'
}
//format 'json', {
// target '**/*.json'
// targetExclude 'src/generated/resources/**'
// prettier().config(['parser': 'json'])
//}
}