protected override DotNetAssembly SetupNativeProgram(CSharpProgramConfiguration config, DotNetAssembly result) { BindGem.Instance().SetupInvocation(result, (DotsRuntimeCSharpProgramConfiguration)config); return(base.SetupNativeProgram(config, result)); }
static void Main() { BeeRootValue = BuildProgramConfigFile.AsmDefDescriptionFor("Unity.Tiny.Text").Path.Parent.Parent.Parent.Combine("DotsPlayer/bee~"); StevedoreGlobalSettings.Instance = new StevedoreGlobalSettings { // Manifest entries always override artifact IDs hard-coded in Bee // Setting EnforceManifest to true will also ensure no artifacts // are used without being listed in a manifest. EnforceManifest = true, Manifest = { BeeRootValue.Combine("manifest.stevedore"), }, }; //The stevedore global manifest will override DownloadableCsc.Csc72 artifacts and use Csc73 CSharpProgram.DefaultConfig = new CSharpProgramConfiguration(CSharpCodeGen.Release, DownloadableCsc.Csc72); UnityLowLevel = new DotsRuntimeCSharpProgram($"{LowLevelRoot}/Unity.LowLevel") { References = { UnsafeUtility.DotNetAssembly }, Unsafe = true }; ZeroJobs = new DotsRuntimeCSharpProgram(BeeRoot.Parent.Combine("ZeroJobs"), "Unity.ZeroJobs") { References = { UnityLowLevel }, Unsafe = true }; var nunit = new StevedoreArtifact("nunit-framework"); Backend.Current.Register(nunit); NUnitLite = new DotNetAssembly(nunit.Path.Combine("bin", "net40", "nunitlite.dll"), Framework.Framework40); NUnitFramework = new DotNetAssembly(nunit.Path.Combine("bin", "net40", "nunit.framework.dll"), Framework.Framework40); //any asmdef that sits next to a .project file we will consider a tiny game. var asmDefDescriptions = BuildProgramConfigFile.AssemblyDefinitions.ToArray(); var gameAsmDefs = asmDefDescriptions.Where(d => d.Path.Parent.Files("*.project").Any()); var gamePrograms = gameAsmDefs.Select(SetupGame).ToArray(); //any asmdef that has .Tests in its name, is going to be our indicator for being a test project for now. var testAsmDefs = asmDefDescriptions.Where(ad => ad.Name.EndsWith(".Tests")); var testPrograms = testAsmDefs.Where(asm => asm.PackageSource != "BuiltIn" && asm.PackageSource != "Registry") .Select(SetupTest) .ExcludeNulls() .ToArray(); var vs = new VisualStudioSolution() { Path = BuildProgramConfigFile.UnityProjectPath.Combine($"{BuildProgramConfigFile.ProjectName}-Dots.sln").RelativeTo(NPath.CurrentDirectory), DefaultSolutionFolderFor = file => (file.Name.Contains("Unity.") || file.Name == "mscorlib") ? "Unity" : "" }; var unityToolsFolder = "Unity/tools"; if (BeeRoot.IsChildOf(BuildProgramConfigFile.UnityProjectPath)) { vs.Projects.Add(new CSharpProjectFileReference("buildprogram.gen.csproj"), unityToolsFolder); } foreach (var gameProgram in gamePrograms) { vs.Projects.Add(gameProgram); } foreach (var testProgram in testPrograms) { vs.Projects.Add(testProgram); } var toolPrograms = new[] { TypeRegistrationTool.EntityBuildUtils, TypeRegistrationTool.TypeRegProgram, BindGem.Instance().Program }; if (BeeRoot.IsChildOf(BuildProgramConfigFile.UnityProjectPath)) { foreach (var p in toolPrograms) { vs.Projects.Add(p, unityToolsFolder); } } foreach (var config in DotsConfigs.Configs) { //we want dotnet to be the default, and we cannot have nice things: https://aras-p.info/blog/2017/03/23/How-does-Visual-Studio-pick-default-config/platform/ var solutionConfigName = config.Identifier == "dotnet" ? "Debug (dotnet)": config.Identifier; vs.Configurations.Add(new SolutionConfiguration(solutionConfigName, (configurations, file) => { var firstOrDefault = configurations.FirstOrDefault(c => c == config); return(new Tuple <IProjectConfiguration, bool>( firstOrDefault ?? configurations.First(), firstOrDefault != null || toolPrograms.Any(t => t.ProjectFile == file))); })); } Backend.Current.AddAliasDependency("ProjectFiles", vs.Setup()); EditorToolsBuildProgram.Setup(BeeRoot); }