public PublishArtifactsInManifestBase WhichPublishingTask(string manifestFullPath)
        {
            Log.LogMessage(MessageImportance.High, $"Creating a task to publish assets from {manifestFullPath}");

            if (!_fileSystem.FileExists(manifestFullPath))
            {
                Log.LogError($"Problem reading asset manifest path from '{manifestFullPath}'");
                return(null);
            }

            BuildModel buildModel = _buildModelFactory.ManifestFileToModel(manifestFullPath);

            if (buildModel.Identity.PublishingVersion == PublishingInfraVersion.Legacy)
            {
                Log.LogError("This task is not able to handle legacy manifests.");
                return(null);
            }
            else if (buildModel.Identity.PublishingVersion == PublishingInfraVersion.Latest)
            {
                return(ConstructPublishingV2Task(buildModel));
            }
            else if (buildModel.Identity.PublishingVersion == PublishingInfraVersion.Next)
            {
                return(ConstructPublishingV3Task(buildModel));
            }
            else
            {
                Log.LogError($"The manifest version '{buildModel.Identity.PublishingVersion}' is not recognized by the publishing task.");
                return(null);
            }
        }
Esempio n. 2
0
 public bool ExecuteTask(IBuildModelFactory buildModelFactory)
 {
     Log.LogMessage(MessageImportance.High, "Parsing build manifest file: {0}", AssetManifestPath);
     try
     {
         BuildModel buildModel = buildModelFactory.ManifestFileToModel(AssetManifestPath);
         if (!Log.HasLoggedErrors)
         {
             if (buildModel.Artifacts.Blobs.Any())
             {
                 BlobInfos = buildModel.Artifacts.Blobs.Select(blob => new TaskItem(blob.Id)).ToArray();
             }
             if (buildModel.Artifacts.Packages.Any())
             {
                 PackageInfos = buildModel.Artifacts.Packages.Select(ConvertToPackageInfoItem).ToArray();
             }
         }
     }
     catch (Exception e)
     {
         Log.LogErrorFromException(e, true);
     }
     return(!Log.HasLoggedErrors);
 }