-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Catch InvalidNodeError for Broccoli 2.0 and fallback to broccoli-builder #8083
10000 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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Can you retarget and rebase this against beta
branch?
lib/models/builder.js
Outdated
} | ||
|
||
// Fallback to broccoli-builder | ||
console.log(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use this.ui
instead of console
(comes from https://github.com/ember-cli/console-ui)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me to an implementation? this.ui
is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the tasks that instantiates this builder model (build, build-watch, serve) pass ui
, it should_ be present.
Lines 15 to 18 in 2805962
let builder = new Builder({ | |
ui, | |
outputPath: options.outputPath, | |
environment: options.environment, |
I’m not sure how it would end up undefined. Can you confirm that the environment that you were testing it in was setup correctly? I could imagine for example that some tests may not instantiate with the correct arguments...
lib/models/builder.js
Outdated
console.warn(chalk.yellow('---------------')); | ||
console.warn(chalk.yellow(e.message)); | ||
console.warn(chalk.yellow('---------------')); | ||
this.broccoli2 = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just removed these properties in beta branch, I'll merge upwards so that shows up on master in a few minutes
90d4b97
to
4e26d3b
Compare
I wonder if we should catch all exceptions as a result of setting up the broccoli 2 builder, for full fallback support, not just the read/rebuild api. @stefanpenner @rwjblue thoughts? |
As Stefan said, let's start with catching only the needed and dial it up from there. |
Comments addressed, we do need some state to tell the rest of the builder whether we're 10000 in fallback mode, so added that, please check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some inline comments, but also need to fix:
- Update PR to point to beta branch
- Rebase against beta
- Add real world test using our builder with
broccoli-test-helper
along with an old style plugin (we should still build)
lib/models/builder.js
Outdated
if (isExperimentEnabled('BROCCOLI_2')) { | ||
broccoli = require('broccoli'); | ||
let tmpDir; | ||
|
||
// If not using system temp dir, compatability mode with broccoli-builder, tmp in root | ||
if (!isExperimentEnabled('SYSTEM_TEMP')) { | ||
if (!systemTemp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not cache experiment values. Each branch point should call isExperimentEnabled
directly.
lib/models/builder.js
Outdated
this.tree = buildFile({ project: this.project }); | ||
} else { | ||
throw new SilentError('No ember-cli-build.js found.'); | ||
if (systemTemp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don’t cache the experiment values, always check isExperimentEnabled
lib/models/builder.js
Outdated
} | ||
|
||
// Fallback to broccoli-builder | ||
console.log(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the tasks that instantiates this builder model (build, build-watch, serve) pass ui
, it should_ be present.
Lines 15 to 18 in 2805962
let builder = new Builder({ | |
ui, | |
outputPath: options.outputPath, | |
environment: options.environment, |
I’m not sure how it would end up undefined. Can you confirm that the environment that you were testing it in was setup correctly? I could imagine for example that some tests may not instantiate with the correct arguments...
tests/unit/models/builder-test.js
Outdated
if (isExperimentEnabled('BROCCOLI_2')) { | ||
describe('fallback from broccoli 2 to broccoli-builder', function() { | ||
it('falls back to broccoli-builder if an InvalidNode error is thrown for read/rebuild api', function() { | ||
let spy = sinon.spy(console, 'warn'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed once the tests properly instantiate the builder with our MockUI object. You can reference other tests to see how to make assertions on the output when using it.
ed66e87
to
656291d
Compare
I pushed a commit that replaces Only thing left here is a "real world test". |
@rwjblue cool, thanks for that update. RE: |
The only tests that exist for the fallback behavior are very mock heavy. We should be able to author a test that uses the builder model with a pipeline that actually includes a node with the |
Ya that test definitely ticks the box, but I was generally looking for a test that uses broccoli-test-helper directly. I migrated the test you added into that format and updated. This is ready to go once CI is happy... |
@rwjblue nice, makes sense. Not sure what’s up with CI, 51 failures, not 100% sure what the issue is |
Ya, seems weird, I restarted CI... |
OK, I think I figured it out. |
Remaining CI failure is being tracked over in #8098. It does not seem related to this PR (the same test is failing in |
Ok cool. Do we need to wait until CI passes to merge then? |
Hopefully getting to passing today. Fell asleep last night doing a bisect (release is good, beta is bad), only 3 more steps to go though. |
What a way to fall asleep 😂 |
f7eaa88
to
0922e31
Compare
0922e31
to
b375cc8
Compare
As the title says. This should provide a decent level of BC for users with old plugins.
This can be tested with a new ember project, and yarn linking this branch of
ember-cli
into the new project.Then
ember install ember-browserify
which uses the old read/rebuild APIThen
ember build
results in:Now this might be too much output, perhaps we only need the
ERROR
, given thatbroccoli-builder
also outputs the offending plugin.Thoughts...