-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow multiple trees as input to Filter #175
Conversation
34be033
to
37f31d9
Compare
9f820b2
to
7ba9626
Compare
ca98c0d
to
b760b22
Compare
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 didn't review everything, but I have enough questions to pause at this point.
d084c3e
to
9e01bda
Compare
Using fs-merger 1. Allow filter developers to reduce mergeTree or funneling entire array of trees to one tree and then pass it to filter 2. Allows input array of trees as input. input/output : 1. Provides good ergonomics and avoids appending the this.outputPath Test: 1. Added additional tests to make sure that Filter can take more than one tree
9e01bda
to
bbe5f19
Compare
@@ -104,8 +101,19 @@ module.exports = class Filter extends Plugin { | |||
return !!result; | |||
} | |||
|
|||
constructor(inputTree, options) { | |||
super([inputTree], { | |||
get fsMerger() { |
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.
as implemented fsMerger
is still part of the public API for subclasses, this seems sorta strange given the above weakmap usage.
Input output facade is addressed in #187. |
try { | ||
let result; | ||
let srcPath = srcDir + '/' + relativePath; | ||
let srcDir = this.inputPaths[0]; // keeping this line to maintain the signature of the fn. |
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.
Using this.inputPaths[0]
here is breaking encapsulation, post this.input
and this.output
migration it should be possible to use only the new APIs, what features are missing or different approaches are required to make this statement true.
let forceInvalidation = invalidated.includes(relativePath); | ||
|
||
this._logger.debug('[operation:%s] %s', operation, relativePath); | ||
|
||
switch (operation) { | ||
case 'mkdir': { | ||
instrumentation.mkdir++; | ||
return fs.mkdirSync(outputPath); | ||
return this.output.mkdirSync(outputPath, { recursive: true }); |
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.
@SparshithNR ^^
|
||
if (this.dependencyInvalidation && !this.dependencies) { | ||
this.dependencies = this.processor.initialDependencies(srcDir); | ||
this.dependencies = this.processor.initialDependencies(this.inputPaths); |
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.
^^
@@ -121,6 +129,10 @@ module.exports = class Filter extends Plugin { | |||
loggerName += ' > [' + annotation + ']'; | |||
} | |||
|
|||
FSMERGER.set(this, { |
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.
Currently I am worried, that this plugin does not use this.input
, did we make a mistake with it? By not using this.input
we are making it hard for future optimizations, as ensuring all plugins go through this.input
this.output
opens many doors when it comes to future optimizations.
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 may have to make changes to the fs-merger
library to somehow match inputPaths and input to broccoli-persistent-filter
where we expect input can be broccoli-node
string
or an object with prefix/getDestinationPath
function.
Closing this as #188 is addressing this |
Example:
Since we are now allowing users to pass two paths/nodes. We avoid a uncessary merge/funnel.
Before to achive the above result we had to below sinppet.