Migrate node_utils.xml to Gradle
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# Kotlin Programming Language
|
||||
|
||||
Welcome to [Kotlin](http://kotlinlang.org/)! Some handy links:
|
||||
|
||||
* [Kotlin Site](http://kotlinlang.org/)
|
||||
* [Getting Started Guide](http://kotlinlang.org/docs/tutorials/javascript/getting-started-idea/getting-started-with-intellij-idea.html)
|
||||
* [Try Kotlin](http://try.kotlinlang.org/)
|
||||
* [Kotlin Standard Library](http://kotlinlang.org/api/latest/jvm/stdlib/index.html)
|
||||
* [Issue Tracker](http://youtrack.jetbrains.com/issues/KT)
|
||||
* [Forum](https://discuss.kotlinlang.org/)
|
||||
* [Kotlin Blog](http://blog.jetbrains.com/kotlin/)
|
||||
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
|
||||
* [Public Slack channel](http://slack.kotlinlang.org/)
|
||||
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
|
||||
|
||||
## Editing Kotlin
|
||||
|
||||
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
|
||||
* [Kotlin Eclipse Plugin](http://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
|
||||
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
var execPath = __dirname + '/kotlinc-js';
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
spawn('"' + execPath + '"', args, { stdio: "inherit", shell: true }).on('exit', function(exitCode) {
|
||||
process.exit(exitCode);
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "kotlin-compiler",
|
||||
"version": "$version",
|
||||
"description": "Kotlin compiler",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://git@github.com/JetBrains/kotlin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Kotlin",
|
||||
"Language",
|
||||
"JavaScript",
|
||||
"JVM",
|
||||
"JetBrains"
|
||||
],
|
||||
"author": "JetBrains",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "kotl.in/issue"
|
||||
},
|
||||
"homepage": "kotlinlang.org",
|
||||
"bin": {
|
||||
"kotlinc-js": "bin/kotlinc-js-runner.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Kotlin Test
|
||||
|
||||
Module `kotlin-test` is used by the [Kotlin/JS](https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html)
|
||||
compiler output for performing assertions in tests, independently of the test framework being used.
|
||||
|
||||
The library includes out-of-the-box support for [Jasmine](https://jasmine.github.io/),
|
||||
[Mocha](https://mochajs.org/), [Jest](https://facebook.github.io/jest/),
|
||||
and [QUnit](http://qunitjs.com).
|
||||
|
||||
Try out the [examples](https://github.com/JetBrains/kotlin-examples/tree/master/gradle/js-tests),
|
||||
read the [forum post](https://discuss.kotlinlang.org/t/unit-testing-in-kotlin-js/3943)
|
||||
and the [library documentation](https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/index.html)
|
||||
for more information.
|
||||
|
||||
## Handy links
|
||||
|
||||
* [Kotlin Site](http://kotlinlang.org/)
|
||||
* [Getting Started Guide](http://kotlinlang.org/docs/tutorials/javascript/getting-started-idea/getting-started-with-intellij-idea.html)
|
||||
* [Try Kotlin](http://try.kotlinlang.org/)
|
||||
* [Kotlin Standard Library](http://kotlinlang.org/api/latest/jvm/stdlib/index.html)
|
||||
* [Issue Tracker](http://youtrack.jetbrains.com/issues/KT)
|
||||
* [Forum](https://discuss.kotlinlang.org/)
|
||||
* [Kotlin Blog](http://blog.jetbrains.com/kotlin/)
|
||||
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
|
||||
* [Public Slack channel](http://slack.kotlinlang.org/)
|
||||
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
|
||||
|
||||
## Editing Kotlin
|
||||
|
||||
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
|
||||
* [Kotlin Eclipse Plugin](http://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
|
||||
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "kotlin-test",
|
||||
"version": "$version",
|
||||
"description": "Standard Testing Library for Kotlin Applications",
|
||||
"main": "kotlin-test.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://git@github.com/JetBrains/kotlin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Kotlin",
|
||||
"Language",
|
||||
"Testing",
|
||||
"JavaScript",
|
||||
"JetBrains"
|
||||
],
|
||||
"author": "JetBrains",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "kotl.in/issue"
|
||||
},
|
||||
"homepage": "kotlinlang.org",
|
||||
"dependencies": {
|
||||
"kotlin": "$version"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# Kotlin Programming Language
|
||||
|
||||
Welcome to [Kotlin](http://kotlinlang.org/)! Some handy links:
|
||||
|
||||
* [Kotlin Site](http://kotlinlang.org/)
|
||||
* [Getting Started Guide](http://kotlinlang.org/docs/tutorials/javascript/getting-started-idea/getting-started-with-intellij-idea.html)
|
||||
* [Try Kotlin](http://try.kotlinlang.org/)
|
||||
* [Kotlin Standard Library](http://kotlinlang.org/api/latest/jvm/stdlib/index.html)
|
||||
* [Issue Tracker](http://youtrack.jetbrains.com/issues/KT)
|
||||
* [Forum](https://discuss.kotlinlang.org/)
|
||||
* [Kotlin Blog](http://blog.jetbrains.com/kotlin/)
|
||||
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
|
||||
* [Public Slack channel](http://slack.kotlinlang.org/)
|
||||
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
|
||||
|
||||
## Editing Kotlin
|
||||
|
||||
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
|
||||
* [Kotlin Eclipse Plugin](http://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
|
||||
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "kotlin",
|
||||
"version": "$version",
|
||||
"description": "Standard Library for Kotlin Applications",
|
||||
"main": "kotlin.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://git@github.com/JetBrains/kotlin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Kotlin",
|
||||
"Language",
|
||||
"Runtime",
|
||||
"JavaScript",
|
||||
"JetBrains"
|
||||
],
|
||||
"author": "JetBrains",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "kotl.in/issue"
|
||||
},
|
||||
"homepage": "kotlinlang.org"
|
||||
}
|
||||
Reference in New Issue
Block a user