2023-08-28 12:15:05 +02:00
|
|
|
plugins {
|
|
|
|
id 'java'
|
2023-11-16 21:35:15 +01:00
|
|
|
id 'org.jetbrains.intellij' version '1.16.0'
|
2023-11-19 00:47:45 +01:00
|
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-19 00:47:45 +01:00
|
|
|
group = 'com.codemp'
|
|
|
|
version = '0.1.0'
|
2023-08-28 12:15:05 +02:00
|
|
|
|
|
|
|
java {
|
|
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2023-11-19 00:47:45 +01:00
|
|
|
maven { url 'https://jitpack.io' }
|
2023-11-16 03:02:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-11-19 00:47:45 +01:00
|
|
|
implementation 'com.github.adamheinrich:native-utils:master-SNAPSHOT'
|
2023-11-17 00:03:26 +01:00
|
|
|
implementation 'org.slf4j:slf4j-api:2.0.9'
|
2024-01-31 22:56:45 +01:00
|
|
|
implementation 'ch.qos.logback:logback-classic:1.4.12'
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
intellij {
|
2024-01-31 22:56:45 +01:00
|
|
|
version.set('2023.3')
|
2023-11-19 00:47:45 +01:00
|
|
|
type.set('IC')
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-19 00:47:45 +01:00
|
|
|
shadowJar {
|
|
|
|
archiveClassifier.set('')
|
|
|
|
dependencies {
|
|
|
|
include(dependency('com.github.adamheinrich:native-utils:master-SNAPSHOT'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def cargoDir = projectDir.toPath().resolve('target').resolve('release').toFile()
|
2023-11-18 20:21:50 +01:00
|
|
|
|
|
|
|
processResources {
|
|
|
|
from(cargoDir) {
|
2023-11-19 00:47:45 +01:00
|
|
|
include('*.dll')
|
|
|
|
include('*.so')
|
|
|
|
into('natives/')
|
2023-11-18 20:21:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-28 12:15:05 +02:00
|
|
|
tasks {
|
|
|
|
patchPluginXml {
|
2023-11-19 00:47:45 +01:00
|
|
|
sinceBuild.set('222')
|
|
|
|
untilBuild.set('232.*')
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
signPlugin {
|
2023-11-19 00:47:45 +01:00
|
|
|
certificateChain.set(System.getenv('CERTIFICATE_CHAIN'))
|
|
|
|
privateKey.set(System.getenv('PRIVATE_KEY'))
|
|
|
|
password.set(System.getenv('PRIVATE_KEY_PASSWORD'))
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
publishPlugin {
|
2023-11-19 00:47:45 +01:00
|
|
|
token.set(System.getenv('PUBLISH_TOKEN'))
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-18 18:47:58 +01:00
|
|
|
//run cargo build
|
2023-08-28 12:15:05 +02:00
|
|
|
tasks.register('cargoBuild', Exec) {
|
|
|
|
workingDir '.'
|
2023-11-18 20:21:50 +01:00
|
|
|
commandLine 'cargo', 'build', '--release'
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-18 21:08:39 +01:00
|
|
|
//must act before all other tasks who mess with resources to reliably get the binary in
|
|
|
|
patchPluginXml.dependsOn cargoBuild
|
2023-08-28 12:15:05 +02:00
|
|
|
|
2023-11-18 18:47:58 +01:00
|
|
|
//delete old jni generated files
|
2023-08-28 12:33:15 +02:00
|
|
|
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
|
|
|
delete 'src/main/java/com/codemp/intellij/jni'
|
2023-08-28 12:22:37 +02:00
|
|
|
}
|
|
|
|
|
2023-11-18 18:47:58 +01:00
|
|
|
//delete cargo build files
|
2023-08-28 12:15:05 +02:00
|
|
|
tasks.register('cargoClean', Exec) {
|
|
|
|
workingDir '.'
|
|
|
|
commandLine 'cargo', 'clean'
|
2023-08-28 12:33:15 +02:00
|
|
|
dependsOn deleteGeneratedNativeInterface
|
2023-08-28 12:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-17 00:03:26 +01:00
|
|
|
clean.dependsOn cargoClean
|
2023-11-19 00:47:45 +01:00
|
|
|
|
|
|
|
instrumentedJar.dependsOn shadowJar //TODO: instrumentedJar should use fatjar as input
|