-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
149 lines (132 loc) · 4.06 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
plugins {
id 'java'
id 'maven-publish'
id 'signing'
}
def gitCommitSha = { ->
def stdout = new ByteArrayOutputStream();
exec {
commandLine 'git', 'describe', '--long', '--always', '--dirty', '--exclude=*', '--abbrev=8';
standardOutput = stdout;
}
return stdout.toString().trim();
}
def gitHeadName = { ->
def stdout = new ByteArrayOutputStream();
def stderr = new ByteArrayOutputStream();
def result = exec {
commandLine 'git', 'describe', '--tags', '--exact-match'
standardOutput = stdout;
errorOutput = stderr;
ignoreExitValue = true;
}
if(result.exitValue == 0)
return stdout.toString().trim();
stdout.reset();
stderr.reset();
exec {
commandLine 'git', 'symbolic-ref', '-q', '--short', 'HEAD'
standardOutput = stdout;
errorOutput = stderr;
ignoreExitValue = true;
}
return stdout.toString().trim();
}
def getVersion = { ->
def version = '1.1.0';
if(gitHeadName().equals('v'+version))
return version;
if(gitHeadName().equals('main'))
return version;
return version + '+' + gitCommitSha() + '-SNAPSHOT';
}
group 'dk.yalibs'
version getVersion()
// Some extra information. Useful for debugging the CI
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
def releaseRepoUrl = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
println '+ GIT HEAD: ' + gitHeadName()
println '+ GIT SHA: ' + gitCommitSha()
println '+ PROJECT VERSION: ' + version
println '+ TARGET REPO: ' + releaseRepoUrl
repositories {
mavenCentral()
}
ext {
pomGroupId = group
pomVersion = version
pomArtifactId = "yaundo"
pomArtifactName = "yaundo"
jdkCompileVersion = 17
}
dependencies {
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release = 17
}
sourceCompatibility = "${jdkCompileVersion}"
targetCompatibility = "${jdkCompileVersion}"
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of("${jdkCompileVersion}"))
}
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = "${pomGroupId}"
artifactId = "${pomArtifactId}"
version = "${pomVersion}"
from components.java
pom {
name = "${pomArtifactId}"
description = 'Yet another framework-agnostic skyhook dependency injection implementation'
url = 'https://www.yalibs.dk'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'yalibs'
name = 'Asger Gitz-Johansen'
email = 'yalibs@protonmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/yalibs/yaundo.git'
developerConnection = 'scm:git:ssh://github.com/yalibs/yaundo.git'
url = 'https://github.com/yalibs/yaundo/'
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = releaseRepoUrl
credentials {
username = findProperty("ossrhUsername")
password = findProperty("ossrhPassword")
}
}
}
}
signing {
def signingKey = findProperty("signingKey") ?: System.getenv("GPG_SIGNING_KEY")
def signingPassword = findProperty("signingPassword") ?: System.getenv("GPG_SIGNING_PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
// sign configurations.archives
}