Skip to content

Commit 1eefde7

Browse files
committed
build(broccoli): replace stew.map with diffing replace
This fixes issues with broken symlinks that occur due to some weird interaction between stew.mv,broccoli-funnel and our diffing plugins. Closes angular#2386
1 parent 44b31f3 commit 1eefde7

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

tools/broccoli/angular_builder.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,13 @@ function writeBuildLog(result: BuildResult, name: string) {
121121
function broccoliNodeToBuildNode(broccoliNode) {
122122
let tree = broccoliNode.tree.newStyleTree || broccoliNode.tree;
123123

124-
return new BuildNode(
125-
tree.description || tree.constructor.name,
126-
tree.inputPath ? [tree.inputPath] : tree.inputPaths,
127-
tree.cachePath,
128-
tree.outputPath,
129-
broccoliNode.subtrees.map(broccoliNodeToBuildNode)
130-
);
124+
return new BuildNode(tree.description || tree.constructor.name,
125+
tree.inputPath ? [tree.inputPath] : tree.inputPaths, tree.cachePath,
126+
tree.outputPath, broccoliNode.subtrees.map(broccoliNodeToBuildNode));
131127
}
132128

133129

134130
class BuildNode {
135-
136-
constructor(public pluginName:string, public inputPaths: string[], public cachePath: string,
137-
public outputPath: string, public inputNodes: BroccoliNode[]) {
138-
}
131+
constructor(public pluginName: string, public inputPaths: string[], public cachePath: string,
132+
public outputPath: string, public inputNodes: BroccoliNode[]) {}
139133
}

tools/broccoli/trees/dart_tree.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import {MultiCopy} from './../multi_copy';
66
import destCopy from '../broccoli-dest-copy';
77
var Funnel = require('broccoli-funnel');
8-
var glob = require('glob');
98
import mergeTrees from '../broccoli-merge-trees';
109
var path = require('path');
1110
var renderLodashTemplate = require('broccoli-lodash');
@@ -25,15 +24,15 @@ function modulesFunnel(include: string[], exclude?: string[]) {
2524
/**
2625
* Replaces $SCRIPT$ in .html files with actual <script> tags.
2726
*/
28-
function replaceScriptTagInHtml(content: string, relativePath: string): string {
27+
function replaceScriptTagInHtml(placeholder: string, relativePath: string): string {
2928
var scriptTags = '';
3029
if (relativePath.match(/^benchmarks/)) {
3130
scriptTags += '<script src="url_params_to_form.js" type="text/javascript"></script>\n';
3231
}
3332
var scriptName = relativePath.replace(/.*\/([^/]+)\.html$/, '$1.dart');
3433
scriptTags += '<script src="' + scriptName + '" type="application/dart"></script>\n' +
3534
'<script src="packages/browser/dart.js" type="text/javascript"></script>';
36-
return content.replace('$SCRIPTS$', scriptTags);
35+
return scriptTags;
3736
}
3837

3938
function stripModulePrefix(relativePath: string): string {
@@ -81,7 +80,11 @@ function fixDartFolderLayout(sourceTree) {
8180

8281
function getHtmlSourcesTree() {
8382
// Replace $SCRIPT$ markers in HTML files.
84-
var htmlSrcsTree = stew.map(modulesFunnel(['*/src/**/*.html']), replaceScriptTagInHtml);
83+
var htmlSrcsTree = modulesFunnel(['*/src/**/*.html']);
84+
htmlSrcsTree = replace(
85+
htmlSrcsTree,
86+
{files: ['*/**'], patterns: [{match: '$SCRIPTS$', replacement: replaceScriptTagInHtml}]});
87+
8588
// Copy a url_params_to_form.js for each benchmark html file.
8689
var urlParamsToFormTree = new MultiCopy('', {
8790
srcPath: 'tools/build/snippets/url_params_to_form.js',

0 commit comments

Comments
 (0)