Skip to content

Commit

Permalink
Replace KotlinCompilerArguments with CompilerCommonOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ting-yuan committed Oct 11, 2022
1 parent e73051e commit 45354a7
Show file tree
Hide file tree
Showing 7 changed files with 305 additions and 291 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2022 Google LLC
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")

package com.google.devtools.ksp.gradle

import org.gradle.api.model.ObjectFactory
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptionsDefault
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptionsDefault
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptionsDefault
import org.jetbrains.kotlin.gradle.utils.newInstance

// TODO: to be replaced by KotlinJvmFactory, etc.
class CompilerOptionsFactory {
companion object {
fun createCompilerJvmOptions(objectFactory: ObjectFactory): CompilerJvmOptions =
objectFactory.newInstance<CompilerJvmOptionsDefault>()

fun createCompilerJsOptions(objectFactory: ObjectFactory): CompilerJsOptions =
objectFactory.newInstance<CompilerJsOptionsDefault>()

fun createCompilerCommonOptions(objectFactory: ObjectFactory): CompilerCommonOptions =
objectFactory.newInstance<CompilerCommonOptionsDefault>()
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.Internal
import org.jetbrains.kotlin.gradle.dsl.CompilerCommonOptions
import org.jetbrains.kotlin.gradle.dsl.CompilerJsOptions
import org.jetbrains.kotlin.gradle.dsl.CompilerJvmOptions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
import org.jetbrains.kotlin.gradle.utils.newInstance
import java.io.File
Expand All @@ -49,37 +52,50 @@ interface KotlinCompilerRunner {

interface KotlinJvmCompilerRunner : KotlinCompilerRunner {
fun runJvmCompilerAsync(
args: KotlinJvmCompilerArguments,
options: CompilerJvmOptions,
freeArgs: List<String>,
sources: List<File>,
commonSources: List<File>,
outputs: List<File>
friendPaths: List<File>,
libraries: List<File>,
destination: File
)
}

interface KotlinJsCompilerRunner : KotlinCompilerRunner {
fun runJsCompilerAsync(
args: KotlinJsCompilerArguments,
options: CompilerJsOptions,
freeArgs: List<String>,
sources: List<File>,
commonSources: List<File>,
outputs: List<File>
friendPaths: List<File>,
libraries: List<File>,
destination: File
)
}

interface KotlinMetadataCompilerRunner : KotlinCompilerRunner {
fun runMetadataCompilerAsync(
args: KotlinMetadataCompilerArguments,
options: CompilerCommonOptions,
freeArgs: List<String>,
sources: List<File>,
commonSources: List<File>,
outputs: List<File>
friendPaths: List<File>,
libraries: List<File>,
destination: File
)
}

interface KotlinNativeCompilerRunner : KotlinCompilerRunner {
fun runNativeCompilerAsync(
args: KotlinNativeCompilerArguments,
options: CompilerCommonOptions,
freeArgs: List<String>,
sources: List<File>,
commonSources: List<File>,
outputs: List<File>,
friendPaths: List<File>,
libraries: List<File>,
destination: File,
target: String
)
}

Expand Down
Loading

0 comments on commit 45354a7

Please sign in to comment.