public static string GetBundleID(DirectoryReference ProjectDirectory, FileReference ProjectFile) { ConfigHierarchy Ini = GetIni(ProjectDirectory); string BundleId; Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleId); BundleId = BundleId.Replace("[PROJECT_NAME]", ((ProjectFile != null) ? ProjectFile.GetFileNameWithoutAnyExtensions() : "UE4Game")).Replace("_", ""); return(BundleId); }
static public ProjectParams GetParams(BuildCommand Cmd, string ProjectFileName, out FileReference PluginFile) { string VersionString = Cmd.ParseParamValue("Version", "NOVERSION"); // Get the plugin filename string PluginPath = Cmd.ParseParamValue("PluginPath"); if (PluginPath == null) { throw new AutomationException("Missing -PluginPath=... argument"); } // Check it exists PluginFile = new FileReference(PluginPath); if (!FileReference.Exists(PluginFile)) { throw new AutomationException("Plugin '{0}' not found", PluginFile.FullName); } string ReleaseVersion = Cmd.ParseParamValue("BasedOnReleaseVersion", "AirsimUGC_v1"); FileReference ProjectFile = new FileReference(ProjectFileName); ProjectParams Params = new ProjectParams( RawProjectPath: ProjectFile, Command: Cmd, ClientTargetPlatforms: new List <TargetPlatformDescriptor>() { new TargetPlatformDescriptor(UnrealTargetPlatform.Win64) }, Build: false, Cook: true, Stage: true, Pak: true, Manifests: true, DLCIncludeEngineContent: true, // Need this to allow engine content that wasn't cooked in the base game to be included in the PAK file BasedOnReleaseVersion: ReleaseVersion, DLCName: PluginFile.GetFileNameWithoutAnyExtensions(), RunAssetNativization: true ); Params.ValidateAndLog(); return(Params); }
public BenchmarkBuildTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform, BuildOptions InOptions, string InUBTArgs = "", int CoreCount = 0) { bool IsVanillaUE4 = InProjectFile == null; string ModuleName = IsVanillaUE4 ? "UE4" : InProjectFile.GetFileNameWithoutAnyExtensions(); TaskName = string.Format("{0} {1} {2}", ModuleName, InTarget, InPlatform); Command = new BuildTarget(); Command.ProjectName = IsVanillaUE4 ? null : ModuleName; Command.Platforms = InPlatform.ToString(); Command.Targets = InTarget; Command.NoTools = true; Command.Clean = InOptions.HasFlag(BuildOptions.Clean); Command.UBTArgs = InUBTArgs; bool WithAccel = !InOptions.HasFlag(BuildOptions.NoAcceleration); if (!WithAccel || !SupportsAcceleration) { string Arg = string.Format("No{0}", AccelerationName); Command.UBTArgs += " -" + Arg; TaskModifiers.Add(Arg); Command.Params = new[] { Arg }; // need to also pass it to this if (CoreCount > 0) { TaskModifiers.Add(string.Format("{0}c", CoreCount)); Command.UBTArgs += string.Format(" -MaxParallelActions={0}", CoreCount); } } else { TaskModifiers.Add(AccelerationName); } if (!string.IsNullOrEmpty(InUBTArgs)) { TaskModifiers.Add(InUBTArgs); } }
private static void CopyPluginToTheGameDir(string gameDir, FileReference projectFile, FileReference pluginFile, string stagingDir) { var modsDir = Path.Combine(gameDir, projectFile.GetFileNameWithoutAnyExtensions(), "Mods"); var projectPluginsFolder = new DirectoryReference(Path.Combine(projectFile.Directory.ToString(), "Plugins")); var pluginRelativePath = pluginFile.Directory.MakeRelativeTo(projectPluginsFolder); var resultPluginDirectory = Path.Combine(modsDir, pluginRelativePath); if (DirectoryExists(resultPluginDirectory)) { DeleteDirectory(resultPluginDirectory); } CreateDirectory(resultPluginDirectory); CopyDirectory_NoExceptions(stagingDir, resultPluginDirectory); }
public override void ExecuteBuild() { // Get the list of platform names string[] FeaturePacks = ParseParamValue("FeaturePacks").Split(';'); string TempDir = ParseParamValue("TempDir"); UnrealTargetPlatform HostPlatform = BuildHostPlatform.Current.Platform; string TargetPlatforms = ParseParamValue("TargetPlatforms"); string SavedDir = ParseParamValue("SavedDir"); string BackendName = ParseParamValue("BackendName", "CreateInstalledEnginePak"); string RelativePakPath = ParseParamValue("RelativePakPath", "Engine/DerivedDataCache/Compressed.ddp"); bool bSkipEngine = ParseParam("SkipEngine"); // Get paths to everything within the temporary directory string EditorExe = CommandUtils.GetEditorCommandletExe(TempDir, HostPlatform); string OutputPakFile = CommandUtils.CombinePaths(TempDir, RelativePakPath); string OutputCsvFile = Path.ChangeExtension(OutputPakFile, ".csv"); List <string> ProjectPakFiles = new List <string>(); List <string> FeaturePackPaths = new List <string>(); // loop through all the projects first and bail out if one of them doesn't exist. foreach (string FeaturePack in FeaturePacks) { if (!String.IsNullOrWhiteSpace(FeaturePack)) { string FeaturePackPath = CommandUtils.CombinePaths(CommandUtils.RootDirectory.FullName, FeaturePack); if (!CommandUtils.FileExists(FeaturePackPath)) { throw new AutomationException("Could not find project: " + FeaturePack); } FeaturePackPaths.Add(FeaturePackPath); } } // loop through all the paths and generate ddc data for them foreach (string FeaturePackPath in FeaturePackPaths) { string ProjectSpecificPlatforms = TargetPlatforms; FileReference FileRef = new FileReference(FeaturePackPath); string GameName = FileRef.GetFileNameWithoutAnyExtensions(); ProjectDescriptor Project = ProjectDescriptor.FromFile(FileRef); if (Project.TargetPlatforms != null && Project.TargetPlatforms.Length > 0) { // Restrict target platforms used to those specified in project file List <string> FilteredPlatforms = new List <string>(); // Always include the editor platform for cooking string EditorCookPlatform = Platform.GetPlatform(HostPlatform).GetEditorCookPlatform(); if (TargetPlatforms.Contains(EditorCookPlatform)) { FilteredPlatforms.Add(EditorCookPlatform); } foreach (string TargetPlatform in Project.TargetPlatforms) { if (TargetPlatforms.Contains(TargetPlatform)) { FilteredPlatforms.Add(TargetPlatform); } } if (FilteredPlatforms.Count == 0) { LogInformation("Did not find any project specific platforms for FeaturePack {0} out of supplied TargetPlatforms {1}, skipping it!", GameName, ProjectSpecificPlatforms); continue; } ProjectSpecificPlatforms = CommandUtils.CombineCommandletParams(FilteredPlatforms.Distinct().ToArray()); } CommandUtils.LogInformation("Generating DDC data for {0} on {1}", GameName, ProjectSpecificPlatforms); CommandUtils.DDCCommandlet(FileRef, EditorExe, null, ProjectSpecificPlatforms, String.Format("-fill -DDC={0} -ProjectOnly", BackendName)); string ProjectPakFile = CommandUtils.CombinePaths(Path.GetDirectoryName(OutputPakFile), String.Format("Compressed-{0}.ddp", GameName)); CommandUtils.DeleteFile(ProjectPakFile); CommandUtils.RenameFile(OutputPakFile, ProjectPakFile); string ProjectCsvFile = Path.ChangeExtension(ProjectPakFile, ".csv"); CommandUtils.DeleteFile(ProjectCsvFile); CommandUtils.RenameFile(OutputCsvFile, ProjectCsvFile); ProjectPakFiles.Add(Path.GetFileName(ProjectPakFile)); } // Generate DDC for the editor, and merge all the other PAK files in CommandUtils.LogInformation("Generating DDC data for engine content on {0}", TargetPlatforms); CommandUtils.DDCCommandlet(null, EditorExe, null, TargetPlatforms, String.Format("-fill -DDC={0} -MergePaks={1}{2}", BackendName, CommandUtils.MakePathSafeToUseWithCommandLine(String.Join("+", ProjectPakFiles)), bSkipEngine? " -projectonly" : "")); string SavedPakFile = CommandUtils.CombinePaths(SavedDir, RelativePakPath); CommandUtils.CopyFile(OutputPakFile, SavedPakFile); }
public override void ExecuteBuild() { int WorkingCL = -1; FileReference PluginFile = null; string ProjectFileName = ParseParamValue("Project"); if (ProjectFileName == null) { ProjectFileName = CombinePaths(CmdEnv.LocalRoot, "SimpleGame", "SimpleGame.uproject"); } LogInformation(ProjectFileName); ProjectParams Params = GetParams(this, ProjectFileName, out PluginFile); // Check whether folder already exists so we know if we can delete it later string PlatformStageDir = Path.Combine(Params.StageDirectoryParam, "WindowsNoEditor"); bool bPreExistingStageDir = Directory.Exists(PlatformStageDir); PluginDescriptor Plugin = PluginDescriptor.FromFile(PluginFile); FileReference ProjectFile = new FileReference(ProjectFileName); // Add Plugin to folders excluded for nativization in config file FileReference UserEditorIni = new FileReference(Path.Combine(Path.GetDirectoryName(ProjectFileName), "Config", "UserEditor.ini")); bool bPreExistingUserEditorIni = FileReference.Exists(UserEditorIni); if (!bPreExistingUserEditorIni) { // Expect this most of the time so we will create and clean up afterwards DirectoryReference.CreateDirectory(UserEditorIni.Directory); CommandUtils.WriteAllText(UserEditorIni.FullName, ""); } const string ConfigSection = "BlueprintNativizationSettings"; const string ConfigKey = "ExcludedFolderPaths"; string ConfigValue = "/" + PluginFile.GetFileNameWithoutAnyExtensions() + "/"; ConfigFile UserEditorConfig = new ConfigFile(UserEditorIni); ConfigFileSection BPNSection = UserEditorConfig.FindOrAddSection(ConfigSection); bool bUpdateConfigFile = !BPNSection.Lines.Exists(x => String.Equals(x.Key, ConfigKey, StringComparison.OrdinalIgnoreCase) && String.Equals(x.Value, ConfigValue, StringComparison.OrdinalIgnoreCase)); if (bUpdateConfigFile) { BPNSection.Lines.Add(new ConfigLine(ConfigLineAction.Add, ConfigKey, ConfigValue)); UserEditorConfig.Write(UserEditorIni); } Project.Cook(Params); if (!bPreExistingUserEditorIni) { FileReference.Delete(UserEditorIni); } Project.CopyBuildToStagingDirectory(Params); Project.Package(Params, WorkingCL); Project.Archive(Params); Project.Deploy(Params); // Get path to where the plugin was staged string StagedPluginDir = Path.Combine(PlatformStageDir, Path.GetFileNameWithoutExtension(ProjectFileName), PluginFile.Directory.MakeRelativeTo(ProjectFile.Directory)); string ZipFile = Path.Combine(Params.StageDirectoryParam, PluginFile.GetFileNameWithoutAnyExtensions()); CommandUtils.DeleteFile(ZipFile); System.IO.Compression.ZipFile.CreateFromDirectory(StagedPluginDir, ZipFile + ".zip"); if (!bPreExistingStageDir) { CommandUtils.DeleteDirectory(PlatformStageDir); } }
public override void ExecuteBuild() { // Get the list of platform names string[] FeaturePacks = ParseParamValue("FeaturePacks").Split(';'); string TempDir = ParseParamValue("TempDir"); UnrealTargetPlatform HostPlatform = (UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), ParseParamValue("HostPlatform")); string TargetPlatforms = ParseParamValue("TargetPlatforms"); string SavedDir = ParseParamValue("SavedDir"); // Get paths to everything within the temporary directory string EditorExe = CommandUtils.GetEditorCommandletExe(TempDir, HostPlatform); string RelativePakPath = "Engine/DerivedDataCache/Compressed.ddp"; string OutputPakFile = CommandUtils.CombinePaths(TempDir, RelativePakPath); string OutputCsvFile = Path.ChangeExtension(OutputPakFile, ".csv"); List<string> ProjectPakFiles = new List<string>(); List<string> FeaturePackPaths = new List<string>(); // loop through all the projects first and bail out if one of them doesn't exist. foreach (string FeaturePack in FeaturePacks) { if (!String.IsNullOrWhiteSpace(FeaturePack)) { string FeaturePackPath = CommandUtils.CombinePaths(CommandUtils.RootDirectory.FullName, FeaturePack); if (!CommandUtils.FileExists(FeaturePackPath)) { throw new AutomationException("Could not find project: " + FeaturePack); } FeaturePackPaths.Add(FeaturePackPath); } } // loop through all the paths and generate ddc data for them foreach (string FeaturePackPath in FeaturePackPaths) { string ProjectSpecificPlatforms = TargetPlatforms; FileReference FileRef = new FileReference(FeaturePackPath); string GameName = FileRef.GetFileNameWithoutAnyExtensions(); ProjectDescriptor Project = ProjectDescriptor.FromFile(FeaturePackPath); if (Project.TargetPlatforms != null && Project.TargetPlatforms.Length > 0) { // Restrict target platforms used to those specified in project file List<string> FilteredPlatforms = new List<string>(); // Always include the editor platform for cooking string EditorCookPlatform = Platform.GetPlatform(HostPlatform).GetEditorCookPlatform(); if (TargetPlatforms.Contains(EditorCookPlatform)) { FilteredPlatforms.Add(EditorCookPlatform); } foreach (string TargetPlatform in Project.TargetPlatforms) { if (TargetPlatforms.Contains(TargetPlatform)) { FilteredPlatforms.Add(TargetPlatform); } } ProjectSpecificPlatforms = CommandUtils.CombineCommandletParams(FilteredPlatforms.Distinct().ToArray()); } CommandUtils.Log("Generating DDC data for {0} on {1}", GameName, ProjectSpecificPlatforms); CommandUtils.DDCCommandlet(FileRef, EditorExe, null, ProjectSpecificPlatforms, "-fill -DDC=CreateInstalledEnginePak -ProjectOnly"); string ProjectPakFile = CommandUtils.CombinePaths(Path.GetDirectoryName(OutputPakFile), String.Format("Compressed-{0}.ddp", GameName)); CommandUtils.DeleteFile(ProjectPakFile); CommandUtils.RenameFile(OutputPakFile, ProjectPakFile); string ProjectCsvFile = Path.ChangeExtension(ProjectPakFile, ".csv"); CommandUtils.DeleteFile(ProjectCsvFile); CommandUtils.RenameFile(OutputCsvFile, ProjectCsvFile); ProjectPakFiles.Add(Path.GetFileName(ProjectPakFile)); } // Generate DDC for the editor, and merge all the other PAK files in CommandUtils.Log("Generating DDC data for engine content on {0}", TargetPlatforms); CommandUtils.DDCCommandlet(null, EditorExe, null, TargetPlatforms, "-fill -DDC=CreateInstalledEnginePak " + CommandUtils.MakePathSafeToUseWithCommandLine("-MergePaks=" + String.Join("+", ProjectPakFiles))); string SavedPakFile = CommandUtils.CombinePaths(SavedDir, RelativePakPath); CommandUtils.CopyFile(OutputPakFile, SavedPakFile); }
/// <summary> /// Returns true/false based on whether the project supports a client configuration /// </summary> /// <param name="ProjectName"></param> /// <returns></returns> FileReference FindProjectSourceFile(FileReference InProjectFile) { FileReference SourceFile = null; if (InProjectFile != null) { DirectoryReference SourceDir = DirectoryReference.Combine(InProjectFile.Directory, "Source", InProjectFile.GetFileNameWithoutAnyExtensions()); var Files = DirectoryReference.EnumerateFiles(SourceDir, "*.cpp", System.IO.SearchOption.AllDirectories); SourceFile = Files.FirstOrDefault(); } if (SourceFile == null) { // touch the write time on a file, first making it writable since it may be under P4 SourceFile = FileReference.Combine(CommandUtils.EngineDirectory, "Source/Runtime/Engine/Private/UnrealEngine.cpp"); } Log.TraceVerbose("Will compile {0} for single-file compilation test for {1}", SourceFile, InProjectFile.GetFileNameWithoutAnyExtensions()); return(SourceFile); }