Skip to content

Commit

Permalink
Use broccoli memoization by default
Browse files Browse the repository at this point in the history
This closes #1112 by removing our OneShot optimization hack in favor of turning on broccoli memoization by default.

Broccoli memoization should absolutely be broccoli's default. It's not yet, but we can turn the flag on here unless users have explicitly turned it off.
  • Loading branch information
ef4 committed Feb 8, 2022
1 parent 9bc26f2 commit 0b6233c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 87 deletions.
1 change: 0 additions & 1 deletion packages/compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"debug": "^4.3.2",
"fs-extra": "^9.1.0",
"fs-tree-diff": "^2.0.1",
"heimdalljs": "^0.2.6",
"jsdom": "^16.6.0",
"lodash": "^4.17.21",
"pkg-up": "^3.1.0",
Expand Down
11 changes: 1 addition & 10 deletions packages/compat/src/build-compat-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@ import { Package } from '@embroider/core';
import SmooshPackageJSON from './smoosh-package-json';
import broccoliMergeTrees from 'broccoli-merge-trees';
import { Node } from 'broccoli-node-api';
import OneShot from './one-shot';
import buildFunnel from 'broccoli-funnel';
import { UnwatchedDir, WatchedDir } from 'broccoli-source';
import EmptyPackageTree from './empty-package-tree';

export default function cachedBuildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): Node {
let tree = buildCompatAddon(originalPackage, v1Cache);
if (!originalPackage.mayRebuild) {
tree = new OneShot(tree, originalPackage.name);
}
return tree;
}

function buildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): Node {
export default function buildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): Node {
if (originalPackage.isV2Addon()) {
// this case is needed when a native-v2 addon depends on a
// non-native-v2 addon. (The non-native one will get rewritten and
Expand Down
11 changes: 11 additions & 0 deletions packages/compat/src/compat-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ import V1App from './v1-app';
import TreeSync from 'tree-sync';
import { WatchedDir } from 'broccoli-source';

// This build stage expects to be run with broccoli memoization enabled in order
// to get good rebuild performance. We turn it on by default here, but you can
// still explicitly turn it off by setting the env var to "false".
//
// As for safetly mutating process.env: broccoli doesn't read this until a Node
// executes its build hook, so as far as I can tell there's no way we could set
// this too late.
if (typeof process.env.BROCCOLI_ENABLED_MEMOIZE === 'undefined') {
process.env.BROCCOLI_ENABLED_MEMOIZE = 'true';
}

export default class CompatAddons implements Stage {
private didBuild = false;
private destDir: string;
Expand Down
60 changes: 0 additions & 60 deletions packages/compat/src/one-shot.ts

This file was deleted.

16 changes: 0 additions & 16 deletions types/heimdalljs/index.d.ts

This file was deleted.

0 comments on commit 0b6233c

Please sign in to comment.