Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

Improve build.rs to not add extra files #58

Closed
steveklabnik opened this issue Jul 21, 2017 · 4 comments
Closed

Improve build.rs to not add extra files #58

steveklabnik opened this issue Jul 21, 2017 · 4 comments

Comments

@steveklabnik
Copy link
Owner

In 718768e, we added a build.rs to properly package up the assets.

The problem is, I just spent about two hours debugging a problem that boiled down to "hey steve had a data.json file lying inside of frontend/dist for some reason. So my code was writing out a data.json, only to immediately be overwritten by the old file. Ugh!

We can't do a literal whitelist because of the hashes, but maybe blacklisting other files isn't good... I dunno.

@mgattozzi
Copy link
Contributor

Would it be possible to do it based off of suffix/prefix for now? If you removed the data.json did it work out fine? This seems similar to #53. Certain files/assets when included in the code seem to cause it to fail.

@mgattozzi
Copy link
Contributor

There have been quite a few changes to build.rs recently. Is this still an issue? I'm guessing it is but better to be up to date on it.

@steveklabnik
Copy link
Owner Author

It is, yeah. Here's how to reproduce:

> git clone https://github.com/steveklabnik/rustdoc
> cd rustdoc/frontend
> npm install
> npm run prod
> cd ..
> cargo build

You'll see that asset.in has:

Asset {
name: "data.json",
contents: include_str!("../frontend/dist/data.json")
},

@hjr3
Copy link
Contributor

hjr3 commented Aug 3, 2017

One of the things we did in cargo was to allow for glob syntax to work whitelist workspace members. See rust-lang/cargo#3979. For rustdoc, we could do something like:

let whitelist = vec!["assets/*", "ember-fetch/*", "index.hml", "robots.txt"];

We would then find every file under frontend/dist and filter it against the whitelist.

hjr3 added a commit to hjr3/rustdoc that referenced this issue Aug 4, 2017
build.rs would add every file in frontend/dist to asset.in. This would
cause hard to debug errors when files were unintentionally placed in
frontend/dist.

Fixes steveklabnik#58
hjr3 added a commit to hjr3/rustdoc that referenced this issue Aug 8, 2017
build.rs would add every file in frontend/dist to asset.in. This would
cause hard to debug errors when files were unintentionally placed in
frontend/dist.

Fixes steveklabnik#58
hjr3 added a commit to hjr3/rustdoc that referenced this issue Aug 8, 2017
build.rs would add every file in frontend/dist to asset.in. This would
cause hard to debug errors when files were unintentionally placed in
frontend/dist.

Fixes steveklabnik#58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants