-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
111 lines (92 loc) · 2.3 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
plugins {
id 'java'
id "com.diffplug.spotless" version "5.14.2"
id 'maven-publish'
id 'signing'
}
group 'com.bradyrussell'
version '1.1-SNAPSHOT'
repositories {
mavenCentral()
maven {
url "https://repo.bradyrussell.com/repository/bradyrussell-release/"
}
maven {
url "https://repo.bradyrussell.com/repository/bradyrussell-snapshot/"
}
}
publishing {
publications {
UISCoin(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = version.endsWith('SNAPSHOT') ? "https://repo.bradyrussell.com/repository/bradyrussell-snapshot/" : "https://repo.bradyrussell.com/repository/bradyrussell-release/"
credentials {
username = repoUsername
password = repoPassword
}
}
}
}
sourceSets.main.java.srcDirs = ['src']
sourceSets.test.java.srcDirs = ['tests']
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(14))
}
}
dependencies {
implementation 'org.jetbrains:annotations:15.0'
implementation 'io.netty:netty-all:4.1.24.Final'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'com.bradyrussell.uiscoin'
}
}
test {
useJUnitPlatform()
maxHeapSize = '1G'
}
task copyDependencies(type: Copy) {
from configurations.runtimeClasspath
into 'dependencies'
}
task copyJar(type: Copy) {
dependsOn("jar", "javadocJar", "sourcesJar")
from layout.buildDirectory.dir("libs")
into 'jar'
}
task copyJavadoc(type: Copy) {
dependsOn("javadoc")
from layout.buildDirectory.dir("docs")
into "docs"
}
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
java {
toggleOffOn()
importOrder('java', 'javax', 'com', 'org')
//googleJavaFormat('1.11.0').aosp() // unfortunately you cannot adjust line lengths for this. maybe wait until spotless issue #817 is fixed
licenseHeader '/* (C) Brady Russell $YEAR */'
}
}
task preCommit() {
dependsOn("clean", "spotlessApply", "test", "javadoc", "copyJavadoc")
}
// pre commit:
//gradle clean spotlessApply test javadoc copyJavadoc
// post commit (Jenkins):
//gradle clean spotlessCheck test javadoc jar javadocJar sourcesJar copyJar copyJavadoc copyDependencies publish