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]
|
[dependencies]
|
||||||
codemp = { git = "ssh://git@github.com-irl/codewithotherpeopleandchangenamelater/codemp.git", tag = "v0.4.2" }
|
codemp = { git = "ssh://git@github.com-irl/codewithotherpeopleandchangenamelater/codemp.git", tag = "v0.4.2" }
|
||||||
jni = "0.21.1"
|
jni = "0.21.1"
|
||||||
flapigen = "0.6.0"
|
|
||||||
rifgen = "0.1.61"
|
rifgen = "0.1.61"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
15
build.gradle
15
build.gradle
|
@ -41,8 +41,6 @@ tasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
//define rust tasks
|
//define rust tasks
|
||||||
def jniSourcesFolder = 'src/main/java/com/codemp/intellij/jni'
|
|
||||||
|
|
||||||
tasks.register('cargoBuild', Exec) {
|
tasks.register('cargoBuild', Exec) {
|
||||||
workingDir '.'
|
workingDir '.'
|
||||||
commandLine 'cargo', 'build'
|
commandLine 'cargo', 'build'
|
||||||
|
@ -50,21 +48,14 @@ tasks.register('cargoBuild', Exec) {
|
||||||
|
|
||||||
compileJava.dependsOn cargoBuild
|
compileJava.dependsOn cargoBuild
|
||||||
|
|
||||||
tasks.register('prepareJniFolder') {
|
tasks.register('deleteGeneratedNativeInterface', Delete) {
|
||||||
mkdir jniSourcesFolder
|
delete 'src/main/java/com/codemp/intellij/jni'
|
||||||
}
|
}
|
||||||
|
|
||||||
cargoBuild.dependsOn prepareJniFolder
|
|
||||||
|
|
||||||
tasks.register('cargoClean', Exec) {
|
tasks.register('cargoClean', Exec) {
|
||||||
workingDir '.'
|
workingDir '.'
|
||||||
commandLine 'cargo', 'clean'
|
commandLine 'cargo', 'clean'
|
||||||
|
dependsOn deleteGeneratedNativeInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
clean.dependsOn cargoClean
|
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)
|
Generator::new(TypeCases::CamelCase,Language::Java,source_folder)
|
||||||
.generate_interface(&glue_file);
|
.generate_interface(&glue_file);
|
||||||
|
|
||||||
let java_gen = flapigen::Generator::new(LanguageConfig::JavaConfig(
|
let jni_path = Path::new("src")
|
||||||
JavaConfig::new(
|
|
||||||
Path::new("src")
|
|
||||||
.join("main")
|
.join("main")
|
||||||
.join("java")
|
.join("java")
|
||||||
.join("com")
|
.join("com")
|
||||||
.join("codemp")
|
.join("codemp")
|
||||||
.join("intellij")
|
.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()
|
"com.codemp.intellij.jni".into()
|
||||||
))).rustfmt_bindings(true);
|
))).rustfmt_bindings(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue