public ZipFilesCommand(ZipFilesTask task) : base(task) { Path = task.Path; File = task.File; Overwrite = task.Overwrite; }
/// <summary> /// Packages the build product into a zip file. /// </summary> /// <param name="zipFileNameFormat"> /// The zip file name format. The format uses the following arguments: /// <list type="bullet"> /// <item> /// <term>{0}</term> /// <description>ProductId</description> /// </item> /// <item> /// <term>{1}</term> /// <description>BuildVersion (4 numbers)</description> /// </item> /// </list> /// </param> /// <param name="rootDirectoryForProductFormat">The format for the root directory of the product. This will /// be the root directory inside the package ZIP file. /// The format is the same as for the <see cref="zipFileNameFormat"/> parameter.</param> /// <param name="productPartsIds">The list of product parts IDs which should be included in the package. /// If the list is empty, the method packages all available product part IDs.</param> /// <returns>The same instance of this <see cref="TRunner"/>.</returns> public TRunner PackageBuildProduct( string zipFileNameFormat, string rootDirectoryForProductFormat, params string[] productPartsIds) { CopyBuildProductFiles(rootDirectoryForProductFormat, productPartsIds); IEnumerable <string> filesToZip = buildProducts.ListFilesForProductParts(productPartsIds); // remove duplicate files to avoid problems with the ZIP file Dictionary <string, string> filesNoDuplicates = new Dictionary <string, string>(); foreach (string fileName in filesToZip) { if (false == filesNoDuplicates.ContainsKey(fileName)) { filesNoDuplicates.Add(fileName, null); } } string zipFileName = String.Format( CultureInfo.InvariantCulture, zipFileNameFormat, ProductId, BuildVersion); string packagesDir = MakePathFromRootDir(BuildPackagesDir); zipFileName = Path.Combine(packagesDir, zipFileName); ZipFilesTask task = new ZipFilesTask( zipFileName, Path.GetFullPath(MakePathFromRootDir(BuildPackagesDir)), filesNoDuplicates.Keys); RunTask(task); lastZipPackageFileName = zipFileName; return(ReturnThisTRunner()); }