forked from Grover-c13/PokeGOAPI-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
109 lines (87 loc) · 2.34 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
group = 'com.github.aphoh'
version = '0.0.1-SNAPSHOT'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'
}
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.google.protobuf'
apply plugin: 'checkstyle'
description = """Pokemon Go Java API"""
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
sourceSets {
main {
proto {
// Need to use custom dir cause Gradle doesn't like us otherwise :(
srcDir 'src/resources/protobuf/src'
include '**/*.proto'
}
}
}
// Remove all .proto definition from the final build
processResources {
exclude('**/*')
}
// Run this task to bundle all needed dependency
task bundle(type: Jar) {
baseName = project.name + '_bundle'
from {
configurations.compile.collect {
it.isDirectory() && !it.isEmpty() ? it : zipTree(it)
}
}
with jar
}
protobuf {
// Configure the protoc executable
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0-beta-3'
}
}
def checkstyleOutputDir = "${project.rootDir}/build/reports/checkstyle/"
checkstyle {
toolVersion = '7.0'
configFile = file("${project.rootDir}/config/checkstyle.xml")
reportsDir = file(checkstyleOutputDir)
ignoreFailures = false
checkstyleMain {
source = sourceSets.main.allSource
}
configurations {
checkstyle
}
dependencies {
checkstyle "com.puppycrawl.tools:checkstyle:${toolVersion}"
}
}
//Abort if any checkstyle warnings
checkstyleMain.doLast {
def outputFile = file(checkstyleOutputDir + "main.xml")
if (outputFile.exists() && outputFile.text.contains("<error ")) {
throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
}
}
dependencies {
compile 'com.squareup.okio:okio:1.9.0'
compile 'com.squareup.moshi:moshi:1.2.0'
compile 'com.annimon:stream:1.1.1'
compile 'com.squareup.okhttp3:okhttp:3.4.0-RC1'
compile 'com.google.protobuf:protobuf-java:3.0.0-beta-3'
compileOnly 'org.projectlombok:lombok:1.16.6'
}
idea {
module {
sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java");
}
}