-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
97 lines (83 loc) · 2.63 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
buildscript {
apply from: "./ext.gradle"
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven {
url = spineRepository
}
maven {
url = spineSnapshotsRepository
}
}
dependencies {
classpath group: 'com.google.protobuf', name:'protobuf-gradle-plugin', version: protobufGradlePluginVersion
classpath group: 'io.spine.tools', name: 'spine-model-compiler', version: spineToolsVersion
}
}
allprojects {
ext {
sourcesRootDir = "$projectDir/src"
genRootDir = "$projectDir/generated"
}
group 'edu.ddashenkov'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'io.spine.tools.spine-model-compiler'
apply from: "$rootDir/ext.gradle"
sourceCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
maven {
url = spineRepository
}
maven {
url = spineSnapshotsRepository
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
sourceSets {
main {
proto.srcDirs = ["${sourcesRootDir}/main/proto"]
java.srcDirs += [
"$genRootDir/main/java",
"$genRootDir/main/spine"
]
resources.srcDirs += ["$genRootDir/main/resources"]
}
test {
proto.srcDirs = ["${sourcesRootDir}/test/proto"]
java.srcDirs += [
"$genRootDir/test/java",
"$genRootDir/test/spine"
]
resources.srcDirs += ["$projectDir/generated/test/resources"]
}
}
protobuf {
generatedFilesBaseDir = "$projectDir/generated"
protoc {
artifact = 'com.google.protobuf:protoc:3.3.0'
}
generateProtoTasks {
all().each { task ->
task.generateDescriptorSet = true
final def descPath = (task.sourceSet.name.contains("test")
? project.extensions.getByName("modelCompiler").testDescriptorSetPath
: project.extensions.getByName("modelCompiler").mainDescriptorSetPath) ?:
"${projectDir}/build/descriptors/${task.sourceSet.name}.desc"
task.descriptorSetOptions.path = descPath
task.descriptorSetOptions.includeImports = true
task.descriptorSetOptions.includeSourceInfo = true
}
}
}
configurations.all {
it.exclude(module: 'com.google.protobuf.nano')
}
}