forked from tonyheadford/m68k
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
122 lines (106 loc) · 3.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
plugins {
id 'java'
}
def dateString = getDate()
group 'com.fbdev.helios'
assert JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17) : "Java 17 or newer is required"
//version dateString
version dateString + '-SNAPSHOT'
def jarNameHead = rootProject.name + "-" + version
repositories {
mavenCentral()
}
sourceSets {
main {
resources {
srcDirs= ["res"]
}
}
}
dependencies {
implementation 'org.tinylog:tinylog-api:2.7.0'
implementation 'org.tinylog:tinylog-impl:2.7.0'
implementation 'org.tinylog:slf4j-tinylog:2.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'com.google.code.gson:gson:2.11.0'
}
test {
useJUnitPlatform()
}
def static getDate() {
String date = new Date().format('yyMMdd')
date.substring(0,2) + "." + date.substring(2)
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
dependsOn "compileJava"
manifest {
attributes 'Implementation-Title': 'headford68k',
'Implementation-Version': archiveVersion
}
duplicatesStrategy= "exclude"
getArchiveBaseName().set(project.name + "-all")//+ version
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
from {
["README.md", "LICENSE.md"]
}
with jar
doLast {
println("Creating fatJar: "+ getArchiveFileName().getOrNull() +" in folder: " + destinationDirectory.getOrNull())
}
}
task copyRes {
copy {
from {
["README.md", "LICENSE.md"]
}
into "$buildDir/packageDir"
}
}
jar {
dependsOn "copyRes"
manifest {
attributes 'Implementation-Title': rootProject.name,
'Implementation-Version': archiveVersion,
'Class-Path': configurations.compileClasspath.collect { "lib/" + it.getName() }.join(' ')
}
archivesBaseName = rootProject.name
destinationDirectory = file("$buildDir/packageDir")
into 'res', {
from 'res'
}
doLast {
println("Creating jar: " + getArchiveFileName().getOrNull() + " in folder: " + getDestinationDirectory().getOrNull())
}
}
task jarWithSources(type: Jar) {
dependsOn "test"
duplicatesStrategy("exclude")
from sourceSets.main.allSource
manifest {
attributes 'Implementation-Title': rootProject.name,
'Implementation-Version': archiveVersion,
'Class-Path': configurations.compileClasspath.collect { "lib/" + it.getName() }.join(' ')
}
getArchiveFileName().set(rootProject.name + "-binsrc-${project.version}.jar")
destinationDirectory = file("$buildDir/dist")
from {
["README.md", "LICENSE.md"]
}
with jar
doLast {
println("Creating jar with sources: " + getArchiveFileName().getOrNull() +
" in folder: " + getDestinationDirectory().getOrNull())
}
}
test {
testLogging {
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
}