-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
151 lines (127 loc) · 3.47 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright (c) 2018 Gonzalo Müller Bravo.
// Licensed under the MIT License (MIT), see LICENSE.txt
plugins {
id 'checkstyle'
id 'codenarc'
id 'com.github.ksoichiro.console.reporter' version '0.6.2'
id 'com.gradle.plugin-publish' version '0.10.0'
id 'groovy'
id 'jacoco'
}
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/gmullerb/all.shared.quality'
}
maven {
url 'https://dl.bintray.com/gmullerb/all.shared.gradle'
}
}
configurations {
styleConfig
}
dependencies {
compile gradleApi()
styleConfig "all.shared.quality:base-style-config:$BASE_STYLE_CONFIG_VERSION"
testImplementation 'all.shared.gradle:spy-project-factory:+'
testImplementation 'org.junit.jupiter:junit-jupiter-api:+'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:+'
}
final PLUGIN_SITE = 'https://github.com/gmullerb/file-lister/'
apply plugin: 'all.shared.gradle.file-lister'
final allFilesInTree = fileLister.obtainPartialFileTree()
// Plugin settings
//////////////////
checkstyle {
toolVersion = CHECKSTYLE_VERSION
config = resources.text.fromArchiveEntry(configurations.styleConfig, 'common/common-checks.xml')
}
codenarc {
toolVersion = CODENARC_VERSION
config = resources.text.fromArchiveEntry(configurations.styleConfig, 'groovy/groovy-rules.groovy')
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
pluginBundle {
website = PLUGIN_SITE
vcsUrl = PLUGIN_SITE
description = 'Small set of utilities for listing files from a Gradle project'
tags = ['file', 'directory', 'folder', 'filetree', 'listing files', 'ignore files', 'filetree',
'filesystem', 'gradle project', 'gitignore', 'node_modules']
plugins {
thePlugin {
id = project.hasProperty('PLUGIN_ID')
? property('PLUGIN_ID')
: 'Set plugin id'
displayName = 'File Lister plugin'
}
}
}
// TASKS
////////
task assessCommon (type: Checkstyle) {
// Checkstyle task settings
classpath = files('dummy') // Required by Checkstyle, Not required for Checker modules
source = allFilesInTree
// gradle task settings
description = 'Run Common Checkstyle analysis for all files.'
group = GROUP_ASSESS
}
task assessGradle(type: CodeNarc) {
// CodeNarc task settings
source = allFilesInTree.filter { it.name.matches('.*\\.gradle') }
// gradle task settings
description = 'Run Codenarc analysis for all gradle files.'
group = GROUP_ASSESS
}
task assess {
group = GROUP_ASSESS
dependsOn = ['codenarcMain', 'codenarcTest']
}
// Task settings
////////////////
check {
dependsOn += ['assess']
}
test {
// Test task settings
useJUnitPlatform()
// gradle task settings
finalizedBy jacocoTestReport, jacocoTestCoverageVerification, reportCoverage
}
jacocoTestCoverageVerification {
// jacocoTestCoverageVerification task settings
doFirst {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/*_closure*')
})
}
violationRules {
rule {
element = 'BUNDLE'
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.85
}
}
rule {
element = 'BUNDLE'
limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 0.65
}
}
}
// gradle task settings
shouldRunAfter jacocoTestReport, reportCoverage
}
reportCoverage {
dependsOn jacocoTestReport
}
// Default task
///////////////
defaultTasks 'assessCommon', 'assessGradle', 'assess', 'build'