Files
kotlin-fork/update_dependencies.xml
T
Ilya Chernikov d301938d23 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
2018-01-30 17:06:10 +03:00

370 lines
16 KiB
XML

<project xmlns:if="ant:if" xmlns:unless="ant:unless" name="Update Dependencies" default="update">
<import file="common.xml" optional="false"/>
<property name="automerge_dummy" value="This property is used to trick git merge. Do not delete empty lines around."/>
<property name="kotlin.bootstrap.branch" value=""/>
<property name="kotlin.bootstrap.branch.locator" value=""/>
<property name="kotlin.bootstrap.locator" value="buildType:bt345,tag:bootstrap,status:SUCCESS${kotlin.bootstrap.branch.locator}"/>
<property name="kotlin.bootstrap.locator.force" value="false"/>
<property name="bootstrap.build.no.tests" value="false"/>
<!-- Uncomment to enable force version increment in branch. Set override.version.disabled to temporary disable feature without commits -->
<!--
<property name="override.version.branch" value="${kotlin.bootstrap.branch.locator}"/>
<property name="override.version.url" value="https://teamcity.jetbrains.com/guestAuth/app/rest/builds/?locator=buildType:bt345,count:1,branch:${override.version.branch}"/>
-->
<!--<property name="override.version.disabled" value="true"/>-->
<condition property="kotlinc.executable.path" value="kotlinc.bat" else="kotlinc">
<os family="windows"/>
</condition>
<property name="kotlinx.coroutines.version" value="0.20"/>
<property name="generators" value="${basedir}/generators"/>
<property name="dependencies.info.file" value="${dependencies}/dependencies.properties"/>
<property name="gradle.libs.repo" value="http://repo.gradle.org/gradle/libs-releases-local"/>
<property file="${dependencies.info.file}" prefix="dependencies.info.prev"/>
<target name="update" depends="fetch-third-party,fetch-annotations" description="Update dependencies">
</target>
<!--<target name="update_teamcity" depends="fetch-third-party,fetch-annotations">-->
<!--<execute_update_with_idea_teamcity_artifacts-->
<!--teamcity.server.url="https://teamcity.jetbrains.com"-->
<!--build.locator.request="buildType:bt410,status:SUCCESS,branch:idea/${ideaVersion}-${idea.kotlin.branch}"/>-->
<!--</target>-->
<target name="get-ivy-library">
<mkdir dir="${dependencies}/download"/>
<get-maven-library prefix="org/apache/ivy" lib="ivy" version="2.4.0" target.jar.name.base="ivy"/>
</target>
<macrodef name="get-maven-library">
<attribute name="prefix"/>
<attribute name="lib"/>
<attribute name="version"/>
<attribute name="bin" default="true"/>
<attribute name="src" default="true"/>
<attribute name="server" default="https://repo1.maven.org/maven2"/>
<attribute name="jar.name.base" default="@{lib}-@{version}"/>
<attribute name="target.jar.name.base" default="@{jar.name.base}"/>
<attribute name="path" default="@{prefix}/@{lib}/@{version}/@{jar.name.base}"/>
<attribute name="download" default="${dependencies}/download"/>
<attribute name="dependencies" default="${dependencies}"/>
<sequential>
<sequential if:true="@{bin}">
<get src="@{server}/@{path}.jar" dest="@{download}/@{jar.name.base}.jar" usetimestamp="true"/>
<copy file="@{download}/@{jar.name.base}.jar" tofile="@{dependencies}/@{target.jar.name.base}.jar" overwrite="true"/>
</sequential>
<sequential if:true="@{src}">
<get src="@{server}/@{path}-sources.jar" dest="@{download}/@{jar.name.base}-sources.jar" usetimestamp="true"/>
<copy file="@{download}/@{jar.name.base}-sources.jar" tofile="@{dependencies}/@{target.jar.name.base}-sources.jar"
overwrite="true"/>
</sequential>
</sequential>
</macrodef>
<!--
This doesn't download sources, see https://issues.apache.org/jira/browse/IVY-1003.
Please download sources manually if you need them.
-->
<macrodef name="get-maven-library-with-dependencies">
<attribute name="group"/>
<attribute name="artifact"/>
<attribute name="version"/>
<attribute name="target.dir" default="maven"/>
<sequential>
<mkdir dir="${dependencies}/@{target.dir}"/>
<java classname="org.apache.ivy.Main" fork="true">
<arg value="-dependency"/>
<arg value="@{group}"/>
<arg value="@{artifact}"/>
<arg value="@{version}"/>
<arg value="-retrieve"/>
<arg value="${dependencies}/@{target.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
<classpath>
<pathelement location="${dependencies}/ivy.jar"/>
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="get-ant-library">
<attribute name="version"/>
<attribute name="folderName"/>
<sequential>
<get src="http://archive.apache.org/dist/ant/binaries/apache-ant-@{version}-bin.tar.gz"
dest="${dependencies}/download/apache-ant-@{version}-bin.tar.gz" usetimestamp="true"/>
<get src="http://archive.apache.org/dist/ant/source/apache-ant-@{version}-src.zip"
dest="${dependencies}/apache-ant-@{version}-src.zip" usetimestamp="true"/>
<delete dir="${dependencies}/@{folderName}" failonerror="false"/>
<untar src="${dependencies}/download/apache-ant-@{version}-bin.tar.gz" dest="${dependencies}" compression="gzip"/>
<move file="${dependencies}/apache-ant-@{version}" tofile="${dependencies}/@{folderName}"/>
</sequential>
</macrodef>
<target name="fetch-third-party" depends="get-ivy-library, make-dependency-dirs">
<!-- dx.jar -->
<property name="android-build-tools.zip" value="build-tools_r21.1.1-linux.zip"/>
<get
src="https://dl-ssl.google.com/android/repository/${android-build-tools.zip}"
dest="${dependencies}/download/${android-build-tools.zip}"
usetimestamp="true"/>
<unzip src="${dependencies}/download/${android-build-tools.zip}" dest="${dependencies}"/>
<property name="android-sources.tgz" value="dx.tar.gz"/>
<get
src="https://android.googlesource.com/platform/dalvik/+archive/android-5.0.0_r2/${android-sources.tgz}"
dest="${dependencies}/download/${android-sources.tgz}"
usetimestamp="true"/>
<delete dir="${dependencies}/dx-src" failonerror="false"/>
<untar src="${dependencies}/download/${android-sources.tgz}" dest="${dependencies}/dx-src" compression="gzip"/>
<mkdir dir="${dependencies}/jflex"/>
<get src="https://jetbrains.bintray.com/intellij-third-party-dependencies/org/jetbrains/intellij/deps/jflex/jflex/1.7.0/jflex-1.7.0.jar"
dest="${dependencies}/jflex/JFlex.jar" usetimestamp="true"/>
<get src="https://raw.github.com/JetBrains/intellij-community/master/tools/lexer/idea-flex.skeleton"
dest="${dependencies}/jflex/idea-flex.skeleton" usetimestamp="true"/>
<!-- jline -->
<get-maven-library prefix="org/jline" lib="jline" version="3.3.1" target.jar.name.base="jline3"/>
<!-- jansi -->
<get-maven-library prefix="org/fusesource/jansi" lib="jansi" version="1.16" target.jar.name.base="jansi"/>
<!-- Guava 21 sources-->
<get-maven-library prefix="com/google/guava" lib="guava" version="21.0" bin="false"/>
<!-- ASM -->
<get src="https://raw.github.com/JetBrains/intellij-community/172/lib/src/asm-src.zip"
dest="${dependencies}/asm-src.zip"/>
<!-- Junit Sources -->
<get-maven-library prefix="junit" lib="junit" version="4.12" bin="false"/>
<get-maven-library prefix="org/hamcrest" lib="hamcrest-core" version="1.3" bin="false"/>
<!-- Android SDK platform -->
<ant antfile="download_android_sdk.xml" target="download_android_sdk"/>
<!-- Javaslang -->
<get-maven-library prefix="io/javaslang" lib="javaslang" version="2.0.6"/>
<delete file="${dependencies}/android.jar" failonerror="false"/>
<get src="http://dl-ssl.google.com/android/repository/android-19_r02.zip"
dest="${dependencies}/download/android-sdk.zip" usetimestamp="true"/>
<unzip src="${dependencies}/download/android-sdk.zip" dest="${dependencies}">
<patternset>
<include name="**/android.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<download_teamcity_artifact
teamcity.server.url="https://teamcity.jetbrains.com"
build.locator.request="${markdown.locator}"
artifact.path="markdown_jar/markdown.jar"
dest="${dependencies}/markdown.jar"
usetimestamp="true"
build.number.pattern="\d+\s-\sKotlin\s[\w-+\.]+"
/>
<!-- node.js -->
<antcall target="download-nodejs-and-npm"/>
</target>
<macrodef name="download_teamcity_artifact">
<attribute name="teamcity.server.url"/>
<attribute name="build.locator.request"/>
<attribute name="artifact.path"/>
<attribute name="dest"/>
<attribute name="usetimestamp"/>
<attribute name="build.number.pattern" default="[\w-+\.]+"/>
<sequential>
<local name="artifact.build.id"/>
<local name="build.request.url"/>
<property name="build.request.url"
value="@{teamcity.server.url}/guestAuth/app/rest/builds/?locator=@{build.locator.request},count:1"/>
<echo message="Requested URL ${build.request.url}"/>
<loadresource property="artifact.build.id">
<url url="${build.request.url}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="^(.*)\sid=&quot;(\d+)&quot;(.*)$" replace="\2" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
<local name="processed.artifact.path"/>
<local name="artifact.build.number"/>
<loadresource property="artifact.build.number">
<url url="${build.request.url}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="^(.*)\snumber=&quot;(@{build.number.pattern})&quot;(.*)$" replace="\2" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="processed.artifact.path">
<string value="@{artifact.path}"/>
<filterchain>
<replacestring from="{build.number}" to="${artifact.build.number}"/>
</filterchain>
</loadresource>
<echo message="Build Number: ${artifact.build.number} Build Id: ${artifact.build.id}"/>
<get
src="@{teamcity.server.url}/guestAuth/app/rest/builds/id:${artifact.build.id}/artifacts/content/${processed.artifact.path}"
dest="@{dest}" usetimestamp="@{usetimestamp}"/>
</sequential>
</macrodef>
<macrodef name="download_and_unzip">
<attribute name="url"/>
<attribute name="dir"/>
<attribute name="usetimestamp"/>
<sequential>
<get src="@{url}" dest="@{dir}.zip" usetimestamp="@{usetimestamp}"/>
<local name="need.unpack"/>
<condition property="need.unpack">
<not>
<available file="@{dir}" type="dir"/>
</not>
</condition>
<unzip src="@{dir}.zip" dest="@{dir}" if:set="need.unpack"/>
<echo message="Folder exist - so not unpacked @{dir}" unless:set="need.unpack"/>
</sequential>
</macrodef>
<!--
Currently we use empty annotations.
Future options are:
- Drop the target when will be sure that custom annotations are unneeded
- Fill the target with downloading correct annotations
-->
<target name="fetch-annotations"/>
<target name="get_android_studio">
<condition property="android.os.tag" value="windows">
<os family="windows"/>
</condition>
<condition property="android.os.tag" value="mac">
<os family="mac"/>
</condition>
<condition property="android.os.tag" value="linux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<local name="have.android.version"/>
<condition property="have.android.version">
<and>
<isset property="android.version"/>
<isset property="android.build.version"/>
</and>
</condition>
<sequential unless:set="have.android.version">
<loadresource property="android.version">
<url url="http://tools.android.com/download/studio/canary/latest"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex
pattern="^(.*)https?://dl\.google\.com/dl/android/studio/ide-zips/([\d\.]+)/android-studio-ide(.*)$"
replace="\2" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="android.build.version">
<url url="http://tools.android.com/download/studio/canary/latest"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex
pattern="^(.*)https?://dl\.google\.com/dl/android/studio/ide-zips/[\d\.]+/android-studio-ide-([\d\.]+)-(.*)$"
replace="\2" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
</sequential>
<echo message="Download android studio: ${android.version} ${android.build.version}"/>
<property name="android.file.name" value="android-studio-ide-${android.build.version}-${android.os.tag}.zip"/>
<property name="android.studio.url"
value="http://dl.google.com/dl/android/studio/ide-zips/${android.version}/${android.file.name}"/>
<property name="android.destination.dir" value="android-studio/sdk"/>
<mkdir dir="${dependencies}/download"/>
<get src="${android.studio.url}" dest="${dependencies}/download" usetimestamp="true"/>
<delete dir="${android.destination.dir}" failonerror="false" includeemptydirs="true">
<exclude name="config/**"/>
<exclude name="system/**"/>
</delete>
<unzip src="${dependencies}/download/${android.file.name}" dest="${android.destination.dir}">
<cutdirsmapper dirs="1"/>
</unzip>
<local name="android.studio.mac"/>
<condition property="android.studio.mac">
<matches pattern=".+mac\.zip" string="${android.file.name}"/>
</condition>
<local name="android.studio.linux"/>
<condition property="android.studio.linux">
<matches pattern=".+linux\.zip" string="${android.file.name}"/>
</condition>
<exec executable="chmod" if:set="android.studio.mac">
<arg value="a+x"/>
<arg path="${android.destination.dir}/bin/fsnotifier"/>
<arg path="${android.destination.dir}/bin/inspect.sh"/>
<arg path="${android.destination.dir}/bin/printenv.py"/>
<arg path="${android.destination.dir}/bin/update_studio.sh"/>
</exec>
<exec executable="chmod" if:set="android.studio.linux">
<arg value="a+x"/>
<arg path="${android.destination.dir}/bin/fsnotifier"/>
<arg path="${android.destination.dir}/bin/fsnotifier64"/>
<arg path="${android.destination.dir}/bin/inspect.sh"/>
<arg path="${android.destination.dir}/bin/studio.sh"/>
<arg path="${android.destination.dir}/bin/update_studio.sh"/>
</exec>
</target>
</project>