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