-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
192 lines (162 loc) · 5.13 KB
/
build.gradle
File metadata and controls
192 lines (162 loc) · 5.13 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
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
plugins {
id 'java'
id 'idea'
id 'signing'
id 'java-library'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '4.1.1'
id "de.undercouch.download" version "4.1.2"
id 'com.github.sherter.google-java-format' version '0.8'
}
println("Notice: current gradle version is " + gradle.gradleVersion)
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
repositories {
mavenCentral()
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
api ('org.slf4j:slf4j-api:1.7.36')
api ('com.fasterxml.jackson.core:jackson-databind:2.13.3')
testCompile ('org.slf4j:slf4j-log4j12:1.7.36')
testCompile ('junit:junit:4.13.2')
}
archivesBaseName = 'bcos-sdk-jni'
group = 'org.fisco-bcos'
version = '3.2.0'
// Additional attribute definition
ext {
if (!project.hasProperty("ossrhUsername")) {
ossrhUsername="xxx"
}
if (!project.hasProperty("ossrhPassword")) {
ossrhPassword="xxx"
}
}
jar {
exclude '**/*.xml'
exclude '**/*.properties'
manifest {
try {
def repo = grgit.open(currentDir: project.rootDir)
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])
}
} catch (Exception e) {
e.printStackTrace()
}
} from sourceSets.main.output
doLast {
copy {
from destinationDirectory
into 'dist/apps'
}
copy {
from configurations.runtimeClasspath
into 'dist/lib'
}
copy {
from file('src/test/resources/log4j.properties')
into 'dist/conf'
}
copy {
from file('src/test/resources/clog.ini')
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'
}
//srourceDir="./.source"
//task downloadBcosCSdk(type: Download) {
// src 'http://localhost:8081/example/test-jar-test_1.jar'
// dest "$srourceDir"
//}
//
//// Notice: build bcos-sdk jni dynamic library
//task buildJniTask(type: Exec) {
// dependsOn: downloadBcosCSdk
// workingDir "$projectDir"
// if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
// // TODO: fix ,add .bat
// commandLine 'cmd', '/c', 'scripts/compile_jni_lib.sh'
// } else {
// commandLine 'sh', '-c', 'bash scripts/compile_jni_lib.sh'
// }
//}
// Notice: build bcos-sdk jni dynamic library
task java2JniTask(type: Exec) {
workingDir "$projectDir"
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
// TODO: fix ,add .bat
commandLine 'cmd', '/c', 'bash scripts/java2jni.sh'
} else {
commandLine 'sh', '-c', 'bash scripts/java2jni.sh'
}
}
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 bcos-sdk-jni'
url = 'https://github.com/FISCO-BCOS/bcos-sdk-jni'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'https://github.com/FISCO-BCOS/bcos-sdk-jni.git'
url = 'https://github.com/FISCO-BCOS/bcos-sdk-jni.git'
}
developers {
developer {
id = 'zhangsan'
name = 'zhangsan'
email = 'zhangsan@example.com'
}
}
}
}
}
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
}
}