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