@@ -16,6 +16,45 @@ import {default as transpileWithTraceur, TRACEUR_RUNTIME_PATH} from '../traceur/
1616var projectRootDir = path . normalize ( path . join ( __dirname , '..' , '..' , '..' , '..' ) ) ;
1717
1818
19+ const kServedPaths = [
20+ // Relative (to /modules) paths to benchmark directories
21+ 'benchmarks/src' ,
22+ 'benchmarks/src/change_detection' ,
23+ 'benchmarks/src/compiler' ,
24+ 'benchmarks/src/costs' ,
25+ 'benchmarks/src/di' ,
26+ 'benchmarks/src/element_injector' ,
27+ 'benchmarks/src/largetable' ,
28+ 'benchmarks/src/naive_infinite_scroll' ,
29+ 'benchmarks/src/tree' ,
30+
31+ // Relative (to /modules) paths to external benchmark directories
32+ 'benchmarks_external/src' ,
33+ 'benchmarks_external/src/compiler' ,
34+ 'benchmarks_external/src/largetable' ,
35+ 'benchmarks_external/src/naive_infinite_scroll' ,
36+ 'benchmarks_external/src/tree' ,
37+ 'benchmarks_external/src/tree/react' ,
38+
39+ // Relative (to /modules) paths to example directories
40+ 'examples/src/benchpress' ,
41+ 'examples/src/forms' ,
42+ 'examples/src/gestures' ,
43+ 'examples/src/hello_world' ,
44+ 'examples/src/key_events' ,
45+ 'examples/src/sourcemap' ,
46+ 'examples/src/todo' ,
47+ 'examples/src/material/button' ,
48+ 'examples/src/material/checkbox' ,
49+ 'examples/src/material/dialog' ,
50+ 'examples/src/material/grid_list' ,
51+ 'examples/src/material/input' ,
52+ 'examples/src/material/progress-linear' ,
53+ 'examples/src/material/radio' ,
54+ 'examples/src/material/switcher'
55+ ] ;
56+
57+
1958module . exports = function makeBrowserTree ( options , destinationPath ) {
2059 var modulesTree = new Funnel (
2160 'modules' ,
@@ -84,26 +123,30 @@ module.exports = function makeBrowserTree(options, destinationPath) {
84123 path . relative ( projectRootDir , TRACEUR_RUNTIME_PATH )
85124 ]
86125 } ) ) ;
126+
87127 var vendorScripts_benchmark =
88128 new Funnel ( 'tools/build/snippets' , { files : [ 'url_params_to_form.js' ] , destDir : '/' } ) ;
89129 var vendorScripts_benchmarks_external =
90130 new Funnel ( 'node_modules/angular' , { files : [ 'angular.js' ] , destDir : '/' } ) ;
91131
92- var servingTrees = [ ] ;
93-
94- function copyVendorScriptsTo ( destDir ) {
95- servingTrees . push ( new Funnel ( vendorScriptsTree , { srcDir : '/' , destDir : destDir } ) ) ;
132+ // Get scripts for each benchmark or example
133+ let servingTrees = kServedPaths . reduce ( getServedFunnels , [ ] ) ;
134+ function getServedFunnels ( funnels , destDir ) {
135+ let options = {
136+ srcDir : '/' ,
137+ destDir : destDir
138+ } ;
139+ funnels . push ( new Funnel ( vendorScriptsTree , options ) ) ;
96140 if ( destDir . indexOf ( 'benchmarks' ) > - 1 ) {
97- servingTrees . push ( new Funnel ( vendorScripts_benchmark , { srcDir : '/' , destDir : destDir } ) ) ;
141+ funnels . push ( new Funnel ( vendorScripts_benchmark , options ) ) ;
98142 }
99143 if ( destDir . indexOf ( 'benchmarks_external' ) > - 1 ) {
100- servingTrees . push (
101- new Funnel ( vendorScripts_benchmarks_external , { srcDir : '/' , destDir : destDir } ) ) ;
144+ funnels . push ( new Funnel ( vendorScripts_benchmarks_external , options ) ) ;
102145 }
146+ return funnels ;
103147 }
104148
105149 function writeScriptsForPath ( relativePath , result ) {
106- copyVendorScriptsTo ( path . dirname ( relativePath ) ) ;
107150 return result . replace ( '@@FILENAME_NO_EXT' , relativePath . replace ( / \. \w + $ / , '' ) ) ;
108151 }
109152
@@ -124,11 +167,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
124167 replaceWithPath : writeScriptsForPath
125168 } ) ;
126169
127- // Copy all vendor scripts into all examples and benchmarks
128- [ 'benchmarks/src' , 'benchmarks_external/src' , 'examples/src/benchpress' ] . forEach (
129- copyVendorScriptsTo ) ;
130-
131- var scripts = mergeTrees ( servingTrees , { overwrite : true } ) ;
170+ var scripts = mergeTrees ( servingTrees ) ;
132171 var css = new Funnel ( modulesTree , { include : [ "**/*.css" ] } ) ;
133172 var polymerFiles = new Funnel ( '.' , {
134173 files : [
0 commit comments