Skip to content

Commit

Permalink
Use fixed version for cbindgen install + formatting I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-wh committed Oct 21, 2024
1 parent 0b42670 commit 7b59482
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 54 deletions.
50 changes: 31 additions & 19 deletions wooting-analog-common/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,54 +1,66 @@
[env]
HEADER_OUTPUT_DIR_C="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes"
HEADER_OUTPUT_DIR_CPP="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes-cpp"
HEADER_OUTPUT_DIR_C = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes"
HEADER_OUTPUT_DIR_CPP = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes-cpp"

HEADER_NAME="wooting-analog-common.h"
HEADER_NAME = "wooting-analog-common.h"

HEADER_PATH_CLEAN="${HEADER_OUTPUT_DIR_C}/wooting-analog-common*"
HEADER_PATH_CLEAN_CPP="${HEADER_OUTPUT_DIR_CPP}/wooting-analog-common*"
HEADER_PATH_CLEAN = "${HEADER_OUTPUT_DIR_C}/wooting-analog-common*"
HEADER_PATH_CLEAN_CPP = "${HEADER_OUTPUT_DIR_CPP}/wooting-analog-common*"

PLUGIN_GEN_PATH="${CARGO_MAKE_WORKING_DIRECTORY}/cbindgen-plugin.toml"
PLUGIN_GEN_PATH = "${CARGO_MAKE_WORKING_DIRECTORY}/cbindgen-plugin.toml"

[tasks.header-cpp]
command = "cbindgen"
args = ["-l", "c++", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}"]
args = [
"-l",
"c++",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}",
]

[tasks.header-c]
command = "cbindgen"
args = ["-l", "c", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}"]
args = [
"-l",
"c",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}",
]

[tasks.cbindgen-install]
install_crate = { crate_name = "cbindgen", rustup_component_name="cbindgen", binary="cbindgen", test_arg = "--help" }
install_crate = { crate_name = "cbindgen", rustup_component_name = "cbindgen", binary = "cbindgen", test_arg = "--help", version = "0.26.0" }
command = "cbindgen"
args = ["--version"]

[tasks.cbindgen]
#TODO: Check the rustup_component_name arg to see if it is the correct name
dependencies=["cbindgen-install", "header-c", "header-cpp"]
dependencies = ["cbindgen-install", "header-c", "header-cpp"]

[tasks.gen-headers]
env = { CBINDGEN_ARGS="-v" }
env = { CBINDGEN_ARGS = "-v" }
run_task = "cbindgen"

[tasks.verify-headers]
env = { CBINDGEN_ARGS="--verify" }
env = { CBINDGEN_ARGS = "--verify" }
run_task = "cbindgen"

[tasks.clean-headers]
#env = { HEADER_POSTFIX="*" }
script_runner = "@shell"
script = [
'''
script = ['''
rm ${HEADER_PATH_CLEAN}
rm ${HEADER_PATH_CLEAN_CPP}
'''
]
''']

[tasks.post-test]
dependencies=["verify-headers"]
dependencies = ["verify-headers"]

[tasks.post-build]
dependencies=["gen-headers"]
dependencies = ["gen-headers"]

[tasks.clean]
#dependencies=["clean-headers"]
#dependencies=["clean-headers"]
48 changes: 30 additions & 18 deletions wooting-analog-plugin-dev/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,52 +1,64 @@
[env]
HEADER_OUTPUT_DIR_C="${CARGO_MAKE_WORKING_DIRECTORY}/../includes"
HEADER_OUTPUT_DIR_CPP="${CARGO_MAKE_WORKING_DIRECTORY}/../includes-cpp"
HEADER_OUTPUT_DIR_C = "${CARGO_MAKE_WORKING_DIRECTORY}/../includes"
HEADER_OUTPUT_DIR_CPP = "${CARGO_MAKE_WORKING_DIRECTORY}/../includes-cpp"

HEADER_NAME="wooting-analog-plugin-dev.h"
HEADER_NAME = "wooting-analog-plugin-dev.h"

HEADER_PATH_CLEAN="${HEADER_OUTPUT_DIR_C}/wooting-analog-common*"
HEADER_PATH_CLEAN_CPP="${HEADER_OUTPUT_DIR_CPP}/wooting-analog-common*"
HEADER_PATH_CLEAN = "${HEADER_OUTPUT_DIR_C}/wooting-analog-common*"
HEADER_PATH_CLEAN_CPP = "${HEADER_OUTPUT_DIR_CPP}/wooting-analog-common*"


[tasks.header-cpp]
command = "cbindgen"
args = ["-l", "c++", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}"]
args = [
"-l",
"c++",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}",
]

[tasks.header-c]
command = "cbindgen"
args = ["-l", "c", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}"]
args = [
"-l",
"c",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}",
]

[tasks.cbindgen-install]
install_crate = { crate_name = "cbindgen", rustup_component_name="cbindgen", binary="cbindgen", test_arg = "--help" }
install_crate = { crate_name = "cbindgen", rustup_component_name = "cbindgen", binary = "cbindgen", test_arg = "--help", version = "0.26.0" }
command = "cbindgen"
args = ["--version"]

[tasks.cbindgen]
dependencies=["cbindgen-install", "header-c", "header-cpp"]
dependencies = ["cbindgen-install", "header-c", "header-cpp"]

[tasks.gen-headers]
env = { CBINDGEN_ARGS="-v" }
env = { CBINDGEN_ARGS = "-v" }
run_task = "cbindgen"

[tasks.verify-headers]
env = { CBINDGEN_ARGS="--verify" }
env = { CBINDGEN_ARGS = "--verify" }
run_task = "cbindgen"

[tasks.clean-headers]
#env = { HEADER_POSTFIX="*" }
script_runner = "@shell"
script = [
'''
script = ['''
rm ${HEADER_PATH_CLEAN}
rm ${HEADER_PATH_CLEAN_CPP}
'''
]
''']

[tasks.post-test]
dependencies=["verify-headers"]
dependencies = ["verify-headers"]

[tasks.post-build]
dependencies=["gen-headers"]
dependencies = ["gen-headers"]

[tasks.clean]
#dependencies=["clean-headers"]
#dependencies=["clean-headers"]
45 changes: 28 additions & 17 deletions wooting-analog-wrapper/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,62 @@
[env]
HEADER_NAME="wooting-analog-wrapper.h"
HEADER_OUTPUT_DIR_C="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes"
HEADER_OUTPUT_DIR_CPP="${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes-cpp"
HEADER_NAME = "wooting-analog-wrapper.h"
HEADER_OUTPUT_DIR_C = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes"
HEADER_OUTPUT_DIR_CPP = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/includes-cpp"

[tasks.header-cpp]
command = "cbindgen"
args = ["-l", "c++", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}"]
args = [
"-l",
"c++",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}",
]
#Include clean on the second header gen as otherwise it'll strangely fail on windows and mac

[tasks.header-c]
command = "cbindgen"
args = ["-l", "c", "${CBINDGEN_ARGS}", "--clean", "-o", "${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}"]
args = [
"-l",
"c",
"${CBINDGEN_ARGS}",
"--clean",
"-o",
"${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}",
]
#Have had to throw in clean as well as there's some weird cases where cbindgen will fail when generating all headers

[tasks.cbindgen-install]
install_crate = { crate_name = "cbindgen", rustup_component_name="cbindgen", binary="cbindgen", test_arg = "--help" }
install_crate = { crate_name = "cbindgen", rustup_component_name = "cbindgen", binary = "cbindgen", test_arg = "--help", version = "0.26.0" }
command = "cbindgen"
args = ["--version"]

[tasks.cbindgen]
dependencies=["cbindgen-install", "header-c", "header-cpp"]
dependencies = ["cbindgen-install", "header-c", "header-cpp"]

[tasks.gen-headers]
env = { CBINDGEN_ARGS="-v" }
env = { CBINDGEN_ARGS = "-v" }
run_task = "cbindgen"

[tasks.verify-headers]
env = { CBINDGEN_ARGS="--verify" }
env = { CBINDGEN_ARGS = "--verify" }
run_task = "cbindgen"

[tasks.clean-headers]
#env = { HEADER_POSTFIX="*" }
script_runner = "@shell"
script = [
'''
script = ['''
rm ${HEADER_OUTPUT_DIR_CPP}/${HEADER_NAME}
rm ${HEADER_OUTPUT_DIR_C}/${HEADER_NAME}
'''
]

''']


[tasks.post-test]
dependencies=["verify-headers"]
dependencies = ["verify-headers"]

[tasks.post-build]
dependencies=["gen-headers"]
dependencies = ["gen-headers"]

[tasks.clean]
#dependencies=["clean-headers"]
#dependencies=["clean-headers"]

0 comments on commit 7b59482

Please sign in to comment.