-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild.gradle
More file actions
127 lines (109 loc) · 3.7 KB
/
build.gradle
File metadata and controls
127 lines (109 loc) · 3.7 KB
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
// Apply necessary plugins
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'
// Define the version and group for the Maven package
version = "1.1.5"
group = "net.servicestack"
if (project.hasProperty('versionSuffix')) {
version = "${version}-${versionSuffix}"
}
// Specify dependencies
dependencies {
implementation 'com.google.code.gson:gson:2.11.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
}
tasks.register('sourceJar', Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allJava
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
// Configure the publishing block for Maven Central deployment
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// Attach source and javadoc JARs
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
pom {
name = 'ServiceStack.Client'
description = 'A client library to call your ServiceStack webservices.'
url = 'https://github.com/ServiceStack/ServiceStack.Java'
version = version
licenses {
license {
name = 'The BSD 3-Clause License'
url = 'https://servicestack.net/bsd-license.txt'
}
}
developers {
developer {
id = 'mythz'
name = 'Demis Bellot'
email = 'team@servicestack.net'
}
developer {
id = 'layoric'
name = 'Darren Reid'
email = 'team@servicestack.net'
}
}
scm {
connection = 'https://github.com/ServiceStack/ServiceStack.Java.git'
developerConnection = 'https://github.com/ServiceStack/ServiceStack.Java.git'
url = 'https://github.com/ServiceStack/ServiceStack.Java'
}
}
}
}
repositories {
maven {
name = 'OSSRH'
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
password = project.findProperty("ossrhPassword") ?: System.getenv("OSSRH_TOKEN")
}
}
maven {
name = 'GitHubPackages'
url = uri("https://maven.pkg.github.com/ServiceStack/ServiceStack.Java")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME_GITHUB")
password = project.findProperty("gpr.token") ?: System.getenv("TOKEN_GITHUB")
}
}
}
}
// Check if the environment variables are set
def signingKey = System.getenv('SIGNING_KEY')
def signingPassword = System.getenv('SIGNING_PASSWORD')
// Conditionally apply the signing plugin and configuration
if (signingKey && signingPassword) {
println "Signing enabled"
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
} else {
println "Signing disabled"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}