-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
84 lines (74 loc) · 2.35 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
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar.grgit:grgit-core:4.0.2'
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2'
}
}
plugins {
id 'java-library'
id 'eclipse'
id 'org.ajoberstar.grgit' version '4.0.2'
id "com.diffplug.spotless" version "5.15.0"
id 'checkstyle'
id 'maven-publish'
id 'signing'
}
group = 'it.unive'
version = '1.0'
repositories {
jcenter()
mavenCentral()
}
dependencies {
api 'org.apache.commons:commons-lang3:3.9'
api 'org.apache.logging.log4j:log4j-api:2.17.1'
api 'org.apache.logging.log4j:log4j-core:2.17.1'
testImplementation 'junit:junit:4.12'
}
plugins.withType(JavaPlugin) {
def git_ready = false
def repo = null
try {
repo = org.ajoberstar.grgit.Grgit.open(dir: rootProject.projectDir)
git_ready = true
} catch (Exception e) {
// this means we are building from outside of LiSA, probably from an outer model
// we can skip the manifest attributes injection here
println('Skipping manifest attriubtes injection because we are not directly building LiSA')
println(e)
}
if (git_ready) {
jar.doFirst {
manifest {
attributes(
'Implementation-Title': rootProject.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Ca\' Foscari University of Venice',
'Created-By': "Gradle ${gradle.gradleVersion}",
'Build-Revision': repo.head().abbreviatedId,
'Build-Tag': repo.describe(tags: true, always: true),
'Build-Branch': repo.branch.current().getName(),
'Build-Clean': repo.status().isClean(),
'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'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']}"
)
}
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
apply from: 'publishing.gradle'
apply from: 'code-style.gradle'