-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
127 lines (102 loc) · 2.78 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
version '1.43'
apply plugin: 'java'
archivesBaseName = 'solution-finder'
// Specify encoding of sources
def defaultEncoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.encoding = defaultEncoding
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
implementation 'commons-cli:commons-cli:1.5.0'
testImplementation 'com.google.guava:guava:31.1-jre'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testImplementation 'org.apiguardian:apiguardian-api:1.1.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
}
jar {
manifest {
attributes 'Main-Class': 'Main'
}
from {
configurations.compileClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
def releaseDir = file 'release'
def distributionDir = file 'distribution'
def binaryDir = file 'binary'
task cleanReleaseDir(type: Task) {
group = 'release'
doLast {
delete releaseDir
releaseDir.mkdir()
}
}
task copyRelease(type: Task) {
group = 'release'
doLast {
// copy distribution
copy {
from distributionDir
into releaseDir
exclude '**/.*'
}
def jarName = String.format '%s-%s.jar', archivesBaseName, version
def srcJarFile = file(["build", "libs", jarName].join(File.separator))
// copy jar
copy {
from srcJarFile
into releaseDir
rename { file -> 'sfinder.jar' }
}
// copy README
def readmeName = "README.md"
copy {
from readmeName
into releaseDir
}
}
}
task copyBinary(type: Task) {
group = 'release'
doLast {
// copy distribution
copy {
from binaryDir
into releaseDir
exclude '**/.*'
}
}
}
task release(type: Zip) {
group = 'release'
// dependency
dependsOn jar, cleanReleaseDir, copyRelease
copyRelease.mustRunAfter jar, cleanReleaseDir
from releaseDir
}
task releaseWithBianry(type: Zip) {
group = 'release'
// dependency
dependsOn jar, cleanReleaseDir, copyRelease, copyBinary
copyRelease.mustRunAfter jar, cleanReleaseDir
copyBinary.mustRunAfter copyRelease
from releaseDir
archiveClassifier.set("GUI")
}
test {
useJUnitPlatform {
if (System.getenv("ALLOWS_ALL_TESTS") == "true") {
println "[useJUnitPlatform] Run all tests"
} else {
println "[useJUnitPlatform] Run tests / Exclude tag:long"
excludeTags 'long'
}
}
}