Skip to content

Commit 736cfb0

Browse files
committed
replace all usage of create with register for Gradle Tasks
1 parent fa9b188 commit 736cfb0

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

core/build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ tasks.withType<KspTask> {
112112
}
113113
}
114114

115-
val clearTestResults by tasks.creating(Delete::class) {
115+
val clearTestResults by tasks.registering(Delete::class, fun Delete.() {
116116
delete(layout.buildDirectory.dir("dataframes"))
117117
delete(layout.buildDirectory.dir("korroOutputLines"))
118-
}
118+
})
119119

120120
val samplesTest = tasks.register<Test>("samplesTest") {
121121
group = "Verification"
@@ -140,7 +140,7 @@ val samplesTest = tasks.register<Test>("samplesTest") {
140140
sourceSets["main"].runtimeClasspath
141141
}
142142

143-
val clearSamplesOutputs by tasks.creating {
143+
val clearSamplesOutputs by tasks.registering {
144144
group = "documentation"
145145

146146
doFirst {
@@ -152,11 +152,11 @@ val clearSamplesOutputs by tasks.creating {
152152
}
153153
}
154154

155-
val addSamplesToGit by tasks.creating(GitTask::class) {
155+
val addSamplesToGit by tasks.registering(GitTask::class, fun GitTask.() {
156156
directory = file(".")
157157
command = "add"
158158
args = listOf("-A", "../docs/StardustDocs/resources/snippets")
159-
}
159+
})
160160

161161
val copySamplesOutputs = tasks.register<JavaExec>("copySamplesOutputs") {
162162
group = "documentation"
@@ -167,7 +167,7 @@ val copySamplesOutputs = tasks.register<JavaExec>("copySamplesOutputs") {
167167
classpath = sourceSets.test.get().runtimeClasspath
168168

169169
doLast {
170-
addSamplesToGit.executeCommand()
170+
addSamplesToGit.get().executeCommand()
171171
}
172172
}
173173

@@ -240,7 +240,7 @@ idea {
240240
// If `changeJarTask` is run, modify all Jar tasks such that before running the Kotlin sources are set to
241241
// the target of `processKdocMain`, and they are returned to normal afterward.
242242
// This is usually only done when publishing
243-
val changeJarTask by tasks.creating {
243+
val changeJarTask by tasks.registering {
244244
outputs.upToDateWhen { project.hasProperty("skipKodex") }
245245
doFirst {
246246
tasks.withType<Jar> {

dataframe-csv/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ tasks.named("runKtlintCheckOverGeneratedSourcesSourceSet") {
106106
// If `changeJarTask` is run, modify all Jar tasks such that before running the Kotlin sources are set to
107107
// the target of `processKdocMain`, and they are returned to normal afterward.
108108
// This is usually only done when publishing
109-
val changeJarTask by tasks.creating {
109+
val changeJarTask by tasks.registering {
110110
outputs.upToDateWhen { false }
111111
doFirst {
112112
tasks.withType<Jar> {

plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/SchemaGeneratorPlugin.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package org.jetbrains.dataframe.gradle
33
import com.google.devtools.ksp.gradle.KspTaskJvm
44
import org.gradle.api.Plugin
55
import org.gradle.api.Project
6-
import org.gradle.api.Task
76
import org.gradle.api.file.FileCollection
87
import org.gradle.api.logging.LogLevel
8+
import org.gradle.api.tasks.TaskProvider
99
import org.gradle.internal.logging.services.DefaultLoggingManager
1010
import org.gradle.kotlin.dsl.create
1111
import org.gradle.kotlin.dsl.withType
@@ -37,9 +37,9 @@ class SchemaGeneratorPlugin : Plugin<Project> {
3737
}
3838

3939
val generationTasks = extension.schemas.map {
40-
createTask(target, extension, appliedPlugin, it)
40+
registerTask(target, extension, appliedPlugin, it)
4141
}
42-
val generateAll = target.tasks.create("generateDataFrames") {
42+
val generateAll = target.tasks.register("generateDataFrames") {
4343
group = GROUP
4444
dependsOn(*generationTasks.toTypedArray())
4545
}
@@ -52,12 +52,12 @@ class SchemaGeneratorPlugin : Plugin<Project> {
5252
}
5353
}
5454

55-
private fun createTask(
55+
private fun registerTask(
5656
target: Project,
5757
extension: SchemaGeneratorExtension,
5858
appliedPlugin: AppliedPlugin?,
5959
schema: Schema,
60-
): Task {
60+
): TaskProvider<GenerateDataSchemaTask> {
6161
val interfaceName = getInterfaceName(schema)
6262

6363
fun propertyError(property: String): Nothing {
@@ -124,7 +124,7 @@ class SchemaGeneratorPlugin : Plugin<Project> {
124124
val defaultPath = schema.defaultPath ?: extension.defaultPath ?: true
125125
val delimiters = schema.withNormalizationBy ?: extension.withNormalizationBy ?: setOf('\t', ' ', '_')
126126

127-
return target.tasks.create("generateDataFrame$interfaceName", GenerateDataSchemaTask::class.java) {
127+
return target.tasks.register("generateDataFrame$interfaceName", GenerateDataSchemaTask::class.java) {
128128
(logging as? DefaultLoggingManager)?.setLevelInternal(LogLevel.QUIET)
129129
group = GROUP
130130
data.set(schema.data)

plugins/expressions-converter/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sourceSets {
5858
}
5959
}
6060

61-
tasks.create<JavaExec>("generateTests") {
61+
tasks.register<JavaExec>("generateTests") {
6262
classpath = sourceSets.test.get().runtimeClasspath
6363
mainClass = "org.jetbrains.kotlinx.dataframe.GenerateTestsKt"
6464
}

plugins/kotlin-dataframe/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ tasks.compileTestKotlin {
9898
}
9999
}
100100

101-
tasks.create<JavaExec>("generateTests") {
101+
tasks.register<JavaExec>("generateTests") {
102102
classpath = sourceSets.test.get().runtimeClasspath
103103
mainClass = "org.jetbrains.kotlin.fir.dataframe.GenerateTestsKt"
104104
}

0 commit comments

Comments
 (0)