Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions lib/bootstrap-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,6 @@ const compilerOptions = ts.getParsedCommandLineOfConfigFile(
ts.sys,
).options;

// Check if we need to profile this CLI run.
let profiler = null;
if (process.env['DEVKIT_PROFILING']) {
debugLocal('setup profiling');
try {
profiler = require('v8-profiler-node8');
} catch (err) {
throw new Error(
`Could not require 'v8-profiler-node8'. You must install it separetely with` +
`'npm install v8-profiler-node8 --no-save.\n\nOriginal error:\n\n${err}`,
);
}

profiler.startProfiling();

function exitHandler(options, _err) {
if (options.cleanup) {
const cpuProfile = profiler.stopProfiling();
const profileData = JSON.stringify(cpuProfile);
const filePath = path.resolve(process.cwd(), process.env.DEVKIT_PROFILING) + '.cpuprofile';

debugLocal('saving profiling data');
console.log(`Profiling data saved in "${filePath}": ${profileData.length} bytes`);
fs.writeFileSync(filePath, profileData);
}

if (options.exit) {
process.exit();
}
}

process.on('exit', exitHandler.bind(null, { cleanup: true }));
process.on('SIGINT', exitHandler.bind(null, { exit: true }));
process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
}

if (process.env['DEVKIT_LONG_STACK_TRACE']) {
debugLocal('setup long stack trace');
Error.stackTraceLimit = Infinity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ export const allowMangle = isPresent(mangleVariable)
export const shouldBeautify = debugOptimize.beautify;
export const allowMinify = debugOptimize.minify;

// Build profiling
const profilingVariable = process.env['NG_BUILD_PROFILING'];
export const profilingEnabled = isPresent(profilingVariable) && isEnabled(profilingVariable);

/**
* Some environments, like CircleCI which use Docker report a number of CPUs by the host and not the count of available.
* This cause `Error: Call retries were exceeded` errors when trying to use them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import {
ContextReplacementPlugin,
RuleSetRule,
SourceMapDevToolPlugin,
debug,
} from 'webpack';
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity';
import { AngularBabelLoaderOptions } from '../../babel/webpack-loader';
import { WebpackConfigOptions } from '../../utils/build-options';
import { allowMangle, profilingEnabled } from '../../utils/environment-options';
import { allowMangle } from '../../utils/environment-options';
import { loadEsmModule } from '../../utils/load-esm';
import {
CommonJsUsageWarnPlugin,
Expand Down Expand Up @@ -133,14 +132,6 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
}
}

if (profilingEnabled) {
extraPlugins.push(
new debug.ProfilingPlugin({
Comment thread
dgp1130 marked this conversation as resolved.
outputPath: path.resolve(root, 'chrome-profiler-events.json'),
}),
);
}

if (allowedCommonJsDependencies) {
// When this is not defined it means the builder doesn't support showing common js usages.
// When it does it will be an array.
Expand Down
12 changes: 0 additions & 12 deletions tests/legacy-cli/e2e/tests/build/profile.ts

This file was deleted.