(i: BuilderInput)
| 91 | }); |
| 92 | |
| 93 | function onInput(i: BuilderInput) { |
| 94 | const builder = i.info as BuilderInfo; |
| 95 | const loggerName = i.target ? targetStringFromTarget(i.target) : builder.builderName; |
| 96 | const logger = new logging.Logger(loggerName); |
| 97 | |
| 98 | subscriptions.push(logger.subscribe((entry) => log(entry))); |
| 99 | |
| 100 | const context: BuilderContext = { |
| 101 | builder, |
| 102 | workspaceRoot: i.workspaceRoot, |
| 103 | currentDirectory: i.currentDirectory, |
| 104 | target: i.target, |
| 105 | logger: logger, |
| 106 | id: i.id, |
| 107 | async scheduleTarget( |
| 108 | target: Target, |
| 109 | overrides: json.JsonObject = {}, |
| 110 | scheduleOptions: ScheduleOptions = {}, |
| 111 | ) { |
| 112 | const run = await scheduleByTarget(target, overrides, { |
| 113 | scheduler, |
| 114 | logger: scheduleOptions.logger || logger.createChild(''), |
| 115 | workspaceRoot: i.workspaceRoot, |
| 116 | currentDirectory: i.currentDirectory, |
| 117 | }); |
| 118 | |
| 119 | // We don't want to subscribe errors and complete. |
| 120 | subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event))); |
| 121 | |
| 122 | return run; |
| 123 | }, |
| 124 | async scheduleBuilder( |
| 125 | builderName: string, |
| 126 | options: json.JsonObject = {}, |
| 127 | scheduleOptions: ScheduleOptions = {}, |
| 128 | ) { |
| 129 | const run = await scheduleByName(builderName, options, { |
| 130 | scheduler, |
| 131 | target: scheduleOptions.target, |
| 132 | logger: scheduleOptions.logger || logger.createChild(''), |
| 133 | workspaceRoot: i.workspaceRoot, |
| 134 | currentDirectory: i.currentDirectory, |
| 135 | }); |
| 136 | |
| 137 | // We don't want to subscribe errors and complete. |
| 138 | subscriptions.push(run.progress.subscribe((event) => progressChannel.next(event))); |
| 139 | |
| 140 | return run; |
| 141 | }, |
| 142 | async getTargetOptions(target: Target) { |
| 143 | return firstValueFrom( |
| 144 | scheduler.schedule<Target, json.JsonValue, json.JsonObject>( |
| 145 | '..getTargetOptions', |
| 146 | target, |
| 147 | ).output, |
| 148 | ); |
| 149 | }, |
| 150 | async getProjectMetadata(target: Target | string) { |
no test coverage detected