示例#1
0
    static List <UnrealTargetPlatform> GetTargetPlatforms(BuildCommand Command, UnrealTargetPlatform HostPlatform)
    {
        List <UnrealTargetPlatform> TargetPlatforms = new List <UnrealTargetPlatform>();

        if (!Command.ParseParam("NoTargetPlatforms"))
        {
            // Only interested in building for Platforms that support code projects
            TargetPlatforms = PlatformExports.GetRegisteredPlatforms().Where(x => InstalledPlatformInfo.IsValidPlatform(x, EProjectType.Code)).ToList();

            // only build Mac on Mac
            if (HostPlatform != UnrealTargetPlatform.Mac && TargetPlatforms.Contains(UnrealTargetPlatform.Mac))
            {
                TargetPlatforms.Remove(UnrealTargetPlatform.Mac);
            }
            // only build Windows on Windows
            if (HostPlatform != UnrealTargetPlatform.Win64 && TargetPlatforms.Contains(UnrealTargetPlatform.Win64))
            {
                TargetPlatforms.Remove(UnrealTargetPlatform.Win64);
                TargetPlatforms.Remove(UnrealTargetPlatform.Win32);
            }
            // build Linux on Windows and Linux
            if (HostPlatform != UnrealTargetPlatform.Win64 && HostPlatform != UnrealTargetPlatform.Linux)
            {
                if (TargetPlatforms.Contains(UnrealTargetPlatform.Linux))
                {
                    TargetPlatforms.Remove(UnrealTargetPlatform.Linux);
                }

                if (TargetPlatforms.Contains(UnrealTargetPlatform.LinuxAArch64))
                {
                    TargetPlatforms.Remove(UnrealTargetPlatform.LinuxAArch64);
                }
            }

            // Remove any platforms that aren't enabled on the command line
            string TargetPlatformFilter = Command.ParseParamValue("TargetPlatforms", null);
            if (TargetPlatformFilter != null)
            {
                List <UnrealTargetPlatform> NewTargetPlatforms = new List <UnrealTargetPlatform>();
                foreach (string TargetPlatformName in TargetPlatformFilter.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    UnrealTargetPlatform TargetPlatform;
                    if (!UnrealTargetPlatform.TryParse(TargetPlatformName, out TargetPlatform))
                    {
                        throw new AutomationException("Unknown target platform '{0}' specified on command line", TargetPlatformName);
                    }
                    if (TargetPlatforms.Contains(TargetPlatform))
                    {
                        NewTargetPlatforms.Add(TargetPlatform);
                    }
                }
                TargetPlatforms = NewTargetPlatforms;
            }
        }
        return(TargetPlatforms);
    }
        public override object ReadJson(JsonReader Reader, Type ObjectType, object ExistingValue, JsonSerializer Serializer)
        {
            UnrealTargetPlatform Platform;

            if (!UnrealTargetPlatform.TryParse((string)Reader.Value, out Platform))
            {
                return(null);
            }
            return(Platform);
        }
        public static UnrealTargetPlatform GetPlatformFromString(string PlatformName)
        {
            UnrealTargetPlatform UnrealPlatform;

            if (UnrealTargetPlatform.TryParse(PlatformName, out UnrealPlatform))
            {
                return(UnrealPlatform);
            }

            throw new AutomationException("Unable convert platform {0} into a valid Unreal Platform", PlatformName);
        }
    private Platform GetPlatformByName(string PlatformName)
    {
        UnrealTargetPlatform TargetPlatform;

        if (UnrealTargetPlatform.TryParse(PlatformName, out TargetPlatform))
        {
            return(null);
        }

        return(Platform.GetPlatform(TargetPlatform));
    }
        public override void ExecuteBuild()
        {
            // Parse all the arguments
            string TargetName   = ParseRequiredStringParam("Name");
            string PlatformName = ParseOptionalStringParam("Platform");
            UnrealTargetPlatform Platform;

            if (UnrealTargetPlatform.TryParse(PlatformName, out Platform))
            {
                Platform = HostPlatform.Current.HostEditorPlatform;
            }
            UnrealTargetConfiguration Configuration = ParseOptionalEnumParam <UnrealTargetConfiguration>("Configuration") ?? UnrealTargetConfiguration.Development;
            string             Architecture         = ParseOptionalStringParam("Architecture");
            FileReference      ProjectFile          = ParseOptionalFileReferenceParam("Project");
            DirectoryReference ToDir = ParseRequiredDirectoryReferenceParam("To");

            // Read the receipt
            FileReference ReceiptFile = TargetReceipt.GetDefaultPath(DirectoryReference.FromFile(ProjectFile) ?? EngineDirectory, TargetName, Platform, Configuration, Architecture);

            if (!FileReference.Exists(ReceiptFile))
            {
                throw new AutomationException("Unable to find '{0}'", ReceiptFile);
            }

            TargetReceipt Receipt = TargetReceipt.Read(ReceiptFile);

            // Enumerate all the files we want to move
            List <FileReference> FilesToMove = new List <FileReference>();

            FilesToMove.Add(ReceiptFile);
            FilesToMove.AddRange(Receipt.BuildProducts.Select(x => x.Path));

            // Move all the files to the output folder
            DirectoryReference.CreateDirectory(ToDir);
            CommandUtils.DeleteDirectoryContents(ToDir.FullName);
            foreach (FileReference SourceFile in FilesToMove)
            {
                FileReference TargetFile = FileReference.Combine(ToDir, SourceFile.MakeRelativeTo(RootDirectory));
                LogInformation("Copying {0} to {1}", SourceFile, TargetFile);
                CommandUtils.CopyFile(SourceFile.FullName, TargetFile.FullName);
            }
        }
    public override void ExecuteBuild()
    {
        var Build         = new UE4Build(this);
        var Agenda        = new UE4Build.BuildAgenda();
        var Platform      = UnrealBuildTool.UnrealTargetPlatform.Win64;
        var Configuration = UnrealBuildTool.UnrealTargetConfiguration.Development;
        var Targets       = new List <string>();

        foreach (var ObjParam in Params)
        {
            var Param = (string)ObjParam;
            if (!UnrealTargetPlatform.TryParse(Param, out Platform))
            {
                continue;
            }
            UnrealBuildTool.UnrealTargetConfiguration ParseConfiguration;
            if (Enum.TryParse <UnrealBuildTool.UnrealTargetConfiguration>(Param, true, out ParseConfiguration))
            {
                Configuration = ParseConfiguration;
                continue;
            }
            if (String.Compare("NoXGE", Param, true) != 0 && String.Compare("Clean", Param, true) != 0)
            {
                Targets.Add(Param);
            }
        }

        var Clean = ParseParam("Clean");

        Agenda.AddTargets(Targets.ToArray(), Platform, Configuration);

        LogInformation("UBT Buid");
        LogInformation("Targets={0}", String.Join(",", Targets));
        LogInformation("Platform={0}", Platform);
        LogInformation("Configuration={0}", Configuration);
        LogInformation("Clean={0}", Clean);

        Build.Build(Agenda, InUpdateVersionFiles: false);

        LogInformation("UBT Completed");
    }
        protected void SetupDevices(UnrealTargetPlatform DefaultPlatform, UnrealTestOptions Options)
        {
            Reservation.ReservationDetails = Options.JobDetails;

            DevicePool.Instance.SetLocalOptions(Options.TempDir, Options.Parallel > 1, Options.DeviceURL);
            DevicePool.Instance.AddLocalDevices(10);

            foreach (var DeviceWithParams in Options.DeviceList)
            {
                UnrealTargetPlatform Platform = DefaultPlatform;

                // see if one of the params is a platform
                foreach (var Param in DeviceWithParams.AllArguments)
                {
                    if (UnrealTargetPlatform.TryParse(Param, out Platform))
                    {
                        break;
                    }
                }

                DevicePool.Instance.AddDevices(Platform, DeviceWithParams.Argument);
            }
        }
示例#8
0
        public override ExitCode Execute()
        {
            string[] Arguments = this.Params;

            ProjectName    = ParseParamValue("project", ProjectName);
            Targets        = ParseParamValue("target", Targets);
            Platforms      = ParseParamValue("platform", Platforms);
            Configurations = ParseParamValue("configuration", Configurations);
            Clean          = ParseParam("clean") || Clean;

            if (string.IsNullOrEmpty(Targets))
            {
                throw new AutomationException("No target specified with -target. Use -help to see all options");
            }

            bool NoTools = ParseParam("notools");

            IEnumerable <string> TargetList = Targets.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
            IEnumerable <UnrealTargetConfiguration> ConfigurationList = null;
            IEnumerable <UnrealTargetPlatform>      PlatformList      = null;

            try
            {
                ConfigurationList = Configurations.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries)
                                    .Select(C => (UnrealTargetConfiguration)Enum.Parse(typeof(UnrealTargetConfiguration), C, true)).ToArray();
            }
            catch (Exception Ex)
            {
                LogError("Failed to parse configuration string. {0}", Ex.Message);
                return(ExitCode.Error_Arguments);
            }

            try
            {
                PlatformList = Platforms.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(C =>
                {
                    UnrealTargetPlatform Platform;
                    if (!UnrealTargetPlatform.TryParse(C, out Platform))
                    {
                        throw new AutomationException("No such platform {0}", C);
                    }
                    return(Platform);
                }).ToArray();
            }
            catch (Exception Ex)
            {
                LogError("Failed to parse configuration string. {0}", Ex.Message);
                return(ExitCode.Error_Arguments);
            }

            FileReference ProjectFile = null;

            if (!string.IsNullOrEmpty(ProjectName))
            {
                ProjectFile = ProjectUtils.FindProjectFileFromName(ProjectName);

                if (ProjectFile == null)
                {
                    throw new AutomationException("Unable to find uproject file for {0}", ProjectName);
                }

                string SourceDirectoryName = Path.Combine(ProjectFile.Directory.FullName, "Source");

                if (Directory.Exists(SourceDirectoryName))
                {
                    IEnumerable <string> TargetScripts = Directory.EnumerateFiles(SourceDirectoryName, "*.Target.cs");

                    foreach (string TargetName in TargetList)
                    {
                        string TargetScript = TargetScripts.Where(S => S.IndexOf(TargetName, StringComparison.OrdinalIgnoreCase) >= 0).FirstOrDefault();

                        if (TargetScript == null && (
                                TargetName.Equals("Client", StringComparison.OrdinalIgnoreCase) ||
                                TargetName.Equals("Game", StringComparison.OrdinalIgnoreCase)
                                )
                            )
                        {
                            // if there's no ProjectGame.Target.cs or ProjectClient.Target.cs then
                            // fallback to Project.Target.cs
                            TargetScript = TargetScripts.Where(S => S.IndexOf(ProjectName + ".", StringComparison.OrdinalIgnoreCase) >= 0).FirstOrDefault();
                        }

                        if (TargetScript == null)
                        {
                            throw new AutomationException("No Target.cs file for target {0} in project {1}", TargetName, ProjectName);
                        }

                        string FullName = Path.GetFileName(TargetScript);
                        TargetNames[TargetName] = Regex.Replace(FullName, ".Target.cs", "", RegexOptions.IgnoreCase);
                    }
                }
            }
            else
            {
                Log.TraceWarning("No project specified, will build vanilla UE4 binaries");
            }

            // Handle content-only projects or when no project was specified
            if (TargetNames.Keys.Count == 0)
            {
                foreach (string TargetName in TargetList)
                {
                    TargetNames[TargetName] = string.Format("UE4{0}", TargetName);
                }
            }

            UE4Build Build = new UE4Build(this);

            UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();

            string EditorTarget = TargetList.Where(T => T.EndsWith("Editor", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            IEnumerable <string> OtherTargets = TargetList.Where(T => T != EditorTarget);

            UnrealTargetPlatform CurrentPlatform = HostPlatform.Current.HostEditorPlatform;

            if (!NoTools)
            {
                Agenda.AddTarget("UnrealHeaderTool", CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile);
            }

            if (string.IsNullOrEmpty(EditorTarget) == false)
            {
                string TargetName = TargetNames[EditorTarget];

                Agenda.AddTarget(TargetName, CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile);

                if (!NoTools)
                {
                    Agenda.AddTarget("UnrealPak", CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile);
                    Agenda.AddTarget("ShaderCompileWorker", CurrentPlatform, UnrealTargetConfiguration.Development);
                    Agenda.AddTarget("UnrealLightmass", CurrentPlatform, UnrealTargetConfiguration.Development);
                    Agenda.AddTarget("CrashReportClient", CurrentPlatform, UnrealTargetConfiguration.Shipping);
                    Agenda.AddTarget("CrashReportClientEditor", CurrentPlatform, UnrealTargetConfiguration.Shipping);
                }
            }

            foreach (string Target in OtherTargets)
            {
                string TargetName = TargetNames[Target];

                bool IsServer = Target.EndsWith("Server", StringComparison.OrdinalIgnoreCase);

                IEnumerable <UnrealTargetPlatform> PlatformsToBuild = IsServer ? new UnrealTargetPlatform[] { CurrentPlatform } : PlatformList;

                foreach (UnrealTargetPlatform Platform in PlatformsToBuild)
                {
                    foreach (UnrealTargetConfiguration Config in ConfigurationList)
                    {
                        Agenda.AddTarget(TargetName, Platform, Config);
                    }
                }
            }

            // Set clean and log
            foreach (var Target in Agenda.Targets)
            {
                if (Clean)
                {
                    Target.Clean = Clean;
                }

                Log.TraceInformation("Will {0}build {1}", Clean ? "clean and " : "", Target);
            }

            Build.Build(Agenda, InUpdateVersionFiles: false);

            return(ExitCode.Success);
        }
        static ConfigInfo GetUnrealConfigFromFileName(string InProjectName, string InName)
        {
            ConfigInfo Config = new ConfigInfo();

            string ShortName = Regex.Replace(InProjectName, "Game", "", RegexOptions.IgnoreCase);

            if (InName.StartsWith("UE4Game", StringComparison.OrdinalIgnoreCase))
            {
                ShortName = "UE4";
            }

            string AppName = Path.GetFileNameWithoutExtension(InName);

            // A project name may be either something like EngineTest or FortniteGame.
            // The Game, Client, Server executables will be called
            // EngineTest, EngineTestClient, EngineTestServer
            // FortniteGame, FortniteClient, FortniteServer
            // Or EngineTest-WIn64-Shipping, FortniteClient-Win64-Shipping etc
            // So we need to search for the project name minus 'Game', with the form, build-type, and platform all optional :(
            string RegExMatch = string.Format(@"{0}(Game|Client|Server|)(?:-(.+?)-(Debug|Test|Shipping))?", ShortName);

            // Format should be something like
            // FortniteClient
            // FortniteClient-Win64-Test
            // Match this and break it down to components
            var NameMatch = Regex.Match(AppName, RegExMatch, RegexOptions.IgnoreCase);

            if (NameMatch.Success)
            {
                string ModuleType   = NameMatch.Groups[1].ToString().ToLower();
                string PlatformName = NameMatch.Groups[2].ToString();
                string ConfigType   = NameMatch.Groups[3].ToString();

                if (ModuleType.Length == 0 || ModuleType == "game")
                {
                    // how to express client&server?
                    Config.RoleType    = UnrealTargetRole.Client;
                    Config.SharedBuild = true;
                }
                else if (ModuleType == "client")
                {
                    Config.RoleType = UnrealTargetRole.Client;
                }
                else if (ModuleType == "server")
                {
                    Config.RoleType = UnrealTargetRole.Server;
                }

                if (ConfigType.Length > 0)
                {
                    Enum.TryParse(ConfigType, true, out Config.Configuration);
                }
                else
                {
                    Config.Configuration = UnrealTargetConfiguration.Development;                       // Development has no string
                }

                UnrealTargetPlatform Platform;
                if (PlatformName.Length > 0 && UnrealTargetPlatform.TryParse(PlatformName, out Platform))
                {
                    Config.Platform = Platform;
                }
            }

            return(Config);
        }
        public override void ExecuteBuild()
        {
            // Parse the target name
            string Target = ParseParamValue("Target");

            if (Target == null)
            {
                throw new AutomationException("Missing -Target=... argument");
            }

            // Parse the platform
            string PlatformParam = ParseParamValue("Platform");

            if (PlatformParam == null)
            {
                throw new AutomationException("Missing -Platform=... argument");
            }
            UnrealTargetPlatform Platform;

            if (!UnrealTargetPlatform.TryParse(PlatformParam, out Platform))
            {
                throw new AutomationException("Invalid platform '{0}'", PlatformParam);
            }

            // Parse the configuration
            string ConfigurationParam = ParseParamValue("Configuration");

            if (ConfigurationParam == null)
            {
                throw new AutomationException("Missing -Configuration=... argument");
            }
            UnrealTargetConfiguration Configuration;

            if (!Enum.TryParse(ConfigurationParam, true, out Configuration))
            {
                throw new AutomationException("Invalid configuration '{0}'", ConfigurationParam);
            }

            // Parse the project
            string Project = ParseParamValue("Project");

            if (Project != null && !File.Exists(Project))
            {
                throw new AutomationException("Specified project file '{0}' was not found", Project);
            }

            // Parse the architecture
            string Architecture = ParseParamValue("Architecture");

            // Check the receipt exists
            DirectoryReference ProjectDir = null;

            if (Project != null)
            {
                ProjectDir = new FileReference(Project).Directory;
            }
            FileReference ReceiptFile = TargetReceipt.GetDefaultPath(ProjectDir, Target, Platform, Configuration, Architecture);

            if (!FileReference.Exists(ReceiptFile))
            {
                throw new AutomationException("FortniteEditor receipt not found ({0})", ReceiptFile);
            }

            LogInformation("Found {0}", ReceiptFile);
        }
示例#11
0
    public Noesis(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        string NoesisBasePath    = Path.Combine(ModuleDirectory, "NoesisSDK");
        string NoesisIncludePath = Path.Combine(NoesisBasePath, "Include");
        string NoesisInteractivityIncludePath = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "Interactivity", "Include");
        string NoesisMediaElementIncludePath  = Path.Combine(NoesisBasePath, "Src", "Packages", "App", "MediaElement", "Include");

        // In monolithic builds we don't want the Interactivity and MediaElement functions
        // dllexported or dllimported from any modules.
        // That's why we use PublicDefinitions.
        if (Target.LinkType == TargetLinkType.Monolithic)
        {
            PublicDefinitions.Add("NS_APP_INTERACTIVITY_API=");
            PublicDefinitions.Add("NS_APP_MEDIAELEMENT_API=");
        }

        PublicIncludePaths.Add(ModuleDirectory);
        PublicIncludePaths.Add(NoesisIncludePath);
        PublicIncludePaths.Add(NoesisInteractivityIncludePath);
        PublicIncludePaths.Add(NoesisMediaElementIncludePath);

        if (!Directory.Exists(NoesisBasePath))
        {
            throw new BuildException("Could not find NoesisGUI SDK in " + NoesisBasePath + ".");
        }

        if (!Directory.Exists(NoesisIncludePath))
        {
            throw new BuildException("Could not find NoesisGUI SDK Include directory in " + NoesisIncludePath);
        }

        PublicSystemIncludePaths.Add(NoesisIncludePath);

        UnrealTargetPlatform Platform;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "windows_x86_64", "Noesis.lib"));

            string NoesisDllPath       = Path.Combine(NoesisBasePath, "Bin", "windows_x86_64", "Noesis.dll");
            string NoesisDllTargetPath = Path.Combine("$(BinaryOutputDir)", "Noesis.dll");

            RuntimeDependencies.Add(NoesisDllTargetPath, NoesisDllPath, StagedFileType.NonUFS);
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            string NoesisSoName = "libNoesis.so";
            string NoesisSoPath = Path.Combine(NoesisBasePath, "Bin", "linux_x86_64", NoesisSoName);
            PublicAdditionalLibraries.Add(NoesisSoPath);
            string NoesisSoTargetPath = Path.Combine("$(BinaryOutputDir)", NoesisSoName);

            RuntimeDependencies.Add(NoesisSoTargetPath, NoesisSoPath, StagedFileType.NonUFS);
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "macos", "Noesis.dylib"));

            string NoesisDylibPath = Path.Combine("NoesisSDK", "Bin", "macos", "Noesis.dylib");
            RuntimeDependencies.Add(Path.Combine(ModuleDirectory, NoesisDylibPath));
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicDefinitions.Add("NS_STATIC_LIBRARY");
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "ios", "libNoesis.a"));

            PublicFrameworks.Add("CoreText");
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "android_arm", "libNoesis.so"));
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "android_arm64", "libNoesis.so"));
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "android_x86", "libNoesis.so"));
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "android_x86_64", "libNoesis.so"));

            string NoesisAplPath = "Noesis_APL.xml";
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(ModuleDirectory, NoesisAplPath));
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            PublicDefinitions.Add("NS_STATIC_LIBRARY");
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "ps4", "Noesis.a"));
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "xbox_one", "Noesis.lib"));

            string NoesisDllPath       = Path.Combine(NoesisBasePath, "Bin", "xbox_one", "Noesis.dll");
            string NoesisDllTargetPath = Path.Combine("$(BinaryOutputDir)", "Noesis.dll");

            RuntimeDependencies.Add(NoesisDllTargetPath, NoesisDllPath, StagedFileType.NonUFS);
        }
        else if (UnrealTargetPlatform.TryParse("HTML5", out Platform) && Target.Platform == Platform)
        {
            PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Bin", "wasm", "Noesis.bc"));
        }
    }
示例#12
0
        public override ExitCode Execute()
        {
            string[] Arguments = this.Params;

            ProjectName    = ParseParamValue("project", ProjectName);
            Targets        = ParseParamValue("target", Targets);
            Platforms      = ParseParamValue("platform", Platforms);
            Configurations = ParseParamValue("configuration", Configurations);
            Clean          = ParseParam("clean") || Clean;
            NoTools        = ParseParam("NoTools") || NoTools;
            UBTArgs        = ParseParamValue("ubtargs", UBTArgs);
            Preview        = ParseParam("preview") || Preview;

            if (string.IsNullOrEmpty(Targets))
            {
                throw new AutomationException("No target specified with -target. Use -help to see all options");
            }

            IEnumerable <string> TargetList = Targets.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
            IEnumerable <UnrealTargetConfiguration> ConfigurationList = null;
            IEnumerable <UnrealTargetPlatform>      PlatformList      = null;

            try
            {
                ConfigurationList = Configurations.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries)
                                    .Select(C => (UnrealTargetConfiguration)Enum.Parse(typeof(UnrealTargetConfiguration), C, true)).ToArray();
            }
            catch (Exception Ex)
            {
                LogError("Failed to parse configuration string. {0}", Ex.Message);
                return(ExitCode.Error_Arguments);
            }

            try
            {
                PlatformList = Platforms.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries)
                               .Select(C =>
                {
                    UnrealTargetPlatform Platform;
                    if (!UnrealTargetPlatform.TryParse(C, out Platform))
                    {
                        throw new AutomationException("No such platform {0}", C);
                    }
                    return(Platform);
                }).ToArray();
            }
            catch (Exception Ex)
            {
                LogError("Failed to parse configuration string. {0}", Ex.Message);
                return(ExitCode.Error_Arguments);
            }

            FileReference ProjectFile = null;

            if (!string.IsNullOrEmpty(ProjectName))
            {
                // find the project
                ProjectFile = ProjectUtils.FindProjectFileFromName(ProjectName);

                if (ProjectFile == null)
                {
                    throw new AutomationException("Unable to find uproject file for {0}", ProjectName);
                }
            }

            IEnumerable <string> BuildTargets = TargetList.Select(T => ProjectTargetFromTarget(T, ProjectFile)).ToArray();

            bool ContainsEditor = BuildTargets.Where(T => T.EndsWith("Editor", StringComparison.OrdinalIgnoreCase)).Any();
            bool SingleBuild    = BuildTargets.Count() == 1 && PlatformList.Count() == 1 && ConfigurationList.Count() == 1;

            if (!SingleBuild || (ContainsEditor && !NoTools))
            {
                UE4Build Build = new UE4Build(this);
                Build.AlwaysBuildUHT = true;

                UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();

                string EditorTarget = BuildTargets.Where(T => T.EndsWith("Editor", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                IEnumerable <string> OtherTargets = BuildTargets.Where(T => T != EditorTarget);

                UnrealTargetPlatform CurrentPlatform = HostPlatform.Current.HostEditorPlatform;

                if (string.IsNullOrEmpty(EditorTarget) == false)
                {
                    Agenda.AddTarget(EditorTarget, CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile, UBTArgs);

                    if (!NoTools)
                    {
                        Agenda.AddTarget("UnrealPak", CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile, UBTArgs);
                        Agenda.AddTarget("ShaderCompileWorker", CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile, UBTArgs);
                        Agenda.AddTarget("UnrealLightmass", CurrentPlatform, UnrealTargetConfiguration.Development, ProjectFile, UBTArgs);
                        Agenda.AddTarget("CrashReportClient", CurrentPlatform, UnrealTargetConfiguration.Shipping, ProjectFile, UBTArgs);
                        Agenda.AddTarget("CrashReportClientEditor", CurrentPlatform, UnrealTargetConfiguration.Shipping, ProjectFile, UBTArgs);
                    }
                }

                foreach (string Target in OtherTargets)
                {
                    bool IsServer = Target.EndsWith("Server", StringComparison.OrdinalIgnoreCase);

                    IEnumerable <UnrealTargetPlatform> PlatformsToBuild = IsServer ? new UnrealTargetPlatform[] { CurrentPlatform } : PlatformList;

                    foreach (UnrealTargetPlatform Platform in PlatformsToBuild)
                    {
                        foreach (UnrealTargetConfiguration Config in ConfigurationList)
                        {
                            Agenda.AddTarget(Target, Platform, Config, ProjectFile, UBTArgs);
                        }
                    }
                }

                foreach (var Target in Agenda.Targets)
                {
                    Log.TraceInformation("Will {0}build {1}", Clean ? "clean and " : "", Target);
                    if (Clean)
                    {
                        Target.Clean = Clean;
                    }
                }

                if (!Preview)
                {
                    Build.Build(Agenda, InUpdateVersionFiles: false);
                }
            }
            else
            {
                // Get the path to UBT
                FileReference InstalledUBT = FileReference.Combine(CommandUtils.EngineDirectory, "Binaries", "DotNET", "UnrealBuildTool.exe");

                UnrealTargetPlatform      PlatformToBuild = PlatformList.First();
                UnrealTargetConfiguration ConfigToBuild   = ConfigurationList.First();
                string TargetToBuild = BuildTargets.First();

                if (!Preview)
                {
                    // Compile the editor
                    string CommandLine = CommandUtils.UBTCommandline(ProjectFile, TargetToBuild, PlatformToBuild, ConfigToBuild, UBTArgs);

                    if (Clean)
                    {
                        CommandUtils.RunUBT(CommandUtils.CmdEnv, InstalledUBT.FullName, CommandLine + " -clean");
                    }
                    CommandUtils.RunUBT(CommandUtils.CmdEnv, InstalledUBT.FullName, CommandLine);
                }
                else
                {
                    Log.TraceInformation("Will {0}build {1} {2} {3}", Clean ? "clean and " : "", TargetToBuild, PlatformToBuild, ConfigToBuild);
                }
            }

            return(ExitCode.Success);
        }
示例#13
0
        /// <summary>
        /// Created a list of device definitions from the passed in reference. Needs work....
        /// </summary>
        /// <param name="InputReference"></param>
        /// <param name="InLocalTempDir"></param>
        /// <param name="ObeyConstraints"></param>
        public void AddDevices(UnrealTargetPlatform DefaultPlatform, string InputReference, bool ObeyConstraints = true)
        {
            lock (LockObject)
            {
                List <ITargetDevice> NewDevices = new List <ITargetDevice>();

                int SlashIndex = InputReference.IndexOf("\\") >= 0 ? InputReference.IndexOf("\\") : InputReference.IndexOf("/");

                bool PossibleFileName = InputReference.IndexOfAny(Path.GetInvalidPathChars()) < 0 &&
                                        (InputReference.IndexOf(":") == -1 || (InputReference.IndexOf(":") == SlashIndex - 1));
                // Did they specify a file?
                if (PossibleFileName && File.Exists(InputReference))
                {
                    Gauntlet.Log.Info("Adding devices from {0}", InputReference);
                    List <DeviceDefinition> DeviceDefinitions = JsonConvert.DeserializeObject <List <DeviceDefinition> >(File.ReadAllText(InputReference));

                    foreach (DeviceDefinition Def in DeviceDefinitions)
                    {
                        Gauntlet.Log.Info("Adding {0}", Def);

                        // use Legacy field if it exists
                        if (Def.Platform == null)
                        {
                            Def.Platform = Def.Type;
                        }

                        // check for an availability constraint
                        if (string.IsNullOrEmpty(Def.Available) == false && ObeyConstraints)
                        {
                            // check whether disabled
                            if (String.Compare(Def.Available, "disabled", true) == 0)
                            {
                                Gauntlet.Log.Info("Skipping {0} due to being disabled", Def.Name);
                                continue;
                            }

                            // availability is specified as a range, e.g 21:00-09:00.
                            Match M = Regex.Match(Def.Available, @"(\d{1,2}:\d\d)\s*-\s*(\d{1,2}:\d\d)");

                            if (M.Success)
                            {
                                DateTime From, To;

                                if (DateTime.TryParse(M.Groups[1].Value, out From) && DateTime.TryParse(M.Groups[2].Value, out To))
                                {
                                    // these are just times so when parsed will have todays date. If the To time is less than
                                    // From (22:00-06:00) time it spans midnight so move it to the next day
                                    if (To < From)
                                    {
                                        To = To.AddDays(1);
                                    }

                                    // if From is in the future (e.g. it's 01:00 and range is 22:00-08:00) we may be in the previous days window,
                                    // so move them both back a day
                                    if (From > DateTime.Now)
                                    {
                                        From = From.AddDays(-1);
                                        To   = To.AddDays(-1);
                                    }

                                    if (DateTime.Now < From || DateTime.Now > To)
                                    {
                                        Gauntlet.Log.Info("Skipping {0} due to availability constraint {1}", Def.Name, Def.Available);
                                        continue;
                                    }
                                }
                                else
                                {
                                    Gauntlet.Log.Warning("Failed to parse availability {0} for {1}", Def.Available, Def.Name);
                                }
                            }
                        }

                        Def.RemoveOnShutdown = true;

                        if (Def.Platform == null)
                        {
                            Def.Platform = DefaultPlatform;
                        }

                        UnprovisionedDevices.Add(Def);
                    }

                    // randomize devices so if there's a bad device st the start so we don't always hit it (or we do if its later)
                    UnprovisionedDevices = UnprovisionedDevices.OrderBy(D => Guid.NewGuid()).ToList();
                }
                else
                {
                    if (string.IsNullOrEmpty(InputReference) == false)
                    {
                        string[] DevicesList = InputReference.Split(',');

                        foreach (string DeviceRef in DevicesList)
                        {
                            // check for <platform>:<address>:<port>|<model>. We pass address:port to device constructor
                            Match M = Regex.Match(DeviceRef, @"(.+?):(.+)");

                            UnrealTargetPlatform DevicePlatform = DefaultPlatform;
                            string DeviceAddress = DeviceRef;
                            string Model         = string.Empty;

                            // when using device service, skip adding local non-desktop devices to pool
                            bool IsDesktop = UnrealBuildTool.Utils.GetPlatformsInClass(UnrealPlatformClass.Desktop).Contains(DevicePlatform);
                            if (!IsDesktop && DeviceRef.Equals("default", StringComparison.OrdinalIgnoreCase) && !String.IsNullOrEmpty(DeviceURL))
                            {
                                continue;
                            }

                            if (M.Success)
                            {
                                if (!UnrealTargetPlatform.TryParse(M.Groups[1].ToString(), out DevicePlatform))
                                {
                                    throw new AutomationException("platform {0} is not a recognized device type", M.Groups[1].ToString());
                                }

                                DeviceAddress = M.Groups[2].ToString();

                                // parse device model
                                if (DeviceAddress.Contains("|"))
                                {
                                    string[] Components = DeviceAddress.Split(new char[] { '|' });
                                    DeviceAddress = Components[0];
                                    Model         = Components[1];
                                }
                            }

                            Log.Info("Added device {0}:{1} to pool", DevicePlatform, DeviceAddress);
                            DeviceDefinition Def = new DeviceDefinition();
                            Def.Address  = DeviceAddress;
                            Def.Name     = DeviceAddress;
                            Def.Platform = DevicePlatform;
                            Def.Model    = Model;
                            UnprovisionedDevices.Add(Def);
                        }
                    }
                }
            }
        }
        public override void ExecuteBuild()
        {
            // Parse the target list
            string[] Targets = ParseParamValues("Target");
            if (Targets.Length == 0)
            {
                throw new AutomationException("No targets specified (eg. -Target=\"UE4Editor Win64 Development\")");
            }

            // Parse the archive path
            string ArchivePath = ParseParamValue("Archive");

            if (ArchivePath != null && (!ArchivePath.StartsWith("//") || ArchivePath.Sum(x => (x == '/')? 1 : 0) < 4))
            {
                throw new AutomationException("Archive path is not a valid depot filename");
            }

            // Parse the stream name
            string StreamName = ParseParamValue("Stream");

            if (StreamName == null && ArchivePath != null)
            {
                StreamName = ArchivePath.Substring(0, ArchivePath.IndexOf('/', ArchivePath.IndexOf('/', 2) + 1));
            }

            // Prepare the build agenda
            UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
            foreach (string Target in Targets)
            {
                string[] Tokens = Target.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                UnrealTargetConfiguration Configuration = UnrealTargetConfiguration.Unknown;
                UnrealTargetPlatform      Platform;
                if (Tokens.Length < 3 || !UnrealTargetPlatform.TryParse(Tokens[1], out Platform) || !Enum.TryParse(Tokens[2], true, out Configuration))
                {
                    throw new AutomationException("Invalid target '{0}' - expected <TargetName> <Platform> <Configuration>");
                }

                Agenda.AddTarget(Tokens[0], Platform, Configuration, InAddArgs: String.Join(" ", Tokens.Skip(3)));
            }

            // Build everything
            UE4Build Builder = new UE4Build(this);

            Builder.Build(Agenda, InUpdateVersionFiles: ArchivePath != null);

            // Include the build products for UAT and UBT if required
            if (ParseParam("WithUAT"))
            {
                Builder.AddUATFilesToBuildProducts();
            }
            if (ParseParam("WithUBT"))
            {
                Builder.AddUBTFilesToBuildProducts();
            }

            // Archive the build products
            if (ArchivePath != null)
            {
                // Create an output folder
                string OutputFolder = Path.Combine(CommandUtils.CmdEnv.LocalRoot, "ArchiveForUGS");
                Directory.CreateDirectory(OutputFolder);

                // Create a temp folder for storing stripped PDB files
                string SymbolsFolder = Path.Combine(OutputFolder, "Symbols");
                Directory.CreateDirectory(SymbolsFolder);

                // Get the Windows toolchain
                Platform WindowsTargetPlatform = Platform.GetPlatform(UnrealTargetPlatform.Win64);

                // Figure out all the files for the archive
                string ZipFileName = Path.Combine(OutputFolder, "Archive.zip");
                using (Ionic.Zip.ZipFile Zip = new Ionic.Zip.ZipFile())
                {
                    Zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.AsNecessary;
                    foreach (string BuildProduct in Builder.BuildProductFiles)
                    {
                        if (!File.Exists(BuildProduct))
                        {
                            throw new AutomationException("Missing build product: {0}", BuildProduct);
                        }
                        if (BuildProduct.EndsWith(".pdb", StringComparison.InvariantCultureIgnoreCase))
                        {
                            string StrippedFileName = CommandUtils.MakeRerootedFilePath(BuildProduct, CommandUtils.CmdEnv.LocalRoot, SymbolsFolder);
                            Directory.CreateDirectory(Path.GetDirectoryName(StrippedFileName));
                            WindowsTargetPlatform.StripSymbols(new FileReference(BuildProduct), new FileReference(StrippedFileName));
                            Zip.AddFile(StrippedFileName, Path.GetDirectoryName(CommandUtils.StripBaseDirectory(StrippedFileName, SymbolsFolder)));
                        }
                        else
                        {
                            Zip.AddFile(BuildProduct, Path.GetDirectoryName(CommandUtils.StripBaseDirectory(BuildProduct, CommandUtils.CmdEnv.LocalRoot)));
                        }
                    }
                    // Create the zip file
                    Console.WriteLine("Writing {0}...", ZipFileName);
                    Zip.Save(ZipFileName);
                }

                // Submit it to Perforce if required
                if (CommandUtils.AllowSubmit)
                {
                    // Delete any existing clientspec for submitting
                    string ClientName = Environment.MachineName + "_BuildForUGS";

                    // Create a brand new one
                    P4ClientInfo Client = new P4ClientInfo();
                    Client.Owner    = CommandUtils.P4Env.User;
                    Client.Host     = Environment.MachineName;
                    Client.Stream   = StreamName;
                    Client.RootPath = Path.Combine(OutputFolder, "Perforce");
                    Client.Name     = ClientName;
                    Client.Options  = P4ClientOption.NoAllWrite | P4ClientOption.NoClobber | P4ClientOption.NoCompress | P4ClientOption.Unlocked | P4ClientOption.NoModTime | P4ClientOption.RmDir;
                    Client.LineEnd  = P4LineEnd.Local;
                    P4.CreateClient(Client, AllowSpew: false);

                    // Create a new P4 connection for this workspace
                    P4Connection SubmitP4 = new P4Connection(Client.Owner, Client.Name, P4Env.ServerAndPort);
                    SubmitP4.Revert("-k //...");

                    // Figure out where the zip file has to go in Perforce
                    P4WhereRecord WhereZipFile = SubmitP4.Where(ArchivePath, false).FirstOrDefault(x => !x.bUnmap && x.Path != null);
                    if (WhereZipFile == null)
                    {
                        throw new AutomationException("Couldn't locate {0} in this workspace");
                    }

                    // Get the latest version of it
                    int NewCL = SubmitP4.CreateChange(Description: String.Format("[CL {0}] Updated binaries", P4Env.Changelist));
                    SubmitP4.Sync(String.Format("-k \"{0}\"", ArchivePath), AllowSpew: false);
                    CommandUtils.CopyFile(ZipFileName, WhereZipFile.Path);
                    SubmitP4.Add(NewCL, String.Format("\"{0}\"", ArchivePath));
                    SubmitP4.Edit(NewCL, String.Format("\"{0}\"", ArchivePath));

                    // Submit it
                    int SubmittedCL;
                    SubmitP4.Submit(NewCL, out SubmittedCL);
                    if (SubmittedCL <= 0)
                    {
                        throw new AutomationException("Submit failed.");
                    }
                    Console.WriteLine("Submitted in changelist {0}", SubmittedCL);
                }
            }
        }
示例#15
0
    public override void ExecuteBuild()
    {
        LogInformation("************************* BuildCommonTools");

        List <UnrealTargetPlatform> Platforms = new List <UnrealTargetPlatform>();

        // Add all the platforms if specified
        if (ParseParam("allplatforms"))
        {
            Platforms = UnrealTargetPlatform.GetValidPlatforms().ToList();
        }
        else
        {
            // Get the list of platform names
            string[] PlatformNames = ParseParamValue("platforms", BuildHostPlatform.Current.Platform.ToString()).Split('+');

            // Parse the platforms
            foreach (string PlatformName in PlatformNames)
            {
                UnrealBuildTool.UnrealTargetPlatform Platform;
                if (!UnrealTargetPlatform.TryParse(PlatformName, out Platform))
                {
                    throw new AutomationException("Unknown platform specified on command line - '{0}' - valid platforms are {1}", PlatformName, String.Join("/", UnrealTargetPlatform.GetValidPlatformNames()));
                }
                Platforms.Add(Platform);
            }
        }

        // Get the agenda
        List <string> ExtraBuildProducts = new List <string>();

        UE4Build.BuildAgenda Agenda = MakeAgenda(Platforms.ToArray(), ExtraBuildProducts);

        // Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version
        UE4Build Builder = new UE4Build(this);

        Builder.Build(Agenda, InUpdateVersionFiles: false);

        // Add UAT and UBT to the build products
        Builder.AddUATFilesToBuildProducts();
        Builder.AddUBTFilesToBuildProducts();

        // Add all the extra build products
        foreach (string ExtraBuildProduct in ExtraBuildProducts)
        {
            Builder.AddBuildProduct(ExtraBuildProduct);
        }

        // Make sure all the build products exist
        UE4Build.CheckBuildProducts(Builder.BuildProductFiles);

        // Write the manifest if needed
        string ManifestPath = ParseParamValue("manifest");

        if (ManifestPath != null)
        {
            SortedSet <string> Files = new SortedSet <string>();
            foreach (string BuildProductFile in Builder.BuildProductFiles)
            {
                Files.Add(BuildProductFile);
            }
            File.WriteAllLines(ManifestPath, Files.ToArray());
        }
    }
示例#16
0
    public Noesis(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        string NoesisBasePath    = ModuleDirectory + "/NoesisSDK/";
        string NoesisIncludePath = NoesisBasePath + "Include/";
        string NoesisInteractivityIncludePath = NoesisBasePath + "Src/Packages/App/Interactivity/Include/";

        PublicIncludePaths.Add(ModuleDirectory);
        PublicIncludePaths.Add(NoesisIncludePath);
        PublicIncludePaths.Add(NoesisInteractivityIncludePath);

        if (!Directory.Exists(NoesisBasePath))
        {
            throw new BuildException("Could not find NoesisGUI SDK in " + NoesisBasePath + ".");
        }

        if (!Directory.Exists(NoesisBasePath + "Bin"))
        {
            throw new BuildException("Could not find NoesisGUI SDK Bin directory in " + NoesisBasePath + "Bin.");
        }

        if (!Directory.Exists(NoesisBasePath + "Include"))
        {
            throw new BuildException("Could not find NoesisGUI SDK Include directory in " + NoesisBasePath + "Include.");
        }

        if (!Directory.Exists(NoesisBasePath + "Lib"))
        {
            throw new BuildException("Could not find NoesisGUI SDK Lib directory in " + NoesisBasePath + "Lib.");
        }

        PublicSystemIncludePaths.Add(NoesisIncludePath);

        UnrealTargetPlatform Platform;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Lib/windows_x86_64/Noesis.lib");

            string NoesisDllPath       = "/NoesisSDK/Bin/windows_x86_64/Noesis.dll";
            string NoesisDllTargetPath = "/Binaries/Win64/Noesis.dll";

            if (Target.ProjectFile != null)
            {
                CopyNoesisDll(ModuleDirectory + NoesisDllPath, DirectoryReference.FromFile(Target.ProjectFile).ToString() + NoesisDllTargetPath);
            }

            CopyNoesisDll(ModuleDirectory + NoesisDllPath, ModuleDirectory + "/../.." + NoesisDllTargetPath);

            if (System.IO.File.Exists(Target.RelativeEnginePath + NoesisDllTargetPath))
            {
                System.IO.File.Delete(Target.RelativeEnginePath + NoesisDllTargetPath);
            }

            if (Target.LinkType == TargetLinkType.Monolithic)
            {
                RuntimeDependencies.Add("$(ProjectDir)" + NoesisDllTargetPath);
            }
            else
            {
                RuntimeDependencies.Add("$(EngineDir)" + NoesisDllTargetPath);
            }
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Bin/osx/Noesis.dylib");

            string NoesisDylibPath = "/NoesisSDK/Bin/osx/Noesis.dylib";
            RuntimeDependencies.Add(ModuleDirectory + NoesisDylibPath);
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Lib/ios/libNoesis.a");

            PublicFrameworks.Add("CoreText");
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Bin/android_arm/libNoesis.so");
            PublicAdditionalLibraries.Add(NoesisBasePath + "Bin/android_arm64/libNoesis.so");

            string NoesisAplPath = "/Noesis_APL.xml";
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", ModuleDirectory + NoesisAplPath);
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Lib/ps4/Noesis.a");
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Bin/xbox_one/Noesis.lib");
        }
        else if (UnrealTargetPlatform.TryParse("HTML5", out Platform) && Target.Platform == Platform)
        {
            PublicAdditionalLibraries.Add(NoesisBasePath + "Bin/wasm/Noesis.bc");
        }
    }
示例#17
0
    public override void ExecuteBuild()
    {
        int WorkingCL = -1;

        if (P4Enabled && AllowSubmit)
        {
            string CmdLine = "";
            foreach (var Arg in Params)
            {
                CmdLine += Arg.ToString() + " ";
            }
            WorkingCL = P4.CreateChange(P4Env.Client, String.Format("MegaXGE build from changelist {0} - Params: {1}", P4Env.Changelist, CmdLine));
        }

        LogInformation("************************* MegaXGE");

        bool   Clean             = ParseParam("Clean");
        string CleanToolLocation = CombinePaths(CmdEnv.LocalRoot, "Engine", "Build", "Batchfiles", "Clean.bat");

        bool ShowProgress = ParseParam("Progress");

        var UE4Build = new UE4Build(this);

        var Agenda = new UE4Build.BuildAgenda();

        // we need to always build UHT when we use mega XGE
        var ProgramTargets = new string[]
        {
            "UnrealHeaderTool",
        };

        Agenda.AddTargets(ProgramTargets, UnrealTargetPlatform.Win64, UnrealTargetConfiguration.Development);
        if (Clean)
        {
            LogSetProgress(ShowProgress, "Cleaning previous builds...");
            foreach (var CurTarget in ProgramTargets)
            {
                string Args = String.Format("{0} {1} {2}", CurTarget, UnrealTargetPlatform.Win64.ToString(), UnrealTargetConfiguration.Development.ToString());
                RunAndLog(CmdEnv, CleanToolLocation, Args);
            }
        }

        LogInformation("*************************");
        for (int Arg = 1; Arg < 100; Arg++)
        {
            string Parm   = String.Format("Target{0}", Arg);
            string Target = ParseParamValue(Parm, "");
            if (String.IsNullOrEmpty(Target))
            {
                break;
            }

            FileReference ProjectFile = null;

            string ProjectFileParam = ParseParamValue(String.Format("Project{0}", Arg), null);
            if (ProjectFileParam != null)
            {
                ProjectFile = new FileReference(ProjectFileParam);
                if (!FileReference.Exists(ProjectFile))
                {
                    throw new AutomationException("Project file '{0}' could not be found");
                }
            }

            var Parts = Target.Split(' ');

            string JustTarget = Parts[0];
            if (String.IsNullOrEmpty(JustTarget))
            {
                throw new AutomationException("BUILD FAILED target option '{0}' not parsed.", Target);
            }
            var Targets = JustTarget.Split('|');
            if (Targets.Length < 1)
            {
                throw new AutomationException("BUILD FAILED target option '{0}' not parsed.", Target);
            }

            var Platforms      = new List <UnrealTargetPlatform>();
            var Configurations = new List <UnrealTargetConfiguration>();

            for (int Part = 1; Part < Parts.Length; Part++)
            {
                if (!String.IsNullOrEmpty(Parts[Part]))
                {
                    var SubParts = Parts[Part].Split('|');

                    foreach (var SubPart in SubParts)
                    {
                        UnrealTargetPlatform Platform;
                        if (UnrealTargetPlatform.TryParse(SubPart, out Platform))
                        {
                            Platforms.Add(Platform);
                        }
                        else
                        {
                            switch (SubPart.ToUpperInvariant())
                            {
                            case "DEBUG":
                                Configurations.Add(UnrealTargetConfiguration.Debug);
                                break;

                            case "DEBUGGAME":
                                Configurations.Add(UnrealTargetConfiguration.DebugGame);
                                break;

                            case "DEVELOPMENT":
                                Configurations.Add(UnrealTargetConfiguration.Development);
                                break;

                            case "SHIPPING":
                                Configurations.Add(UnrealTargetConfiguration.Shipping);
                                break;

                            case "TEST":
                                Configurations.Add(UnrealTargetConfiguration.Test);
                                break;

                            default:
                                throw new AutomationException("BUILD FAILED target option {0} not recognized.", SubPart);
                            }
                        }
                    }
                }
            }
            if (Platforms.Count < 1)
            {
                Platforms.Add(UnrealTargetPlatform.Win64);
            }
            if (Configurations.Count < 1)
            {
                Configurations.Add(UnrealTargetConfiguration.Development);
            }
            foreach (var Platform in Platforms)
            {
                foreach (var CurTarget in Targets)
                {
                    foreach (var Configuration in Configurations)
                    {
                        Agenda.AddTargets(new string[] { CurTarget }, Platform, Configuration, ProjectFile);
                        LogInformation("Target {0} {1} {2}", CurTarget, Platform.ToString(), Configuration.ToString());
                        if (Clean)
                        {
                            string Args = String.Format("{0} {1} {2}", CurTarget, Platform.ToString(), Configuration.ToString());
                            RunAndLog(CmdEnv, CleanToolLocation, Args);
                        }
                    }
                }
            }
        }
        LogInformation("*************************");

        UE4Build.Build(Agenda, InUpdateVersionFiles: IsBuildMachine, InUseParallelExecutor: ParseParam("useparallelexecutor"), InShowProgress: ShowProgress);

        //      if (WorkingCL > 0) // only move UAT files if we intend to check in some build products
        //      {
        //          UE4Build.CopyUATFilesAndAddToBuildProducts();
        //      }

        UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles);

        if (WorkingCL > 0)
        {
            // Sign everything we built
            CodeSign.SignMultipleIfEXEOrDLL(this, UE4Build.BuildProductFiles);

            // Open files for add or edit
            UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles);

            int SubmittedCL;
            P4.Submit(WorkingCL, out SubmittedCL, true, true);
        }

        PrintRunTime();
    }
示例#18
0
            public void ParseParams(string[] InParams)
            {
                this.Params = InParams;

                bool AllThings  = ParseParam("all");
                bool AllCompile = AllThings | ParseParam("allcompile");

                Preview    = ParseParam("preview");
                DoUE4Tests = AllThings || ParseParam("ue4");

                // compilation
                DoBuildEditorTests          = AllCompile | ParseParam("editor");
                DoBuildClientTests          = AllCompile | ParseParam("client");
                DoNoCompileTests            = AllCompile | ParseParam("nopcompile");
                DoSingleCompileTests        = AllCompile | ParseParam("singlecompile");
                DoAcceleratedCompileTests   = AllCompile | ParseParam("xge") | ParseParam("fastbuild");
                DoNoAcceleratedCompileTests = AllCompile | ParseParam("noxge") | ParseParam("nofastbuild");

                // cooking
                DoCookTests = AllThings | ParseParam("cook");

                // editor startup tests
                DoPIETests = AllThings | ParseParam("pie");

                // DDC options
                DDCOptions |= ParseParam("warmddc") ? DDCTaskOptions.WarmDDC : DDCTaskOptions.None;
                DDCOptions |= ParseParam("hotddc") ? DDCTaskOptions.HotDDC : DDCTaskOptions.None;
                DDCOptions |= ParseParam("coldddc") ? DDCTaskOptions.ColdDDC : DDCTaskOptions.None;
                DDCOptions |= ParseParam("noshaderddc") ? DDCTaskOptions.NoShaderDDC : DDCTaskOptions.None;
                DDCOptions |= ParseParam("noxge") ? DDCTaskOptions.NoXGE : DDCTaskOptions.None;

                // sanity
                DoAcceleratedCompileTests = DoAcceleratedCompileTests && BenchmarkBuildTask.SupportsAcceleration;

                Preview          = ParseParam("Preview");
                Iterations       = ParseParamInt("Iterations", Iterations);
                TimeBetweenTasks = ParseParamInt("Wait", TimeBetweenTasks);

                FileName = ParseParamValue("filename", FileName);

                CookArgs = ParseParamValue("CookArgs", "");
                PIEArgs  = ParseParamValue("PIEArgs", "");

                // Parse the project arg
                {
                    string ProjectsArg = ParseParamValue("project", null);
                    ProjectsArg = ParseParamValue("projects", ProjectsArg);

                    // Look at the project argument and verify it's a valid uproject
                    if (!string.IsNullOrEmpty(ProjectsArg))
                    {
                        ProjectsToTest = ProjectsArg.Split(new[] { '+', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                }

                // Parse and validate platform list from arguments
                {
                    string PlatformArg = ParseParamValue("platform", "");
                    PlatformArg = ParseParamValue("platforms", PlatformArg);

                    if (!string.IsNullOrEmpty(PlatformArg))
                    {
                        List <UnrealTargetPlatform> ClientPlatforms = new List <UnrealTargetPlatform>();

                        var PlatformList = PlatformArg.Split(new[] { '+', ',' }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (var Platform in PlatformList)
                        {
                            UnrealTargetPlatform PlatformEnum;
                            if (!UnrealTargetPlatform.TryParse(Platform, out PlatformEnum))
                            {
                                throw new AutomationException("{0} is not a valid Unreal Platform", Platform);
                            }

                            ClientPlatforms.Add(PlatformEnum);
                        }

                        PlatformsToTest = ClientPlatforms;
                    }
                    else
                    {
                        PlatformsToTest = new[] { BuildHostPlatform.Current.Platform };
                    }
                }

                // parse processor args
                {
                    string ProcessorArg = ParseParamValue("cores", "");

                    if (!string.IsNullOrEmpty(ProcessorArg))
                    {
                        var ProcessorList = ProcessorArg.Split(new[] { '+', ',' }, StringSplitOptions.RemoveEmptyEntries);

                        CoresForLocalJobs = ProcessorList.Select(P => Convert.ToInt32(P));
                    }
                }

                // parse ddc args
                {
                    string Arg = ParseParamValue("ddc", "");

                    if (!string.IsNullOrEmpty(Arg))
                    {
                        DCCTypes = Arg.Split(new[] { '+', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                }

                // parse map args
                {
                    string Arg = ParseParamValue("map", "");

                    if (!string.IsNullOrEmpty(Arg))
                    {
                        MapList = Arg.Split(new[] { '+', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                }
            }