build(broccoli): TreeDiffer should log associated plugin name rather than inputPath
Usually we don't care what we are diffing, but why we are diffing it. With this change we see what is causing build slowdown due to diffing.
This commit is contained in:
parent
533c64d4ea
commit
9b0fa0dedc
|
@ -102,7 +102,8 @@ class DiffingPluginWrapper implements BroccoliTree {
|
|||
let includeExtensions = this.pluginClass.includeExtensions || [];
|
||||
let excludeExtensions = this.pluginClass.excludeExtensions || [];
|
||||
this.initialized = true;
|
||||
this.treeDiffer = new TreeDiffer(this.inputPath, includeExtensions, excludeExtensions);
|
||||
this.treeDiffer =
|
||||
new TreeDiffer(this.description, this.inputPath, includeExtensions, excludeExtensions);
|
||||
this.wrappedPlugin =
|
||||
new this.pluginClass(this.inputPath, this.cachePath, this.wrappedPluginArguments[1]);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -49,7 +49,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -76,7 +76,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -123,7 +123,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('symlinks');
|
||||
let differ = new TreeDiffer('testLabel', 'symlinks');
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -190,7 +190,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1', ['.js', '.coffee']);
|
||||
let differ = new TreeDiffer('testLabel', 'dir1', ['.js', '.coffee']);
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -236,7 +236,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1', ['.ts', '.cs'], ['.d.ts', '.d.cs']);
|
||||
let differ = new TreeDiffer('testLabel', 'dir1', ['.ts', '.cs'], ['.d.ts', '.d.cs']);
|
||||
|
||||
let diffResult = differ.diffTree();
|
||||
|
||||
|
@ -277,7 +277,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
differ.diffTree();
|
||||
|
||||
testDir['dir1']['file-2.txt'] = 'new file';
|
||||
|
@ -295,7 +295,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
differ.diffTree();
|
||||
|
||||
testDir['dir1']['file-1.txt'] = 'new content';
|
||||
|
@ -316,7 +316,7 @@ describe('TreeDiffer', () => {
|
|||
};
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
differ.diffTree();
|
||||
|
||||
delete testDir['dir1']['file-1.txt'];
|
||||
|
@ -339,7 +339,7 @@ describe('TreeDiffer', () => {
|
|||
|
||||
mockfs(testDir);
|
||||
|
||||
let differ = new TreeDiffer('dir1');
|
||||
let differ = new TreeDiffer('testLabel', 'dir1');
|
||||
differ.diffTree();
|
||||
|
||||
testDir['dir1']['file-1.txt'] = 'changed content';
|
||||
|
|
|
@ -21,7 +21,7 @@ export class TreeDiffer {
|
|||
private include: RegExp = null;
|
||||
private exclude: RegExp = null;
|
||||
|
||||
constructor(private rootPath: string, includeExtensions?: string[],
|
||||
constructor(private label: string, private rootPath: string, includeExtensions?: string[],
|
||||
excludeExtensions?: string[]) {
|
||||
this.rootDirName = path.basename(rootPath);
|
||||
|
||||
|
@ -40,7 +40,7 @@ export class TreeDiffer {
|
|||
|
||||
|
||||
public diffTree(): DiffResult {
|
||||
let result = new DirtyCheckingDiffResult(this.rootDirName);
|
||||
let result = new DirtyCheckingDiffResult(this.label, this.rootDirName);
|
||||
this.dirtyCheckPath(this.rootPath, result);
|
||||
this.detectDeletionsAndUpdateFingerprints(result);
|
||||
result.endTime = Date.now();
|
||||
|
@ -127,12 +127,12 @@ class DirtyCheckingDiffResult {
|
|||
public startTime: number = Date.now();
|
||||
public endTime: number = null;
|
||||
|
||||
constructor(public name: string) {}
|
||||
constructor(public label:string, public directoryName: string) {}
|
||||
|
||||
toString() {
|
||||
return `${pad(this.name, 40)}, duration: ${pad(this.endTime - this.startTime, 5)}ms, ` +
|
||||
`${pad(this.changedPaths.length + this.removedPaths.length, 5)} changes detected ` +
|
||||
`(files: ${pad(this.filesChecked, 5)}, directories: ${pad(this.directoriesChecked, 4)})`;
|
||||
return `${pad(this.label, 30)}, ${pad(this.endTime - this.startTime, 5)}ms, ` +
|
||||
`${pad(this.changedPaths.length + this.removedPaths.length, 5)} changes ` +
|
||||
`(files: ${pad(this.filesChecked, 5)}, dirs: ${pad(this.directoriesChecked, 4)})`;
|
||||
}
|
||||
|
||||
log(verbose) {
|
||||
|
|
Loading…
Reference in New Issue