Rewrite preprocessor task in gradle without ant
This commit is contained in:
@@ -15,7 +15,6 @@ ext.JDK_16 = System.getenv("JDK_16")
|
|||||||
ext.JDK_17 = System.getenv("JDK_17")
|
ext.JDK_17 = System.getenv("JDK_17")
|
||||||
ext.JDK_18 = System.getenv("JDK_18")
|
ext.JDK_18 = System.getenv("JDK_18")
|
||||||
ext.bootstrapCompilerFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
ext.bootstrapCompilerFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
||||||
ext.compilerPreloaderFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-preloader.jar")
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = 'org.jetbrains.kotlin'
|
group = 'org.jetbrains.kotlin'
|
||||||
@@ -122,3 +121,12 @@ static def manifestAttributes(Manifest manifest, Project project, String compone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def createPreprocessorTask(Project project, def name, def sourceDir, def targetDir, def profile = "JS") {
|
||||||
|
return project.tasks.create("preprocessSources$name", JavaExec) {
|
||||||
|
inputs.dir(sourceDir)
|
||||||
|
outputs.dir(targetDir)
|
||||||
|
classpath = project.files(bootstrapCompilerFile)
|
||||||
|
main = "org.jetbrains.kotlin.preprocessor.PreprocessorCLI"
|
||||||
|
args = [sourceDir, targetDir, profile]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,14 +13,9 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ant.properties.baseDir = projectDir
|
createPreprocessorTask(project, "Main", "${projectDir}/../src/kotlin", commonSrcDir)
|
||||||
ant.properties.commonSrcDir = commonSrcDir
|
|
||||||
ant.properties.kotlinCompiler = bootstrapCompilerFile.path
|
|
||||||
ant.properties.compilerPreloader = compilerPreloaderFile.path
|
|
||||||
|
|
||||||
ant.importBuild('tasks.xml')
|
compileKotlinCommon.dependsOn preprocessSourcesMain
|
||||||
|
|
||||||
compileKotlinCommon.dependsOn commonSources
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// TODO: currently unsupported
|
// TODO: currently unsupported
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<project>
|
|
||||||
<target name="commonSources">
|
|
||||||
<delete dir="${commonSrcDir}" failonerror="false"/>
|
|
||||||
<mkdir dir="${commonSrcDir}"/>
|
|
||||||
<java classname="org.jetbrains.kotlin.preloading.Preloader" failonerror="true" fork="true">
|
|
||||||
<classpath>
|
|
||||||
<pathelement location="${compilerPreloader}"/>
|
|
||||||
</classpath>
|
|
||||||
<assertions>
|
|
||||||
<enable/>
|
|
||||||
</assertions>
|
|
||||||
<arg value="-cp"/>
|
|
||||||
<arg value="${kotlinCompiler}"/>
|
|
||||||
<arg value="org.jetbrains.kotlin.preprocessor.PreprocessorCLI"/>
|
|
||||||
<arg value="${basedir}/../src/kotlin"/>
|
|
||||||
<arg value="${commonSrcDir}"/>
|
|
||||||
<arg value="JS"/>
|
|
||||||
</java>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
@@ -60,12 +60,7 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ant.properties.baseDir = projectDir
|
createPreprocessorTask(project, "Main", "${projectDir}/../src/kotlin", commonSrcDir)
|
||||||
ant.properties.commonSrcDir = commonSrcDir
|
|
||||||
ant.properties.kotlinCompiler = bootstrapCompilerFile.path
|
|
||||||
ant.properties.compilerPreloader = compilerPreloaderFile.path
|
|
||||||
|
|
||||||
ant.importBuild('../common/tasks.xml')
|
|
||||||
|
|
||||||
kotlin.experimental.coroutines "enable"
|
kotlin.experimental.coroutines "enable"
|
||||||
|
|
||||||
@@ -88,7 +83,7 @@ compileBuiltinsKotlin2Js {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin2Js {
|
compileKotlin2Js {
|
||||||
dependsOn commonSources
|
dependsOn preprocessSourcesMain
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
outputFile = "${buildDir}/classes/main/kotlin.js"
|
outputFile = "${buildDir}/classes/main/kotlin.js"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user