[tasks.openapi-delete] cwd = "openapi" command = "rm" args = ["-rf", "spec3.sdk.json", "out"] [tasks.openapi-delete-out] cwd = "openapi" command = "rm" args = ["-rf", "out"] # verifies if all the apis are exported, and reports which are missing [tasks.verify] script = ''' #!/usr/bin/env bash for filename in src/resources/generated/*.rs ; do BASE=$(basename $filename '.rs') if ! grep -Fq "pub mod $BASE;" src/resources/generated.rs ; then echo $BASE missing module fi if ! grep -Fq "$BASE::*," src/resources.rs ; then echo $BASE missing export fi done ''' [tasks.duplicates] script = ''' rg -N --no-filename -i '^pub (struct|enum) ([A-Z][a-zA-z0-9]+).*?$' src/resources/generated -g '!placeholders.rs' -r '$2'\ | sort\ | uniq -cd ''' [tasks.openapi-generate-no-fetch] cwd = "openapi" command = "cargo" args = ["run", "spec3.sdk.json"] dependencies = ["openapi-delete-out"] [tasks.openapi-generate] cwd = "openapi" command = "cargo" args = ["run", "spec3.sdk.json", "--fetch", "current"] dependencies = ["openapi-delete-out"] [tasks.openapi-generate-latest] cwd = "openapi" command = "cargo" args = ["run", "spec3.sdk.json", "--fetch", "latest"] dependencies = ["openapi-delete-out"] [tasks.openapi-copy] cwd = "openapi" command = "rsync" # --delete so that generated files don't stick around when not # generated anymore, see https://github.com/arlyon/async-stripe/issues/229 args = ["-a", "--delete-during", "out/", "../src/resources/generated"] [tasks.fmt] command = "cargo" toolchain = "nightly" install_crate = "rustfmt" # we set this to true because missing files currently cause rustfmt to fail # which impacts our weekly CI job ignore_errors = true args = ["fmt"] [tasks.check] command = "cargo" toolchain = "nightly" install_crate = "rustfmt" args = ["fmt", "--", "--check"] [tasks.openapi-install] dependencies = ["openapi-generate", "openapi-copy", "fmt"] [tasks.openapi-install-latest] dependencies = ["openapi-generate-latest", "openapi-copy", "fmt"] [tasks.openapi-install-no-fetch] dependencies = ["openapi-generate-no-fetch", "openapi-copy", "fmt"] [config] default_to_workspace = false