Skip to content

Commit ec15e3e

Browse files
committed
Attempt to fix things
1 parent 6f2d97d commit ec15e3e

File tree

6 files changed

+139
-193
lines changed

6 files changed

+139
-193
lines changed

gradle-plugin/lint-baseline.xml

Lines changed: 8 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
errorLine2=" ~~~">
99
<location
1010
file="src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt"
11-
line="82"
11+
line="84"
1212
column="58"/>
1313
</issue>
1414

@@ -19,7 +19,7 @@
1919
errorLine2=" ~~~">
2020
<location
2121
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
22-
line="201"
22+
line="223"
2323
column="59"/>
2424
</issue>
2525

@@ -30,7 +30,7 @@
3030
errorLine2=" ~~~">
3131
<location
3232
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
33-
line="323"
33+
line="345"
3434
column="68"/>
3535
</issue>
3636

@@ -52,29 +52,18 @@
5252
errorLine2=" ~~~">
5353
<location
5454
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt"
55-
line="350"
55+
line="361"
5656
column="63"/>
5757
</issue>
5858

59-
<issue
60-
id="EagerGradleConfiguration"
61-
message="Avoid using method get"
62-
errorLine1=" kotlinCompileProvider.get().libraries.filter {"
63-
errorLine2=" ~~~">
64-
<location
65-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt"
66-
line="390"
67-
column="51"/>
68-
</issue>
69-
7059
<issue
7160
id="EagerGradleConfiguration"
7261
message="Avoid using method get"
7362
errorLine1=" val kotlinCompileTask = kotlinCompileProvider.get() as KotlinCompile"
7463
errorLine2=" ~~~">
7564
<location
7665
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt"
77-
line="477"
66+
line="496"
7867
column="75"/>
7968
</issue>
8069

@@ -85,29 +74,18 @@
8574
errorLine2=" ~~~">
8675
<location
8776
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt"
88-
line="554"
77+
line="573"
8978
column="75"/>
9079
</issue>
9180

92-
<issue
93-
id="FilePropertyDetector"
94-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
95-
errorLine1=" abstract val destination: Property&lt;File>"
96-
errorLine2=" ~~~~~~~~~~~">
97-
<location
98-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KotlinFactories.kt"
99-
line="202"
100-
column="18"/>
101-
</issue>
102-
10381
<issue
10482
id="FilePropertyDetector"
10583
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
10684
errorLine1=" abstract val jdkHome: Property&lt;File>"
10785
errorLine2=" ~~~~~~~">
10886
<location
10987
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
110-
line="374"
88+
line="397"
11189
column="18"/>
11290
</issue>
11391

@@ -118,85 +96,8 @@
11896
errorLine2=" ~~~~~~~~~~~~~~">
11997
<location
12098
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
121-
line="381"
99+
line="404"
122100
column="18"/>
123101
</issue>
124102

125-
<issue
126-
id="FilePropertyDetector"
127-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
128-
errorLine1=" abstract val outputBaseDir: Property&lt;File>"
129-
errorLine2=" ~~~~~~~~~~~~~">
130-
<location
131-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
132-
line="384"
133-
column="18"/>
134-
</issue>
135-
136-
<issue
137-
id="FilePropertyDetector"
138-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
139-
errorLine1=" abstract val kotlinOutputDir: Property&lt;File>"
140-
errorLine2=" ~~~~~~~~~~~~~~~">
141-
<location
142-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
143-
line="390"
144-
column="18"/>
145-
</issue>
146-
147-
<issue
148-
id="FilePropertyDetector"
149-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
150-
errorLine1=" abstract val javaOutputDir: Property&lt;File>"
151-
errorLine2=" ~~~~~~~~~~~~~">
152-
<location
153-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
154-
line="393"
155-
column="18"/>
156-
</issue>
157-
158-
<issue
159-
id="FilePropertyDetector"
160-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
161-
errorLine1=" abstract val classOutputDir: Property&lt;File>"
162-
errorLine2=" ~~~~~~~~~~~~~~">
163-
<location
164-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
165-
line="396"
166-
column="18"/>
167-
</issue>
168-
169-
<issue
170-
id="FilePropertyDetector"
171-
message="`Property&lt;File>` is discouraged. Use `RegularFileProperty` or `DirectoryProperty`."
172-
errorLine1=" abstract val resourceOutputDir: Property&lt;File>"
173-
errorLine2=" ~~~~~~~~~~~~~~~~~">
174-
<location
175-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
176-
line="399"
177-
column="18"/>
178-
</issue>
179-
180-
<issue
181-
id="GradleProjectIsolation"
182-
message="Use providers.gradleProperty instead of findProperty"
183-
errorLine1=" project.findProperty(&quot;kotlin.native.enableKlibsCrossCompilation&quot;) == &quot;true&quot;"
184-
errorLine2=" ~~~~~~~~~~~~">
185-
<location
186-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt"
187-
line="326"
188-
column="37"/>
189-
</issue>
190-
191-
<issue
192-
id="WithTypeWithoutConfigureEach"
193-
message="Avoid passing a closure to withType, use withType().configureEach instead"
194-
errorLine1=" project.plugins.withType(KotlinBaseApiPlugin::class.java) {"
195-
errorLine2=" ~~~~~~~~">
196-
<location
197-
file="src/main/kotlin/com/google/devtools/ksp/gradle/KspConfigurations.kt"
198-
line="99"
199-
column="25"/>
200-
</issue>
201-
202103
</issues>

gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import com.android.build.gradle.BaseExtension
2222
import com.android.build.gradle.api.SourceKind
2323
import org.gradle.api.Project
2424
import org.gradle.api.Task
25+
import org.gradle.api.file.Directory
2526
import org.gradle.api.file.FileCollection
27+
import org.gradle.api.provider.Provider
2628
import org.gradle.api.tasks.TaskProvider
2729
import org.jetbrains.kotlin.gradle.internal.KaptTask
2830
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmAndroidCompilation
@@ -114,9 +116,9 @@ object AndroidPluginIntegration {
114116
project: Project,
115117
kotlinCompilation: KotlinJvmAndroidCompilation,
116118
kspTaskProvider: TaskProvider<*>,
117-
javaOutputDir: File,
118-
kotlinOutputDir: File,
119-
classOutputDir: File,
119+
javaOutputDir: Provider<Directory>,
120+
kotlinOutputDir: Provider<Directory>,
121+
classOutputDir: Provider<Directory>,
120122
resourcesOutputDir: FileCollection,
121123
) {
122124
val kspJavaOutput = project.fileTree(javaOutputDir).builtBy(kspTaskProvider)
@@ -135,9 +137,9 @@ object AndroidPluginIntegration {
135137
project: Project,
136138
kotlinCompilation: KotlinJvmAndroidCompilation,
137139
kspTaskProvider: TaskProvider<*>,
138-
javaOutputDir: File,
139-
kotlinOutputDir: File,
140-
classOutputDir: File,
140+
javaOutputDir: Provider<Directory>,
141+
kotlinOutputDir: Provider<Directory>,
142+
classOutputDir: Provider<Directory>,
141143
resourcesOutputDir: FileCollection
142144
) {
143145
// Order is important here as we update task with AGP generated sources and

gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KotlinFactories.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package com.google.devtools.ksp.gradle
2121
import org.gradle.api.Project
2222
import org.gradle.api.Task
2323
import org.gradle.api.file.ConfigurableFileCollection
24+
import org.gradle.api.file.DirectoryProperty
2425
import org.gradle.api.file.FileCollection
2526
import org.gradle.api.model.ObjectFactory
2627
import org.gradle.api.provider.ListProperty
@@ -199,7 +200,7 @@ abstract class KspTaskJvm @Inject constructor(
199200
),
200201
KspTask {
201202
@get:OutputDirectory
202-
abstract val destination: Property<File>
203+
abstract val destination: DirectoryProperty
203204

204205
@get:PathSensitive(PathSensitivity.NONE)
205206
@get:Incremental
@@ -241,7 +242,8 @@ abstract class KspTaskJvm @Inject constructor(
241242
@get:IgnoreEmptyDirectories
242243
@get:PathSensitive(PathSensitivity.RELATIVE)
243244
override val javaSources: FileCollection = super.javaSources.filter {
244-
!destination.get().isParentOf(it)
245+
// TODO: This is eager realization of destination directory
246+
!destination.get().asFile.isParentOf(it)
245247
}
246248
}
247249

0 commit comments

Comments
 (0)