Skip to content

Commit

Permalink
Platform specific alias
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Jun 26, 2017
1 parent 11f3899 commit 2f27596
Show file tree
Hide file tree
Showing 10 changed files with 608 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-make"
version = "0.2.6"
version = "0.2.7"
authors = ["Sagie Gur-Ari <[email protected]>"]
description = "Rust task runner and build tool."
license = "Apache-2.0"
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,40 @@ hello

Now you can see that 'hello' was printed twice.

It is also possible to define platform specific aliases, for example:

````toml
[tasks.my_task]
linux_alias = "linux_my_task"
windows_alias = "windows_my_task"
mac_alias = "mac_my_task"

[tasks.linux_my_task]

[tasks.mac_my_task]

[tasks.windows_my_task]
````

If platform specific alias is found and matches current platform it will take precedence over the non platform alias definition.<br>
For example:

````toml
[tasks.my_task]
linux_alias = "run"
alias = "do_nothing"

[tasks.run]
script = [
"echo hello"
]

[tasks.do_nothing]
````

If you run task **my_task** on windows or mac, it will invoke the **do_nothing** task.<br>
However, if executed on a linux platform, it will invoke the **run** task.

<a name="usage-default-tasks"></a>
### Default Tasks and Extending
There is no real need to define the tasks that were shown in the previous example.<br>
Expand Down Expand Up @@ -423,6 +457,7 @@ See [contributing guide](.github/CONTRIBUTING.md)

| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2017-06-26 | v0.2.7 | Platform specific alias |
| 2017-06-26 | v0.2.6 | Enable task attributes override |
| 2017-06-25 | v0.2.3 | Added disabled task attribute support |
| 2017-06-24 | v0.2.0 | Internal fixes (renamed dependencies attribute) |
Expand Down
10 changes: 10 additions & 0 deletions docs/api/src/cargo_make/cli.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<span id="68">68</span>
<span id="69">69</span>
<span id="70">70</span>
<span id="71">71</span>
<span id="72">72</span>
<span id="73">73</span>
<span id="74">74</span>
<span id="75">75</span>
</pre><pre class="rust ">
<span class="doccomment">//! # cli</span>
<span class="doccomment">//!</span>
Expand Down Expand Up @@ -183,6 +188,11 @@
<span class="kw">fn</span> <span class="ident">run_empty_task</span>() {
<span class="ident">run</span>(<span class="string">&quot;bad.toml&quot;</span>, <span class="string">&quot;empty&quot;</span>, <span class="string">&quot;error&quot;</span>);
}

<span class="attribute">#[<span class="ident">test</span>]</span>
<span class="kw">fn</span> <span class="ident">run_file_and_task</span>() {
<span class="ident">run</span>(<span class="string">&quot;./examples/dependencies.toml&quot;</span>, <span class="string">&quot;A&quot;</span>, <span class="string">&quot;error&quot;</span>);
}
}
</pre>
</section>
Expand Down
18 changes: 18 additions & 0 deletions docs/api/src/cargo_make/command.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@
<span id="230">230</span>
<span id="231">231</span>
<span id="232">232</span>
<span id="233">233</span>
<span id="234">234</span>
<span id="235">235</span>
<span id="236">236</span>
<span id="237">237</span>
<span id="238">238</span>
<span id="239">239</span>
<span id="240">240</span>
<span id="241">241</span>
</pre><pre class="rust ">
<span class="doccomment">//! # command</span>
<span class="doccomment">//!</span>
Expand Down Expand Up @@ -463,6 +472,9 @@
<span class="ident">args</span>: <span class="prelude-val">None</span>,
<span class="ident">disabled</span>: <span class="prelude-val">None</span>,
<span class="ident">alias</span>: <span class="prelude-val">None</span>,
<span class="ident">linux_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">windows_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">mac_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">install_script</span>: <span class="prelude-val">None</span>,
<span class="ident">script</span>: <span class="prelude-val">None</span>,
<span class="ident">dependencies</span>: <span class="prelude-val">None</span>
Expand All @@ -481,6 +493,9 @@
<span class="ident">install_crate</span>: <span class="prelude-val">None</span>,
<span class="ident">disabled</span>: <span class="prelude-val">None</span>,
<span class="ident">alias</span>: <span class="prelude-val">None</span>,
<span class="ident">linux_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">windows_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">mac_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">install_script</span>: <span class="prelude-val">None</span>,
<span class="ident">script</span>: <span class="prelude-val">None</span>,
<span class="ident">dependencies</span>: <span class="prelude-val">None</span>
Expand All @@ -500,6 +515,9 @@
<span class="ident">args</span>: <span class="prelude-val">None</span>,
<span class="ident">disabled</span>: <span class="prelude-val">None</span>,
<span class="ident">alias</span>: <span class="prelude-val">None</span>,
<span class="ident">linux_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">windows_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">mac_alias</span>: <span class="prelude-val">None</span>,
<span class="ident">install_script</span>: <span class="prelude-val">None</span>,
<span class="ident">dependencies</span>: <span class="prelude-val">None</span>
};
Expand Down
Loading

0 comments on commit 2f27596

Please sign in to comment.