/// <summary>
 /// Copying symbol files to temporary location.
 /// </summary>
 /// <param name="buildModel"></param>
 /// <param name="symbolTemporaryLocation"></param>
 private void CopySymbolFilesToTemporaryLocation(BuildModel buildModel, string symbolTemporaryLocation)
 {
     foreach (var blobAsset in buildModel.Artifacts.Blobs)
     {
         if (GeneralUtils.IsSymbolPackage(blobAsset.Id))
         {
             var sourceFile      = Path.Combine(BlobAssetsBasePath, Path.GetFileName(blobAsset.Id));
             var destinationFile = Path.Combine(symbolTemporaryLocation, Path.GetFileName(blobAsset.Id));
             File.Copy(sourceFile, destinationFile);
             Log.LogMessage(MessageImportance.Low,
                            $"Successfully copied file {sourceFile} to {destinationFile}.");
         }
     }
 }
示例#2
0
        public BuildModel CreateModelFromItems(
            ITaskItem[] artifacts,
            ITaskItem[] itemsToSign,
            ITaskItem[] strongNameSignInfo,
            ITaskItem[] fileSignInfo,
            ITaskItem[] fileExtensionSignInfo,
            ITaskItem[] certificatesSignInfo,
            string buildId,
            string[] manifestBuildData,
            string repoUri,
            string repoBranch,
            string repoCommit,
            bool isStableBuild,
            PublishingInfraVersion publishingVersion,
            bool isReleaseOnlyPackageVersion)
        {
            if (artifacts == null)
            {
                throw new ArgumentNullException(nameof(artifacts));
            }

            var blobArtifacts    = new List <BlobArtifactModel>();
            var packageArtifacts = new List <PackageArtifactModel>();

            foreach (var artifact in artifacts)
            {
                if (string.Equals(artifact.GetMetadata("ExcludeFromManifest"), "true", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                var isSymbolsPackage = GeneralUtils.IsSymbolPackage(artifact.ItemSpec);

                if (artifact.ItemSpec.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase) && !isSymbolsPackage)
                {
                    packageArtifacts.Add(_packageArtifactModelFactory.CreatePackageArtifactModel(artifact));
                }
                else
                {
                    if (isSymbolsPackage)
                    {
                        string fileName = Path.GetFileName(artifact.ItemSpec);
                        artifact.SetMetadata("RelativeBlobPath", $"{AssetsVirtualDir}symbols/{fileName}");
                    }

                    blobArtifacts.Add(_blobArtifactModelFactory.CreateBlobArtifactModel(artifact));
                }
            }

            var signingInfoModel = _signingInformationModelFactory.CreateSigningInformationModelFromItems(
                itemsToSign, strongNameSignInfo, fileSignInfo, fileExtensionSignInfo,
                certificatesSignInfo, blobArtifacts, packageArtifacts);

            var buildModel = CreateModel(
                blobArtifacts,
                packageArtifacts,
                buildId,
                manifestBuildData,
                repoUri,
                repoBranch,
                repoCommit,
                isStableBuild,
                publishingVersion,
                isReleaseOnlyPackageVersion,
                signingInformationModel: signingInfoModel);

            return(buildModel);
        }