-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
116 lines (104 loc) · 3.1 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
plugins {
id 'maven-publish'
id 'java-library'
id 'java'
id 'signing'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testImplementation('org.junit.jupiter:junit-jupiter:5.11.3', 'org.json:json:20240303')
}
version = System.getenv("RELEASE_VERSION") ?: 'NONE'
group 'dev.personnummer'
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}
java {
withJavadocJar()
withSourcesJar()
}
artifacts {
archives javadocJar, sourcesJar, jar
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/personnummer/java")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
maven {
name = "OSSRH"
if (project.version.endsWith('-SNAPSHOT')) {
url "https://oss.sonatype.org/content/repositories/snapshots"
} else {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
publications {
mavenJava (MavenPublication) {
version = System.getenv("RELEASE_VERSION")
groupId = 'dev.personnummer'
from components.java
pom {
name = 'Personnummer'
description = 'personnummer is a small open-source project that validates, formatting and determine sex and age from swedish personal identity numbers'
url = 'https://personnummer.dev'
licenses {
license {
name = 'MIT'
url = 'https://mit-license.org/'
}
}
developers {
developer {
id = 'jite'
name = 'Johannes Tegnér'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:personnummer/java.git'
url = 'https://github.com/personnummer/java'
}
}
}
}
}
signing {
def signingKeyId = "5E695E6A"
def signingKey = findProperty("signingKey") ?: "key"
def signingPassword = findProperty("signingPassword") ?: "pass"
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { version != "NONE" }
}