mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-21 22:54:48 +01:00
chore: better bundling of binary
This commit is contained in:
parent
54965a6744
commit
b29f353c7c
3 changed files with 13 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -49,5 +49,3 @@ target
|
||||||
|
|
||||||
# Do not include generated code
|
# Do not include generated code
|
||||||
src/main/java/com/codemp/intellij/jni
|
src/main/java/com/codemp/intellij/jni
|
||||||
src/main/resources/*.so
|
|
||||||
src/main/resources/*.dll
|
|
22
build.gradle
22
build.gradle
|
@ -24,6 +24,16 @@ intellij {
|
||||||
type.set("IC")
|
type.set("IC")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def cargoDir = projectDir.toPath().resolve("target").resolve("release").toFile()
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
from(cargoDir) {
|
||||||
|
include("*.dll")
|
||||||
|
include("*.so")
|
||||||
|
into("natives/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
sinceBuild.set("222")
|
sinceBuild.set("222")
|
||||||
|
@ -44,21 +54,11 @@ tasks {
|
||||||
//run cargo build
|
//run cargo build
|
||||||
tasks.register('cargoBuild', Exec) {
|
tasks.register('cargoBuild', Exec) {
|
||||||
workingDir '.'
|
workingDir '.'
|
||||||
commandLine 'cargo', 'build'
|
commandLine 'cargo', 'build', '--release'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn cargoBuild
|
compileJava.dependsOn cargoBuild
|
||||||
|
|
||||||
//copy the generated binary into the resources folder
|
|
||||||
tasks.register('copyBinary', Copy) {
|
|
||||||
from "target/debug"
|
|
||||||
into "src/main/resources"
|
|
||||||
include "*.so", "*.dll"
|
|
||||||
dependsOn cargoBuild
|
|
||||||
}
|
|
||||||
|
|
||||||
patchPluginXml.dependsOn copyBinary
|
|
||||||
|
|
||||||
//delete old jni generated files
|
//delete old jni generated files
|
||||||
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
||||||
delete 'src/main/java/com/codemp/intellij/jni'
|
delete 'src/main/java/com/codemp/intellij/jni'
|
||||||
|
|
|
@ -21,8 +21,8 @@ public class CodeMP {
|
||||||
if(!loadedLibrary) {
|
if(!loadedLibrary) {
|
||||||
try {
|
try {
|
||||||
if(SystemInfo.isWindows) //TODO on win for some reason it bundles it twice
|
if(SystemInfo.isWindows) //TODO on win for some reason it bundles it twice
|
||||||
NativeUtils.loadLibraryFromJar("/codemp_intellij.dll");
|
NativeUtils.loadLibraryFromJar("/natives/codemp_intellij.dll");
|
||||||
else NativeUtils.loadLibraryFromJar("/libcodemp_intellij.so");
|
else NativeUtils.loadLibraryFromJar("/natives/libcodemp_intellij.so");
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in a new issue