14
14
package com.github.spotbugs.snom
15
15
16
16
import groovy.lang.Closure
17
- import org.gradle.api.Action;
17
+ import org.gradle.api.Action
18
18
import org.gradle.api.file.RegularFileProperty
19
19
import org.gradle.api.model.ObjectFactory
20
20
import org.gradle.api.provider.Property
@@ -28,103 +28,105 @@ import org.gradle.api.tasks.Internal
28
28
import java.io.File
29
29
import javax.inject.Inject
30
30
31
- abstract class SpotBugsReport @Inject constructor(
32
- objects : ObjectFactory ,
33
- @get:Internal
34
- protected val task : SpotBugsTask ,
35
- ) :
31
+ abstract class SpotBugsReport
32
+ @Inject
33
+ constructor (
34
+ objects: ObjectFactory ,
35
+ @get:Internal
36
+ protected val task: SpotBugsTask ,
37
+ ) :
36
38
SingleFileReport , CustomizableHtmlReport { // to expose CustomizableHtmlReport#setStylesheet to build script
37
- private val destination: RegularFileProperty
38
- private val isRequired: Property <Boolean >
39
+ private val destination: RegularFileProperty
40
+ private val isRequired: Property <Boolean >
39
41
40
- init {
41
- destination = objects.fileProperty()
42
- isRequired = objects.property(Boolean ::class .java).convention(true )
43
- }
44
-
45
- abstract fun toCommandLineOption (): String
42
+ init {
43
+ destination = objects.fileProperty()
44
+ isRequired = objects.property(Boolean ::class .java).convention(true )
45
+ }
46
46
47
- @Internal
48
- @Deprecated(" use {@link #getOutputLocation()} instead." )
49
- fun getDestination (): File {
50
- return destination.get().asFile
51
- }
47
+ abstract fun toCommandLineOption (): String
52
48
53
- override fun getOutputLocation (): RegularFileProperty {
54
- return destination
55
- }
49
+ @Internal
50
+ @Deprecated(" use {@link #getOutputLocation()} instead." )
51
+ fun getDestination (): File {
52
+ return destination.get().asFile
53
+ }
56
54
57
- @Internal(" This property returns always same value" )
58
- override fun getOutputType (): Report .OutputType {
59
- return Report .OutputType .FILE
60
- }
55
+ override fun getOutputLocation (): RegularFileProperty {
56
+ return destination
57
+ }
61
58
62
- @Input
63
- override fun getRequired (): Property < Boolean > {
64
- return isRequired
65
- }
59
+ @Internal( " This property returns always same value " )
60
+ override fun getOutputType (): Report . OutputType {
61
+ return Report . OutputType . FILE
62
+ }
66
63
67
- @get:Deprecated(" use {@link #getRequired()} instead." )
68
- @get:Internal
69
- @set:Deprecated(" use {@code getRequired().set(value)} instead." )
70
- var isEnabled: Boolean
71
- get() = isRequired.get()
72
- set(b) {
73
- isRequired.set(b)
64
+ @Input
65
+ override fun getRequired (): Property <Boolean > {
66
+ return isRequired
74
67
}
75
68
76
- @Deprecated(" use {@code getRequired().set(provider)} instead." )
77
- fun setEnabled (provider : Provider <Boolean >) {
78
- isRequired.set(provider)
79
- }
69
+ @get:Deprecated(" use {@link #getRequired()} instead." )
70
+ @get:Internal
71
+ @set:Deprecated(" use {@code getRequired().set(value)} instead." )
72
+ var isEnabled: Boolean
73
+ get() = isRequired.get()
74
+ set(b) {
75
+ isRequired.set(b)
76
+ }
77
+
78
+ @Deprecated(" use {@code getRequired().set(provider)} instead." )
79
+ fun setEnabled (provider : Provider <Boolean >) {
80
+ isRequired.set(provider)
81
+ }
80
82
81
- @Deprecated(" use {@code getOutputLocation().set(file)} instead." )
82
- override fun setDestination (file : File ) {
83
- destination.set(file)
84
- }
83
+ @Deprecated(" use {@code getOutputLocation().set(file)} instead." )
84
+ override fun setDestination (file : File ) {
85
+ destination.set(file)
86
+ }
85
87
86
- @Deprecated(" use {@code getOutputLocation().set(provider)} instead." )
87
- fun setDestination (provider : Provider <File ?>) {
88
- destination.set(task.project.layout.file(provider))
89
- }
88
+ @Deprecated(" use {@code getOutputLocation().set(provider)} instead." )
89
+ fun setDestination (provider : Provider <File ?>) {
90
+ destination.set(task.project.layout.file(provider))
91
+ }
90
92
91
- override fun configure (closure : Closure <in Report >): Report {
92
- return configure { report ->
93
- closure.delegate = report;
94
- closure.call(report);
95
- };
96
- }
93
+ override fun configure (closure : Closure <in Report >): Report {
94
+ return configure { report ->
95
+ closure.delegate = report
96
+ closure.call(report)
97
+ }
98
+ }
97
99
98
- fun configure (action : Action <in Report >): Report {
99
- action.execute(this );
100
- return this ;
101
- }
100
+ fun configure (action : Action <in Report >): Report {
101
+ action.execute(this )
102
+ return this
103
+ }
102
104
103
- @Internal(" This property provides only a human readable name." )
104
- override fun getDisplayName (): String {
105
- return String .format(" %s type report generated by the task %s" , name, task.path)
106
- }
105
+ @Internal(" This property provides only a human readable name." )
106
+ override fun getDisplayName (): String {
107
+ return String .format(" %s type report generated by the task %s" , name, task.path)
108
+ }
107
109
108
- // TODO adding an @Input triggers 'cannot be serialized' exception
109
- override fun getStylesheet (): TextResource ? {
110
- return null
111
- }
110
+ // TODO adding an @Input triggers 'cannot be serialized' exception
111
+ override fun getStylesheet (): TextResource ? {
112
+ return null
113
+ }
112
114
113
- override fun setStylesheet (textResource : TextResource ? ) {
114
- throw UnsupportedOperationException (
115
- String .format(
116
- " stylesheet property is not available in the %s type report" ,
117
- name,
118
- ),
119
- )
120
- }
115
+ override fun setStylesheet (textResource : TextResource ? ) {
116
+ throw UnsupportedOperationException (
117
+ String .format(
118
+ " stylesheet property is not available in the %s type report" ,
119
+ name,
120
+ ),
121
+ )
122
+ }
121
123
122
- open fun setStylesheet (path : String? ) {
123
- throw UnsupportedOperationException (
124
- String .format(
125
- " stylesheet property is not available in the %s type report" ,
126
- name,
127
- ),
128
- )
124
+ open fun setStylesheet (path : String? ) {
125
+ throw UnsupportedOperationException (
126
+ String .format(
127
+ " stylesheet property is not available in the %s type report" ,
128
+ name,
129
+ ),
130
+ )
131
+ }
129
132
}
130
- }
0 commit comments