forked from davidmc24/gradle-avro-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
101 lines (90 loc) · 2.96 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
plugins {
id "groovy"
id "checkstyle"
id "codenarc"
id "idea"
id "com.gradle.plugin-publish" version "0.9.1"
}
repositories {
jcenter()
}
dependencies {
compile gradleApi()
compile localGroovy()
compile "org.apache.avro:avro-compiler:1.7.7"
compile "org.apache.commons:commons-io:1.3.2"
testCompile "org.spockframework:spock-core:1.0-groovy-2.3"
testCompile gradleTestKit()
}
sourceCompatibility = 1.7
pluginBundle {
website = "https://github.com/commercehub-oss/gradle-avro-plugin"
vcsUrl = "https://github.com/commercehub-oss/gradle-avro-plugin"
description = "A Gradle plugin to allow easily performing Java code generation for Apache Avro. It supports JSON schema declaration files, JSON protocol declaration files, and Avro IDL files."
tags = ["serialization", "avro"]
version = "0.5.0"
plugins {
avro {
id = "com.commercehub.gradle.plugin.avro"
displayName = "Avro Plugin"
}
avroBase {
id = "com.commercehub.gradle.plugin.avro-base"
displayName = "Avro Base Plugin"
}
}
mavenCoordinates {
groupId = "com.commercehub.gradle.plugin"
artifactId = "gradle-avro-plugin"
}
}
idea {
project {
vcs = "Git"
ipr {
withXml { provider ->
def node = provider.asNode()
node.append(new XmlParser().parseText("""
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="LINE_SEPARATOR" value=" "/>
<option name="RIGHT_MARGIN" value="140"/>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
""".stripIndent()))
}
}
}
}
// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
def outputDir = file("$buildDir/$name")
inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n")
}
}
// Add the classpath file to the test runtime classpath
dependencies {
testRuntime files(createClasspathManifest)
}
checkstyle {
toolVersion = "6.10.1"
}
// Nasty workaround for https://issues.gradle.org/browse/GRADLE-2888
def checkstyleWarningsFile = "build/reports/checkstyle/main.xml"
checkstyleMain << {
File warningsFile = file(checkstyleWarningsFile)
if (warningsFile.exists() && warningsFile.text.contains("<error ")) {
throw new GradleException("There were checkstyle warnings! For more info check ${warningsFile}")
}
}
codenarc {
toolVersion = "0.24.1"
config = project.resources.text.fromFile("config/codenarc/codenarc.groovy")
}