-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
195 lines (163 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
plugins {
id 'java'
id 'idea'
id 'signing'
id 'java-library'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '4.0.1'
id 'com.github.sherter.google-java-format' version '0.8'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
//configurations.all.resolutionStrategy {
// // 版本冲突时直接构建失败
// // failOnVersionConflict()
//
// // 缓存有效时间
// // cacheChangingModulesFor 0,'seconds'
//}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
googleJavaFormat {
options style: 'AOSP'
source = sourceSets*.allJava
include '**/*.java'
exclude '**/temp/*.java'
}
verifyGoogleJavaFormat {
source = sourceSets*.allJava
include '**/*.java'
exclude '**/temp/*.java'
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.30'
testCompile group: 'commons-codec', name: 'commons-codec', version: '1.14'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'
}
archivesBaseName = 'solcJ'
group = 'org.fisco-bcos'
version = '1.0.0-SNAPSHOT'
// Additional attribute definition
ext {
if (!project.hasProperty("ossrhUsername")) {
ossrhUsername="xxx"
}
if (!project.hasProperty("ossrhPassword")) {
ossrhPassword="xxx"
}
}
// Test related configuration
test {
testLogging {
// showStandardStreams = true
events "started","passed","skipped","failed"
}
}
jar {
// destinationDir file('dist/apps')
// archiveName project.name + '-' + project.version + '.jar'
exclude '**/*.xml'
exclude '**/*.properties'
manifest {
try {
def repo = grgit.open()
if (repo != null) {
def date = new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
def branch = repo.branch.getCurrent().getName()
def commit = repo.head().getAbbreviatedId(40)
attributes(["Implementation-Timestamp": date,
"Git-Branch" : branch,
"Git-Commit" : commit
])
logger.info(" Commit : ")
logger.info(" => date: {}", date)
logger.info(" => branch: {}", branch)
logger.info(" => commit: {}", commit)
}
} catch (Exception e) {
logger.info(' Not a git project ')
}
} from sourceSets.main.output
doLast {
copy {
from destinationDir
into 'dist/apps'
}
copy {
from configurations.runtime
into 'dist/lib'
}
copy {
from file('src/main/resources/log4j.properties')
into 'dist/conf'
}
}
}
//javadoc {
// options.addStringOption('Xdoclint:none', '-quiet')
// options.addStringOption('encoding', 'UTF-8')
// options.addStringOption('charSet', 'UTF-8')
//}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.name
groupId project.group
version project.version
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'fisco-bcos'
description = 'fisco-bcos solcJ'
url = 'http://www.fisco-bcos.org'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'zhangsan'
name = 'zhangsan'
email = 'zhangsan@example.com'
}
}
scm {
connection = 'https://github.com/FISCO-BCOS/solcJ.git'
url = 'https://github.com/FISCO-BCOS/solcJ.git'
}
}
}
}
repositories {
maven {
def releasesRepoURL = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoURL = "https://oss.sonatype.org/content/repositories/snapshots"
url = !version.endsWith("SNAPSHOT") ? releasesRepoURL : snapshotsRepoURL
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
signing {
sign publishing.publications.mavenJava
}
}