-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
59 lines (46 loc) · 1.96 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
import java.text.SimpleDateFormat
plugins {
id 'java'
id 'net.nemerosa.versioning' version '2.6.1'
}
group 'com.github.antoinejt'
def lastUpdate = 'December 6th 2019'
def majorVersionNumber = '0'
def minorVersionNumber = '8'
def patchVersionNumber = '0'
def wipBuildNumber = '0' // if different from 0 it indicates that this is a wip version, not a yet released one
def buildNumber = (wipBuildNumber != '0') ? "-alpha.${wipBuildNumber}" : ''
def versionNumber = "${majorVersionNumber}.${minorVersionNumber}.${patchVersionNumber}${buildNumber}"
def internalVersionNumber = "${versionNumber}${versioning.info.branch != 'master' ? '-DEVELOP' : ''}"
version "${versionNumber}-${versioning.info.full}"
def jarName = "${jar.archiveBaseName.getOrNull()}-${rootProject.version}.jar"
def runScript = "java -jar ${jarName}"
sourceCompatibility = 1.8
jar {
manifest {
attributes(
'Main-Class': 'com.github.antoinejt.jasc.Main',
'Built-By': System.properties['user.name'],
'Last-Update': lastUpdate,
'Version': internalVersionNumber,
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Build-Revision': versioning.info.commit,
'Created-By': "Gradle ${gradle.gradleVersion}",
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS': "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
)
}
doLast {
new File('build/libs', 'run.bat').text = runScript
new File('build/libs', 'run.sh').text = runScript
}
}
task run(dependsOn: ':build', type: Exec) {
commandLine 'java', '-jar', "build/libs/${jarName}"
}
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
}