Skip to content

Commit

Permalink
Add cargo-make support for building the examples. (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicky5124 authored Sep 4, 2020
1 parent fa03b75 commit b137f51
Show file tree
Hide file tree
Showing 18 changed files with 526 additions and 15 deletions.
285 changes: 285 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
[env]
EXAMPLES_PATH = { value = "./examples", condition = { env_not_set = ["EXAMPLES_PATH"] } }

[tasks.build]
command = "cargo"
args = ["build"]

[tasks.build_release]
extend = "build"
args = ["build", "--release"]

[tasks.build_example]
command = "cargo"
args = ["make", "--cwd", "${EXAMPLES_PATH}/${@}", "examples_build"]
dependencies = ["build"]

[tasks.build_example_release]
command = "cargo"
args = ["make", "--cwd", "${EXAMPLES_PATH}/${@}", "examples_build_release"]
dependencies = ["build_release"]

[tasks.run]
command = "cargo"
args = ["run"]

[tasks.run_release]
extend = "run"
args = ["run", "--release"]
dependencies = ["build"]

[tasks.run_example]
command = "cargo"
args = ["make", "--cwd", "${EXAMPLES_PATH}/${@}", "examples_run"]
dependencies = ["build_release"]

[tasks.run_example_release]
command = "cargo"
args = ["make", "--cwd", "${EXAMPLES_PATH}/${@}", "examples_run_release"]

[tasks.1]
alias = "run_1"

[tasks.run_1]
command = "cargo"
args = ["make", "run_example_release", "e01_basic_ping_bot"]

[tasks.build_1]
command = "cargo"
args = ["make", "build_example_release", "e01_basic_ping_bot"]

[tasks.dev_run_1]
command = "cargo"
args = ["make", "run_example", "e01_basic_ping_bot"]

[tasks.dev_build_1]
command = "cargo"
args = ["make", "build_example", "e01_basic_ping_bot"]

[tasks.2]
alias = "run_2"

[tasks.run_2]
command = "cargo"
args = ["make", "run_example_release", "e02_transparent_guild_sharding"]

[tasks.build_2]
command = "cargo"
args = ["make", "build_example_release", "e02_transparent_guild_sharding"]

[tasks.dev_run_2]
command = "cargo"
args = ["make", "run_example", "e02_transparent_guild_sharding"]

[tasks.dev_build_2]
command = "cargo"
args = ["make", "build_example", "e02_transparent_guild_sharding"]

[tasks.3]
alias = "run_3"

[tasks.run_3]
command = "cargo"
args = ["make", "run_example_release", "e03_struct_utilities"]

[tasks.build_3]
command = "cargo"
args = ["make", "build_example_release", "e03_struct_utilities"]

[tasks.dev_run_3]
command = "cargo"
args = ["make", "run_example", "e03_struct_utilities"]

[tasks.dev_build_3]
command = "cargo"
args = ["make", "build_example", "e03_struct_utilities"]

[tasks.4]
alias = "run_4"

[tasks.run_4]
command = "cargo"
args = ["make", "run_example_release", "e04_message_builder"]

[tasks.build_4]
command = "cargo"
args = ["make", "build_example_release", "e04_message_builder"]

[tasks.dev_run_4]
command = "cargo"
args = ["make", "run_example", "e04_message_builder"]

[tasks.dev_build_4]
command = "cargo"
args = ["make", "build_example", "e04_message_builder"]

[tasks.5]
alias = "run_5"

[tasks.run_5]
command = "cargo"
args = ["make", "run_example_release", "e05_command_framework"]

[tasks.build_5]
command = "cargo"
args = ["make", "build_example_release", "e05_command_framework"]

[tasks.dev_run_5]
command = "cargo"
args = ["make", "run_example", "e05_command_framework"]

[tasks.dev_build_5]
command = "cargo"
args = ["make", "build_example", "e05_command_framework"]

[tasks.6]
alias = "run_6"

[tasks.run_6]
command = "cargo"
args = ["make", "run_example_release", "e06_voice"]

[tasks.build_6]
command = "cargo"
args = ["make", "build_example_release", "e06_voice"]

[tasks.dev_run_6]
command = "cargo"
args = ["make", "run_example", "e06_voice"]

[tasks.dev_build_6]
command = "cargo"
args = ["make", "build_example", "e06_voice"]

[tasks.7]
alias = "run_7"

[tasks.run_7]
command = "cargo"
args = ["make", "run_example_release", "e07_sample_bot_structure"]

[tasks.build_7]
command = "cargo"
args = ["make", "build_example_release", "e07_sample_bot_structure"]

[tasks.dev_run_7]
command = "cargo"
args = ["make", "run_example", "e07_sample_bot_structure"]

[tasks.dev_build_7]
command = "cargo"
args = ["make", "build_example", "e07_sample_bot_structure"]

[tasks.8]
alias = "run_8"

[tasks.run_8]
command = "cargo"
args = ["make", "run_example_release", "e08_env_logging"]

[tasks.build_8]
command = "cargo"
args = ["make", "build_example_release", "e08_env_logging"]

[tasks.dev_run_8]
command = "cargo"
args = ["make", "run_example", "e08_env_logging"]

[tasks.dev_build_8]
command = "cargo"
args = ["make", "build_example", "e08_env_logging"]

[tasks.9]
alias = "run_9"

[tasks.run_9]
command = "cargo"
args = ["make", "run_example_release", "e09_shard_manager"]

[tasks.build_9]
command = "cargo"
args = ["make", "build_example_release", "e09_shard_manager"]

[tasks.dev_run_9]
command = "cargo"
args = ["make", "run_example", "e09_shard_manager"]

[tasks.dev_build_9]
command = "cargo"
args = ["make", "build_example", "e09_shard_manager"]

[tasks.10]
alias = "run_10"

[tasks.run_10]
command = "cargo"
args = ["make", "run_example_release", "e10_voice_receive"]

[tasks.build_10]
command = "cargo"
args = ["make", "build_example_release", "e10_voice_receive"]

[tasks.dev_run_10]
command = "cargo"
args = ["make", "run_example", "e10_voice_receive"]

[tasks.dev_build_10]
command = "cargo"
args = ["make", "build_example", "e10_voice_receive"]

[tasks.11]
alias = "run_11"

[tasks.run_11]
command = "cargo"
args = ["make", "run_example_release", "e11_create_message_builder"]

[tasks.build_11]
command = "cargo"
args = ["make", "build_example_release", "e11_create_message_builder"]

[tasks.dev_run_11]
command = "cargo"
args = ["make", "run_example", "e11_create_message_builder"]

[tasks.dev_build_11]
command = "cargo"
args = ["make", "build_example", "e11_create_message_builder"]

[tasks.12]
alias = "run_12"

[tasks.run_12]
command = "cargo"
args = ["make", "run_example_release", "e12_collectors"]

[tasks.build_12]
command = "cargo"
args = ["make", "build_example_release", "e12_collectors"]

[tasks.dev_run_12]
command = "cargo"
args = ["make", "run_example", "e12_collectors"]

[tasks.dev_build_12]
command = "cargo"
args = ["make", "build_example", "e12_collectors"]

[tasks.13]
alias = "run_13"

[tasks.run_13]
command = "cargo"
args = ["make", "run_example_release", "e13_gateway_intents"]

[tasks.build_13]
command = "cargo"
args = ["make", "build_example_release", "e13_gateway_intents"]

[tasks.dev_run_13]
command = "cargo"
args = ["make", "run_example", "e13_gateway_intents"]

[tasks.dev_build_13]
command = "cargo"
args = ["make", "build_example", "e13_gateway_intents"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Add the following to your `Cargo.toml` file:

```toml
[dependencies]
serenity = "0.9.0-rc.0"
serenity = "0.9.0-rc.1"
```

Serenity supports a minimum of Rust 1.39.
Expand All @@ -115,7 +115,7 @@ Cargo.toml:
[dependencies.serenity]
default-features = false
features = ["pick", "your", "feature", "names", "here"]
version = "0.9.0-rc.0"
version = "0.9.0-rc.1"
```

The default features are: `builder`, `cache`, `client`, `framework`, `gateway`,
Expand Down Expand Up @@ -175,7 +175,7 @@ features = [
"utils",
"rustls_backend",
]
version = "0.9.0-rc.0"
version = "0.9.0-rc.1"
```

# Dependencies
Expand Down
24 changes: 24 additions & 0 deletions examples/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extend = "../Makefile.toml"

[env]
EXAMPLES_PATH = "../../examples"

[tasks.build_example]
command = "cargo"
args = ["make", "--cwd", "./${@}", "examples_build"]
dependencies = ["build"]

[tasks.build_example_release]
command = "cargo"
args = ["make", "--cwd", "./${@}", "examples_build_release"]
dependencies = ["build_release"]

[tasks.run_example]
command = "cargo"
args = ["make", "--cwd", "./${@}", "examples_run"]
dependencies = ["build"]

[tasks.run_example_release]
command = "cargo"
args = ["make", "--cwd", "./${@}", "examples_run_release"]
dependencies = ["build_release"]
Loading

0 comments on commit b137f51

Please sign in to comment.