-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
96 lines (80 loc) · 2.67 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
import java.nio.file.Paths
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:+'
}
}
repositories {
maven {
url 'https://maven-central.storage.googleapis.com'
}
jcenter()
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'com.google.appengine:appengine:+'
compile 'javax.inject:javax.inject:1'
compile 'com.google.endpoints:endpoints-framework:+'
/*
compile 'com.google.endpoints:endpoints-management-control:+'
compile 'com.google.endpoints:endpoints-management-config:+'
compile 'com.google.endpoints:endpoints-management-auth:+'
compile 'com.google.endpoints:endpoints-management-control-appengine:+'
*/
compile 'com.google.endpoints:endpoints-framework-auth:+'
compile 'com.google.endpoints:endpoints-framework-guice:+'
}
appengine { // App Engine tasks configuration
run.port = 8080
deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
def cloudSdkDir = null
try {
project.rootProject.file('local.properties').withInputStream {
Properties properties = new Properties()
properties.load(it)
cloudSdkDir = properties.'cloudSdk.dir'
}
if (cloudSdkDir) {
tools.cloudSdkHome = [cloudSdkDir]
}
} catch (Exception ignore) {
}
}
endpointsServer {
serviceClasses = ['org.somecompany.api.DemoEndpoint']
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
group 'org.somecompany.api'
version '1.0-SNAPSHOT'
task getSwaggerDocs(type: JavaExec) {
dependsOn explodeWar
classpath = buildscript.configurations.classpath
main = "com.google.api.server.spi.tools.EndpointsTool"
args = [
"get-swagger-doc",
"--hostname=someapi.endpoints.soft-lynx.cloud.goog",
"--war=build/exploded-app"] + endpointsServer.serviceClasses
}
task deployEndpoint(type: Exec) {
def gcloud = Paths.get(appengine.tools.cloudSdkHome.toString(), "bin", "gcloud")
dependsOn getSwaggerDocs
dependsOn appengineDeploy
commandLine gcloud, "service-management", "deploy", "openapi.json"
}