-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
82 lines (69 loc) · 2.55 KB
/
build.gradle.kts
File metadata and controls
82 lines (69 loc) · 2.55 KB
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
plugins {
id("java")
id("com.gradleup.shadow") version "9.0.0-beta12"
id("org.jetbrains.intellij.platform") version "2.13.0"
}
group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
// Separate configuration for JARs that go into the fat driver JAR
val driverRuntime: Configuration by configurations.creating
dependencies {
implementation("com.google.code.gson:gson:2.11.0")
driverRuntime("com.google.code.gson:gson:2.11.0")
intellijPlatform {
val platformType = providers.gradleProperty("platformType")
val platformVersion = providers.gradleProperty("platformVersion")
create(platformType, platformVersion)
bundledPlugin("com.intellij.database")
pluginVerifier()
}
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
intellijPlatform {
buildSearchableOptions = false
}
// Build a fat JAR with Gson shaded in for the JDBC driver classloader
val fatDriverJar by tasks.registering(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class) {
archiveClassifier.set("driver")
archiveBaseName.set("libsql-driver")
from(sourceSets.main.map { it.output })
configurations = listOf(driverRuntime)
mergeServiceFiles()
}
tasks {
prepareSandbox {
dependsOn(fatDriverJar)
doLast {
val sandboxDir = defaultDestinationDirectory.get().asFile
val pluginDir = sandboxDir.resolve("datagrip-libsql")
val targetDir = pluginDir.resolve("datagrip-driver-libsql")
targetDir.mkdirs()
// Copy the fat driver JAR (includes Gson)
val fat = fatDriverJar.get().archiveFile.get().asFile
fat.copyTo(targetDir.resolve("libsql-driver.jar"), overwrite = true)
// Copy driver.xml from resources (single source of truth)
val driverXmlSource = file("src/main/resources/databaseDrivers/libsql-drivers.xml")
driverXmlSource.copyTo(targetDir.resolve("driver.xml"), overwrite = true)
}
}
patchPluginXml {
sinceBuild.set(providers.gradleProperty("pluginSinceBuild"))
}
signPlugin {
certificateChainFile.set(file("certificate/chain.crt"))
privateKeyFile.set(file("certificate/private.pem"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD").orEmpty())
}
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}