public static void CreateExtensionBundle(BundlePackageConfiguration bundlePackageConfig) { // Create a directory to hold the bundle content string bundlePath = Path.Combine(Settings.RootBuildDirectory, bundlePackageConfig.BundleName); foreach (var packageConfig in bundlePackageConfig.ConfigBinariesToInclude) { // find the build configuration matching the config id var buildConfig = Settings.WindowsBuildConfigurations.FirstOrDefault(b => b.ConfigId == packageConfig) ?? Settings.LinuxBuildConfigurations.FirstOrDefault(b => b.ConfigId == packageConfig); string targetBundleBinariesPath = Path.Combine(bundlePath, buildConfig.PublishBinDirectorySubPath); // Copy binaries FileUtility.CopyDirectory(buildConfig.PublishBinDirectoryPath, targetBundleBinariesPath); string extensionJsonFilePath = Path.Join(targetBundleBinariesPath, Settings.ExtensionsJsonFileName); AddBindingInfoToExtensionsJson(extensionJsonFilePath); } // Copy templates var staticContentDirectory = Path.Combine(bundlePath, Settings.StaticContentDirectoryName); FileUtility.CopyDirectory(Settings.StaticContentDirectoryPath, staticContentDirectory); // Add bundle.json CreateBundleJsonFile(bundlePath); // Add Csproj file string projectPath = Path.Combine(bundlePath, "extensions.csproj"); File.Copy(bundlePackageConfig.CsProjFilePath, projectPath); FileUtility.EnsureDirectoryExists(Settings.ArtifactsDirectory); ZipFile.CreateFromDirectory(bundlePath, bundlePackageConfig.GeneratedBundleZipFilePath, CompressionLevel.NoCompression, false); }
public static void AddBundleZipFile(string rootPath, BundlePackageConfiguration packageConfig) { string bundleZipDestinationPath = Path.Combine(rootPath, packageConfig.GeneratedBundleZipFileName); FileUtility.CopyFile(packageConfig.GeneratedBundleZipFilePath, bundleZipDestinationPath); }