Extract kotlin-reflect-api module out of kotlin-reflect

This is needed only for faster compilation of the Kotlin project itself
and has no effect on the public artifact
org.jetbrains.kotlin:kotlin-reflect.

The problem this is solving is the rebuild of the project once anything
has been changed in modules in 'core' (even inside function bodies, i.e.
a non-API change). Previously, changes in 'core' led to the compilation
of kotlin-reflect, which led to the rebuild of all modules depending on
kotlin-reflect directly or indirectly (which is almost all modules in
the project) because kotlin-reflect's artifacts are custom-built and the
changes can not be picked up incrementally. But 99.9% of the time the
initial changes in 'core' could not have any effect on the usages of
kotlin-reflect, because classes from those modules are moved to an
internal package in kotlin-reflect and thus are an internal
implementation detail.

Now, changes in 'core' still lead to the compilation of kotlin-reflect
and to the process of building the custom jar. But if a module depends
on kotlin-reflect-api, not kotlin-reflect, then the incremental
difference checker will detect that the module does not have to be
recompiled if there hasn't been any changes to the API of
kotlin-reflect-api. Which means that the module will not be rebuilt on
every change in 'core'.

This commit only introduces the new module. The dependencies
(kotlin-reflect -> kotlin-reflect-api) are replaced in the next commit.
This commit is contained in:
Alexander Udalov
2017-11-09 14:29:24 +01:00
parent 3e8b39af90
commit 329fbd8fa8
9 changed files with 3041 additions and 32 deletions
@@ -69,9 +69,12 @@ fun main(args: Array<String>) {
for (protoPath in PROTO_PATHS) {
execProtoc(protoPath.file, protoPath.outPath)
renamePackages(protoPath.file, protoPath.outPath)
modifyAndExecProtoc(protoPath)
}
generateJvmPackageTableToBuildSrc()
println()
println("Do not forget to run GenerateProtoBufCompare")
}
@@ -108,8 +111,6 @@ private fun execProtoc(protoPath: String, outPath: String) {
if (processOutput.stderr.isNotEmpty()) {
throw AssertionError(processOutput.stderr)
}
renamePackages(protoPath, outPath)
}
private fun renamePackages(protoPath: String, outPath: String) {
@@ -143,7 +144,9 @@ private fun modifyAndExecProtoc(protoPath: ProtoPath) {
debugProtoFile.writeText(modifyForDebug(protoPath))
debugProtoFile.deleteOnExit()
execProtoc(debugProtoFile.path, "build-common/test")
val outPath = "build-common/test"
execProtoc(debugProtoFile.path, outPath)
renamePackages(debugProtoFile.path, outPath)
}
private fun modifyForDebug(protoPath: ProtoPath): String {
@@ -158,3 +161,7 @@ private fun modifyForDebug(protoPath: ProtoPath): String {
}
return text
}
private fun generateJvmPackageTableToBuildSrc() {
execProtoc("core/descriptors.jvm/src/jvm_package_table.proto", "buildSrc/src/main/java")
}