On 12/21/2017 11:12 AM, google via dev-servo wrote:
On 21.12.2017 06:20, Fabrice Desre wrote:
Hi,
I feature-gated the bluetooth support in >
https://github.com/fabricedesre/servo/commit/2afbaf365f6379eedf26e36a33e7cb38aba5c00a#diff-8c43e49d8f1af13938ed86125b97244c
> > There are more changes that really needed because of rustfmt that
ran > when I saved files :( but look for the web-bluetooth feature.
Maybe we should run rustfmt once on the whole tree and then put it
into pre-commit-hook, to get consistent formatting automatically ?
I'd like that, but I'm quite sure that there are cases where we want
hand tuned formatting so doing it properly will be time consuming.
In components/servo/lib.rs, you didn't disable
bluetooth_traits::BluetoothRequest.
What about the references in the Navigator JSON object ?
Indeed this is a quick hacked patch to unblock me on something else.
Absolutely not ready to be submitted in any way.
I'd like to make several features optional, which I'll never need >>
and don't want on my systems (eg. bluetooth, webvr, ...).>>>> I've
already started w/ adding conditional compiles, but that doesn't>> catch
everything (and i don't like to patches w/ hard removals):>>>> * IDL
code generator currently processes all *.webidl files,>> no explicit
lists that can be created on build options>> * webidl doesn't have any
preprocessor/conditional compile yet> > I don't know how much of that
codegen is driven by cargo vs. mach. I > think cargo should let us do
that properly.
I'm pretty fresh w/ rust+cargo ... can you give me some hint how to
pass the chosen features down to the generator python script ?
I don't know yet how the binding generator is hooked up in the build
system, so I can't answer that.
* cargo seems to compile all *.rs files - no explicit lists, that
can be made depending on features.
using #[cfg(..)] let you do that in general by selecting the modules
you need.
Does it only compile those modules that are actually imported ?
Yes, if you have:
#[cfg(feature = "some-api")]
mod some_api_impl;
then some_api_impl.rs will only be compiled when the feature is set.
Same with crates.
In components/script/dom/mod.rs I see several vr* modules imported, but
not actually used. Is that for getting them compiled ?
Do they register themselves automatically ? Is that what #[dom_struct]
does ? Can we move these imports to a separate module, so we'd need
only #[cfg(...)] for that ?
That's possible, I haven't looked into that.
Yeah, the new() function takes a reference to BluetoothRequest,
therefore this needs to be defined in the first place - which I had
cut out. Note, I removed the bluetooth rs files, to make sure they
won't be compiled anywhere.
Unlike me, you didn't drop the dependencies to 'bluetooth' and
'bluetooth_traits' dependencies - wouldn't that mean they're still
compiled ? Or is rustc clever enough to skip them entirely ?
bluetooth_traits is still compiled, yes. I think bluetooth is not
anymore since my issue was to not bring in the android impl that doesn't
work on my android-like-but-not-really platform.
Overall, it's absolutely possible to do that cleanly and to compile only
what's needed. As I said earlier, that was just not my immediate goal.
BTW: I'd also like to make the script crate smaller, as it doesn't
compile on my 32bit environment (takes >4G process size).
well, good luck with that... compiling servo with less than 16G on a
64bits arch is a challenge. I honestly don't see the point of making
compiling on a 32bits host a priority.
Fabrice
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo