Rename "import jet.*" to "import kotlin.*" on ant dist
Yet another hack for moving built-ins from package "jet" to "kotlin"
This commit is contained in:
@@ -284,6 +284,26 @@
|
|||||||
<arg value="core/builtins/native"/>
|
<arg value="core/builtins/native"/>
|
||||||
<arg value="core/builtins/src"/>
|
<arg value="core/builtins/src"/>
|
||||||
</java>
|
</java>
|
||||||
|
|
||||||
|
<if>
|
||||||
|
<isfalse value="${bootstrap.build.no.tests}"/>
|
||||||
|
<then>
|
||||||
|
<cleandir dir="${output}/renameImportJet"/>
|
||||||
|
<kotlinc output="${output}/renameImportJet">
|
||||||
|
<src path="renameImportJet.kt"/>
|
||||||
|
<classpath refid="classpath"/>
|
||||||
|
</kotlinc>
|
||||||
|
<java classname="_DefaultPackage" failonerror="true" fork="true">
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="${output}/renameImportJet"/>
|
||||||
|
<path refid="classpath"/>
|
||||||
|
</classpath>
|
||||||
|
<assertions>
|
||||||
|
<enable/>
|
||||||
|
</assertions>
|
||||||
|
</java>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<macrodef name="pack_compiler">
|
<macrodef name="pack_compiler">
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import java.io.File
|
||||||
|
import com.intellij.util.Processor
|
||||||
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
println("renameImportJet")
|
||||||
|
|
||||||
|
fun processFile(file: File) {
|
||||||
|
if (!file.getName().endsWith(".java") || file.isDirectory()) return
|
||||||
|
|
||||||
|
val lines = ArrayList<String>()
|
||||||
|
var rewrite = false
|
||||||
|
file.reader().forEachLine { line ->
|
||||||
|
if (line.startsWith("import jet.") && !line.startsWith("import jet.runtime.typeinfo")) {
|
||||||
|
lines.add("import kotlin." + line.substring("import jet.".length))
|
||||||
|
rewrite = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lines.add(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rewrite) {
|
||||||
|
println("renaming imports in $file")
|
||||||
|
file.writeText(lines reduce { (a, b) -> "$a\n$b" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val processor = Processor<File> { if (it != null) processFile(it); true }
|
||||||
|
val directoryFilter = Processor<File> { it?.getName() != "testData" }
|
||||||
|
|
||||||
|
FileUtil.processFilesRecursively(File("."), processor, directoryFilter)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user