Skip to content

Commit e959ad9

Browse files
committed
Replace KotlinCompilerArguments with CompilerCommonOptions
1 parent e73051e commit e959ad9

File tree

7 files changed

+309
-281
lines changed

7 files changed

+309
-281
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
19+
20+
package com.google.devtools.ksp.gradle
21+
22+
import org.gradle.api.model.ObjectFactory
23+
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions
24+
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault
25+
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions
26+
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptionsDefault
27+
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions
28+
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptionsDefault
29+
import org.jetbrains.kotlin.gradle.utils.newInstance
30+
31+
// TODO: to be replaced by KotlinJvmFactory, etc.
32+
class CompilerOptionsFactory {
33+
companion object {
34+
fun createCompilerJvmOptions(objectFactory: ObjectFactory): CompilerJvmOptions =
35+
objectFactory.newInstance<CompilerJvmOptionsDefault>()
36+
37+
fun createCompilerJsOptions(objectFactory: ObjectFactory): CompilerJsOptions =
38+
objectFactory.newInstance<CompilerJsOptionsDefault>()
39+
40+
fun createCompilerCommonOptions(objectFactory: ObjectFactory): CompilerCommonOptions =
41+
objectFactory.newInstance<CompilerCommonOptionsDefault>()
42+
}
43+
}

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

Lines changed: 0 additions & 93 deletions
This file was deleted.

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

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import org.gradle.api.provider.ListProperty
2626
import org.gradle.api.provider.Property
2727
import org.gradle.api.tasks.Classpath
2828
import org.gradle.api.tasks.Internal
29+
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions
30+
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions
31+
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions
2932
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
3033
import org.jetbrains.kotlin.gradle.utils.newInstance
3134
import java.io.File
@@ -49,37 +52,54 @@ interface KotlinCompilerRunner {
4952

5053
interface KotlinJvmCompilerRunner : KotlinCompilerRunner {
5154
fun runJvmCompilerAsync(
52-
args: KotlinJvmCompilerArguments,
55+
options: CompilerJvmOptions,
56+
freeArgs: List<String>,
5357
sources: List<File>,
5458
commonSources: List<File>,
55-
outputs: List<File>
59+
friendPaths: List<File>,
60+
libraries: List<File>,
61+
outputs: List<File>,
62+
destination: File
5663
)
5764
}
5865

5966
interface KotlinJsCompilerRunner : KotlinCompilerRunner {
6067
fun runJsCompilerAsync(
61-
args: KotlinJsCompilerArguments,
68+
options: CompilerJsOptions,
69+
freeArgs: List<String>,
6270
sources: List<File>,
6371
commonSources: List<File>,
64-
outputs: List<File>
72+
friendPaths: List<File>,
73+
libraries: List<File>,
74+
outputs: List<File>,
75+
destination: File
6576
)
6677
}
6778

6879
interface KotlinMetadataCompilerRunner : KotlinCompilerRunner {
6980
fun runMetadataCompilerAsync(
70-
args: KotlinMetadataCompilerArguments,
81+
options: CompilerCommonOptions,
82+
freeArgs: List<String>,
7183
sources: List<File>,
7284
commonSources: List<File>,
73-
outputs: List<File>
85+
friendPaths: List<File>,
86+
libraries: List<File>,
87+
outputs: List<File>,
88+
destination: File
7489
)
7590
}
7691

7792
interface KotlinNativeCompilerRunner : KotlinCompilerRunner {
7893
fun runNativeCompilerAsync(
79-
args: KotlinNativeCompilerArguments,
94+
options: CompilerCommonOptions,
95+
freeArgs: List<String>,
8096
sources: List<File>,
8197
commonSources: List<File>,
98+
friendPaths: List<File>,
99+
libraries: List<File>,
82100
outputs: List<File>,
101+
destination: File,
102+
target: String
83103
)
84104
}
85105

0 commit comments

Comments
 (0)