public override BuildResult Run(BuildContext context)
        {
            // BuildConfiguration names are used as part of a generated Bee target name. As such, error if the user's
            // asset contains a space as this will be seen by bee as multiple target names erroneously
            if (context.BuildConfigurationName.Contains(' '))
            {
                throw new ArgumentException($"The DOTS Runtime Build Profile does not support BuildConfiguration assets with spaces in the name. Please rename asset '{context.BuildConfigurationName}'");
            }

            var manifest     = context.BuildManifest;
            var profile      = context.GetComponentOrDefault <DotsRuntimeBuildProfile>();
            var rootAssembly = context.GetComponentOrDefault <DotsRuntimeRootAssembly>();
            var outputDir    = DotsRuntimeRootAssembly.BeeRootDirectory;

            BuildProgramDataFileWriter.WriteAll(outputDir.FullName);

            var jsonObject = new JsonObject();
            var targetName = rootAssembly.MakeBeeTargetName(context.BuildConfigurationName);

            jsonObject["Version"] = BuildSettingsFileVersion;
            jsonObject["PlatformTargetIdentifier"] = profile.Target.BeeTargetName;
#if UNITY_2020_1_OR_NEWER
            jsonObject["RootAssembly"] = rootAssembly.RootAssembly.asset.name;
#else
            jsonObject["RootAssembly"] = rootAssembly.RootAssembly.name;
#endif

            jsonObject["EnableManagedDebugging"] = BuildSettingToggle.UseBuildConfiguration.ToString();

            // EnableBurst is defaulted to true but can be configured via the DotsRuntimeBurstSettings object
            jsonObject["EnableBurst"] = true;

            // Scripting Settings defaults but can be overriden via the DotsRuntimeScriptingSettings object
            jsonObject["EnableMultithreading"] = false;
            jsonObject["EnableSafetyChecks"]   = BuildSettingToggle.UseBuildConfiguration.ToString();
            jsonObject["EnableProfiler"]       = BuildSettingToggle.UseBuildConfiguration.ToString();

            jsonObject["FinalOutputDirectory"] = GetFinalOutputDirectory(context, targetName);
            jsonObject["DotsConfig"]           = profile.Configuration.ToString();

            foreach (var component in context.GetComponents <IDotsRuntimeBuildModifier>())
            {
                component.Modify(jsonObject);
            }

            var settingsDir = new NPath(outputDir.FullName).Combine("settings");
            var json        = JsonSerialization.ToJson(jsonObject, new JsonSerializationParameters
            {
                DisableRootAdapters = true,
                SerializedType      = typeof(JsonObject)
            });
            settingsDir.Combine($"{targetName}.json").UpdateAllText(json);

            var file = rootAssembly.StagingDirectory.Combine(targetName).GetFile("export.manifest");
            file.UpdateAllLines(manifest.ExportedFiles.Select(x => x.FullName).ToArray());

            profile.Target.WriteBuildConfiguration(context, DotsRuntimeRootAssembly.BeeRootDirectory.ToString());

            return(context.Success());
        }
Beispiel #2
0
            public static void RunBeeProjectFiles(BuildProgress progress = null)
            {
                bool ownProgress = progress == null;

                if (ownProgress)
                {
                    progress = new BuildProgress(k_WindowTitle, "Please wait...");

                    BuildProgramDataFileWriter.WriteAll(BeeRootDirectory.FullName);
                }

                var result = BeeTools.Run("ProjectFiles -f", BeeRootDirectory, progress);

                if (!result.Succeeded)
                {
                    UnityEngine.Debug.LogError($"{k_WindowTitle} failed.\n{result.Error}");
                    if (ownProgress)
                    {
                        progress.Dispose();
                    }
                    return;
                }

                if (ownProgress)
                {
                    progress.Dispose();
                }
            }
        // Convenience method for CI workflow so they can quickly create all files
        // required by the buildprogram to build the samples without using the editor UI
        public static void UpdateAsmDefsJson()
        {
            var bootstrapFolder = Path.GetFullPath("./Library/DotsRuntimeBuild");

            if (!Directory.Exists(bootstrapFolder))
            {
                Directory.CreateDirectory(bootstrapFolder);
            }

            BuildProgramDataFileWriter.WriteAll(bootstrapFolder);
        }
Beispiel #4
0
        public override BuildStepResult RunBuildStep(BuildContext context)
        {
            var manifest  = context.BuildManifest;
            var profile   = GetRequiredComponent <DotsRuntimeBuildProfile>(context);
            var outputDir = profile.BeeRootDirectory;

            var buildSettingsJObject = new JObject();

            BuildProgramDataFileWriter.WriteAll(outputDir.FullName);

            if (HasOptionalComponent <DotsRuntimeScriptingDefines>(context))
            {
                buildSettingsJObject["ScriptingDefines"] = new JArray(GetOptionalComponent <DotsRuntimeScriptingDefines>(context).ScriptingDefines);
            }

            buildSettingsJObject["PlatformTargetIdentifier"] = profile.Target.BeeTargetName;
            buildSettingsJObject["UseBurst"] = profile.EnableBurst;
            buildSettingsJObject["EnableManagedDebugging"] = profile.EnableManagedDebugging;
            buildSettingsJObject["RootAssembly"]           = profile.RootAssembly.name;
            buildSettingsJObject["EnableMultiThreading"]   = profile.EnableMultiThreading;
            buildSettingsJObject["FinalOutputDirectory"]   = this.GetOutputBuildDirectory(context);
            buildSettingsJObject["DotsConfig"]             = profile.Configuration.ToString();

            var buildSettings = BuildContextInternals.GetBuildSettings(context);

            //web is broken until we can get all components that modify a particular interface
            foreach (var component in BuildSettingsInternals.GetComponents <IDotsRuntimeBuildModifier>(buildSettings))
            {
                component.Modify(buildSettingsJObject);
            }

            var settingsDir = new NPath(outputDir.FullName).Combine("settings");

            settingsDir.Combine($"{buildSettings.name}.json")
            .UpdateAllText(buildSettingsJObject.ToString());

            WriteBeeExportManifestFile(profile, manifest);

            profile.Target.WriteBeeConfigFile(profile.BeeRootDirectory.ToString());

            return(Success());
        }