Exemplo n.º 1
0
        public Config()
        {
            // KeepBenchmarkFiles = true;

            //Add(Job.Default.With(CsProjClassicNetToolchain.Net472));
            Add(Job.Default.With(CsProjClassicNetToolchain.From("net48")));
            //Add(Job.Default.With(CsProjCoreToolchain.Current.Value));

            //var toolchain = CsProjCoreToolchain.Current.Value;
            //var jobWithCustomConfiguration = Job.Dry.WithCustomBuildConfiguration("CUSTOM").With(toolchain);
            //Add(jobWithCustomConfiguration);
        }
        internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null, bool preferMsBuildToolchains = false)
        {
            switch (runtime)
            {
            case ClrRuntime clrRuntime:
                if (RuntimeInformation.IsNetCore || preferMsBuildToolchains)
                {
                    return(clrRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(clrRuntime.RuntimeMoniker)
                            : CsProjClassicNetToolchain.From(clrRuntime.MsBuildMoniker));
                }

                return(RoslynToolchain.Instance);

            case MonoRuntime mono:
                if (!string.IsNullOrEmpty(mono.AotArgs))
                {
                    return(MonoAotToolchain.Instance);
                }

                return(RoslynToolchain.Instance);

            case CoreRuntime coreRuntime:
                if (descriptor != null && descriptor.Type.Assembly.IsLinqPad())
                {
                    return(InProcessEmitToolchain.Instance);
                }
                if (coreRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized)
                {
                    return(GetToolchain(coreRuntime.RuntimeMoniker));
                }

                return(CsProjCoreToolchain.From(new DotNetCli.NetCoreAppSettings(coreRuntime.MsBuildMoniker, null, coreRuntime.Name)));

            case CoreRtRuntime coreRtRuntime:
                return(coreRtRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
                            ? GetToolchain(coreRtRuntime.RuntimeMoniker)
                            : CoreRtToolchain.CreateBuilder().UseCoreRtNuGet().TargetFrameworkMoniker(coreRtRuntime.MsBuildMoniker).ToToolchain());

            default:
                throw new ArgumentOutOfRangeException(nameof(runtime), runtime, "Runtime not supported");
            }
        }
Exemplo n.º 3
0
        .AsDefault();         // this way we tell BDN that it's a default config which can be overwritten

        /// <summary>
        /// we need our own toolchain because MSBuild by default does not copy recursive native dependencies to the output
        /// </summary>
        private IToolchain CreateToolchain()
        {
            TimeSpan timeout = TimeSpan.FromMinutes(5);

#if NETFRAMEWORK
            var tfm    = "net461";
            var csProj = CsProjClassicNetToolchain.From(tfm, timeout: timeout);
#else
            var settings = AppDomain.CurrentDomain.GetData("FX_PRODUCT_VERSION") == null
                ? NetCoreAppSettings.NetCoreApp21 : NetCoreAppSettings.NetCoreApp31;

            settings = settings.WithTimeout(timeout);

            var tfm    = settings.TargetFrameworkMoniker;
            var csProj = CsProjCoreToolchain.From(settings);
#endif
            return(new Toolchain(
                       tfm,
                       new ProjectGenerator(tfm), // custom generator that copies native dependencies
                       csProj.Builder,
                       csProj.Executor));
        }
Exemplo n.º 4
0
        public NetFramework472JobAttribute()
        {
            var job = Job.Default.With(Runtime.Clr).With(Jit.RyuJit).With(Platform.X64).With(CsProjClassicNetToolchain.From("net472"));

            Config = ManualConfig.CreateEmpty().With(job);
        }