Esempio n. 1
0
        internal IEnumerable <ITaskItem> ProcessWorkloadManifestFile(string workloadManifestJsonPath)
        {
            WorkloadManifest manifest = WorkloadManifestReader.ReadWorkloadManifest(Path.GetFileNameWithoutExtension(workloadManifestJsonPath), File.OpenRead(workloadManifestJsonPath));

            List <TaskItem> swixProjects = new();

            foreach (WorkloadDefinition workloadDefinition in manifest.Workloads.Values)
            {
                if ((workloadDefinition.Platforms?.Count > 0) && (!workloadDefinition.Platforms.Any(p => p.StartsWith("win"))))
                {
                    Log?.LogMessage(MessageImportance.High, $"{workloadDefinition.Id} platforms does not support Windows and will be skipped ({string.Join(", ", workloadDefinition.Platforms)}).");
                    continue;
                }

                // Each workload maps to a Visual Studio component.
                VisualStudioComponent component = VisualStudioComponent.Create(Log, manifest, workloadDefinition,
                                                                               ComponentVersions, ShortNames, ComponentResources, MissingPacks);

                // If there are no dependencies, regardless of whether we are generating MSIs, we'll report an
                // error as we'd produce invalid SWIX.
                if (!component.HasDependencies)
                {
                    Log?.LogError($"Visual Studio components '{component.Name}' must have at least one dependency.");
                }

                string vsPayloadRelativePath = $"{component.Name},version={component.Version}\\_package.json";
                CheckRelativePayloadPath(vsPayloadRelativePath);

                swixProjects.Add(component.Generate(Path.Combine(SourceDirectory, $"{workloadDefinition.Id}.{manifest.Version}.0")));
            }

            return(swixProjects);
        }
        internal IEnumerable <ITaskItem> ProcessWorkloadManifestFile(string workloadManifestJsonPath)
        {
            WorkloadManifest manifest = WorkloadManifestReader.ReadWorkloadManifest(Path.GetFileNameWithoutExtension(workloadManifestJsonPath), File.OpenRead(workloadManifestJsonPath));

            List <TaskItem> swixProjects = new();

            foreach (WorkloadDefinition workloadDefinition in manifest.Workloads.Values)
            {
                // Each workload maps to a Visual Studio component.
                VisualStudioComponent component = VisualStudioComponent.Create(Log, manifest, workloadDefinition,
                                                                               ComponentVersion, ShortNames, ComponentResources, MissingPacks);

                // If there are no dependencies, regardless of whether we are generating MSIs, we'll report an
                // error as we'd produce invalid SWIX.
                if (!component.HasDependencies)
                {
                    Log?.LogError($"Visual Studio components '{component.Name}' must have at least one dependency.");
                }

                swixProjects.Add(component.Generate(Path.Combine(SourceDirectory, $"{workloadDefinition.Id}.{manifest.Version}.0")));
            }

            return(swixProjects);
        }