forked from google/nomulus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
211 lines (176 loc) · 5.79 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
buildscript {
if (project.disableDependencyLocking.toBoolean() == false) {
// Lock buildscript dependencies.
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.6.1"
classpath 'org.sonatype.aether:aether-api:1.13.1'
classpath 'org.sonatype.aether:aether-impl:1.13.1'
}
}
plugins {
// Java static analysis plugins. Keep versions consistent with
// ./buildSrc/build.gradle
id 'nebula.lint' version '10.4.2'
// TODO(weiminyu): consider remove net.ltgt.apt. Gradle 5.2+
// has similar functionalities.
id 'net.ltgt.apt' version '0.19' apply false
id 'net.ltgt.errorprone' version '0.6.1'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.0.0'
// NodeJs plugin
id "com.moowork.node" version "1.2.0"
id 'idea'
}
apply plugin: google.registry.gradle.plugin.ReportUploaderPlugin
reportUploader {
// Set the location where we want to upload the build results.
// e.g. -P uploaderDestination=gcs://domain-registry-alpha-build-result-test
//
// If not set - the upload will be skipped
destination = uploaderDestination
// The location of the file containing the OAuth2 Google Cloud credentials.
//
// The file can contain a Service Account key file in JSON format from the
// Google Developers Console or a stored user credential using the format
// supported by the Cloud SDK.
//
// If no file is given - the default credentials are used.
credentialsFile = uploaderCredentialsFile
// If set to 'yes', each file will be uploaded to GCS in a separate thread.
// This is MUCH faster.
multithreadedUpload = uploaderMultithreadedUpload
}
apply from: 'dependencies.gradle'
// Provide defaults for all of the project properties.
// showAllOutput: boolean. If true, dump all test output during the build.
if (!project.hasProperty('showAllOutput')) {
ext.showAllOutput = 'false'
}
// Only do linting if the build is successful.
gradleLint.autoLintAfterFailure = false
// Paths to main and test sources.
ext.projectRootDir = "${rootDir}"
// Tasks to deploy/stage all App Engine services
task deploy {
group = 'deployment'
description = 'Deploys all services to App Engine.'
}
task stage {
group = 'deployment'
description = 'Generates application directories for all services.'
}
allprojects {
// Skip no-op project
if (project.name == 'services') return
repositories {
if (rootProject.mavenUrl) {
maven {
println "Java dependencies: Using repo $pluginsUrl..."
url rootProject.mavenUrl
}
} else {
println "Java dependencies: Using Maven Central..."
mavenCentral()
}
}
}
subprojects {
// Skip no-op project
if (project.name == 'services') return
ext.createUberJar = { taskName, binaryName, mainClass ->
project.tasks.create(
taskName, com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
mergeServiceFiles()
baseName = binaryName
manifest {
attributes 'Main-Class': mainClass
}
zip64 = true
classifier = null
version = null
configurations = [project.configurations.runtimeClasspath]
from project.sourceSets.main.output
// Excludes signature files that accompany some dependency jars, like
// bonuncycastle. If they are present, only classes from those signed jars are
// made available to the class loader.
// see https://discuss.gradle.org/t/signing-a-custom-gradle-plugin-thats-downloaded-by-the-build-system-from-github/1365
exclude "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA"
}
}
if (rootProject.disableDependencyLocking.toBoolean() == false) {
buildscript {
// Lock buildscript dependencies.
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
// Lock application dependencies.
dependencyLocking {
lockAllConfigurations()
}
}
def services = [':services:default',
':services:backend',
':services:tools',
':services:pubapi']
// Set up all of the deployment projects.
if (services.contains(project.path)) {
apply from: "${rootDir.path}/appengine_war.gradle"
// Return early, do not apply the settings below.
return
}
apply from: "${rootDir.path}/java_common.gradle"
if (project.name == 'third_party') return
// Path to code generated with annotation processors. Note that this path is
// chosen by the 'net.ltgt.apt' plugin, and may change if IDE-specific plugins
// are applied, e.g., 'idea' or 'eclipse'
def aptGeneratedDir = "${project.buildDir}/generated/source/apt/main"
def aptGeneratedTestDir = "${project.buildDir}/generated/source/apt/test"
def commonlyExcludedResources = ['**/*.java', '**/BUILD']
project.ext.javaDir = "${project.projectDir}/src/main/java"
project.ext.javaTestDir = "${project.projectDir}/src/test/java"
sourceSets {
main {
java {
srcDirs += aptGeneratedDir
}
resources {
srcDirs = [
project.ext.javaDir
]
exclude commonlyExcludedResources
}
}
test {
java {
srcDirs += aptGeneratedTestDir
}
resources {
srcDirs = [
project.ext.javaTestDir
]
exclude commonlyExcludedResources
}
}
}
if (project.name == 'util') return
if (project.name == 'proxy') return
if (project.name == 'core') return
test {
testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput)
}
ext.relativePath = "google/registry/${project.name}"
sourceSets.each {
it.java {
include "${project.relativePath}/"
}
it.resources {
include "${project.relativePath}/"
}
}
}