Add tasks to download node.js (platform independently) and tasks to publish packages to npm; extract some common things to common.xml

This commit is contained in:
Zalim Bashorov
2016-10-13 16:48:05 +03:00
parent 96830e306a
commit 0a0a05d211
5 changed files with 166 additions and 39 deletions
Generated
+1
View File
@@ -18,5 +18,6 @@
</properties>
</buildFile>
<buildFile url="file://$PROJECT_DIR$/TeamCityRelay.xml" />
<buildFile url="file://$PROJECT_DIR$/node_utils.xml" />
</component>
</project>
+12 -15
View File
@@ -1,4 +1,5 @@
<project name="Kotlin" default="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="common.xml" optional="false"/>
<property file="resources/kotlinManifest.properties"/>
<!-- Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build -->
@@ -18,8 +19,6 @@
<property name="bootstrap.script.runtime" value="${bootstrap.compiler.home}/lib/kotlin-script-runtime.jar"/>
<property name="bootstrap.kotlin.test" value="${bootstrap.compiler.home}/lib/kotlin-test.jar" />
<property name="output" value="${basedir}/dist"/>
<property name="js.stdlib.output.dir" value="${output}/js"/>
<property name="intermediate-sources" value="out/src" />
<property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/>
@@ -31,8 +30,6 @@
<property name="java.target" value="1.6"/>
<property name="dependencies.dir" value="${basedir}/dependencies"/>
<condition property="bootstrap.or.local.build" value="true">
<or>
<istrue value="${bootstrap.build.no.tests}"/>
@@ -72,9 +69,9 @@
<pathelement location="${protobuf.jar}"/>
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
<fileset dir="${dependencies.dir}" includes="jansi.jar"/>
<fileset dir="${dependencies.dir}" includes="jline.jar"/>
<fileset dir="${dependencies.dir}" includes="cli-parser-1.1.2.jar"/>
<fileset dir="${dependencies}" includes="jansi.jar"/>
<fileset dir="${dependencies}" includes="jline.jar"/>
<fileset dir="${dependencies}" includes="cli-parser-1.1.2.jar"/>
<fileset dir="${basedir}/ideaSDK/jps" includes="jps-model.jar"/>
</path>
@@ -341,7 +338,7 @@
<taskdef name="closure-compiler"
classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${dependencies.dir}/closure-compiler.jar"/>
classpath="${dependencies}/closure-compiler.jar"/>
<closure-compiler
compilationLevel="${compilationLevel}"
@@ -532,8 +529,8 @@
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
<zipfileset src="${dependencies.dir}/jline.jar"/>
<zipfileset src="${dependencies.dir}/cli-parser-1.1.2.jar"/>
<zipfileset src="${dependencies}/jline.jar"/>
<zipfileset src="${dependencies}/cli-parser-1.1.2.jar"/>
<zipfileset src="${protobuf.jar}"/>
<manifest>
@@ -566,8 +563,8 @@
<target name="compiler">
<taskdef resource="proguard/ant/task.properties">
<classpath>
<pathelement path="${dependencies.dir}/proguard.jar"/>
<pathelement path="${dependencies.dir}/proguard-anttask.jar"/>
<pathelement path="${dependencies}/proguard.jar"/>
<pathelement path="${dependencies}/proguard-anttask.jar"/>
</classpath>
</taskdef>
@@ -726,13 +723,13 @@
</src>
<classpath>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${dependencies.dir}/native-platform-uberjar.jar"/>
<pathelement path="${dependencies}/native-platform-uberjar.jar"/>
</classpath>
</kotlinc>
<jar destfile="${kotlin-home}/lib/kotlin-daemon-client.jar">
<fileset dir="${output}/classes/daemon-client"/>
<zipfileset src="${dependencies.dir}/native-platform-uberjar.jar" includes="**" />
<zipfileset src="${dependencies}/native-platform-uberjar.jar" includes="**" />
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<manifest>
@@ -847,7 +844,7 @@
</src>
<compilerarg value="-Xlint:all"/>
<classpath>
<pathelement location="${dependencies.dir}/ant-1.8/lib/ant.jar"/>
<pathelement location="${dependencies}/ant-1.8/lib/ant.jar"/>
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
</classpath>
</javac2>
+29
View File
@@ -0,0 +1,29 @@
<project name="Commons">
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isLinux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<property name="dependencies" value="${basedir}/dependencies"/>
<property name="output" value="${basedir}/dist"/>
<property name="js.stdlib.output.dir" value="${output}/js"/>
<target name="make-dependency-dirs">
<mkdir dir="${dependencies}"/>
<mkdir dir="${dependencies}/download"/>
</target>
</project>
+123
View File
@@ -0,0 +1,123 @@
<project name="Node.js utils" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="common.xml" optional="false"/>
<!-- Expected that these properties will be overridden by system properties -->
<property name="kotlin.deploy.version" value="0.0.0"/>
<property name="kotlin.compiler.deploy.version" value="0.0.0"/>
<property name="kotlin.npmjs.auth.token" value="AUTH"/>
<property name="node.version" value="v6.3.1"/>
<property name="node.dir" value="${dependencies}/node"/>
<property name="node.executable" value="${node.dir}/bin/node"/>
<target name="download-nodejs-and-npm" depends="make-dependency-dirs">
<property name="linux-x86" value="linux-x86"/>
<property name="platform" value="win-x86" if:set="isWindows"/>
<property name="platform" value="darwin-x64" if:set="isMac"/>
<property name="platform" value="${linux-x86}" if:set="isLinux"/>
<property name="node.tar.gz" value="${dependencies}/download/node.tar.gz"/>
<property name="node.exe" value="${node.executable}.exe"/>
<property name="node.name.prefix" value="${platform}" unless:set="isWindows"/>
<property name="node.name.prefix" value="${linux-x86}" if:set="isWindows"/>
<property name="node.full.name" value="node-${node.version}-${node.name.prefix}"/>
<property name="url.node.tar.gz" value="https://nodejs.org/dist/${node.version}/${node.full.name}.tar.gz"/>
<property name="url.node.exe" value="https://nodejs.org/dist/${node.version}/${platform}/node.exe"/>
<get src="${url.node.tar.gz}" dest="${node.tar.gz}" usetimestamp="true"/>
<exec executable="tar" unless:set="isWindows">
<arg value="-zxf"/>
<arg path="${node.tar.gz}"/>
<arg value="-C"/>
<arg path="${dependencies}"/>
</exec>
<untar src="${node.tar.gz}" dest="${dependencies}" compression="gzip" if:set="isWindows"/>
<move file="${dependencies}/${node.full.name}" tofile="${dependencies}/node"/>
<delete dir="${dependencies}/${node.full.name}"/>
<delete file="${node.tar.gz}"/>
<sequential if:set="isWindows">
<get src="${url.node.exe}" dest="${node.exe}" usetimestamp="true"/>
</sequential>
</target>
<macrodef name="node">
<attribute name="dir" default="."/>
<attribute name="failonerror" default="true"/>
<element name="args" implicit="true"/>
<sequential>
<exec executable="${node.executable}" dir="@{dir}" failonerror="@{failonerror}">
<args/>
</exec>
</sequential>
</macrodef>
<macrodef name="npm">
<attribute name="command"/>
<attribute name="dir" default="."/>
<attribute name="failonerror" default="true"/>
<element name="args" optional="true" implicit="true"/>
<sequential>
<node dir="@{dir}" failonerror="@{failonerror}">
<arg file="${node.dir}/lib/node_modules/npm/bin/npm-cli.js"/>
<arg value="@{command}"/>
<args/>
</node>
</sequential>
</macrodef>
<macrodef name="publish-to-npm">
<attribute name="template"/>
<attribute name="version"/>
<element name="actions" optional="true" implicit="true"/>
<sequential>
<property name="deploy_to_npm_dir" value="${output}/deploy_to_npm"/>
<property name="package_deploy_dir" value="${deploy_to_npm_dir}/@{template}"/>
<delete dir="${deploy_to_npm_dir}"/>
<mkdir dir="${deploy_to_npm_dir}"/>
<copy todir="${package_deploy_dir}">
<fileset dir="js/npm.templates/@{template}"/>
</copy>
<actions/>
<npm command="version" dir="${package_deploy_dir}">
<arg value="@{version}"/>
</npm>
<npm command="publish" dir="${package_deploy_dir}">
<arg value="--//registry.npmjs.org/:_authToken=${kotlin.npmjs.auth.token}"/>
</npm>
</sequential>
</macrodef>
<target name="publish-kotlin-js-to-npm">
<publish-to-npm template="kotlin" version="${kotlin.deploy.version}">
<copy file="${js.stdlib.output.dir}/kotlin.js" todir="${package_deploy_dir}" failonerror="true" />
<copy file="${js.stdlib.output.dir}/kotlin.meta.js" todir="${package_deploy_dir}" failonerror="true" />
</publish-to-npm>
</target>
<target name="publish-kotlin-compiler-to-npm">
<publish-to-npm template="kotlin-compiler" version="${kotlin.compiler.deploy.version}">
</publish-to-npm>
</target>
<!-- Used on TeamCity-->
<target name="unzip-jslib.jar">
<unzip src="${output}/kotlinc/lib/kotlin-jslib.jar" dest="${js.stdlib.output.dir}"/>
</target>
</project>
+1 -24
View File
@@ -1,4 +1,5 @@
<project name="Update Dependencies" default="update" xmlns:if="ant:if" xmlns:unless="ant:unless">
<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="ideaVersion" value="162.1812.17"/>
@@ -26,28 +27,10 @@
-->
<!--<property name="override.version.disabled" value="true"/>-->
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isLinux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="kotlinc.executable.path" value="kotlinc.bat" else="kotlinc">
<os family="windows"/>
</condition>
<property name="dependencies" value="${basedir}/dependencies"/>
<property name="generators" value="${basedir}/generators"/>
<property name="idea.dir" value="ideaSDK"/>
@@ -184,12 +167,6 @@
<zipfileset src="${download}/${common.name}-freebsd-amd64.jar" includes="**" />
<zipfileset src="${download}/${common.name}-freebsd-i386.jar" includes="**" />
</jar>
</target>
<target name="make-dependency-dirs">
<mkdir dir="${dependencies}"/>
<mkdir dir="${dependencies}/download"/>
</target>
<target name="fetch-third-party" depends="make-dependency-dirs, make-native-platform-uberjar, fetch-idea-artifacts-for-compiler-tests">