-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle.kts
114 lines (96 loc) · 3.3 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
import java.io.ByteArrayOutputStream
import org.gradle.jvm.tasks.Jar
plugins {
kotlin("jvm") version "1.8.21"
kotlin("plugin.serialization") version "1.8.21"
id("com.adarshr.test-logger") version "3.2.0"
`maven-publish`
}
group = "com.reevajs"
version = "1.0.0"
val RELEASE = false
repositories {
mavenCentral()
mavenLocal()
maven("https://jitpack.io")
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21")
implementation("com.github.ReevaJS:mfbt:78080dba4e")
implementation("com.github.ReevaJS:regexp:78f14e1326")
implementation("org.ow2.asm:asm:9.3")
implementation("org.ow2.asm:asm-tree:9.3")
implementation("org.ow2.asm:asm-commons:9.3")
implementation("com.github.mattco98:Koffee:3b4b48e9ff")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
testImplementation("com.charleskorn.kaml:kaml:0.47.0")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:1.8.21")
testImplementation("io.strikt:strikt-core:0.34.1")
}
task("runScriptRunner", JavaExec::class) {
classpath = sourceSets.test.get().runtimeClasspath
main = "com.reevajs.reeva.test262.DebugScriptRunnerKt"
}
tasks {
test {
maxHeapSize = "8G"
useJUnitPlatform()
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xinline-classes",
"-opt-in=kotlin.RequiresOptIn",
)
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
val jarWithSources = withType(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val (publishingUsername, publishingPassword) = when {
project.hasProperty("IS_CI") -> System.getenv("REPOSILITE_USER") to System.getenv("REPOSILITE_PASSWORD")
project.hasProperty("reposilite_user") -> project.property("reposilite_user") to project.property("reposilite_password")
else -> null to null
}
if (publishingUsername != null && publishingPassword != null) {
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = if (RELEASE) project.version.toString() else getGitHash()
artifact(jarWithSources)
// ??
// from(components["kotlin"])
}
}
repositories {
maven {
name = "reposilite"
url = uri("https://repo.mattco.me/" + if (RELEASE) "releases" else "snapshots")
credentials {
username = publishingUsername as String
password = publishingPassword as String
}
}
}
}
}
}
fun getGitHash(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
return stdout.toString().trim()
}