-
Notifications
You must be signed in to change notification settings - Fork 0
/
libcosmas.gradle
104 lines (88 loc) · 2.27 KB
/
libcosmas.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
import java.text.SimpleDateFormat
def read_versions() {
def props = new Properties()
props.load(new FileInputStream("${System.getenv("REPO_HOME")}/versions.properties"))
return props
}
def papeeriaVersion(String defaultVersion) {
def versions = read_versions()
if (project.hasProperty("ver")) {
return project["ver"]
}
if (versions["papeeria"] != null && !String.valueOf(versions["papeeria"]).isAllWhitespace()) {
return versions["papeeria"]
}
return defaultVersion
}
def this_version = papeeriaVersion(new SimpleDateFormat("yyyy.MM.dd").format(new Date()))
def grpc_version = read_versions()["grpc"]
def protobuf_version = read_versions()["protobuf"]
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.+'
}
}
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'maven-publish'
sourceSets {
main {
java {
srcDirs 'generated/source/proto/main/java',
'generated/source/proto/main/grpc'
}
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "com.google.protobuf:protobuf-java:$protobuf_version"
compile "io.grpc:grpc-stub:$grpc_version"
compile "io.grpc:grpc-protobuf:$grpc_version"
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobuf_version"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:$grpc_version"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
if (!hasProperty("mavenRepo")) {
throw new Exception("\n\n==== Please specify maven repository URL using -PmavenRepo=... command line flag ====\n\n")
}
jar {
from sourceSets.main.output
include "com/**/*"
}
group = 'com.bardsoftware.papeeria.backend'
version = this_version
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'cosmas-proto'
from components.java
}
}
repositories {
maven {
url = "${mavenRepo}"
}
}
}
publishToMavenLocal.doLast {
println("Published $project.group:cosmas-proto:$version")
}