"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.StackOutputReference=exports.ShellStep=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../../core"),javascript_1=require("../private/javascript"),file_set_1=require("./file-set"),step_1=require("./step");class ShellStep extends step_1.Step{constructor(id,props){var _c,_d,_e,_f;super(id);if(this.inputs=[],this.outputs=[],this._additionalOutputs={},jsiiDeprecationWarnings.aws_cdk_lib_pipelines_ShellStepProps(props),this.commands=props.commands,this.installCommands=(_c=props.installCommands)!==null&&_c!==void 0?_c:[],this.env=(_d=props.env)!==null&&_d!==void 0?_d:{},this.envFromCfnOutputs=javascript_1.mapValues((_e=props.envFromCfnOutputs)!==null&&_e!==void 0?_e:{},StackOutputReference.fromCfnOutput),props.input){const fileSet=props.input.primaryOutput;if(!fileSet)throw new Error(`'${id}': primary input should be a step that produces a file set, got ${props.input}`);this.addDependencyFileSet(fileSet),this.inputs.push({directory:".",fileSet})}for(const[directory,step]of Object.entries((_f=props.additionalInputs)!==null&&_f!==void 0?_f:{})){if(directory===".")throw new Error(`'${id}': input for directory '.' should be passed via 'input' property`);const fileSet=step.primaryOutput;if(!fileSet)throw new Error(`'${id}': additionalInput for directory '${directory}' should be a step that produces a file set, got ${step}`);this.addDependencyFileSet(fileSet),this.inputs.push({directory,fileSet})}if(props.primaryOutputDirectory){this._primaryOutputDirectory=props.primaryOutputDirectory;const fileSet=new file_set_1.FileSet("Output",this);this.configurePrimaryOutput(fileSet),this.outputs.push({directory:props.primaryOutputDirectory,fileSet})}}primaryOutputDirectory(directory){if(this._primaryOutputDirectory!==void 0){if(this._primaryOutputDirectory!==directory)throw new Error(`${this}: primaryOutputDirectory is '${this._primaryOutputDirectory}', cannot be changed to '${directory}'`);return this.primaryOutput}this._primaryOutputDirectory=directory;const fileSet=new file_set_1.FileSet("Output",this);return this.configurePrimaryOutput(fileSet),this.outputs.push({directory,fileSet}),fileSet}addOutputDirectory(directory){let fileSet=this._additionalOutputs[directory];return fileSet||(fileSet=new file_set_1.FileSet(directory,this),this._additionalOutputs[directory]=fileSet,this.outputs.push({directory,fileSet})),fileSet}}exports.ShellStep=ShellStep,_a=JSII_RTTI_SYMBOL_1,ShellStep[_a]={fqn:"aws-cdk-lib.pipelines.ShellStep",version:"2.13.0"};class StackOutputReference{constructor(stackDescription,stackArtifactId,outputName){this.stackDescription=stackDescription,this.stackArtifactId=stackArtifactId,this.outputName=outputName}static fromCfnOutput(output){jsiiDeprecationWarnings.aws_cdk_lib_CfnOutput(output);const stack=core_1.Stack.of(output);return new StackOutputReference(stack.node.path,stack.artifactId,stack.resolve(output.logicalId))}isProducedBy(stack){return jsiiDeprecationWarnings.aws_cdk_lib_pipelines_StackDeployment(stack),stack.stackArtifactId===this.stackArtifactId}}exports.StackOutputReference=StackOutputReference,_b=JSII_RTTI_SYMBOL_1,StackOutputReference[_b]={fqn:"aws-cdk-lib.pipelines.StackOutputReference",version:"2.13.0"};
//# sourceMappingURL=shell-step.js.map
