-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathbuild.gradle
More file actions
113 lines (102 loc) · 3.94 KB
/
build.gradle
File metadata and controls
113 lines (102 loc) · 3.94 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
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.1'
implementation 'com.auth0:java-jwt:4.5.1'
implementation 'org.bouncycastle:bcprov-jdk18on:1.83'
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.mockito:mockito-core:5.23.0'
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
javadoc {
source = sourceSets.main.allJava
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'com.apple.itunes.storekit'
artifactId = 'app-store-server-library'
from components.java
pom {
name = "App Store Server Library"
description = "The Java server library for the App Store Server API and App Store Server Notifications"
url = "https://github.com/apple/app-store-server-library-java/"
licenses {
license {
name = "MIT License"
url = "https://github.com/apple/app-store-server-library-java/blob/main/LICENSE.txt"
}
}
developers {
developer {
id = 'app-store-server-library-project-authors'
name = 'App Store Server Library project authors'
email = 'app-store-server-library@group.apple.com'
}
}
scm {
connection = 'scm:git:git://github.com:apple/app-store-server-library-java.git'
developerConnection = 'scm:git:ssh://github.com:apple/app-store-server-library-java.git'
url = 'https://github.com/apple/app-store-server-library-java/'
}
}
}
}
repositories {
maven {
credentials {
username = findProperty("mavenUsername")
password = findProperty("mavenPassword")
}
if(project.version.endsWith('-SNAPSHOT')) {
url = "https://central.sonatype.com/repository/maven-snapshots/"
} else {
url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
}
}
}
}
tasks.named('publish') {
finalizedBy tasks.named('postRelease')
}
tasks.register('postRelease') {
doLast {
if (!project.version.endsWith('-SNAPSHOT')) {
def username = findProperty("mavenUsername")
def password = findProperty("mavenPassword")
def url = "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.apple.itunes.storekit"
def connection = new URL(url).openConnection() as HttpURLConnection
connection.setRequestMethod("POST")
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
connection.setRequestProperty('Authorization', 'Basic ' + "${username}:${password}".bytes.encodeBase64().toString())
def responseCode = connection.responseCode
if (responseCode == 200) {
def response = connection.inputStream.text
println "Success: $response"
} else {
def error = connection.errorStream?.text ?: "No error details"
println "Error $responseCode: $error"
}
}
}
}
test {
useJUnitPlatform()
}