-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·129 lines (113 loc) · 4.22 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
128
129
plugins {
id 'java-library'
id 'maven-publish'
}
/*
* Gets the version name from the latest Git tag, omit leading "v" - yeah!
* Note: a plugin way to do this would be via https://plugins.gradle.org/plugin/net.nemerosa.versioning
*/
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
standardOutput = stdout
}
def tag = stdout.toString().trim()
return tag.startsWith("v") ? tag.substring(1) : tag
}
/*
* Gets the commit hash from the latest Git
* Note: a plugin way to do this would be via https://plugins.gradle.org/plugin/net.nemerosa.versioning
*/
def getGitCommitHash = {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--format="%H"'
standardOutput = stdout
}
return stdout.toString().trim().replace("\"", "")
}
version = version != null && version != "unspecified" ? version : getVersionName()
ext {
specVendor = 'International Air Transport Association (IATA)'
product = 'ONE Record Ontology-Model'
specTitle = product + ' Specification'
implVendor = 'Riege Software'
implTitle = product + ' Java Library'
implDescription = implVendor + ' ' + product + ' Java Library'
specVersion = '1.1'
implVersion = version
javaTarget = JavaVersion.VERSION_1_8
}
configurations.all {
// Disabling transitive resolution of dependencies
// https://docs.gradle.org/current/userguide/resolution_rules.html#sec:disabling_resolution_transitive_dependencies
transitive = false
}
dependencies {
api "com.fasterxml.jackson.core:jackson-annotations:2.11.4"
api "cz.cvut.kbss.jopa:jopa-api:0.16.5"
api "net.sourceforge.owlapi:owlapi-api:5.1.17"
api "org.apache.commons:commons-rdf-api:0.5.0"
api "io.swagger:swagger-annotations:1.5.24"
api "org.springframework.data:spring-data-mongodb:3.0.9.RELEASE"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
// testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
// testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
// testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
// testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
}
test {
useJUnitPlatform()
}
group 'com.riege'
sourceCompatibility = javaTarget
targetCompatibility = javaTarget
java {
withSourcesJar() // to get a "sourcesJar" task
}
tasks.withType(Jar) {
manifest {
attributes(
"Built-By" : System.properties['user.name'],
"Build-Revision" : getGitCommitHash(),
"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']}",
"Created-By" : "Gradle ${gradle.gradleVersion}",
"Specification-Title" : specTitle,
"Specification-Vendor" : specVendor,
"Specification-Version" : specVersion,
"Implementation-Title" : implTitle,
"Implementation-Vendor" : implVendor,
"Implementation-Version" : implVersion
)
}
}
repositories {
mavenCentral()
}
publishing {
publications {
thisLibrary(MavenPublication) {
groupId group
from components.java
pom {
name = implTitle
description = implDescription
url = System.getenv("PROJECT_URL")
}
}
}
repositories {
maven {
name = "thisLibrary"
url = System.getenv("MAVEN_PUBLISH_URL")
credentials {
username = System.getenv("MAVEN_PUBLISH_USERNAME")
password = System.getenv("MAVEN_PUBLISH_PASSWORD")
}
}
}
}