-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
135 lines (115 loc) · 3.69 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
plugins {
id 'java'
id 'groovy'
id 'maven'
id 'java-gradle-plugin'
id 'com.github.sherter.google-java-format' version '0.8'
id 'net.researchgate.release' version '2.6.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
group = 'com.google.cloud.tools'
dependencies {
compile localGroovy()
compile gradleApi()
compile "com.google.guava:guava:30.1-jre"
compile "com.google.endpoints:endpoints-framework-tools:2.2.2"
testCompile 'commons-io:commons-io:2.8.0'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:2.1.0'
testCompile 'junit:junit:4.13.1'
}
jar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
}
}
test {
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
}
}
/* GOOGLE JAVA FORMAT */
check.dependsOn verifyGoogleJavaFormat
// to auto-format run ./gradlew googleJavaFormat
/* GOOGLE JAVA FORMAT */
/* CHECKSTYLE */
apply plugin: 'checkstyle'
checkstyle {
toolVersion = "7.6.1"
// get the google_checks.xml file from the actual tool we're invoking
config = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml')
maxErrors = 0
maxWarnings = 0
}
/* CHECKSTYLE */
/* RELEASING */
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
task writePom {
project.afterEvaluate {
def outputFile = file("$buildDir/pom/${project.name}-${project.version}.pom")
outputs.file outputFile
doLast {
pom {
project {
name 'Endpoints Framework Gradle Plugin'
description 'This Gradle plugin provides tasks and configurations to generate Google Cloud Endpoints Framework client code and discovery docs'
url 'https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin'
inceptionYear '2016'
scm {
url 'https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin'
connection 'scm:https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin.git'
developerConnection 'scm:git://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'loosebazooka'
name 'Appu Goundan'
email '[email protected]'
}
}
}
}.writeTo(outputFile)
}
}
}
task prepareRelease(type: Copy) {
from jar
from sourceJar
from javadocJar
from writePom
into "${buildDir}/release-artifacts"
dependsOn build
dependsOn cleanPrepareRelease
}
// Release helper (git release commits and version updates)
release {
tagTemplate = 'v$version'
git {
requireBranch = /^release_v\d+.*$/ //regex
}
}
/* RELEASING */