Hi Ryan and Andy!
*disclaimer: I work on the Dart team and AngularDart, which is a consumer
of both pub, bazel, and other build systems we use. I can try and answer
any other questions you have or redirect them to folks that would know
more.*
tl;dr, at one point we had *no* build system. Dart 1.0 was predicated
around having a JIT (just-in-time) source-code VM, so similar to the JS
ecosystem in ~2011/2012, there wasn't an apparent need to have a
platform-level build system (remember, Dart->JS was just going to be for
*legacy* browsers, and you did most browser development in Dartium).
Once *pub*, as a package manager, was built and shipped, there were various
opinions on whether it or another tool should play a build/asset system
role, and the current implementation of pub does via "pub serve", "pub
build", and asset transformers (commonly called "transformers").
This worked well enough for small/medium-ish size projects, but broke down
quite a bit once your project(s) got larger - designed to be an in-memory
monolithic transformation system, not a scaleable, modular build system.
Internally, because of how Google is setup, we used/were required to use
Blaze (now called "Bazel"), and new developments here helped a lot - for
example we could quickly re-compile code to JavaScript using DDC.
Externally, we considered offering full Bazel support, but shied away:
* Bazel at the time barely supported Windows, which is important to us.
* Even today, lots of our Bazel integration is Unix-specific. It would take
a lot of time, resources, and debugging to get this to work great
out-of-the-box to Windows users, and even then Bazel is pretty heavyweight
for some projects.
* Dart users *liked* the ability to author new transformers/builders, and
we already had some success with source_gen/build_runner, which generated
files on disk instead of through pub. The infamous *built_value* used this
system.
So, we took build_runner, and tried building on it. And it turned out to
work quite well. Basically, there is one user-level set of interfaces,
package:build <https://pub.dartlang.org/packages/build>, with a set of
contracts that if you follow work for pub transformers, bazel/blaze, and
build_runner.
So, where are we in EO 2017?
1. We're about to soft deprecate "pub transformers" entirely.
2. We've suspended work on shipping Bazel support externally.
3. And we're working to enhance build_runner into a longer-term solution.
If you follow our milestones for build_runner
<https://github.com/dart-lang/build/milestone/11>, you'll see we are making
quite a bit of progress, but with still more to do. Please let us know if
you have any other questions.
I've answered your questions inline below, as well.
Cheers!
~ Matan
Post by Hochhaus, AndyThanks Ryan.
Post by Ryan GonzalezDazel basically takes in a pubspec and outputs Bazel rules.
Makes sense. This matches my understanding.
Dazel was based on the idea that we could infer a build system
configuration based on your package configuration and a bit of extra
metadata. We've actually kept this model as "build_config" for
build_runner. The idea here is that users that *consume* generators would
have to do little or no work.
https://github.com/dart-lang/build/tree/master/build_config
Post by Hochhaus, AndyPost by Ryan GonzalezThe underlying rules don't need to be stable, because they're
autogenerated.
Assuming one is using dazel, this also makes sense. However, if one
plans to hand write BUILD files the inconsistency is potentially still
worth clarifying.
Unfortunately we're not in a place where it's feasible to do this with
guaranteed success - though we welcome folks contributing if this is
something that is important to you. We might revisit this story in 2018,
but not before we've shipped something that lets people move off pub
serve/build.
Post by Hochhaus, AndyPost by Ryan GonzalezI'd highly advise getting used to pub anyway
I respectfully disagree here. One of the major wins of a tool like
bazel is that it supports "multiple languages with one tool". Having a
company-wide monorepo which uses a single tool for all compiles,
tests, deployments, etc regardless of language allows developers to
move about the code base while minimizing cognitive load.
Definitely agree with ... both of you :)
Pub as a package manager is likely to stay indefinitely (similar to NPM for
Node). As far as a *build* system goes, we'll be focusing on build_runner.
We're also still working out what the long-term entry-points for
compilation, testing, deployment will be.
For example some people prefer a single monolothic tool, others would
prefer specialized packages. If you have opinions please speak up :)
Post by Hochhaus, AndyBased on the wording in the README, I would guess that Google
internally prefers the use of bazel over pub.
Because we use a single mono-repo internally without branches, there is no
reason to have dependency management, so a lot (read: all) of the benefits
of pub sort of go away anyway.
Post by Hochhaus, AndyPost by Ryan Gonzalezalthough its future as a build tool is somewhat hazy (IIRC the build
package is a replacement for pub transformers), it's still the current
dependency management tool.
Thanks! Do you happen to have a reference regarding the build package
replacing pub (so that I can learn more about the road map for the
tooling)?
See above :)
Post by Hochhaus, AndyBest,
Andy
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.