コード例 #1
0
    public static bool IsRequestedTargetExactlyProjectFiles()
    {
        var commandLineTargets = StandaloneBeeDriver.GetCommandLineTargets();

        if (commandLineTargets.Count() != 1)
        {
            return(false);
        }

        return(commandLineTargets.Single() == "ProjectFiles");
    }
コード例 #2
0
    private static bool IsRequestedTargetExactlySingleAppSingleConfig()
    {
        var commandLineTargets = StandaloneBeeDriver.GetCommandLineTargets();

        if (commandLineTargets.Count() != 1)
        {
            return(false);
        }

        var commandLineTarget = commandLineTargets.Single();
        var ret = PerConfigBuildSettings.Any(entry => entry.Value.Any(v => v.Identifier == commandLineTarget));

        return(ret);
    }
コード例 #3
0
    static bool CanSkipSetupOf(string programName, DotsRuntimeCSharpProgramConfiguration config)
    {
        /* This is disabled for now (11/12/2019) because we have a theory that because there will be very few
         * bee targets overall, we don't need to optimize project files as much as we used to.
         * But we should re-enable this check if we see project files taking too long to generate.
         */
        /*if (IsRequestedTargetExactlyProjectFiles())
         *  return true;*/

        if (!IsRequestedTargetExactlySingleAppSingleConfig())
        {
            return(false);
        }

        return(config.Identifier != StandaloneBeeDriver.GetCommandLineTargets().Single());
    }
コード例 #4
0
    static bool CanSkipSetupOf(string programName, DotsRuntimeCSharpProgramConfiguration config)
    {
        /* This is disabled for now (11/12/2019) because we have a theory that because there will be very few
         * bee targets overall, we don't need to optimize project files as much as we used to.
         * But we should re-enable this check if we see project files taking too long to generate.
         */
        /*if (IsRequestedTargetExactlyProjectFiles())
         *  return true;*/

        if (!IsRequestedTargetExactlySingleAppSingleConfig())
        {
            return(false);
        }

        //If there is complementary target its config identifier is generated from main target identifier by adding slash symbol
        //and complementary target name. So only part before slash should be compared with target from command line.
        //See comment in DotsConfigs.cs, DotsConfigs.MakeConfigs() method for details
        var slash      = config.Identifier.IndexOf('/');
        var identifier = slash == -1 ? config.Identifier : config.Identifier.Substring(0, slash);

        return(identifier != StandaloneBeeDriver.GetCommandLineTargets().Single());
    }
コード例 #5
0
    static void Main()
    {
        if (!(Backend.Current is TundraBackend))
        {
            StandaloneBeeDriver.RunBuildProgramInBeeEnvironment("dummy.json", Main);
            return;
        }

        BeeRootValue = AsmDefConfigFile.AsmDefDescriptionFor("Unity.ZeroPlayer.TypeRegGen").Path.Parent.Parent.Combine("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
        };
        UnityLowLevel.NativeProgram.Libraries.Add(IsLinux, new SystemLibrary("dl"));

        ZeroJobs = new DotsRuntimeCSharpProgram($"{LowLevelRoot}/Unity.ZeroJobs")
        {
            References = { UnityLowLevel },
            Unsafe     = true
        };

        UnityCompilationPipeline = new DotNetAssembly(AsmDefConfigFile.UnityCompilationPipelineAssemblyPath, Framework.NetStandard20);

        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 = AsmDefConfigFile.AssemblyDefinitions.ToArray();

        BurstCompiler.BurstExecutable = asmDefDescriptions.First(d => d.Name == "Unity.Burst")
                                        .Path.Parent.Parent.Combine(".Runtime/bcl.exe").QuoteForProcessStart();

        var ilPostProcessorPrograms = asmDefDescriptions.Where(d => d.Name.EndsWith(".CodeGen") && !d.DefineConstraints.Contains("!NET_DOTS")).Select(GetOrMakeDotsRuntimeCSharpProgramFor);

        ILPostProcessorAssemblies = ilPostProcessorPrograms.Select(p => p.SetupSpecificConfiguration(DotsConfigs.HostDotnet)).ToArray();
        PerConfigBuildSettings    = DotsConfigs.MakeConfigs();

        var tinyMainAsmDefs = asmDefDescriptions;//.Where(d => d.NamedReferences.Contains("Unity.Tiny.Main"));
        var gameAsmDefs     = tinyMainAsmDefs.Union(AsmDefConfigFile.TestableAssemblyDefinitions);
        var gamePrograms    = gameAsmDefs.Select(SetupGame).ExcludeNulls().ToArray();

        var vs = new VisualStudioSolution
        {
            Path = AsmDefConfigFile.UnityProjectPath.Combine($"{AsmDefConfigFile.ProjectName}-Dots.sln").RelativeTo(NPath.CurrentDirectory),
            DefaultSolutionFolderFor = file => (file.Name.Contains("Unity.") || file.Name == "mscorlib") ? "Unity" : ""
        };

        var unityToolsFolder            = "Unity/tools";
        var unityILPostProcessorsFolder = "Unity/ILPostProcessing";

        if (BeeRoot.IsChildOf(AsmDefConfigFile.UnityProjectPath))
        {
            var buildProjRef = new CSharpProjectFileReference("buildprogram.gen.csproj");
            vs.Projects.Add(buildProjRef, unityToolsFolder);
            vs.Projects.Add(buildProjRef, unityILPostProcessorsFolder);
        }

        foreach (var gameProgram in gamePrograms)
        {
            vs.Projects.Add(gameProgram);
        }

        var toolPrograms = new[]
        { TypeRegistrationTool.EntityBuildUtils, TypeRegistrationTool.TypeRegProgram };

        foreach (var p in toolPrograms)
        {
            vs.Projects.Add(p, unityToolsFolder);
        }

        vs.Projects.Add(ILPostProcessorTool.ILPostProcessorRunnerProgram, unityILPostProcessorsFolder);
        foreach (var p in ilPostProcessorPrograms)
        {
            vs.Projects.Add(p, unityILPostProcessorsFolder);
        }

        foreach (var config in PerConfigBuildSettings.SelectMany(entry => entry.Value))
        {
            //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)));
            }));
        }

        VisualStudioSolution = vs;

        EditorToolsBuildProgram.Setup(BeeRoot);

        // Run this before solution setup, to potentially give this a chance to muck with the VisualStudioSolution
        DotsBuildCustomizer.RunAllCustomizers();

        if (!IsRequestedTargetExactlySingleAppSingleConfig())
        {
            Backend.Current.AddAliasDependency("ProjectFiles", vs.Setup());
        }
    }