@hidden
(session?: Session, unverifiedConfig?: any, configPath?: string)
| 123 | |
| 124 | /** @hidden */ |
| 125 | constructor(session?: Session, unverifiedConfig?: any, configPath?: string) { |
| 126 | super(session); |
| 127 | this.session = session; |
| 128 | this.configPath = configPath; |
| 129 | // A copy is used here to prevent manipulation of the original. |
| 130 | this.unverifiedConfig = Object.assign({}, unverifiedConfig); |
| 131 | |
| 132 | if (!unverifiedConfig) { |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | const config = this.verifyConfig(unverifiedConfig); |
| 137 | |
| 138 | if (!config.name) { |
| 139 | config.name = Path.basename(config.filename); |
| 140 | } |
| 141 | const target = actionConfigToCompiledGraphTarget(config); |
| 142 | this.proto.target = this.applySessionToTarget(target, session.projectConfig, config.filename, { |
| 143 | validateTarget: true |
| 144 | }); |
| 145 | this.proto.canonicalTarget = this.applySessionToTarget(target, session.canonicalProjectConfig); |
| 146 | |
| 147 | if (configPath) { |
| 148 | config.filename = resolveActionsConfigFilename(config.filename, configPath); |
| 149 | this.query(nativeRequire(config.filename).query); |
| 150 | } |
| 151 | if (config.filename) { |
| 152 | this.proto.fileName = config.filename; |
| 153 | } |
| 154 | |
| 155 | if (config.dependOnDependencyAssertions) { |
| 156 | this.setDependOnDependencyAssertions(config.dependOnDependencyAssertions); |
| 157 | } |
| 158 | if (config.dependencyTargets) { |
| 159 | this.dependencies( |
| 160 | config.dependencyTargets.map(dependencyTarget => |
| 161 | configTargetToCompiledGraphTarget(dataform.ActionConfig.Target.create(dependencyTarget)) |
| 162 | ) |
| 163 | ); |
| 164 | } |
| 165 | if (config.hermetic !== undefined) { |
| 166 | this.hermetic(config.hermetic); |
| 167 | } |
| 168 | if (config.disabled) { |
| 169 | this.disabled(); |
| 170 | } |
| 171 | if (config.tags) { |
| 172 | this.tags(config.tags); |
| 173 | } |
| 174 | if (config.description) { |
| 175 | this.description(config.description); |
| 176 | } |
| 177 | if (config.metadata) { |
| 178 | if (!this.proto.actionDescriptor) { |
| 179 | this.proto.actionDescriptor = {}; |
| 180 | } |
| 181 | this.proto.actionDescriptor.metadata = config.metadata; |
| 182 | } |
nothing calls this directly
no test coverage detected