/
IncubatingApiReportTask.kt
57 lines (46 loc) · 1.9 KB
/
IncubatingApiReportTask.kt
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
package gradlebuild.incubation.tasks
import gradlebuild.incubation.action.IncubatingApiReportWorkAction
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
// Using star import to workaround https://youtrack.jetbrains.com/issue/KTIJ-24390
import org.gradle.kotlin.dsl.*
import org.gradle.workers.WorkerExecutor
import javax.inject.Inject
@CacheableTask
abstract class IncubatingApiReportTask : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val versionFile: RegularFileProperty
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val releasedVersionsFile: RegularFileProperty
@get:Input
abstract val title: Property<String>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val sources: ConfigurableFileCollection
@get:OutputFile
abstract val htmlReportFile: RegularFileProperty
@get:OutputFile
abstract val textReportFile: RegularFileProperty
@get:Inject
abstract val workerExecutor: WorkerExecutor
@TaskAction
fun analyze() = workerExecutor.noIsolation().submit(IncubatingApiReportWorkAction::class) {
srcDirs.from(this@IncubatingApiReportTask.sources)
htmlReportFile = this@IncubatingApiReportTask.htmlReportFile
textReportFile = this@IncubatingApiReportTask.textReportFile
title = this@IncubatingApiReportTask.title
releasedVersionsFile = this@IncubatingApiReportTask.releasedVersionsFile
}
}