Migrate node_utils.xml to Gradle
This commit is contained in:
Generated
-1
@@ -18,6 +18,5 @@
|
||||
</properties>
|
||||
</buildFile>
|
||||
<buildFile url="file://$PROJECT_DIR$/TeamCityRelay.xml" />
|
||||
<buildFile url="file://$PROJECT_DIR$/node_utils.xml" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -343,6 +343,7 @@ tasks {
|
||||
|
||||
"jsCompilerTest" {
|
||||
dependsOn(":js:js.tests:test")
|
||||
dependsOn(":js:js.tests:runMocha")
|
||||
}
|
||||
|
||||
"scriptingTest" {
|
||||
|
||||
+69
-12
@@ -90,8 +90,7 @@
|
||||
"testJvm6ServerRuntime",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
"testRuntimeOnly"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -428,7 +427,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -619,6 +619,46 @@
|
||||
"signing": "org.gradle.plugins.signing.SigningExtension"
|
||||
}
|
||||
},
|
||||
":kotlin-annotation-processing-runtime": {
|
||||
"conventions": {
|
||||
"base": "org.gradle.api.plugins.BasePluginConvention",
|
||||
"java": "org.gradle.api.plugins.JavaPluginConvention",
|
||||
"maven": "org.gradle.api.plugins.MavenPluginConvention"
|
||||
},
|
||||
"configurations": [
|
||||
"apiElements",
|
||||
"archives",
|
||||
"compile",
|
||||
"compileClasspath",
|
||||
"compileOnly",
|
||||
"default",
|
||||
"distJar",
|
||||
"implementation",
|
||||
"kapt",
|
||||
"kaptTest",
|
||||
"runtime",
|
||||
"runtimeClasspath",
|
||||
"runtimeElements",
|
||||
"runtimeJar",
|
||||
"runtimeOnly",
|
||||
"signatures",
|
||||
"testCompile",
|
||||
"testCompileClasspath",
|
||||
"testCompileOnly",
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension",
|
||||
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
|
||||
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
|
||||
"reporting": "org.gradle.api.reporting.ReportingExtension",
|
||||
"signing": "org.gradle.plugins.signing.SigningExtension"
|
||||
}
|
||||
},
|
||||
":kotlin-annotations-android": {
|
||||
"conventions": {
|
||||
"base": "org.gradle.api.plugins.BasePluginConvention",
|
||||
@@ -1223,7 +1263,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -1291,7 +1332,6 @@
|
||||
"runtimeClasspath",
|
||||
"runtimeElements",
|
||||
"runtimeOnly",
|
||||
"shadow",
|
||||
"shadows",
|
||||
"signatures",
|
||||
"testCompile",
|
||||
@@ -1304,7 +1344,6 @@
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
"shadow": "com.github.jengelman.gradle.plugins.shadow.ShadowExtension",
|
||||
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
|
||||
"reporting": "org.gradle.api.reporting.ReportingExtension",
|
||||
"signing": "org.gradle.plugins.signing.SigningExtension"
|
||||
@@ -1491,7 +1530,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -2235,7 +2275,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -2939,8 +2980,7 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
"testRuntimeOnly"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -3922,6 +3962,7 @@
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
"node": "com.moowork.gradle.node.NodeExtension",
|
||||
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension",
|
||||
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
|
||||
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
|
||||
@@ -3964,6 +4005,20 @@
|
||||
"reporting": "org.gradle.api.reporting.ReportingExtension"
|
||||
}
|
||||
},
|
||||
":js:npm": {
|
||||
"conventions": {
|
||||
"base": "org.gradle.api.plugins.BasePluginConvention"
|
||||
},
|
||||
"configurations": [
|
||||
"archives",
|
||||
"default"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
"node": "com.moowork.gradle.node.NodeExtension",
|
||||
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet"
|
||||
}
|
||||
},
|
||||
":kotlin-allopen:plugin-marker": {
|
||||
"conventions": {
|
||||
"base": "org.gradle.api.plugins.BasePluginConvention",
|
||||
@@ -4323,7 +4378,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
@@ -4395,7 +4451,8 @@
|
||||
"testImplementation",
|
||||
"testRuntime",
|
||||
"testRuntimeClasspath",
|
||||
"testRuntimeOnly"
|
||||
"testRuntimeOnly",
|
||||
"tests-jar"
|
||||
],
|
||||
"extensions": {
|
||||
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
import com.moowork.gradle.node.exec.ExecRunner
|
||||
import com.moowork.gradle.node.npm.NpmExecRunner
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
|
||||
plugins {
|
||||
id("com.moowork.node").version("1.2.0")
|
||||
}
|
||||
|
||||
node {
|
||||
download = true
|
||||
}
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
@@ -52,3 +63,21 @@ projectTest("quickTest") {
|
||||
}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt")
|
||||
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
|
||||
|
||||
val install by task<NpmTask> {
|
||||
setWorkingDir(testDataDir)
|
||||
setArgs(listOf("install"))
|
||||
}
|
||||
|
||||
val runMocha by task<NpmTask> {
|
||||
setWorkingDir(testDataDir)
|
||||
|
||||
val target = if (project.hasProperty("teamcity")) "runOnTeamcity" else "test"
|
||||
setArgs(listOf("run", target))
|
||||
|
||||
dependsOn(install, "test")
|
||||
|
||||
val check by tasks
|
||||
check.dependsOn(this)
|
||||
}
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@
|
||||
"mocha-teamcity-reporter": "1.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter mocha-teamcity-reporter"
|
||||
"runOnTeamcity": "mocha --reporter mocha-teamcity-reporter",
|
||||
"test": "mocha"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
|
||||
plugins {
|
||||
id("com.moowork.node").version("1.2.0")
|
||||
base
|
||||
}
|
||||
|
||||
description = "Node utils"
|
||||
|
||||
node {
|
||||
download = true
|
||||
}
|
||||
|
||||
val deployDir = "$buildDir/deploy_to_npm"
|
||||
val templateDir = "$projectDir/templates"
|
||||
val kotlincDir = rootProject.extra["distKotlinHomeDir"] as String
|
||||
|
||||
fun getProperty(name: String, default: String = "") = findProperty(name)?.toString() ?: default
|
||||
|
||||
val deployVersion = getProperty("kotlin.deploy.version", "0.0.0")
|
||||
val deployTag = getProperty("kotlin.deploy.tag", "dev")
|
||||
val authToken = getProperty("kotlin.npmjs.auth.token")
|
||||
val dryRun = getProperty("dryRun", "false") // Pack instead of publish
|
||||
|
||||
fun Project.createCopyTemplateTask(templateName: String): Copy {
|
||||
return task<Copy>("copy-$templateName-template") {
|
||||
from("$templateDir/$templateName")
|
||||
into("$deployDir/$templateName")
|
||||
|
||||
expand(hashMapOf("version" to deployVersion))
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.createCopyLibraryFilesTask(libraryName: String, fromJar: String): Copy {
|
||||
return task<Copy>("copy-$libraryName-library") {
|
||||
from(zipTree(fromJar).matching {
|
||||
include("$libraryName.js")
|
||||
include("$libraryName.meta.js")
|
||||
include("$libraryName.js.map")
|
||||
include("$libraryName/**")
|
||||
})
|
||||
|
||||
into("$deployDir/$libraryName")
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.createPublishToNpmTask(templateName: String): NpmTask {
|
||||
return task<NpmTask>("publish-$templateName-to-npm") {
|
||||
val deployDir = File("$deployDir/$templateName")
|
||||
setWorkingDir(deployDir)
|
||||
|
||||
val deployArgs = listOf("publish", "--//registry.npmjs.org/:_authToken=$authToken", "--tag=$deployTag")
|
||||
if (dryRun == "true") {
|
||||
println("$deployDir \$ npm arguments: $deployArgs");
|
||||
setArgs(listOf("pack"))
|
||||
}
|
||||
else {
|
||||
setArgs(deployArgs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun sequential(first: Task, vararg tasks: Task): Task {
|
||||
tasks.fold(first) { previousTask, currentTask ->
|
||||
currentTask.dependsOn(previousTask)
|
||||
}
|
||||
return tasks.last()
|
||||
}
|
||||
|
||||
val publishKotlinJs = sequential(
|
||||
createCopyTemplateTask("kotlin"),
|
||||
createCopyLibraryFilesTask("kotlin", "$kotlincDir/lib/kotlin-stdlib-js.jar"),
|
||||
createPublishToNpmTask("kotlin")
|
||||
)
|
||||
|
||||
val publishKotlinCompiler = sequential(
|
||||
createCopyTemplateTask("kotlin-compiler"),
|
||||
task<Copy>("copy-kotlin-compiler") {
|
||||
from(kotlincDir)
|
||||
into("$deployDir/kotlin-compiler")
|
||||
},
|
||||
task<Exec>("chmod-kotlinc-bin") {
|
||||
commandLine = listOf("chmod", "-R", "ugo+rx", "$deployDir/kotlin-compiler/bin")
|
||||
},
|
||||
createPublishToNpmTask("kotlin-compiler")
|
||||
)
|
||||
|
||||
val publishKotlinTest = sequential(
|
||||
createCopyTemplateTask("kotlin-test"),
|
||||
createCopyLibraryFilesTask("kotlin-test", "$kotlincDir/lib/kotlin-test-js.jar"),
|
||||
createPublishToNpmTask("kotlin-test")
|
||||
)
|
||||
|
||||
task("publishAll") {
|
||||
dependsOn(publishKotlinJs, publishKotlinTest, publishKotlinCompiler)
|
||||
}
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
<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.deploy.tag" value="dev"/>
|
||||
<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"/>
|
||||
<delete file="${node.executable}"/>
|
||||
</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"/>
|
||||
<attribute name="tag"/>
|
||||
<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/>
|
||||
|
||||
<replace file="${package_deploy_dir}/package.json" token="$version" value="@{version}" />
|
||||
|
||||
<npm command="publish" dir="${package_deploy_dir}">
|
||||
<arg value="--//registry.npmjs.org/:_authToken=${kotlin.npmjs.auth.token}"/>
|
||||
<arg value="--tag"/>
|
||||
<arg value="@{tag}"/>
|
||||
</npm>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="publish-kotlin-js-to-npm">
|
||||
<publish-to-npm template="kotlin" version="${kotlin.deploy.version}" tag="${kotlin.deploy.tag}">
|
||||
<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" />
|
||||
<copy file="${js.stdlib.output.dir}/kotlin.js.map" todir="${package_deploy_dir}" failonerror="true" />
|
||||
<copy todir="${package_deploy_dir}/kotlin" failonerror="true">
|
||||
<fileset dir="${js.stdlib.output.dir}/kotlin"/>
|
||||
</copy>
|
||||
</publish-to-npm>
|
||||
</target>
|
||||
|
||||
<target name="publish-kotlin-compiler-to-npm">
|
||||
<publish-to-npm template="kotlin-compiler" version="${kotlin.deploy.version}" tag="${kotlin.deploy.tag}">
|
||||
<copy todir="${package_deploy_dir}" failonerror="true" >
|
||||
<fileset dir="${output}/kotlinc" />
|
||||
</copy>
|
||||
<chmod perm="ugo+rx" dir="dist/deploy_to_npm/kotlin-compiler/bin" includes="*" />
|
||||
</publish-to-npm>
|
||||
</target>
|
||||
|
||||
<target name="publish-kotlin-test-js-to-npm">
|
||||
<publish-to-npm template="kotlin-test" version="${kotlin.deploy.version}" tag="${kotlin.deploy.tag}">
|
||||
<copy file="${js.stdlib.output.dir}/kotlin-test.js" todir="${package_deploy_dir}" failonerror="true" />
|
||||
<copy file="${js.stdlib.output.dir}/kotlin-test.meta.js" todir="${package_deploy_dir}" failonerror="true" />
|
||||
<copy file="${js.stdlib.output.dir}/kotlin-test.js.map" todir="${package_deploy_dir}" failonerror="true" />
|
||||
<copy todir="${package_deploy_dir}/kotlin-test" failonerror="true">
|
||||
<fileset dir="${js.stdlib.output.dir}/kotlin-test"/>
|
||||
</copy>
|
||||
</publish-to-npm>
|
||||
</target>
|
||||
|
||||
<!-- Used on TeamCity-->
|
||||
<target name="unzip-jslib.jar">
|
||||
<unzip src="${output}/kotlinc/lib/kotlin-stdlib-js.jar" dest="${js.stdlib.output.dir}"/>
|
||||
</target>
|
||||
|
||||
<!-- Used on TeamCity-->
|
||||
<target name="unzip-test-jslib.jar">
|
||||
<unzip src="${output}/kotlinc/lib/kotlin-test-js.jar" dest="${js.stdlib.output.dir}"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="run-nodejs-tests" description="Run JS backend tests in node.js" depends="download-nodejs-and-npm">
|
||||
<npm command="install" dir="js/js.translator/testData" />
|
||||
<npm command="run" dir="js/js.translator/testData" failonerror="false">
|
||||
<arg value="test"/>
|
||||
</npm>
|
||||
</target>
|
||||
</project>
|
||||
@@ -47,6 +47,7 @@ include ":kotlin-build-common",
|
||||
":js:js.translator",
|
||||
":js:js.dce",
|
||||
":js:js.tests",
|
||||
":js:npm",
|
||||
":jps-plugin",
|
||||
":kotlin-jps-plugin",
|
||||
":core:descriptors",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<project xmlns:if="ant:if" xmlns:unless="ant:unless" name="Update Dependencies" default="update">
|
||||
<import file="common.xml" optional="false"/>
|
||||
<import file="node_utils.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="172.4343.14"/>
|
||||
@@ -270,8 +269,6 @@
|
||||
build.number.pattern="\d+\s-\sKotlin\s[\w-+\.]+"
|
||||
/>
|
||||
|
||||
<!-- node.js -->
|
||||
<antcall target="download-nodejs-and-npm"/>
|
||||
</target>
|
||||
|
||||
<macrodef name="get-protobuf-and-rename-packages">
|
||||
|
||||
Reference in New Issue
Block a user