Skip to content

Add build tools section & basic cc example #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2017

Conversation

jaemk
Copy link
Contributor

@jaemk jaemk commented Sep 27, 2017

issue #292

@budziq Here's what I've got so far. Were you thinking of a more in-depth build-tools intro? Does the wording make sense?

Copy link
Collaborator

@budziq budziq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
That is exemplar work @jaemk !

I have some minor suggestions due to not knowing how I wanted to look before you have made all the work.

Common use cases include `rust` code generation and compilation of bundled `C/C++/asm` code.
See `crates.io`'s [documentation on the matter][build-script-docs] for more information.

Notes:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the notes section here. The play button will not work anyway as these examples will be no_run anyway.

@@ -0,0 +1,122 @@
# Build Tools
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the hindsight I'm not sure if "Development Tools" would not be a better name but I'm willing to crowd source here. What do you think @jaemk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I'm thinking about it, I'm wondering what other types of examples (other than cc stuff) will eventually be included here, if any. Does something of this nature deserve a more specifically named category? Maybe one of the following?

  • External Build Tools
  • Custom Build Steps
  • Building FFI Libraries
  • Compiling and Integrating Non-Rust Code
  • Build Script Support (the conventional name used by cargo)

If not, I think Development Tools might be better for covering a broader topic-space.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm in time we might want to have here other types of support tooling such as

so imho Development Tools, Compile time or Build time dependencies might be appropriate (I'm leaning towards the last one). But I'll let you chose, its easy enough to change anytime ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of Build Time Tooling or Build Time Tools?

extern crate cc;

fn main() {
// builds a static lib: `libhello.a`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have this information in the textual description above instead of a comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made note of the output name in the example description, including a link to the compile method that talks about the naming scheme of output files. But I've also kept a comment nearby to make it clear that the compile output may not necessarily match the specified name.


fn main() {
// builds a static lib: `libhello.a`
cc::Build::new()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to see some hyperlinked references pointing to the used structs and methods as this is the firs formative example in this section.

@jaemk
Copy link
Contributor Author

jaemk commented Sep 27, 2017

Thanks @budziq! I'll get to this later tonight!

@jaemk
Copy link
Contributor Author

jaemk commented Sep 28, 2017

@budziq I went with Build Time Tooling (thoughts?) and cleaned up / added extra info to the first example's description.

Copy link
Collaborator

@budziq budziq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jaemk just some final touches and we are ready to merge! Sorry to catch the small details so late.

src/links.md Outdated
[cat-encoding-badge]: https://badge-cache.kominick.com/badge/encoding--x.svg?style=social
[cat-encoding]: https://crates.io/categories/encoding
[cat-external-ffi-bindings-badge]: https://badge-cache.kominick.com/badge/external_ffi_bindings--x.svg?style=social
[cat-external-ffi-bindings]: https://crate.io/categories/external-ffi-bindings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in the domain ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!


[build-script-docs]: http://doc.crates.io/build-script.html
[playground]: https://play.rust-lang.org
[cc-build]: https://docs.rs/cc/1.0.0/cc/struct.Build.html
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using wildcard version numbers in doc.rs links

# Build Time Tooling

This section covers "build-time" tooling, or code that is run prior to compiling a crate's source code.
Conventionally, build-time code lives in a `build.rs` file and is commonly referred to as a "build script".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to catch this this late but generally we strive to use backticks `` for code /symbols or external commands and for other text we use different form of emphasis (italics or bold). So I would change the method of emphasis for the file/language/crate/website names and use the backticks only for symbols and language keywords (extern)

src/intro.md Outdated

| Recipe | Crates | Categories |
|--------|--------|------------|
| [Compile and link statically to a bundled C library][ex-cc-static-bundled] | [![cc-badge]][cc] | [![cat-development-tools-badge]][cat-development-tools] [![cat-rust-patterns-badge]][cat-rust-patterns] [![cat-external-ffi-bindings-badge]][cat-external-ffi-bindings] |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the "rust-patterns" badge is appropriate here (infact the the "external-ffi-bindings" to as these is pretty much reselved for "*sys" crates and the bindgen)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wasn't too sure which categories were appropriate when I first start this, so I just chose a couple and forgot to ask you earlier! I agree, just Development Tools seems appropriate now.

@jaemk
Copy link
Contributor Author

jaemk commented Sep 28, 2017

@budziq No problem, thanks for the thorough read-through!

issue rust-lang-nursery#292
- Add new `build_tools.md` file/section
- Add a simple `cc` crate example
@jaemk
Copy link
Contributor Author

jaemk commented Sep 29, 2017

@budziq let me know if you see anything else

@budziq budziq merged commit 403f9e6 into rust-lang-nursery:master Sep 29, 2017
@budziq
Copy link
Collaborator

budziq commented Sep 29, 2017

Excellent work! Thanks @jaemk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants