-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle.kts
141 lines (122 loc) · 3.75 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL
plugins {
java
kotlin("jvm") version "1.3.50"
`maven-publish`
id("com.jfrog.bintray") version "1.8.4"
id("org.jetbrains.dokka") version "0.10.0"
}
group = "net.plan99.nodejs"
version = "1.1"
repositories {
mavenCentral()
jcenter()
}
dependencies {
compileOnly("org.jetbrains:annotations:16.0.2")
compileOnly(kotlin("stdlib-jdk8"))
api("org.graalvm.sdk:graal-sdk:19.2.0.1")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<JavaCompile> {
// Not strictly needed but it's nice for Java users to always have parameter reflection info.
options.compilerArgs.add("-parameters")
}
val genNodeJVMScript = task<Copy>("genNodeJVMScript") {
val bootjs = "src/main/resources/boot.js"
inputs.file(bootjs)
from("src/main/resources/nodejvm")
into("$buildDir/nodejvm")
filter(ReplaceTokens::class, mapOf("tokens" to mapOf("bootjs" to file(bootjs).readText())))
fileMode = 0x000001ed // rwxr-xr-x permissions, kotlin doesn't support octal literals
}
val copyInteropJar = task<Copy>("copyInteropJar") {
dependsOn(":jar")
from("$buildDir/libs/nodejs-interop-$version.jar")
into("$buildDir/nodejvm")
}
tasks["build"].dependsOn(genNodeJVMScript, copyInteropJar)
tasks.register<Jar>("sourcesJar") {
from(sourceSets.main.get().allJava)
archiveClassifier.set("sources")
}
tasks.register<Jar>("javadocJar") {
from(tasks.javadoc)
archiveClassifier.set("javadoc")
}
publishing {
publications {
create<MavenPublication>("api") {
from(components["java"])
groupId = "net.plan99"
artifactId = "nodejvm"
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("NodeJVM")
description.set("Easier NodeJS interop for GraalVM")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("mike")
name.set("Mike Hearn")
email.set("[email protected]")
}
}
}
}
}
repositories {
maven {
// change to point to your repo, e.g. http://my.org/repo
url = uri("$buildDir/repo")
}
}
}
bintray {
user = "mikehearn"
key = System.getenv("BINTRAY_KEY")
pkg.apply {
repo = "open-source"
name = "nodejvm"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/mikehearn/nodejvm.git"
version.apply {
name = project.version.toString()
desc = "NodeJS interop for GraalVM"
}
}
setPublications("api")
}
tasks {
val dokka by getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$projectDir/docsite/docs/kotlin-api"
configuration {
jdkVersion = 8
externalDocumentationLink {
url = URL("https://www.graalvm.org/sdk/javadoc/")
packageListUrl = URL("https://www.graalvm.org/sdk/javadoc/package-list")
}
reportUndocumented = true
// Exclude the Java API.
perPackageOption {
prefix = "net.plan99.nodejs.java"
suppress = true
}
}
}
}