-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
103 lines (84 loc) · 2.44 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "com.github.m4gshm.cds.gradle"
version = "0.0.3"
plugins {
kotlin("jvm") version "1.4.20"
`java-gradle-plugin`
`maven-publish`
id("com.gradle.plugin-publish") version "0.14.0"
}
repositories {
mavenCentral()
}
val dryRunner = ":dry-runner"
dependencies {
api("org.apache.bcel:bcel:6.5.0")
compileOnly(project(dryRunner))
testImplementation(gradleApi())
testImplementation(kotlin("test"))
testImplementation("junit:junit:4.13.2")
testImplementation(project(":test-app"))
}
tasks.test {
dependsOn(":test-app:jar")
useJUnit()
val jar = tasks.findByPath("test-app:jar") as Jar
val file = jar.archiveFile.get().asFile
jvmArgs("-Dcds.test.jar=$file")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<JavaCompile> {
options.apply {
encoding = "UTF-8"
debugOptions.debugLevel = "source,lines,vars"
}
}
tasks.test {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(13))
}
)
}
gradlePlugin {
plugins {
create("cds-gradle-plugin") {
id = "com.github.m4gshm.cds"
displayName = "Class Data Sharing (CDS) gradle plugin"
description = "helper for generating and using shared classes archive in your applications."
implementationClass = "com.github.m4gshm.cds.gradle.CdsPlugin"
}
}
}
pluginBundle {
website = "https://github.com/m4gshm/cds-gradle-plugin"
vcsUrl = "https://github.com/m4gshm/cds-gradle-plugin"
tags = listOf("cds", "jsa", "class Data sharing")
}
publishing {
repositories {
maven {
name = "localPlugins"
url = uri("${System.getProperty("user.home")}/gradle-plugin-repository")
}
}
}
val copyRunner = tasks.create("copyRunner") {
doFirst {
val runnerProj = project(dryRunner)
val runnerJar = runnerProj.tasks.getByName<org.gradle.jvm.tasks.Jar>("jar").archiveFile.get().asFile
val resourcesDir = sourceSets["main"].output.resourcesDir!!
val destination = resourcesDir.toPath().resolve("META-INF").resolve(runnerJar.name).toFile()
runnerJar.copyTo(destination, true)
}
}
tasks.jar {
dependsOn(copyRunner)
}