Skip to content
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

Add needsCache and persistentOutput to internal broccoli-plugins. #918

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/compat/src/compat-adapters/ember-cli-fastboot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ export default class EmberCliFastboot extends V1Addon {

class RewriteManifest extends Plugin {
constructor(tree: Node, private scriptFilter: (file: string) => boolean, private extraAppFiles: string[]) {
super([tree], { annotation: 'embroider-compat-adapter-ember-cli-fastboot' });
super([tree], {
annotation: 'embroider-compat-adapter-ember-cli-fastboot',
persistentOutput: true,
needsCache: false,
});
}
build() {
let json = readJSONSync(join(this.inputPaths[0], 'package.json'));
Expand Down
1 change: 1 addition & 0 deletions packages/compat/src/empty-package-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class extends Plugin {
super([], {
annotation: 'empty-package-tree',
persistentOutput: true,
needsCache: false,
});
}
build() {
Expand Down
7 changes: 4 additions & 3 deletions packages/compat/src/one-shot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Builder } from 'broccoli';
import { copySync } from 'fs-extra';
import heimdall from 'heimdalljs';

class NerfHeimdallReparentingBuilder extends Builder {
class NerfHeimdallBuilder extends Builder {
/*
Replace the code used to track heimdall nodes: https://github.com/broccolijs/broccoli/blob/v3.5.2/lib/builder.ts#L463-L503

Expand All @@ -20,17 +20,18 @@ class NerfHeimdallReparentingBuilder extends Builder {
// Wraps a broccoli tree such that it (and everything it depends on) will only
// build a single time.
export default class OneShot extends Plugin {
private builder: NerfHeimdallReparentingBuilder | null;
private builder: NerfHeimdallBuilder | null;

constructor(originalTree: Node, private addonName: string) {
// from broccoli's perspective, we don't depend on any input trees!
super([], {
annotation: `@embroider/compat: ${addonName}`,
persistentOutput: true,
needsCache: false,
});

// create a nested builder in order to isolate the specific addon
this.builder = new NerfHeimdallReparentingBuilder(originalTree);
this.builder = new NerfHeimdallBuilder(originalTree);
}

async build() {
Expand Down
2 changes: 2 additions & 0 deletions packages/compat/src/rewrite-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class RewritePackageJSON extends Plugin {
constructor(inputTree: Node, private getPackageJSON: () => any) {
super([inputTree], {
annotation: 'embroider:core:rewrite-package-json',
persistentOutput: true,
needsCache: false,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/compat/src/smoosh-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default class SmooshPackageJSON extends Plugin {
constructor(inputTrees: Node[], opts: { annotation?: string } = {}) {
super(inputTrees, {
annotation: `embroider:core:smoosh-package-json:${opts?.annotation}`,
persistentOutput: true,
needsCache: false,
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/compat/src/v1-appboot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class WriteV1AppBoot extends Plugin {
constructor() {
super([], {
persistentOutput: true,
needsCache: false,
});
}
build() {
Expand All @@ -26,6 +27,7 @@ export class ReadV1AppBoot extends Plugin {
constructor(appBootTree: Node) {
super([appBootTree], {
persistentOutput: true,
needsCache: false,
});
}
build() {
Expand Down
1 change: 1 addition & 0 deletions packages/compat/src/v1-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class WriteV1Config extends Plugin {
constructor(private inputTree: V1Config, private storeConfigInMeta: boolean) {
super([inputTree], {
persistentOutput: true,
needsCache: false,
});
}
build() {
Expand Down