text: "use strict";
  // Copyright (C) Microsoft Corporation. All rights reserved.
  Object.defineProperty(exports, "__esModule", { value: true });
  const path = require("path");
  const diagnosticMessages_generated_1 = require("../diagnosticMessages.generated");
  const locale_1 = require("../generated/locale");
  const sourceCodeValidator_1 = require("../sourceCodeValidator");
  const manifestSchemaValidator_1 = require("../manifestSchemaValidator");
  class ValidateSourceTask {
      getDescription() {
          return locale_1.translate(diagnosticMessages_generated_1.strings.task_validate_control_source.key);
      }
      setOptions(options) {
          this._options = options;
      }
      run(context) {
          return context.mapControls((control) => {
              const codePath = path.resolve(control.getControlPath(), control.getCodeRelativePath());
              if (!sourceCodeValidator_1.ValidateCode(context.getDiagnostic(), codePath)) {
                  return Promise.reject();
              }
              return Promise.resolve();
          });
      }
  }
  exports.ValidateSourceTask = ValidateSourceTask;
  class ValidateManifestTask {
      getDescription() {
          return locale_1.translate(diagnosticMessages_generated_1.strings.task_validate_manifest.key);
      }
      setOptions(options) {
          this._options = options;
      }
      run(context) {
          return context.mapControls((control) => {
              const validator = new manifestSchemaValidator_1.ManifestSchemaValidator(control.getParsedManifest(), context.getDiagnostic());
              validator.validateManifest();
              if (validator.diag.hasErrors()) {
                  return Promise.reject();
              }
              return Promise.resolve();
          });
      }
  }
  exports.ValidateManifestTask = ValidateManifestTask;
  