예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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));
        }
예제 #7
0
        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));
        }
예제 #8
0
        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;
        }
예제 #9
0
        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;
        }