Skip to content

Commit cb2bc53

Browse files
bnormtschuchortdev
authored andcommitted
Documentation and function naming
1 parent ece66f2 commit cb2bc53

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

core/src/main/kotlin/com/tschuchort/compiletesting/AbstractKotlinCompilation.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ import java.net.URI
2222
import java.nio.file.Files
2323
import java.nio.file.Paths
2424

25-
abstract class AbstractKotlinCompilation<A : CommonCompilerArguments> {
25+
/**
26+
* Base compilation class for sharing common compiler arguments and
27+
* functionality. Should not be used outside of this library as it is an
28+
* implementation detail.
29+
*/
30+
abstract class AbstractKotlinCompilation<A : CommonCompilerArguments> internal constructor() {
2631
/** Working directory for the compilation */
2732
var workingDir: File by default {
2833
val path = Files.createTempDirectory("Kotlin-Compilation")

core/src/main/kotlin/com/tschuchort/compiletesting/KotlinJsCompilation.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
6868

6969

7070
// setup common arguments for the two kotlinc calls
71-
private fun commonK2JSArgs() = commonArguments(K2JSCompilerArguments()) { args ->
71+
private fun jsArgs() = commonArguments(K2JSCompilerArguments()) { args ->
7272
// the compiler should never look for stdlib or reflect in the
7373
// kotlinHome directory (which is null anyway). We will put them
7474
// in the classpath manually if they're needed
7575
args.noStdlib = true
7676

7777
args.moduleKind = "commonjs"
7878
args.outputFile = File(outputDir, outputFileName).absolutePath
79-
args.sourceMapBaseDirs = commonClasspaths().joinToString(separator = File.pathSeparator)
79+
args.sourceMapBaseDirs = jsClasspath().joinToString(separator = File.pathSeparator)
8080
args.libraries = listOfNotNull(kotlinStdLibJsJar).joinToString(separator = ":")
8181

8282
args.irProduceKlibDir = irProduceKlibDir
@@ -114,7 +114,7 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
114114
*/
115115
withSystemProperty("idea.use.native.fs.for.win", "false") {
116116
// step 1: compile Kotlin files
117-
return makeResult(compileKotlin(sourceFiles, K2JSCompiler(), commonK2JSArgs()))
117+
return makeResult(compileKotlin(sourceFiles, K2JSCompiler(), jsArgs()))
118118
}
119119
}
120120

@@ -127,7 +127,7 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
127127
return Result(exitCode, messages)
128128
}
129129

130-
private fun commonClasspaths() = mutableListOf<File>().apply {
130+
private fun jsClasspath() = mutableListOf<File>().apply {
131131
addAll(classpaths)
132132
addAll(listOfNotNull(kotlinStdLibCommonJar, kotlinStdLibJsJar))
133133

0 commit comments

Comments
 (0)