[K/JS] Generate the similar variant of newlines on different OS in the @file:JsExport tests generating task
This commit is contained in:
@@ -5,6 +5,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
@@ -71,7 +72,7 @@ dependencies {
|
||||
testRuntimeOnly(project(":kotlin-preloader")) // it's required for ant tests
|
||||
testRuntimeOnly(project(":compiler:backend-common"))
|
||||
testRuntimeOnly(commonDependency("org.fusesource.jansi", "jansi"))
|
||||
|
||||
|
||||
antLauncherJar(commonDependency("org.apache.ant", "ant"))
|
||||
antLauncherJar(toolsJar())
|
||||
|
||||
@@ -193,6 +194,7 @@ fun generateJsExportOnFileTestFor(dir: String): Task = task<Copy>("generate-js-e
|
||||
|
||||
eachFile {
|
||||
var isFirstLine = true
|
||||
|
||||
filter {
|
||||
when {
|
||||
isFirstLine && name.endsWith(".kt") -> "/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */\n\n$it"
|
||||
@@ -202,6 +204,12 @@ fun generateJsExportOnFileTestFor(dir: String): Task = task<Copy>("generate-js-e
|
||||
else -> it.replace("@JsExport(?!.)".toRegex(), "")
|
||||
}
|
||||
}
|
||||
|
||||
filter(
|
||||
FixCrLfFilter::class,
|
||||
"eol" to FixCrLfFilter.CrLf.newInstance("lf"),
|
||||
"fixlast" to false
|
||||
)
|
||||
}
|
||||
|
||||
into(outputDir)
|
||||
@@ -211,10 +219,10 @@ val generateTypeScriptJsExportOnFileTests = sequential(
|
||||
tasks = typescriptTestsDir
|
||||
.listFiles { it: File ->
|
||||
it.isDirectory &&
|
||||
!it.path.endsWith("/selective-export") &&
|
||||
!it.path.endsWith("/implicit-export") &&
|
||||
!it.path.endsWith("/inheritance") &&
|
||||
!it.path.endsWith("/strict-implicit-export") &&
|
||||
!it.path.endsWith("selective-export") &&
|
||||
!it.path.endsWith("implicit-export") &&
|
||||
!it.path.endsWith("inheritance") &&
|
||||
!it.path.endsWith("strict-implicit-export") &&
|
||||
!it.path.endsWith(exportFileDirPostfix)
|
||||
}
|
||||
.map { generateJsExportOnFileTestFor(it.name) }
|
||||
|
||||
Reference in New Issue
Block a user