forked from facebook/buck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This adds a `rust_binary` and `rust_library` rules to Buck. Test Plan: * added many tests
- Loading branch information
Showing
35 changed files
with
1,303 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{namespace rust_common} | ||
|
||
/***/ | ||
{template .supported_language_version} | ||
Note: Buck is currently tested with (and therefore supports) version 1.1.0 of Rust. | ||
{/template} | ||
|
||
/***/ | ||
{template .deps_arg} | ||
{call buck.arg} | ||
{param name : 'deps' /} | ||
{param default : '[]' /} | ||
{param desc} | ||
The set of dependencies of this rule. Currently, this only supports rust_library rules. | ||
{/param} | ||
{/call} | ||
{/template} | ||
|
||
/***/ | ||
{template .srcs_arg} | ||
{call buck.arg} | ||
{param name : 'srcs' /} | ||
{param desc} | ||
<p> | ||
The set of Rust source files to be compiled by this rule. | ||
</p> | ||
<p> | ||
One of these files must be named <code>{lb}name{rb}.rs</code> or <code>main.rs</code>. This | ||
file will be passed to <code>rustc</code> as the crate root. | ||
</p> | ||
{/param} | ||
{/call} | ||
{/template} | ||
|
||
/***/ | ||
{template .features_arg} | ||
{call buck.arg} | ||
{param name : 'features' /} | ||
{param default : '[]' /} | ||
{param desc} | ||
<p> | ||
The set of features to be enabled for this rule. | ||
</p> | ||
<p> | ||
These are passed to <code>rustc</code> with <code>--cfg feature="{lb}feature{rb}"</code>, and | ||
can be used in the code with <code>#[cfg(feature = "{lb}feature{rb}")]</code>. | ||
</p> | ||
{/param} | ||
{/call} | ||
{/template} | ||
|
||
/***/ | ||
{template .rustc_flags_arg} | ||
{call buck.arg} | ||
{param name : 'rustc_flags' /} | ||
{param default : '[]' /} | ||
{param desc} | ||
The set of additional compiler flags to pass to <code>rustc</code>. | ||
{/param} | ||
{/call} | ||
{/template} | ||
|
||
/***/ | ||
{template .more_examples} | ||
<p> | ||
For more examples, check out our <a | ||
href="https://github.com/facebook/buck/tree/master/test/com/facebook/buck/rust/testdata/"> | ||
integration tests</a>. | ||
</p> | ||
{/template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{namespace rust_binary} | ||
|
||
/***/ | ||
{template .soyweb} | ||
{call buck.page} | ||
{param title: 'rust_binary()' /} | ||
{param prettify: true /} | ||
{param description} | ||
A rust_binary() rule builds a native Rust executable. | ||
{/param} | ||
{param content} | ||
|
||
{call buck.rule} | ||
{param status: 'UNFROZEN' /} | ||
{param overview} | ||
<p> | ||
A rust_binary() rule builds a native executable from the supplied set of Rust source files | ||
and dependencies. | ||
</p> | ||
<p> | ||
{call rust_common.supported_language_version /} | ||
</p> | ||
{/param} | ||
|
||
{param args} | ||
|
||
{call buck.arg} | ||
{param name: 'name' /} | ||
{param desc} | ||
The name of the rule. | ||
{/param} | ||
{/call} | ||
|
||
{call rust_common.srcs_arg /} | ||
|
||
{call rust_common.deps_arg /} | ||
|
||
{call rust_common.features_arg /} | ||
|
||
{call rust_common.rustc_flags_arg /} | ||
|
||
{/param} // close args | ||
|
||
{param examples} | ||
|
||
{call rust_common.more_examples /} | ||
|
||
{literal}<pre class="prettyprint lang-py"> | ||
rust_binary( | ||
name='greet', | ||
srcs=[ | ||
'greet.rs', | ||
], | ||
deps=[ | ||
':greeting', | ||
], | ||
) | ||
|
||
rust_library( | ||
name='greeting', | ||
srcs=[ | ||
'greeting.rs', | ||
], | ||
deps=[ | ||
':join', | ||
], | ||
) | ||
|
||
rust_library( | ||
name='join', | ||
srcs=[ | ||
'join.rs', | ||
], | ||
) | ||
</pre>{/literal} | ||
{/param} | ||
|
||
{/call} // close buck.rule | ||
|
||
{/param} | ||
{/call} | ||
{/template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{namespace rust_library} | ||
|
||
/***/ | ||
{template .soyweb} | ||
{call buck.page} | ||
{param title: 'rust_library()' /} | ||
{param prettify: true /} | ||
{param description} | ||
A rust_library() rule builds a native Rust library. | ||
{/param} | ||
{param content} | ||
|
||
{call buck.rule} | ||
{param status: 'UNFROZEN' /} | ||
{param overview} | ||
<p> | ||
A rust_library() rule builds a native library from the supplied set of Rust source files | ||
and dependencies. | ||
</p> | ||
<p> | ||
{call rust_common.supported_language_version /} | ||
</p> | ||
{/param} | ||
|
||
{param args} | ||
|
||
{call buck.arg} | ||
{param name: 'name' /} | ||
{param desc} | ||
The name of the rule. | ||
{/param} | ||
{/call} | ||
|
||
{call rust_common.srcs_arg /} | ||
|
||
{call rust_common.deps_arg /} | ||
|
||
{call rust_common.features_arg /} | ||
|
||
{call rust_common.rustc_flags_arg /} | ||
|
||
{/param} // close args | ||
|
||
{param examples} | ||
|
||
{call rust_common.more_examples /} | ||
|
||
{literal}<pre class="prettyprint lang-py"> | ||
rust_library( | ||
name='greeting', | ||
srcs=[ | ||
'greeting.rs', | ||
], | ||
deps=[ | ||
':join', | ||
], | ||
) | ||
</pre>{/literal} | ||
{/param} | ||
|
||
{/call} // close buck.rule | ||
|
||
{/param} | ||
{/call} | ||
{/template} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.