File tree Expand file tree Collapse file tree 3 files changed +20
-24
lines changed
src/main/java/org/hypertrace/gradle/code/style Expand file tree Collapse file tree 3 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ plugins {
4
4
`java- gradle- plugin`
5
5
id(" org.hypertrace.repository-plugin" ) version " 0.4.0"
6
6
id(" org.hypertrace.ci-utils-plugin" ) version " 0.3.0"
7
+ id(" org.hypertrace.code-style-plugin" ) version " latest.release"
7
8
id(" org.hypertrace.publish-plugin" ) version " 1.0.4"
8
9
id(" org.owasp.dependencycheck" ) version " 8.4.0"
9
- id(" com.diffplug.spotless" ) version " 7.0.0"
10
10
}
11
11
12
12
group = " org.hypertrace.gradle.code.style"
@@ -40,14 +40,3 @@ dependencyCheck {
40
40
scanConfigurations.add(" runtimeClasspath" )
41
41
failBuildOnCVSS = 3.0F
42
42
}
43
-
44
- spotless {
45
- java {
46
- importOrder()
47
- removeUnusedImports()
48
- googleJavaFormat(" 1.17.0" )
49
- }
50
- kotlin {
51
- ktlint()
52
- }
53
- }
Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ plugins {
12
12
id(" org.hypertrace.version-settings" ) version " 0.2.0"
13
13
}
14
14
15
- rootProject.name = " hypertrace-gradle-code-style-plugin"
15
+ rootProject.name = " hypertrace-gradle-code-style-plugin"
Original file line number Diff line number Diff line change 12
12
import org .gradle .api .Plugin ;
13
13
import org .gradle .api .Project ;
14
14
import org .gradle .api .plugins .PluginContainer ;
15
+ import org .gradle .api .provider .Provider ;
15
16
16
17
public class CodeStylePlugin implements Plugin <Project > {
17
18
@@ -49,18 +50,24 @@ private void configureFormatting(Project project) {
49
50
});
50
51
51
52
BufExtension bufExtension = project .getExtensions ().getByType (BufExtension .class );
53
+ Provider <File > bufBinaryProvider =
54
+ project .provider (
55
+ () -> {
56
+ File binary =
57
+ project
58
+ .getConfigurations ()
59
+ .getByName (BufSupportKt .BUF_BINARY_CONFIGURATION_NAME )
60
+ .getSingleFile ();
61
+ if (!binary .canExecute ()) {
62
+ binary .setExecutable (true );
63
+ }
64
+ return binary ;
65
+ });
52
66
spotlessExtension .protobuf (
53
- format -> {
54
- File bufBinary =
55
- project
56
- .getConfigurations ()
57
- .getByName (BufSupportKt .BUF_BINARY_CONFIGURATION_NAME )
58
- .getSingleFile ();
59
- if (!bufBinary .canExecute ()) {
60
- bufBinary .setExecutable (true );
61
- }
62
- format .buf (bufExtension .getToolVersion ()).pathToExe (bufBinary .getAbsolutePath ());
63
- });
67
+ format ->
68
+ format
69
+ .buf (bufExtension .getToolVersion ())
70
+ .pathToExe (bufBinaryProvider .get ().getAbsolutePath ()));
64
71
bufExtension .setEnforceFormat (false );
65
72
66
73
spotlessExtension .format (
You can’t perform that action at this time.
0 commit comments