MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / build

Method build

lib/models/builder.js:148–206  ·  view source on GitHub ↗

* @private * @method build * @return {Promise}

(addWatchDirCallback, resultAnnotation)

Source from the content-addressed store, hash-verified

146 * @return {Promise}
147 */
148 async build(addWatchDirCallback, resultAnnotation) {
149 await this.ensureBroccoliBuilder();
150
151 let buildResults, uiProgressIntervalID;
152
153 try {
154 this.project._instrumentation.start('build');
155
156 if (addWatchDirCallback) {
157 for (let path of this.builder.watchedPaths) {
158 addWatchDirCallback(path);
159 }
160 }
161
162 this.ui.startProgress(progress.format(progress()));
163
164 uiProgressIntervalID = setInterval(() => {
165 this.ui.spinner.text = progress.format(progress());
166 }, this.ui.spinner.interval);
167
168 await this.processAddonBuildSteps('preBuild');
169
170 try {
171 await this.builder.build();
172
173 // build legacy style results object (this is passed to various addon APIs)
174 buildResults = {
175 directory: this.builder.outputPath,
176 graph: this.builder.outputNodeWrapper,
177 };
178 } catch (error) {
179 this.throwFormattedBroccoliError(error);
180 }
181
182 await this.processAddonBuildSteps('postBuild', buildResults);
183
184 let outputChanges = await this.copyToOutputPath(buildResults.directory);
185
186 await this.processAddonBuildSteps(
187 'outputReady',
188 Object.assign({}, buildResults, { outputChanges, directory: this.outputPath })
189 );
190
191 return buildResults;
192 } catch (error) {
193 await this.processAddonBuildSteps('buildError', error);
194
195 // Mark this as a builder error so the watcher knows it has been handled
196 // and won't re-throw it
197 error.isBuilderError = true;
198
199 throw error;
200 } finally {
201 clearInterval(uiProgressIntervalID);
202 this.ui.stopProgress();
203 this.project._instrumentation.stopAndReport('build', buildResults, resultAnnotation);
204 this.project.configCache.clear();
205 }

Callers 1

runMethod · 0.95

Calls 6

ensureBroccoliBuilderMethod · 0.95
copyToOutputPathMethod · 0.95
stopAndReportMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected