mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-24 16:04:48 +01:00
feat: have cargo handle folder creation instead of gradle
This commit is contained in:
parent
c3896ca997
commit
c05947466d
3 changed files with 17 additions and 21 deletions
|
@ -6,7 +6,6 @@ edition = "2021"
|
|||
[dependencies]
|
||||
codemp = { git = "ssh://git@github.com-irl/codewithotherpeopleandchangenamelater/codemp.git", tag = "v0.4.2" }
|
||||
jni = "0.21.1"
|
||||
flapigen = "0.6.0"
|
||||
rifgen = "0.1.61"
|
||||
|
||||
[build-dependencies]
|
||||
|
|
15
build.gradle
15
build.gradle
|
@ -41,8 +41,6 @@ tasks {
|
|||
}
|
||||
|
||||
//define rust tasks
|
||||
def jniSourcesFolder = 'src/main/java/com/codemp/intellij/jni'
|
||||
|
||||
tasks.register('cargoBuild', Exec) {
|
||||
workingDir '.'
|
||||
commandLine 'cargo', 'build'
|
||||
|
@ -50,21 +48,14 @@ tasks.register('cargoBuild', Exec) {
|
|||
|
||||
compileJava.dependsOn cargoBuild
|
||||
|
||||
tasks.register('prepareJniFolder') {
|
||||
mkdir jniSourcesFolder
|
||||
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
||||
delete 'src/main/java/com/codemp/intellij/jni'
|
||||
}
|
||||
|
||||
cargoBuild.dependsOn prepareJniFolder
|
||||
|
||||
tasks.register('cargoClean', Exec) {
|
||||
workingDir '.'
|
||||
commandLine 'cargo', 'clean'
|
||||
dependsOn deleteGeneratedNativeInterface
|
||||
}
|
||||
|
||||
clean.dependsOn cargoClean
|
||||
|
||||
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
||||
delete jniSourcesFolder
|
||||
}
|
||||
|
||||
cargoClean.dependsOn deleteGeneratedNativeInterface
|
14
build.rs
14
build.rs
|
@ -12,15 +12,21 @@ fn main() {
|
|||
Generator::new(TypeCases::CamelCase,Language::Java,source_folder)
|
||||
.generate_interface(&glue_file);
|
||||
|
||||
let java_gen = flapigen::Generator::new(LanguageConfig::JavaConfig(
|
||||
JavaConfig::new(
|
||||
Path::new("src")
|
||||
let jni_path = Path::new("src")
|
||||
.join("main")
|
||||
.join("java")
|
||||
.join("com")
|
||||
.join("codemp")
|
||||
.join("intellij")
|
||||
.join("jni"),
|
||||
.join("jni");
|
||||
|
||||
//create folder if it doesn't exist
|
||||
std::fs::create_dir_all(&jni_path)
|
||||
.expect("An error occurred while creating the JNI folder!");
|
||||
|
||||
let java_gen = flapigen::Generator::new(LanguageConfig::JavaConfig(
|
||||
JavaConfig::new(
|
||||
jni_path,
|
||||
"com.codemp.intellij.jni".into()
|
||||
))).rustfmt_bindings(true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue