"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
/** Object that maps a CLI target to its default builder name. */
exports.defaultTargetBuilders = {
    build: '@angular-devkit/build-angular:browser',
    test: '@angular-devkit/build-angular:karma',
};
/** Resolves the architect options for the build target of the given project. */
function getProjectTargetOptions(project, buildTarget) {
    if (project.targets && project.targets[buildTarget] && project.targets[buildTarget].options) {
        return project.targets[buildTarget].options;
    }
    if (project.architect && project.architect[buildTarget] &&
        project.architect[buildTarget].options) {
        return project.architect[buildTarget].options;
    }
    throw new schematics_1.SchematicsException(`Cannot determine project target configuration for: ${buildTarget}.`);
}
exports.getProjectTargetOptions = getProjectTargetOptions;
/** Gets all targets from the given project that match the specified builder name. */
function getTargetsByBuilderName(project, builderName) {
    const targets = project.targets || project.architect || {};
    return Object.keys(targets)
        .filter(name => targets[name].builder === builderName)
        .map(name => targets[name]);
}
exports.getTargetsByBuilderName = getTargetsByBuilderName;
//# sourceMappingURL=project-targets.js.map