-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
120 lines (97 loc) · 2.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
plugins {
id "pmd"
id "com.diffplug.spotless" version "6.8.0"
id "com.gradle.plugin-publish" version "1.0.0"
id "com.wagner.gitver" version "0.1.0"
}
/* Version Configuration */
group = "org.gatored"
def build_number = "git rev-list --count master".execute().text.trim()
println("\u001B[1;36mVERSION ${version} -- BUILD ${build_number}\u001B[0m")
/* GatorGradle Dependency Configuration */
repositories {
mavenCentral()
}
dependencies {
implementation gradleApi()
}
/* Plugin Specification */
pluginBundle {
website = "https://gatoreducator.github.io/gatorgradle/"
vcsUrl = "https://github.com/gatoreducator/gatorgradle"
tags = ["grading", "allegheny", "gatorgrader"]
}
gradlePlugin {
plugins {
gatorgradle {
id = "${group}.${name}"
description = "Integrates GatorGrader checking as a Gradle task, as used at Allegheny College."
displayName = "GatorGradle"
implementationClass = "org.gatorgradle.GatorGradlePlugin"
}
}
}
publishing {
repositories {
maven {
name = "mavenLocal"
url = "file://${System.properties['user.home']}/.m2/repository"
}
}
}
jar {
manifest {
attributes 'Implementation-Title': 'GatorGradle',
'Implementation-Version': project.version,
'Implementation-Build': build_number
}
}
/* Publishing Tasks */
task publishJavadocs(type: GradleBuild) {
def docFolder = "docs/${version}"
project.tasks.findByName("javadoc").destinationDir = file(docFolder)
tasks = ['clean', '_cleanJavadoc', 'javadoc', '_publishJavadocs']
}
task _cleanJavadoc(type: Delete) {
delete "docs/${version}"
}
task _publishJavadocs(type: Exec) {
dependsOn 'javadoc'
// TODO: determine this better
def status = "passing"
def docFolder = "docs/${version}"
def date = new Date().format("MMMM d, YYYY", TimeZone.getTimeZone("UTC"))
commandLine "./scripts/publishJavadocs.sh", docFolder, status, version, build_number, date
}
/* Quality Control Configuration */
spotless {
format "misc", {
target("*.gradle", ".gitignore")
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
java {
googleJavaFormat("1.7")
trimTrailingWhitespace()
endWithNewline()
importOrder("java", "javax", "org", "com")
}
}
pmd {
// incrementalAnalysis = true
ruleSets = []
ruleSetFiles = files(".pmdrules.xml")
}
task format {
dependsOn spotlessApply
doLast { print "Formatted!" }
}
tasks.withType(JavaCompile) {
//enable compilation in a separate daemon process
options.deprecation = true
}
compileJava.finalizedBy(format)
compileJava.mustRunAfter(spotlessJavaApply)
compileJava.mustRunAfter(spotlessJavaCheck)
compileJava.mustRunAfter(spotlessJava)