-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProjectStyleCheckerPlugin.groovy
32 lines (27 loc) · 1.04 KB
/
ProjectStyleCheckerPlugin.groovy
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
// Copyright (c) 2018 Gonzalo Müller Bravo.
// Licensed under the MIT License (MIT), see LICENSE.txt
package all.shared.gradle.quality.code
import groovy.transform.CompileStatic
import org.gradle.api.Plugin
import org.gradle.api.Project
@CompileStatic
class ProjectStyleCheckerPlugin implements Plugin<Project> {
public static final String EXTENSION_NAME = 'projectStyleChecker'
static final boolean complement(final ProjectStyleChecker projectStyleChecker) {
final ProjectStyleCheckerExtension config = projectStyleChecker.addExtension(EXTENSION_NAME)
if (config != null) {
projectStyleChecker.project.logger.debug('Added project-style-check extension')
projectStyleChecker.addRequiredPlugins()
projectStyleChecker.fillAllExtensions(config)
projectStyleChecker.addTasks(config)
true
}
else {
projectStyleChecker.project.logger.error('Couldn\'t add project-style-check extension')
false
}
}
void apply(final Project project) {
complement(new ProjectStyleChecker(project))
}
}