"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Copyright 2017-2018 Plexus Interop Deutsche Bank AG
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var BaseJavaGenCommand_1 = require("./BaseJavaGenCommand");
var DefaultOptions_1 = require("./DefaultOptions");
var java_1 = require("../common/java");
var process_1 = require("../common/process");
var ValidateMetadataPatchCommand = /** @class */ (function (_super) {
    tslib_1.__extends(ValidateMetadataPatchCommand, _super);
    function ValidateMetadataPatchCommand() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.plexusGenArgs = function (opts) {
            return ['--type=validate-patch'].concat(_this.optionArgs(opts));
        };
        _this.generalDescription = function () { return 'validate metadata update'; };
        _this.name = function () { return 'validate-patch'; };
        _this.options = function () { return [DefaultOptions_1.baseDir(), DefaultOptions_1.targetBaseDir(), DefaultOptions_1.verbose()]; };
        return _this;
    }
    ValidateMetadataPatchCommand.prototype.action = function (opts) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var javaExecPath, javaLibPath;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, java_1.getJavaExecPath()];
                    case 1:
                        javaExecPath = _a.sent();
                        javaLibPath = java_1.getJavaGenLibPath();
                        return [4 /*yield*/, process_1.simpleSpawn(javaExecPath, ['-jar', javaLibPath].concat(this.plexusGenArgs(opts)), true)];
                    case 2:
                        _a.sent();
                        this.log('No validation errors found');
                        return [2 /*return*/];
                }
            });
        });
    };
    return ValidateMetadataPatchCommand;
}(BaseJavaGenCommand_1.BaseJ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