Skip to content

Commit

Permalink
feat(@angular-devkit/architect): deprecate the current architect API
Browse files Browse the repository at this point in the history
This is done in short notice since it was always considered
experimental. Most developers already know that the API is going to
change.
  • Loading branch information
hansl authored and alexeagle committed Jan 10, 2019
1 parent 068bb40 commit 32e230d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,62 @@ import { resolve as nodeResolve } from '@angular-devkit/core/node';
import { Observable, forkJoin, of, throwError } from 'rxjs';
import { concatMap, map, tap } from 'rxjs/operators';

/**
* @deprecated
*/
export class ProjectNotFoundException extends BaseException {
constructor(projectName: string) {
super(`Project '${projectName}' could not be found in Workspace.`);
}
}

/**
* @deprecated
*/
export class TargetNotFoundException extends BaseException {
constructor(projectName: string, targetName: string) {
super(`Target '${targetName}' could not be found in project '${projectName}'.`);
}
}

/**
* @deprecated
*/
export class ConfigurationNotFoundException extends BaseException {
constructor(projectName: string, configurationName: string) {
super(`Configuration '${configurationName}' could not be found in project '${projectName}'.`);
}
}

// TODO: break this exception apart into more granular ones.
/**
* @deprecated
*/
export class BuilderCannotBeResolvedException extends BaseException {
constructor(builder: string) {
super(`Builder '${builder}' cannot be resolved.`);
}
}

/**
* @deprecated
*/
export class ArchitectNotYetLoadedException extends BaseException {
constructor() { super(`Architect needs to be loaded before Architect is used.`); }
}

/**
* @deprecated
*/
export class BuilderNotFoundException extends BaseException {
constructor(builder: string) {
super(`Builder ${builder} could not be found.`);
}
}

/**
* @deprecated
*/
export interface BuilderContext {
logger: logging.Logger;
host: virtualFs.Host<{}>;
Expand All @@ -70,37 +91,57 @@ export interface BuilderContext {
// TODO: use Build Event Protocol
// https://docs.bazel.build/versions/master/build-event-protocol.html
// https://github.com/googleapis/googleapis/tree/master/google/devtools/build/v1
// TODO: use unknown
// tslint:disable-next-line:no-any
export interface BuildEvent<BuildResultT = any> {
/**
* TODO: use unknown
* @deprecated
*/
export interface BuildEvent<BuildResultT = any> { // tslint:disable-line:no-any
success: boolean;
result?: BuildResultT;
}

/**
* @deprecated
*/
export interface Builder<OptionsT> {
run(builderConfig: BuilderConfiguration<Partial<OptionsT>>): Observable<BuildEvent>;
}

/**
* @deprecated
*/
export interface BuilderPathsMap {
builders: { [k: string]: BuilderPaths };
}

/**
* @deprecated
*/
export interface BuilderPaths {
class: Path;
schema: Path;
description: string;
}

/**
* @deprecated
*/
export interface BuilderDescription {
name: string;
schema: JsonObject;
description: string;
}

/**
* @deprecated
*/
export interface BuilderConstructor<OptionsT> {
new(context: BuilderContext): Builder<OptionsT>;
}

/**
* @deprecated
*/
export interface BuilderConfiguration<OptionsT = {}> {
root: Path;
sourceRoot?: Path;
Expand All @@ -109,26 +150,38 @@ export interface BuilderConfiguration<OptionsT = {}> {
options: OptionsT;
}

/**
* @deprecated
*/
export interface TargetSpecifier<OptionsT = {}> {
project: string;
target: string;
configuration?: string;
overrides?: Partial<OptionsT>;
}

/**
* @deprecated
*/
export interface TargetMap {
[k: string]: Target;
}

export declare type TargetOptions<T = JsonObject> = T;
export declare type TargetConfiguration<T = JsonObject> = Partial<T>;

/**
* @deprecated
*/
export interface Target<T = JsonObject> {
builder: string;
options: TargetOptions<T>;
configurations?: { [k: string]: TargetConfiguration<T> };
}

/**
* @deprecated
*/
export class Architect {
private readonly _targetsSchemaPath = join(normalize(__dirname), 'targets-schema.json');
private readonly _buildersSchemaPath = join(normalize(__dirname), 'builders-schema.json');
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/architect/src/architect_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
BuilderCannotBeResolvedException,
ConfigurationNotFoundException,
TargetNotFoundException,
} from './architect';
} from './architect-legacy';


describe('Architect', () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/angular_devkit/architect/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export * from './architect';
/**
* @deprecated
*/
export * from './architect-legacy';

0 comments on commit 32e230d

Please sign in to comment.