public void TestBundlingSymbols(BundleOptions options) { var fixture = sharedTestState.TestFixture.Copy(); var appBaseName = BundleHelper.GetAppBaseName(fixture); var bundler = BundleHelper.Bundle(fixture, options); bundler.BundleManifest.Contains($"{appBaseName}.pdb").Should().Be(options.HasFlag(BundleOptions.BundleSymbolFiles)); }
public void TestBundlingNativeBinaries(BundleOptions options) { var fixture = sharedTestState.TestFixture.Copy(); var coreclr = Path.GetFileName(fixture.TestProject.CoreClrDll); var bundler = BundleHelper.Bundle(fixture, options); bundler.BundleManifest.Contains($"{coreclr}").Should().Be(options.HasFlag(BundleOptions.BundleNativeBinaries)); }
private bool ShouldCompress(FileType type) { if (!Options.HasFlag(BundleOptions.EnableCompression)) { return(false); } switch (type) { case FileType.Symbols: case FileType.NativeBinary: return(true); default: return(false); } }
private bool ShouldCompress(FileType type) { if (!Options.HasFlag(BundleOptions.EnableCompression)) { return(false); } switch (type) { case FileType.DepsJson: case FileType.RuntimeConfigJson: return(false); default: return(true); } }
bool ShouldExclude(FileType type, string relativePath) { switch (type) { case FileType.Assembly: case FileType.DepsJson: case FileType.RuntimeConfigJson: return(false); case FileType.NativeBinary: return(!Options.HasFlag(BundleOptions.BundleNativeBinaries) || Target.ShouldExclude(relativePath)); case FileType.Symbols: return(!Options.HasFlag(BundleOptions.BundleSymbolFiles)); case FileType.Unknown: return(!Options.HasFlag(BundleOptions.BundleOtherFiles)); default: Debug.Assert(false); return(false); } }
public void TestBundlingNativeBinaries(BundleOptions options) { var fixture = sharedTestState.TestFixture.Copy(); var hostName = BundleHelper.GetHostName(fixture); var hostfxr = Path.GetFileName(fixture.TestProject.HostFxrDll); string publishPath = BundleHelper.GetPublishPath(fixture); var bundleDir = BundleHelper.GetBundleDir(fixture); var bundler = new Bundler(hostName, bundleDir.FullName, options); BundleHelper.GenerateBundle(bundler, publishPath); bundler.BundleManifest.Contains($"{hostfxr}").Should().Be(options.HasFlag(BundleOptions.BundleNativeBinaries)); }
public void TestBundlingSymbols(BundleOptions options) { var fixture = sharedTestState.TestFixture.Copy(); var hostName = BundleHelper.GetHostName(fixture); var appName = Path.GetFileNameWithoutExtension(hostName); string publishPath = BundleHelper.GetPublishPath(fixture); var bundleDir = BundleHelper.GetBundleDir(fixture); var bundler = new Bundler(hostName, bundleDir.FullName, options); BundleHelper.GenerateBundle(bundler, publishPath); bundler.BundleManifest.Contains($"{appName}.pdb").Should().Be(options.HasFlag(BundleOptions.BundleSymbolFiles)); }
public Bundler(string hostName, string outputDir, BundleOptions options = BundleOptions.None, OSPlatform?targetOS = null, Architecture?targetArch = null, Version targetFrameworkVersion = null, bool diagnosticOutput = false, string appAssemblyName = null) { Tracer = new Trace(diagnosticOutput); HostName = hostName; OutputDir = Path.GetFullPath(string.IsNullOrEmpty(outputDir) ? Environment.CurrentDirectory : outputDir); Target = new TargetInfo(targetOS, targetArch, targetFrameworkVersion); if (Target.BundleMajorVersion < 6 && (options & BundleOptions.EnableCompression) != 0) { throw new ArgumentException("Compression requires framework version 6.0 or above", nameof(options)); } appAssemblyName ??= Target.GetAssemblyName(hostName); DepsJson = appAssemblyName + ".deps.json"; RuntimeConfigJson = appAssemblyName + ".runtimeconfig.json"; RuntimeConfigDevJson = appAssemblyName + ".runtimeconfig.dev.json"; BundleManifest = new Manifest(Target.BundleMajorVersion, netcoreapp3CompatMode: options.HasFlag(BundleOptions.BundleAllContent)); Options = Target.DefaultOptions | options; }
public Bundler(string hostName, string outputDir, BundleOptions options = BundleOptions.None, OSPlatform?targetOS = null, Version targetFrameworkVersion = null, bool diagnosticOutput = false, string appAssemblyName = null) { Tracer = new Trace(diagnosticOutput); HostName = hostName; OutputDir = Path.GetFullPath(string.IsNullOrEmpty(outputDir) ? Environment.CurrentDirectory : outputDir); Target = new TargetInfo(targetOS, targetFrameworkVersion); appAssemblyName ??= Target.GetAssemblyName(hostName); DepsJson = appAssemblyName + ".deps.json"; RuntimeConfigJson = appAssemblyName + ".runtimeconfig.json"; RuntimeConfigDevJson = appAssemblyName + ".runtimeconfig.dev.json"; BundleManifest = new Manifest(Target.BundleVersion, netcoreapp3CompatMode: options.HasFlag(BundleOptions.BundleAllContent)); Options = Target.DefaultOptions | options; }