This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
95 lines (73 loc) · 2.27 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
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/4.3/userguide/java_library_plugin.html
*/
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
archivesBaseName = 'Lang'
version = '0.0.0.1'
sourceSets
{
main.java.srcDir 'src/main/java'
test.java.srcDir 'src/test/java'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.1.0'
}
}
repositories
{
mavenCentral()
}
dependencies
{
compile 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.0.0'
}
jar {
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})"
)
}
}
test {
useJUnitPlatform()
reports {
junitXml.enabled = false
html.enabled = true
}
afterSuite { desc, result ->
if (!desc.parent) {
println "\nTest result: ${result.resultType}"
println "Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
}
}
}
ext.assembleNextVersionNumber = { oldVersion ->
def parts = oldVersion.tokenize(".")
int buildCode = parts[parts.size()-1] as Integer
buildCode+=1
return parts[0] + '.' + parts[1] + '.' + parts[2] + '.' + buildCode
}
task incrementVersion<<{
String newVersion = assembleNextVersionNumber(version)
def s = buildFile.getText().replaceFirst("version = '$version'", "version = '" + newVersion + "'")
buildFile.setText(s)
}
build.dependsOn incrementVersion