-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (159 loc) · 5.07 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion"
}
}
subprojects {
group = 'xyz.codemeans.tensorflow4j'
version = '1.12.0'
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: "java"
apply plugin: 'java-library'
// protobuf
apply plugin: "com.google.protobuf"
protobuf {
generatedFilesBaseDir = "$projectDir/gen/"
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcProtocPluginVersion"
}
}
generateProtoTasks {
ofSourceSet('main')
all().each { task ->
task.plugins {
grpc {
outputSubDir = "java"
}
}
}
}
}
clean {
delete protobuf.generatedFilesBaseDir
}
sourceSets {
main.java.srcDir("${protobuf.generatedFilesBaseDir}/main/java")
}
apply plugin: "idea"
idea {
module {
// mark proto directory as source root
sourceDirs += sourceSets.main.proto.sourceDirectories
}
}
// artifacts
jar << {
println "jar: ${archivePath}"
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allJava
classifier = 'sources'
doLast {
println "sources: ${archivePath}"
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
doLast {
println "sources: ${archivePath}"
}
}
task('protoZip', type: Zip) {
from sourceSets.main.proto
classifier = 'proto'
}
apply plugin: "maven-publish"
publishing {
repositories {
maven {
name "oss"
def ossBaseUrl = "https://oss.sonatype.org/content/repositories"
url = project.hasProperty("release") ? "https://oss.sonatype.org/service/local/staging/deploy/maven2" : "$ossBaseUrl/snapshots"
credentials {
username property("maven2.username")
password property("maven2.password")
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
if (project.hasProperty("release")) {
version = project.getVersion()
} else {
version = project.getVersion() + "-SNAPSHOT"
}
artifact sourcesJar
artifact javadocJar
artifact protoZip
pom {
name = 'TensorFlow4j: Java Library For Protobuf In TensorFlow and TensorFlow-Serving'
description = 'A Java Library for Protobuf in TensorFlow and TensorFlow-Serving'
url = 'https://github.com/YuanWenqing/tensorflow4j'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'yuanwq'
name = 'YuanWenqing'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com:YuanWenqing/tensorflow4j.git'
developerConnection = 'scm:git:ssh://github.com:YuanWenqing/tensorflow4j.git'
url = 'https://github.com/YuanWenqing/tensorflow4j'
}
}
}
}
}
publish {
doLast {
def pub = publishing.publications.mavenJava
println "artifact: ${pub.groupId}:${pub.artifactId}:${pub.version}"
for (repo in publishing.repositories) {
println "upload to ${repo.url}"
}
}
}
publishToMavenLocal {
doLast {
def pub = publishing.publications.mavenJava
println "artifact: ${pub.groupId}:${pub.artifactId}:${pub.version}"
}
}
task('local').dependsOn(publishToMavenLocal)
apply plugin: "signing" // generate a signature file for each artifact
signing {
sign publishing.publications.mavenJava
}
}
project(":tensorflow-proto") {
dependencies {
api("com.google.protobuf:protobuf-java:$protobufJavaVersion")
api("io.grpc:grpc-protobuf:$grpcVersion")
api("io.grpc:grpc-stub:$grpcVersion")
}
}
project(":serving-proto") {
dependencies {
protobuf(project(":tensorflow-proto"))
api("com.google.protobuf:protobuf-java:$protobufJavaVersion")
api("io.grpc:grpc-protobuf:$grpcVersion")
api("io.grpc:grpc-stub:$grpcVersion")
}
}