Refactoring: specify internal visibility where possible
This commit is contained in:
@@ -34,14 +34,13 @@ interface AdditionalGradleProperties {
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val dslSrcDir = File("libraries/tools/kotlin-gradle-plugin-dsl/src/main/kotlin")
|
||||
val dslImplDir = File("libraries/tools/kotlin-gradle-plugin-core/src/main/kotlin")
|
||||
val srcDir = File("libraries/tools/kotlin-gradle-plugin/src/main/kotlin")
|
||||
val additionalGradleOptions = gradleOptions<AdditionalGradleProperties>()
|
||||
|
||||
// generate jvm interface
|
||||
val jvmInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions")
|
||||
val optionsFromK2JVMCompilerArguments = gradleOptions<K2JVMCompilerArguments>()
|
||||
File(dslSrcDir, jvmInterfaceFqName).usePrinter {
|
||||
File(srcDir, jvmInterfaceFqName).usePrinter {
|
||||
generateInterface(jvmInterfaceFqName,
|
||||
optionsFromK2JVMCompilerArguments + additionalGradleOptions)
|
||||
}
|
||||
@@ -49,7 +48,7 @@ fun main(args: Array<String>) {
|
||||
// generate jvm impl
|
||||
val k2JvmCompilerArgumentsFqName = FqName(K2JVMCompilerArguments::class.qualifiedName!!)
|
||||
val jvmImplFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsBase")
|
||||
File(dslImplDir, jvmImplFqName).usePrinter {
|
||||
File(srcDir, jvmImplFqName).usePrinter {
|
||||
generateImpl(jvmImplFqName,
|
||||
jvmInterfaceFqName,
|
||||
k2JvmCompilerArgumentsFqName,
|
||||
@@ -59,7 +58,7 @@ fun main(args: Array<String>) {
|
||||
// generate js interface
|
||||
val jsInterfaceFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions")
|
||||
val optionsFromK2JSCompilerArguments = gradleOptions<K2JSCompilerArguments>()
|
||||
File(dslSrcDir, jsInterfaceFqName).usePrinter {
|
||||
File(srcDir, jsInterfaceFqName).usePrinter {
|
||||
generateInterface(jsInterfaceFqName,
|
||||
optionsFromK2JSCompilerArguments +
|
||||
additionalGradleOptions)
|
||||
@@ -67,7 +66,7 @@ fun main(args: Array<String>) {
|
||||
|
||||
val k2JsCompilerArgumentsFqName = FqName(K2JSCompilerArguments::class.qualifiedName!!)
|
||||
val jsImplFqName = FqName("org.jetbrains.kotlin.gradle.dsl.KotlinJsOptionsBase")
|
||||
File(dslImplDir, jsImplFqName).usePrinter {
|
||||
File(srcDir, jsImplFqName).usePrinter {
|
||||
generateImpl(jsImplFqName,
|
||||
jsInterfaceFqName,
|
||||
k2JsCompilerArgumentsFqName,
|
||||
@@ -110,7 +109,7 @@ private fun Printer.generateImpl(
|
||||
argsType: FqName,
|
||||
properties: List<KProperty1<*, *>>
|
||||
) {
|
||||
generateDeclaration("abstract class", type, afterType = ": $parentType") {
|
||||
generateDeclaration("internal abstract class", type, afterType = ": $parentType") {
|
||||
fun KProperty1<*, *>.backingField(): String = "${this.name}Field"
|
||||
|
||||
for (property in properties) {
|
||||
@@ -137,7 +136,7 @@ private fun Printer.generateImpl(
|
||||
}
|
||||
|
||||
println()
|
||||
println("fun $argsType.fillDefaultValues() {")
|
||||
println("internal fun $argsType.fillDefaultValues() {")
|
||||
withIndent {
|
||||
for (property in properties) {
|
||||
println("${property.name} = ${property.gradleDefaultValue}")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import java.util.*
|
||||
* 2.1 remove classes corresponding to dirty source files
|
||||
* 2.2 add annotations from newly generated annotations file
|
||||
*/
|
||||
class AnnotationFileUpdater(private val generatedAnnotationFile: File) {
|
||||
internal class AnnotationFileUpdater(private val generatedAnnotationFile: File) {
|
||||
private val logger = Logging.getLogger(this.javaClass)
|
||||
private val lastSuccessfullyUpdatedFile = File.createTempFile("kapt-annotations-copy", "tmp")
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import org.jetbrains.kotlin.incremental.components.SourceRetentionAnnotationHand
|
||||
import java.io.*
|
||||
import java.util.*
|
||||
|
||||
class SourceAnnotationsRegistry(private val file: File) : SourceRetentionAnnotationHandler {
|
||||
internal class SourceAnnotationsRegistry(private val file: File) : SourceRetentionAnnotationHandler {
|
||||
private val mutableAnnotations: MutableSet<String> by lazy { readAnnotations() }
|
||||
val annotations: Set<String>
|
||||
get() = mutableAnnotations
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import org.jetbrains.org.objectweb.asm.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class AnnotationsRemover(annotations: Iterable<String>) {
|
||||
internal class AnnotationsRemover(annotations: Iterable<String>) {
|
||||
private val annotations = annotations.mapTo(HashSet()) { "L$it;" }
|
||||
|
||||
fun transformClassFile(inputFile: File, outputFile: File) {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions {
|
||||
internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions {
|
||||
|
||||
private var kjsmField: kotlin.Boolean? = null
|
||||
override var kjsm: kotlin.Boolean
|
||||
@@ -74,7 +74,7 @@ abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJsOpt
|
||||
}
|
||||
}
|
||||
|
||||
fun org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.fillDefaultValues() {
|
||||
internal fun org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.fillDefaultValues() {
|
||||
kjsm = true
|
||||
languageVersion = "1.0"
|
||||
main = "noCall"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package org.jetbrains.kotlin.gradle.dsl
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
|
||||
class KotlinJsOptionsImpl() : KotlinJsOptionsBase() {
|
||||
internal class KotlinJsOptionsImpl() : KotlinJsOptionsBase() {
|
||||
override var freeCompilerArgs: List<String> = listOf()
|
||||
|
||||
override fun updateArguments(args: K2JSCompilerArguments) {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions {
|
||||
internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions {
|
||||
|
||||
private var includeRuntimeField: kotlin.Boolean? = null
|
||||
override var includeRuntime: kotlin.Boolean
|
||||
@@ -62,7 +62,7 @@ abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.KotlinJvmO
|
||||
}
|
||||
}
|
||||
|
||||
fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fillDefaultValues() {
|
||||
internal fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fillDefaultValues() {
|
||||
includeRuntime = false
|
||||
jdkHome = null
|
||||
jvmTarget = "1.6"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package org.jetbrains.kotlin.gradle.dsl
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
|
||||
open class KotlinJvmOptionsImpl : KotlinJvmOptionsBase() {
|
||||
internal class KotlinJvmOptionsImpl : KotlinJvmOptionsBase() {
|
||||
override var freeCompilerArgs: List<String> = listOf()
|
||||
|
||||
override fun updateArguments(args: K2JVMCompilerArguments) {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
fun Project.initKapt(
|
||||
internal fun Project.initKapt(
|
||||
kotlinTask: KotlinCompile,
|
||||
javaTask: AbstractCompile,
|
||||
kaptManager: AnnotationProcessingManager,
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ private fun comparableVersionStr(version: String) =
|
||||
?.let { if (it.all { (it?.value?.length ?: 0).let { it > 0 && it < 4 }}) it else null }
|
||||
?.joinToString(".", transform = { it!!.value.padStart(3, '0') })
|
||||
|
||||
class KotlinGradleBuildServices private constructor(gradle: Gradle): BuildAdapter() {
|
||||
internal class KotlinGradleBuildServices private constructor(gradle: Gradle): BuildAdapter() {
|
||||
companion object {
|
||||
private val CLASS_NAME = KotlinGradleBuildServices::class.java.simpleName
|
||||
const val FORCE_SYSTEM_GC_MESSAGE = "Forcing System.gc()"
|
||||
@@ -133,7 +133,7 @@ class KotlinGradleBuildServices private constructor(gradle: Gradle): BuildAdapte
|
||||
}
|
||||
|
||||
|
||||
class CompilerServicesCleanup() {
|
||||
internal class CompilerServicesCleanup() {
|
||||
private val log = Logging.getLogger(this.javaClass)
|
||||
|
||||
operator fun invoke(gradleVersion: String) {
|
||||
|
||||
+13
-10
@@ -38,7 +38,7 @@ val KOTLIN_DSL_NAME = "kotlin"
|
||||
val KOTLIN_JS_DSL_NAME = "kotlin2js"
|
||||
val KOTLIN_OPTIONS_DSL_NAME = "kotlinOptions"
|
||||
|
||||
abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
||||
internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
||||
val project: Project,
|
||||
val javaBasePlugin: JavaBasePlugin,
|
||||
val sourceSet: SourceSet,
|
||||
@@ -91,7 +91,7 @@ abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
||||
protected abstract fun doCreateTask(project: Project, taskName: String): T
|
||||
}
|
||||
|
||||
class Kotlin2JvmSourceSetProcessor(
|
||||
internal class Kotlin2JvmSourceSetProcessor(
|
||||
project: Project,
|
||||
javaBasePlugin: JavaBasePlugin,
|
||||
sourceSet: SourceSet,
|
||||
@@ -166,7 +166,7 @@ class Kotlin2JvmSourceSetProcessor(
|
||||
}
|
||||
}
|
||||
|
||||
class Kotlin2JsSourceSetProcessor(
|
||||
internal class Kotlin2JsSourceSetProcessor(
|
||||
project: Project,
|
||||
javaBasePlugin: JavaBasePlugin,
|
||||
sourceSet: SourceSet,
|
||||
@@ -207,8 +207,12 @@ class Kotlin2JsSourceSetProcessor(
|
||||
}
|
||||
|
||||
|
||||
abstract class AbstractKotlinPlugin(val tasksProvider: KotlinTasksProvider, val kotlinSourceSetProvider: KotlinSourceSetProvider, val kotlinPluginVersion: String) : Plugin<Project> {
|
||||
abstract fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String): KotlinSourceSetProcessor<*>
|
||||
internal abstract class AbstractKotlinPlugin(
|
||||
val tasksProvider: KotlinTasksProvider,
|
||||
val kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
protected val kotlinPluginVersion: String
|
||||
) : Plugin<Project> {
|
||||
internal abstract fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String): KotlinSourceSetProcessor<*>
|
||||
|
||||
override fun apply(project: Project) {
|
||||
val javaBasePlugin = project.plugins.apply(JavaBasePlugin::class.java)
|
||||
@@ -230,8 +234,7 @@ abstract class AbstractKotlinPlugin(val tasksProvider: KotlinTasksProvider, val
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class KotlinPlugin(
|
||||
internal open class KotlinPlugin(
|
||||
tasksProvider: KotlinTasksProvider,
|
||||
kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
kotlinPluginVersion: String,
|
||||
@@ -247,7 +250,7 @@ open class KotlinPlugin(
|
||||
}
|
||||
|
||||
|
||||
open class Kotlin2JsPlugin(
|
||||
internal open class Kotlin2JsPlugin(
|
||||
tasksProvider: KotlinTasksProvider,
|
||||
kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
kotlinPluginVersion: String
|
||||
@@ -256,7 +259,7 @@ open class Kotlin2JsPlugin(
|
||||
Kotlin2JsSourceSetProcessor(project, javaBasePlugin, sourceSet, tasksProvider, kotlinSourceSetProvider)
|
||||
}
|
||||
|
||||
open class KotlinAndroidPlugin(
|
||||
internal open class KotlinAndroidPlugin(
|
||||
val tasksProvider: KotlinTasksProvider,
|
||||
private val kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
private val kotlinPluginVersion: String,
|
||||
@@ -509,7 +512,7 @@ private fun loadSubplugins(project: Project): SubpluginEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
class SubpluginEnvironment(
|
||||
internal class SubpluginEnvironment(
|
||||
val subpluginClasspaths: Map<KotlinGradleSubplugin<KotlinCompile>, List<File>>,
|
||||
val subplugins: List<KotlinGradleSubplugin<KotlinCompile>>
|
||||
) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ abstract class KotlinBasePluginWrapper(protected val fileResolver: FileResolver)
|
||||
plugin.apply(project)
|
||||
}
|
||||
|
||||
protected abstract fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin<Project>
|
||||
internal abstract fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin<Project>
|
||||
}
|
||||
|
||||
open class KotlinPluginWrapper @Inject constructor(fileResolver: FileResolver): KotlinBasePluginWrapper(fileResolver) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
|
||||
interface KotlinSourceSetProvider {
|
||||
internal interface KotlinSourceSetProvider {
|
||||
fun create(displayName: String): KotlinSourceSet
|
||||
}
|
||||
+2
-2
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.gradle.plugin
|
||||
import org.gradle.api.Task
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
|
||||
abstract class TaskToFriendTaskMapper {
|
||||
internal abstract class TaskToFriendTaskMapper {
|
||||
operator fun get(task: Task): String? =
|
||||
getFriendByName(task.name)
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class TaskToFriendTaskMapper {
|
||||
protected abstract fun getFriendByName(name: String): String?
|
||||
}
|
||||
|
||||
sealed class RegexTaskToFriendTaskMapper(
|
||||
sealed internal class RegexTaskToFriendTaskMapper(
|
||||
private val prefix: String,
|
||||
suffix: String
|
||||
) : TaskToFriendTaskMapper() {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ internal fun Task.finalizedByIfNotFailed(finalizer: Task) {
|
||||
this.finalizedBy(finalizer)
|
||||
}
|
||||
|
||||
fun AbstractCompile.mapClasspath(fn: ()->FileCollection) {
|
||||
internal fun AbstractCompile.mapClasspath(fn: ()->FileCollection) {
|
||||
conventionMapping.map("classpath", fn)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@ package org.jetbrains.kotlin.gradle.tasks
|
||||
import org.jetbrains.kotlin.incremental.DirtyData
|
||||
import java.io.File
|
||||
|
||||
interface ArtifactDifferenceRegistry {
|
||||
internal interface ArtifactDifferenceRegistry {
|
||||
operator fun get(artifact: File): Iterable<ArtifactDifference>?
|
||||
fun add(artifact: File, difference: ArtifactDifference)
|
||||
fun remove(artifact: File)
|
||||
}
|
||||
|
||||
class ArtifactDifference(val buildTS: Long, val dirtyData: DirtyData)
|
||||
internal class ArtifactDifference(val buildTS: Long, val dirtyData: DirtyData)
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.jetbrains.kotlin.gradle.tasks
|
||||
|
||||
import java.io.File
|
||||
|
||||
class CompilerPluginOptions {
|
||||
internal class CompilerPluginOptions {
|
||||
private val mutableClasspath = arrayListOf<String>()
|
||||
private val mutableArguments = arrayListOf<String>()
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ import kotlin.properties.Delegates
|
||||
* if it's timestamp now is newer than when we copied it
|
||||
* (assuming it was modified by javac when class was converted to java).
|
||||
*/
|
||||
open class SyncOutputTask : DefaultTask() {
|
||||
internal open class SyncOutputTask : DefaultTask() {
|
||||
@get:InputFiles
|
||||
var kotlinOutputDir: File by Delegates.notNull()
|
||||
var javaOutputDir: File by Delegates.notNull()
|
||||
|
||||
+16
-17
@@ -63,12 +63,12 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCo
|
||||
System.setProperty("kotlin.incremental.compilation.experimental", value.toString())
|
||||
}
|
||||
|
||||
var compilerCalled: Boolean = false
|
||||
internal var compilerCalled: Boolean = false
|
||||
// TODO: consider more reliable approach (see usage)
|
||||
var anyClassesCompiled: Boolean = false
|
||||
var friendTaskName: String? = null
|
||||
var javaOutputDir: File? = null
|
||||
var moduleName: String = "${project.name}-${this.name}"
|
||||
internal var anyClassesCompiled: Boolean = false
|
||||
internal var friendTaskName: String? = null
|
||||
internal var javaOutputDir: File? = null
|
||||
internal var moduleName: String = "${project.name}-${this.name}"
|
||||
|
||||
override fun compile() {
|
||||
assert(false, { "unexpected call to compile()" })
|
||||
@@ -109,7 +109,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCo
|
||||
open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), KotlinJvmCompile {
|
||||
override val compiler = K2JVMCompiler()
|
||||
|
||||
var parentKotlinOptionsImpl: KotlinJvmOptionsImpl? = null
|
||||
internal var parentKotlinOptionsImpl: KotlinJvmOptionsImpl? = null
|
||||
private val kotlinOptionsImpl = KotlinJvmOptionsImpl()
|
||||
override val kotlinOptions: KotlinJvmOptions
|
||||
get() = kotlinOptionsImpl
|
||||
@@ -117,7 +117,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
private val sourceRoots = HashSet<File>()
|
||||
|
||||
// lazy because name is probably not available when constructor is called
|
||||
val taskBuildDirectory: File by lazy { File(File(project.buildDir, KOTLIN_BUILD_DIR_NAME), name).apply { mkdirs() } }
|
||||
internal val taskBuildDirectory: File by lazy { File(File(project.buildDir, KOTLIN_BUILD_DIR_NAME), name).apply { mkdirs() } }
|
||||
private val cacheDirectory: File by lazy { File(taskBuildDirectory, CACHES_DIR_NAME) }
|
||||
private val dirtySourcesSinceLastTimeFile: File by lazy { File(taskBuildDirectory, DIRTY_SOURCES_FILE_NAME) }
|
||||
private val lastBuildInfoFile: File by lazy { File(taskBuildDirectory, LAST_BUILD_INFO_FILE_NAME) }
|
||||
@@ -127,7 +127,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
dataContainerCacheVersion(taskBuildDirectory),
|
||||
gradleCacheVersion(taskBuildDirectory))
|
||||
}
|
||||
val isCacheFormatUpToDate: Boolean
|
||||
internal val isCacheFormatUpToDate: Boolean
|
||||
get() {
|
||||
if (!incremental) return true
|
||||
|
||||
@@ -143,12 +143,12 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
get() = File(project.buildDir, "generated/source/kapt2")
|
||||
|
||||
|
||||
val kaptOptions = KaptOptions()
|
||||
val pluginOptions = CompilerPluginOptions()
|
||||
var artifactDifferenceRegistry: ArtifactDifferenceRegistry? = null
|
||||
var artifactFile: File? = null
|
||||
internal val kaptOptions = KaptOptions()
|
||||
internal val pluginOptions = CompilerPluginOptions()
|
||||
internal var artifactDifferenceRegistry: ArtifactDifferenceRegistry? = null
|
||||
internal var artifactFile: File? = null
|
||||
// created only if kapt2 is active
|
||||
var sourceAnnotationsRegistry: SourceAnnotationsRegistry? = null
|
||||
internal var sourceAnnotationsRegistry: SourceAnnotationsRegistry? = null
|
||||
|
||||
override fun populateCompilerArguments(): K2JVMCompilerArguments {
|
||||
val args = K2JVMCompilerArguments().apply { fillDefaultValues() }
|
||||
@@ -578,7 +578,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
return super.source(*sourcesToAdd)
|
||||
}
|
||||
|
||||
fun findRootsForSources(sources: Iterable<File>): Set<File> {
|
||||
internal fun findRootsForSources(sources: Iterable<File>): Set<File> {
|
||||
val resultRoots = HashSet<File>()
|
||||
val sourceDirs = sources.mapTo(HashSet()) { it.parentFile }
|
||||
|
||||
@@ -652,7 +652,7 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
||||
}
|
||||
}
|
||||
|
||||
class GradleMessageCollector(val logger: Logger, val outputCollector: OutputItemsCollector? = null) : MessageCollector {
|
||||
internal class GradleMessageCollector(val logger: Logger, val outputCollector: OutputItemsCollector? = null) : MessageCollector {
|
||||
private var hasErrors = false
|
||||
|
||||
override fun hasErrors() = hasErrors
|
||||
@@ -712,8 +712,7 @@ internal fun Logger.kotlinDebug(message: String) {
|
||||
this.debug("[KOTLIN] $message")
|
||||
}
|
||||
|
||||
inline
|
||||
internal fun Logger.kotlinDebug(message: ()->String) {
|
||||
internal inline fun Logger.kotlinDebug(message: ()->String) {
|
||||
if (isDebugEnabled) {
|
||||
kotlinDebug(message())
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.plugin.RegexTaskToFriendTaskMapper
|
||||
import org.jetbrains.kotlin.gradle.plugin.TaskToFriendTaskMapper
|
||||
import org.jetbrains.kotlin.gradle.plugin.mapKotlinTaskProperties
|
||||
|
||||
open class KotlinTasksProvider {
|
||||
internal open class KotlinTasksProvider {
|
||||
fun createKotlinJVMTask(project: Project, name: String): KotlinCompile {
|
||||
return project.tasks.create(name, KotlinCompile::class.java).apply {
|
||||
friendTaskName = taskToFriendTaskMapper[this]
|
||||
@@ -21,7 +21,7 @@ open class KotlinTasksProvider {
|
||||
RegexTaskToFriendTaskMapper.Default()
|
||||
}
|
||||
|
||||
class AndroidTasksProvider : KotlinTasksProvider() {
|
||||
internal class AndroidTasksProvider : KotlinTasksProvider() {
|
||||
override val taskToFriendTaskMapper: TaskToFriendTaskMapper =
|
||||
RegexTaskToFriendTaskMapper.Android()
|
||||
}
|
||||
+3
-3
@@ -4,10 +4,10 @@ import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.incremental.CacheVersion
|
||||
import java.io.File
|
||||
|
||||
const val GRADLE_CACHE_VERSION = 1
|
||||
const val GRADLE_CACHE_VERSION_FILE_NAME = "gradle-format-version.txt"
|
||||
internal const val GRADLE_CACHE_VERSION = 1
|
||||
internal const val GRADLE_CACHE_VERSION_FILE_NAME = "gradle-format-version.txt"
|
||||
|
||||
fun gradleCacheVersion(dataRoot: File): CacheVersion =
|
||||
internal fun gradleCacheVersion(dataRoot: File): CacheVersion =
|
||||
CacheVersion(ownVersion = GRADLE_CACHE_VERSION,
|
||||
versionFile = File(dataRoot, GRADLE_CACHE_VERSION_FILE_NAME),
|
||||
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.gradle.tasks.ArtifactDifferenceRegistry
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.io.File
|
||||
|
||||
fun configureMultiProjectIncrementalCompilation(
|
||||
internal fun configureMultiProjectIncrementalCompilation(
|
||||
project: Project,
|
||||
kotlinTask: KotlinCompile,
|
||||
javaTask: AbstractCompile,
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import org.jetbrains.org.objectweb.asm.*
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import java.io.File
|
||||
|
||||
fun generateKotlinAptAnnotation(outputDirectory: File): File {
|
||||
internal fun generateKotlinAptAnnotation(outputDirectory: File): File {
|
||||
val packageName = "__gen"
|
||||
val className = "KotlinAptAnnotation"
|
||||
val classFqName = "$packageName/$className"
|
||||
@@ -25,7 +25,7 @@ fun generateKotlinAptAnnotation(outputDirectory: File): File {
|
||||
return outputFile
|
||||
}
|
||||
|
||||
fun generateAnnotationProcessorWrapper(
|
||||
internal fun generateAnnotationProcessorWrapper(
|
||||
processorFqName: String,
|
||||
packageName: String,
|
||||
outputDirectory: File,
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental.snapshots
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
|
||||
val File.md5: ByteArray
|
||||
internal val File.md5: ByteArray
|
||||
get() {
|
||||
val messageDigest = MessageDigest.getInstance("MD5")
|
||||
val buffer = ByteArray(4048)
|
||||
|
||||
+2
-3
@@ -2,7 +2,6 @@ package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices
|
||||
import org.jetbrains.kotlin.gradle.util.checkBytecodeNotContains
|
||||
import org.jetbrains.kotlin.gradle.util.createGradleCommand
|
||||
import org.jetbrains.kotlin.gradle.util.runProcess
|
||||
@@ -183,8 +182,8 @@ abstract class BaseGradleIT {
|
||||
}
|
||||
|
||||
fun CompiledProject.checkKotlinGradleBuildServices() {
|
||||
assertSubstringCount(KotlinGradleBuildServices.INIT_MESSAGE, expectedCount = 1)
|
||||
assertSubstringCount(KotlinGradleBuildServices.DISPOSE_MESSAGE, expectedCount = 1)
|
||||
assertSubstringCount("Initialized KotlinGradleBuildServices", expectedCount = 1)
|
||||
assertSubstringCount("Disposed KotlinGradleBuildServices", expectedCount = 1)
|
||||
}
|
||||
|
||||
fun CompiledProject.assertNotContains(vararg expected: String): CompiledProject {
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices
|
||||
import org.jetbrains.kotlin.gradle.tasks.USING_EXPERIMENTAL_INCREMENTAL_MESSAGE
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
@@ -106,12 +105,12 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
fun testLogLevelForceGC() {
|
||||
val debugProject = Project("simpleProject", GRADLE_VERSION, minLogLevel = LogLevel.DEBUG)
|
||||
debugProject.build("build") {
|
||||
assertContains(KotlinGradleBuildServices.FORCE_SYSTEM_GC_MESSAGE)
|
||||
assertContains("Forcing System.gc()")
|
||||
}
|
||||
|
||||
val infoProject = Project("simpleProject", GRADLE_VERSION, minLogLevel = LogLevel.INFO)
|
||||
infoProject.build("clean", "build") {
|
||||
assertNotContains(KotlinGradleBuildServices.FORCE_SYSTEM_GC_MESSAGE)
|
||||
assertNotContains("Forcing System.gc()")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user