mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
210 lines
9.3 KiB
XML
210 lines
9.3 KiB
XML
<project name="Kotlin CI Steps" default="none">
|
|
<import file="build.xml" optional="false"/>
|
|
<import file="replicate_versions.xml" optional="false"/>
|
|
|
|
<property name="build.number" value="snapshot"/>
|
|
<property name="jdk16.home" value="${java.home}"/>
|
|
<property name="fail.on.plugin.verifier.error" value="true"/>
|
|
|
|
<property name="version_substitute_dir" value="${basedir}/versions_temp/"/>
|
|
|
|
<property name="artifact.output.path" value="${basedir}/out/artifacts"/>
|
|
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
|
|
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
|
|
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned"/>
|
|
|
|
<property name="android-extensions.plugin.xml" value="plugins/android-idea-plugin/src/META-INF/plugin.xml"/>
|
|
<property name="android-extensions.plugin.xml.bk" value="${version_substitute_dir}/kotlin-android-extensions.plugin.xml.bk"/>
|
|
<property name="android-extensions.plugin.xml.versioned" value="${android-extensions.plugin.xml}.versioned"/>
|
|
|
|
<property name="compiler.version.java" value="compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/KotlinVersion.java"/>
|
|
<property name="compiler.version.java.bk" value="${version_substitute_dir}/KotlinVersion.java.bk"/>
|
|
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned"/>
|
|
|
|
<property name="plugin.zip" value="${artifact.output.path}/kotlin-plugin-${build.number}.zip"/>
|
|
<property name="bare.plugin.zip" value="${artifact.output.path}/kotlin-bare-plugin-${build.number}.zip"/>
|
|
<property name="android-extensions.zip" value="${artifact.output.path}/kotlin-android-extensions-plugin-${build.number}.zip"/>
|
|
|
|
<macrodef name="echoprop">
|
|
<attribute name="prop"/>
|
|
<sequential>
|
|
<echo>@{prop}=${@{prop}}</echo>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<echoprop prop="os.name"/>
|
|
<echoprop prop="os.version"/>
|
|
<echoprop prop="os.arch"/>
|
|
<echoprop prop="java.home"/>
|
|
<echoprop prop="java.vendor"/>
|
|
<echoprop prop="java.version"/>
|
|
<echoprop prop="user.name"/>
|
|
<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}"/>
|
|
<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"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="writeVersionToTemplateFiles">
|
|
<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>"/>
|
|
|
|
<substituteVersionInFile
|
|
target.file="${android-extensions.plugin.xml}"
|
|
target.file.bk="${android-extensions.plugin.xml.bk}"
|
|
target.file.versioned="${android-extensions.plugin.xml.versioned}"
|
|
test.string="<version>@snapshot@</version>"/>
|
|
|
|
<substituteVersionInFile
|
|
target.file="${compiler.version.java}"
|
|
target.file.bk="${compiler.version.java.bk}"
|
|
target.file.versioned="${compiler.version.java.versioned}"
|
|
test.string="public static final String VERSION = "@snapshot@";"/>
|
|
|
|
<replicateIdeaVersion target.file="${android-extensions.plugin.xml}"/>
|
|
</target>
|
|
|
|
<target name="revertTemplateFiles">
|
|
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
|
|
<copy file="${android-extensions.plugin.xml.bk}" tofile="${android-extensions.plugin.xml}" overwrite="true"/>
|
|
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
|
|
|
|
<delete dir="${version_substitute_dir}" quiet="true"/>
|
|
</target>
|
|
|
|
<target name="pre_build" depends="writeVersionToTemplateFiles, cleanupArtifacts"/>
|
|
|
|
<target name="zipArtifacts">
|
|
<macrodef name="zipPlugin">
|
|
<attribute name="filename"/>
|
|
<attribute name="dir"/>
|
|
|
|
<sequential>
|
|
<zip destfile="@{filename}">
|
|
<zipfileset prefix="@{dir}" dir="${artifact.output.path}/@{dir}" excludes="kotlinc/bin/*"/>
|
|
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" includes="*.bat"
|
|
filemode="644"/>
|
|
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" excludes="*.bat"
|
|
filemode="755"/>
|
|
</zip>
|
|
<delete dir="${artifact.output.path}/@{dir}" quiet="true"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<zipPlugin filename="${plugin.zip}" dir="Kotlin"/>
|
|
<zipPlugin filename="${bare.plugin.zip}" dir="BareKotlin"/>
|
|
|
|
<zip destfile="${android-extensions.zip}">
|
|
<zipfileset prefix="KotlinAndroidExtensions" dir="${artifact.output.path}/KotlinAndroidExtensions"/>
|
|
</zip>
|
|
<delete dir="${artifact.output.path}/KotlinAndroidExtensions" quiet="true"/>
|
|
</target>
|
|
|
|
<macrodef name="print-statistic">
|
|
<attribute name="key"/>
|
|
<attribute name="value"/>
|
|
|
|
<sequential>
|
|
<echo message="##teamcity[buildStatisticValue key='@{key}' value='@{value}']"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="print-file-size-statistic">
|
|
<attribute name="path"/>
|
|
<attribute name="file-name"/>
|
|
|
|
<sequential>
|
|
<local name="file.size"/>
|
|
<length file="@{path}/@{file-name}" property="file.size"/>
|
|
<print-statistic key="@{file-name} size" value="${file.size}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="printStatistics">
|
|
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-runtime.jar"/>
|
|
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-reflect.jar"/>
|
|
|
|
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-jslib.jar"/>
|
|
<print-file-size-statistic path="${output}" file-name="kotlin.js"/>
|
|
<print-file-size-statistic path="${output}" file-name="builtins.js"/>
|
|
<print-file-size-statistic path="${output}" file-name="builtins.meta.js"/>
|
|
<print-file-size-statistic path="${output}" file-name="stdlib.js"/>
|
|
<print-file-size-statistic path="${output}" file-name="stdlib.meta.js"/>
|
|
</target>
|
|
|
|
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
|
|
|
|
<target name="none">
|
|
<fail message="Either specify pre_build or post_build"/>
|
|
</target>
|
|
|
|
<property name="teamcity.build.branch" value=""/>
|
|
|
|
<condition property="need.remove.artifacts" value="true">
|
|
<and>
|
|
<matches pattern="rr/.*" string="${teamcity.build.branch}"/>
|
|
<not>
|
|
<matches pattern="rr/internal/.*" string="${teamcity.build.branch}"/>
|
|
</not>
|
|
</and>
|
|
</condition>
|
|
|
|
<target name="remove_internal_artifacts" description="Remove internal artifacts for rr/* branches, but store them for rr/internal/*" if="need.remove.artifacts">
|
|
<echo message="Remove internal artifacts" />
|
|
|
|
<delete failonerror="false" verbose="true">
|
|
<fileset dir="dist">
|
|
<include name="kotlin-compiler-before-shrink.jar"/>
|
|
<include name="kotlin-for-upsource.jar"/>
|
|
<include name="kotlin-for-upsource-sources.jar"/>
|
|
<include name="kotlin-test-data.zip"/>
|
|
</fileset>
|
|
<fileset dir="out/artifacts/internal">
|
|
<include name="kotlin-ide-common.jar"/>
|
|
</fileset>
|
|
</delete>
|
|
</target>
|
|
|
|
<target name="dont_remove_internal_artifacts" unless="need.remove.artifacts">
|
|
<echo message="Internal artifacts left untouched"/>
|
|
</target>
|
|
</project>
|