-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
167 lines (138 loc) · 5.04 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
plugins {
id "java"
id 'maven-publish'
id 'signing'
}
ext {
Map env = System.getenv()
getOrDefault = { String key, String defaultValue ->
String value
(value = project.findProperty(key)) && !value.isEmpty() ? value : defaultValue
}
getEnv = {
return env
}
String mavenCentral_username = project.getOrDefault("ossrhUsername", project.getEnv().CENTRAL_MAVEN_USERNAME)
String mavenCentral_password = project.getOrDefault("ossrhPassword", project.getEnv().CENTRAL_MAVEN_PASSWORD)
credentialsMavenCentral = { MavenArtifactRepository mavenArtifactRepository ->
mavenArtifactRepository.credentials { PasswordCredentials passwordCredentials ->
username(mavenCentral_username)
password(mavenCentral_password)
}
}
}
repositories {
maven {
url 'https://repo1.maven.org/maven2/'
}
maven {
url 'https://maven.aliyun.com/repository/central'
}
}
dependencies {
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compileOnly('org.apache.logging.log4j:log4j-core:2.23.1')
compileOnly('org.slf4j:slf4j-api:2.0.13')
compileOnly('commons-io:commons-io:2.15.1')
// dataBase
compileOnly('dev.morphia.morphia:morphia-core:2.3.9')
compileOnly('de.bwaldvogel:mongo-java-server:1.45.0')
compileOnly('de.bwaldvogel:mongo-java-server-h2-backend:1.45.0')
compileOnly('org.mongodb:mongodb-driver-sync:4.11.1')
compileOnly('org.mongodb:bson:4.11.1')
compileOnly('com.h2database:h2:2.2.224')
implementation('org.lz4:lz4-java:1.8.0')
// lombok
compileOnly('org.projectlombok:lombok:1.18.24')
annotationProcessor('org.projectlombok:lombok:1.18.24')
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc).configureEach { Javadoc task ->
task.options.encoding("UTF-8")
(task.options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
String versionSuffix = ''
if (System.getenv("BUILD_RELEASE") != "true") {
String buildNumber = System.getenv("BUILD_ID")
versionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '+SNAPSHOT'
}
version = project.version + versionSuffix
publishing {
publications {
maven(MavenPublication) {
groupId = "io.github.skydynamic"
artifactId = "incremental-storage-lib"
from components.java
pom {
name = 'Incremental Storage Lib'
description = 'IncrementalStorageLib aims to provide a generic incremental backup&restore solution, It utilize mongodb to store file hashes to determine which file has changed'
url = 'https://github.com/QuickBackupMultiMod-Dev/IncrementalStorageLib'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'skydynamic'
name = 'Sky Dynamic'
email = 'tcplxw@outlook.com'
}
}
scm {
connection = 'scm:git:https://github.com/QuickBackupMultiMod-Dev/IncrementalStorageLib.git'
developerConnection = 'scm:git:ssh://github.com/QuickBackupMultiMod-Dev/IncrementalStorageLib.git'
url = 'https://github.com/QuickBackupMultiMod-Dev/IncrementalStorageLib'
}
}
}
}
repositories {
mavenLocal()
maven {
name "CJ-Maven"
url System.getenv("CJ_MAVEN_URL")
credentials {
username System.getenv("CJ_MAVEN_USERNAME")
password System.getenv("CJ_MAVEN_PASSWORD")
}
}
maven {
name "mavenCentralRelease"
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
project.credentialsMavenCentral(it)
}
}
}
signing {
String signingKey = base64Decode(project.getOrDefault("secrets.gpg.signingKey", project.getEnv().SIGNING_KEY))
String signingPassword = project.getOrDefault("secrets.gpg.signingPassword", project.getEnv().SIGNING_PASSWORD)
required {
signingKey
}
useInMemoryPgpKeys(signingKey, signingPassword ? signingPassword : "")
sign(publishing.publications)
}
static def base64Decode(encodedString) {
if (encodedString != null) {
byte[] decoded = encodedString.decodeBase64()
String decode = new String(decoded)
return decode
}
return null
}