Rewrite TeamCityBuild.xml tasks in gradle, finally drop build.xml files
also: proxying previous tasks from TeamCityBuild.xml to gradle, cleaning update_dependencies.xml from ant dependencies
This commit is contained in:
committed by
Vyacheslav Gerasimov
parent
12f0f019da
commit
d301938d23
Generated
-4
@@ -2,10 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<buildFile url="file://$PROJECT_DIR$/compiler/frontend/buildLexer.xml" />
|
||||
<buildFile url="file://$PROJECT_DIR$/build.xml">
|
||||
<antCommandLine value="-J-ea" />
|
||||
<maximumHeapSize value="1024" />
|
||||
</buildFile>
|
||||
<buildFile url="file://$PROJECT_DIR$/update_dependencies.xml" />
|
||||
<buildFile url="file://$PROJECT_DIR$/TeamCityBuild.xml">
|
||||
<maximumHeapSize value="512" />
|
||||
|
||||
+32
-62
@@ -1,5 +1,6 @@
|
||||
<project name="Kotlin CI Steps" default="none">
|
||||
<import file="build.xml" optional="false"/>
|
||||
<import file="common.xml" optional="false"/>
|
||||
<property name="kotlin-home" value="${output}/kotlinc"/>
|
||||
|
||||
<property name="build.number" value="snapshot"/>
|
||||
<property name="fail.on.plugin.verifier.error" value="true"/>
|
||||
@@ -38,84 +39,53 @@
|
||||
<echoprop prop="user.home"/>
|
||||
<echoprop prop="user.dir"/>
|
||||
|
||||
<target name="cleanupArtifacts">
|
||||
<delete dir="${artifact.output.path}" includes="*"/>
|
||||
</target>
|
||||
|
||||
<macrodef name="substituteVersionInFile">
|
||||
<attribute name="target.file"/>
|
||||
<attribute name="test.string"/>
|
||||
<attribute name="target.file.bk" default="@{target.file}.bk"/>
|
||||
<attribute name="target.file.versioned" default="@{target.file}.versioned"/>
|
||||
<attribute name="token.key" default="snapshot"/>
|
||||
<attribute name="version" default="${build.number}"/>
|
||||
<macrodef name="run-gradle">
|
||||
<attribute name="tasks" />
|
||||
<sequential>
|
||||
<!-- Create backup. Backup will be restored after build end. This will allow to rebuild project without renew
|
||||
plugin.xml from repository. -->
|
||||
<copy file="@{target.file}" tofile="@{target.file.bk}"/>
|
||||
|
||||
<!-- Check that version has correct pattern for substitution -->
|
||||
<copy todir="">
|
||||
<fileset file="@{target.file.bk}">
|
||||
<contains text="@{test.string}"/>
|
||||
</fileset>
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="@{token.key}" value="@{version}"/>
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
<mergemapper to="@{target.file.versioned}"/>
|
||||
</copy>
|
||||
|
||||
<!-- If file doesn't exist - there's a problem with original plugin.xml. Probably there's a bad pattern used for version -->
|
||||
<copy file="@{target.file.versioned}" tofile="@{target.file}" overwrite="true"/>
|
||||
|
||||
<delete file="@{target.file.versioned}" quiet="true"/>
|
||||
<java classname="org.gradle.wrapper.GradleWrapperMain"
|
||||
fork="true"
|
||||
dir="${basedir}"
|
||||
failonerror="true"
|
||||
timeout="4000000"
|
||||
maxmemory="400m"
|
||||
taskname="gradle">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/gradle/wrapper/gradle-wrapper.jar"/>
|
||||
</classpath>
|
||||
<arg line="--no-daemon" />
|
||||
<arg line="@{tasks}" />
|
||||
</java>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="cleanupArtifacts">
|
||||
<run-gradle tasks="cleanupArtifacts" />
|
||||
</target>
|
||||
|
||||
<target name="zip-compiler">
|
||||
<run-gradle tasks="zip-compiler" />
|
||||
</target>
|
||||
|
||||
<target name="zip-test-data">
|
||||
<run-gradle tasks="zip-test-data" />
|
||||
</target>
|
||||
|
||||
<target name="writeCompilerVersionToTemplateFile">
|
||||
<!-- empty, version is written in gradle build -->
|
||||
</target>
|
||||
|
||||
<target name="writePluginVersionToTemplateFile">
|
||||
<mkdir dir="${version_substitute_dir}"/>
|
||||
|
||||
<substituteVersionInFile
|
||||
target.file="${plugin.xml}"
|
||||
target.file.bk="${plugin.xml.bk}"
|
||||
target.file.versioned="${plugin.xml.versioned}"
|
||||
test.string="<version>@snapshot@</version>"
|
||||
version="${plugin.xml.version.number}"/>
|
||||
<run-gradle tasks="writePluginVersionToTemplateFile" />
|
||||
</target>
|
||||
|
||||
<target name="revertTemplateFiles">
|
||||
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
|
||||
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
|
||||
|
||||
<delete dir="${version_substitute_dir}" quiet="true"/>
|
||||
<run-gradle tasks="revertTemplateFiles" />
|
||||
</target>
|
||||
|
||||
<target name="pre_build" depends="writeCompilerVersionToTemplateFile, writePluginVersionToTemplateFile, cleanupArtifacts"/>
|
||||
|
||||
<target name="zipArtifacts">
|
||||
<macrodef name="zipPlugin">
|
||||
<attribute name="filename"/>
|
||||
<attribute name="prefix" />
|
||||
<attribute name="dir"/>
|
||||
|
||||
<sequential>
|
||||
<zip destfile="@{filename}">
|
||||
<zipfileset prefix="@{prefix}" dir="@{dir}" excludes="kotlinc/bin/*"/>
|
||||
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" includes="*.bat"
|
||||
filemode="644"/>
|
||||
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" excludes="*.bat"
|
||||
filemode="755"/>
|
||||
</zip>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<zipPlugin filename="${plugin.zip}" prefix="Kotlin" dir="${artifact.output.path}/${pluginArtifactDir}"/>
|
||||
<run-gradle tasks="zipArtifacts" />
|
||||
</target>
|
||||
|
||||
<macrodef name="print-statistic">
|
||||
|
||||
@@ -358,6 +358,13 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: copied from TeamCityBuild.xml (with ultimate-related modification), consider removing after migrating from it
|
||||
"cleanupArtifacts" {
|
||||
doLast {
|
||||
delete(ideaPluginDir)
|
||||
delete(ideaUltimatePluginDir)
|
||||
}
|
||||
}
|
||||
|
||||
"coreLibsTest" {
|
||||
(coreLibProjects + listOf(
|
||||
@@ -484,6 +491,86 @@ tasks {
|
||||
"check" { dependsOn("test") }
|
||||
}
|
||||
|
||||
// TODO: copied from build.xml (used on TC), reconsider location and dependencies after complete migration
|
||||
val `zip-compiler` by task<Zip> {
|
||||
destinationDir = file(distDir)
|
||||
archiveName = "kotlin-compiler-$kotlinVersion.zip"
|
||||
from(distKotlinHomeDir) {
|
||||
exclude("bin/**")
|
||||
into("kotlinc")
|
||||
}
|
||||
from("$distKotlinHomeDir/bin") {
|
||||
include("*.bat")
|
||||
into("kotlinc/bin")
|
||||
fileMode = 0b110100100
|
||||
}
|
||||
from("$distKotlinHomeDir/bin") {
|
||||
exclude("*.bat")
|
||||
into("kotlinc/bin")
|
||||
fileMode = 0b111101101
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: copied from build.xml (used on TC), reconsider location and dependencies after complete migration
|
||||
val `zip-test-data` by task<Zip> {
|
||||
destinationDir = file(distDir)
|
||||
archiveName = "kotlin-test-data.zip"
|
||||
from("compiler/testData") { into("compiler") }
|
||||
from("idea/testData") { into("ide") }
|
||||
from("idea/idea-completion/testData") { into("ide/completion") }
|
||||
}
|
||||
|
||||
// TODO: copied from TeamCityBuild.xml (excluding some parts), consider implementing patching in the appropriate projects
|
||||
|
||||
val pluginXmlDir = "$rootDir/idea/src/META-INF"
|
||||
val pluginXmlPath = "$pluginXmlDir/plugin.xml"
|
||||
val pluginXmlBackupDir = "$buildDir/plugin_xml_backup"
|
||||
val pluginXmlBackupPath = "$pluginXmlBackupDir/plugin.xml"
|
||||
|
||||
val backupTemplateFile by task<Copy> {
|
||||
from(pluginXmlPath)
|
||||
into(pluginXmlBackupDir)
|
||||
}
|
||||
|
||||
val writePluginVersionToTemplateFile by task<Copy> {
|
||||
dependsOn(backupTemplateFile)
|
||||
from(pluginXmlBackupPath)
|
||||
into(pluginXmlDir)
|
||||
filter { it.replace("@snapshot@", "$buildNumber") }
|
||||
}
|
||||
|
||||
val restoreTemplateFile by task<Copy> {
|
||||
from(pluginXmlBackupPath)
|
||||
into(pluginXmlDir)
|
||||
}
|
||||
|
||||
val revertTemplateFiles by task<Delete> {
|
||||
dependsOn(restoreTemplateFile)
|
||||
delete(pluginXmlBackupDir)
|
||||
}
|
||||
|
||||
// TODO: copied from build.xml (used on TC), reconsider location, logic and dependencies after complete migration
|
||||
val zipArtifacts by task<Zip> {
|
||||
val dest = File(System.getProperty("plugin.zip") ?: "$distDir/artifacts/kotlin-plugin-$buildNumber.zip")
|
||||
val src = System.getProperty("pluginArtifactDir") ?: ideaPluginDir
|
||||
destinationDir = dest.parentFile
|
||||
archiveName = dest.name
|
||||
from(src) {
|
||||
exclude("kotlinc/bin/**")
|
||||
into("Kotlin")
|
||||
}
|
||||
from("$src/kotlinc/bin") {
|
||||
include("*.bat")
|
||||
into("Kotlin/kotlinc/bin")
|
||||
fileMode = 0b110100100
|
||||
}
|
||||
from("$src/kotlinc/bin") {
|
||||
exclude("*.bat")
|
||||
into("Kotlin/kotlinc/bin")
|
||||
fileMode = 0b111101101
|
||||
}
|
||||
}
|
||||
|
||||
configure<IdeaModel> {
|
||||
module {
|
||||
excludeDirs = files(
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<project default="build_artifact">
|
||||
<property name="artifact.root" value="out/artifacts/Kotlin"/>
|
||||
<property name="production.root" value="out/production/kotlin-ultimate"/>
|
||||
<property name="meta.inf" value="${production.root}/META-INF"/>
|
||||
<property name="kotlin.plugin.jar" value="${artifact.root}/lib/kotlin-plugin.jar"/>
|
||||
|
||||
<macrodef name="merge_plugin_xml">
|
||||
<attribute name="main.plugin.xml.dir" />
|
||||
|
||||
<sequential>
|
||||
<loadfile srcfile="${meta.inf}/ultimate-plugin.xml" property="ultimate.plugin.xml.content">
|
||||
<filterchain>
|
||||
<tokenfilter>
|
||||
<filetokenizer/>
|
||||
<replaceregex pattern="\<idea-plugin\>" replace="" />
|
||||
<replaceregex pattern="\</idea-plugin\>" replace="" />
|
||||
</tokenfilter>
|
||||
</filterchain>
|
||||
</loadfile>
|
||||
|
||||
<replace file="@{main.plugin.xml.dir}/plugin.xml" token="<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->" value="${ultimate.plugin.xml.content}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="build_artifact">
|
||||
<copy todir="${artifact.root}">
|
||||
<fileset dir="../${artifact.root}"/>
|
||||
</copy>
|
||||
|
||||
<unzip src="${kotlin.plugin.jar}" dest="${production.root}">
|
||||
<patternset>
|
||||
<include name="META-INF/plugin.xml"/>
|
||||
</patternset>
|
||||
</unzip>
|
||||
|
||||
<merge_plugin_xml main.plugin.xml.dir="${meta.inf}"/>
|
||||
|
||||
<jar destfile="${kotlin.plugin.jar}" update="true">
|
||||
<fileset dir="${production.root}"/>
|
||||
<file file="${meta.inf}/plugin.xml"/>
|
||||
</jar>
|
||||
|
||||
<delete file="${meta.inf}/plugin.xml"/>
|
||||
</target>
|
||||
|
||||
<target name="patch_outer_plugin_xml_for_tests">
|
||||
<merge_plugin_xml main.plugin.xml.dir="../out/production/idea/META-INF" />
|
||||
</target>
|
||||
</project>
|
||||
@@ -116,13 +116,6 @@
|
||||
</macrodef>
|
||||
|
||||
<target name="fetch-third-party" depends="get-ivy-library, make-dependency-dirs">
|
||||
<!-- ProGuard -->
|
||||
<get-maven-library prefix="net/sf/proguard" lib="proguard-base" version="5.3" target.jar.name.base="proguard" src="false"/>
|
||||
<get-maven-library prefix="net/sf/proguard" lib="proguard-anttask" version="5.3" target.jar.name.base="proguard-anttask" src="false"/>
|
||||
|
||||
<!-- JarJar -->
|
||||
<get src="http://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jarjar/jarjar-1.4.jar" dest="${dependencies}/download/jarjar-1.4.jar" usetimestamp="true"/>
|
||||
<copy file="${dependencies}/download/jarjar-1.4.jar" tofile="${dependencies}/jarjar.jar" overwrite="true"/>
|
||||
|
||||
<!-- dx.jar -->
|
||||
<property name="android-build-tools.zip" value="build-tools_r21.1.1-linux.zip"/>
|
||||
|
||||
Reference in New Issue
Block a user