Exemplo n.º 1
0
    public static void ValidateInternal(string packagePath)
    {
        var packageManifest = Path.Combine(packagePath, "package.json");

        if (!File.Exists(packageManifest))
        {
            throw new Exception($"File package.json not found in {packagePath}");
        }

        object dict;

        if (!Json.TryDeserializeObject(File.ReadAllText(packageManifest), out dict))
        {
            throw new Exception($"Invalid package.json file in {packageManifest}");
        }

        Json.TryGetValue((IDictionary <string, object>)dict, "name", out string name);
        Json.TryGetValue((IDictionary <string, object>)dict, "version", out string version);

        var result = ValidationSuite.ValidatePackage($"{name}@{version}", ValidationType.Publishing);

        if (!result)
        {
            FilterWhitelistedFailures(ValidationSuite.GetValidationSuiteReport(name, version));
        }
    }
Exemplo n.º 2
0
        public void Validate()
        {
            const string package = "[email protected]";
            var          result  = ValidationSuite.ValidatePackage(package, ValidationType.LocalDevelopment);

            Debug.Log(ValidationSuite.GetValidationSuiteReport(package));
            Assert.True(result);
        }
        public void OnPublish(IPackageVersion packageVersion)
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                Debug.LogWarning("Validation suite requires network access and cannot be used offline.");
                return;
            }

            ValidationSuite.ValidatePackage(packageVersion.versionId(), ValidationType.Publishing);
            ValidationSuiteReportWindow.Open(packageVersion);
        }
        void OnValidate()
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                Debug.LogWarning("Validation suite requires network access and cannot be used offline.");
                return;
            }

            ValidationSuite.ValidatePackage(PackageVersion.versionId(), ValidationType.LocalDevelopment);
            PrepareTools.ShowValidationReport();
        }
Exemplo n.º 5
0
        private void ValidateClicked(PackageSelectionArgs args)
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                Debug.LogWarning("Validation suite requires network access and cannot be used offline.");
                return;
            }

            ValidationSuite.ValidatePackage(args.packageVersion.VersionId(), ValidationType.LocalDevelopment);
            ShowValidationReport(args);
        }
        private void Validate()
        {
            if (root == null)
            {
                return;
            }

            if (Utilities.NetworkNotReachable)
            {
                EditorUtility.DisplayDialog("", "Validation suite requires network access and cannot be used offline.", "Ok");
                return;
            }

            var validationType = CurrentPackageinfo.source == PackageSource.Registry ? ValidationType.Promotion : ValidationType.LocalDevelopmentInternal;
            var results        = ValidationSuite.ValidatePackage(PackageId, validationType);
            var report         = ValidationSuiteReport.GetReport(PackageId);

            UIUtils.SetElementDisplay(ViewResultsButton, ValidationSuiteReport.ReportExists(PackageId));
            UIUtils.SetElementDisplay(ViewDiffButton, ValidationSuiteReport.DiffsReportExists(PackageId));

            if (!results)
            {
                ValidationResults.text     = "Failed";
                root.style.backgroundColor = Color.red;
            }
            else if (report != null && report.Tests.Any(t => t.TestOutput.Any(o => o.Type == TestOutputType.Warning)))
            {
                ValidationResults.text     = "Warnings";
                root.style.backgroundColor = Color.yellow;
            }
            else
            {
                ValidationResults.text     = "Success";
                root.style.backgroundColor = Color.green;
            }
        }
Exemplo n.º 7
0
 public void Validate()
 {
     Assert.True(ValidationSuite.ValidatePackage("[email protected]", ValidationType.LocalDevelopment));
 }