/// <summary>
        /// Execute the task.
        /// </summary>
        /// <param name="Job">Information about the current job</param>
        /// <param name="BuildProducts">Set of build products produced by this node.</param>
        /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
        /// <returns>True if the task succeeded</returns>
        public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet)
        {
            // Get the base directory
            DirectoryReference BaseDir = ResolveDirectory(Parameters.BaseDir);

            // Get the output directory
            DirectoryReference OutputDir = ResolveDirectory(Parameters.OutputDir);

            // Make sure the source and destination directories don't overlap. We can't strip in-place at the moment.
            if (BaseDir == OutputDir)
            {
                CommandUtils.LogError("Output directory for stripped files is the same as source directory ({0})", BaseDir.FullName);
                return(false);
            }

            // Find the matching files
            FileReference[] SourceFiles = ResolveFilespec(BaseDir, Parameters.Files, TagNameToFileSet).OrderBy(x => x.FullName).ToArray();

            // Create the matching target files
            FileReference[] TargetFiles = SourceFiles.Select(x => FileReference.Combine(OutputDir, x.MakeRelativeTo(BaseDir))).ToArray();

            // Run the stripping command
            UEBuildPlatform Platform  = UEBuildPlatform.GetBuildPlatform(Parameters.Platform);
            UEToolChain     ToolChain = Platform.CreateContext(null, null).CreateToolChainForDefaultCppPlatform();

            for (int Idx = 0; Idx < SourceFiles.Length; Idx++)
            {
                TargetFiles[Idx].Directory.CreateDirectory();
                CommandUtils.Log("Stripping symbols: {0} -> {1}", SourceFiles[Idx].FullName, TargetFiles[Idx].FullName);
                ToolChain.StripSymbols(SourceFiles[Idx].FullName, TargetFiles[Idx].FullName);
            }

            // Apply the optional tag to the build products
            foreach (string TagName in FindTagNamesFromList(Parameters.Tag))
            {
                FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(TargetFiles);
            }

            // Add the target files to the set of build products
            BuildProducts.UnionWith(TargetFiles);
            return(true);
        }
    void CompilePluginWithUBT(FileReference HostProjectFile, FileReference HostProjectPluginFile, PluginDescriptor Plugin, string TargetName, TargetRules.TargetType TargetType, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, List <string> ReceiptFileNames, string InAdditionalArgs)
    {
        // Find a list of modules that need to be built for this plugin
        List <string> ModuleNames = new List <string>();

        if (Plugin.Modules != null)
        {
            foreach (ModuleDescriptor Module in Plugin.Modules)
            {
                bool bBuildDeveloperTools = (TargetType == TargetRules.TargetType.Editor || TargetType == TargetRules.TargetType.Program);
                bool bBuildEditor         = (TargetType == TargetRules.TargetType.Editor);
                if (Module.IsCompiledInConfiguration(Platform, TargetType, bBuildDeveloperTools, bBuildEditor))
                {
                    ModuleNames.Add(Module.Name);
                }
            }
        }

        // Add these modules to the build agenda
        if (ModuleNames.Count > 0)
        {
            string Arguments = "";            // String.Format("-plugin {0}", CommandUtils.MakePathSafeToUseWithCommandLine(PluginFile.FullName));
            foreach (string ModuleName in ModuleNames)
            {
                Arguments += String.Format(" -module {0}", ModuleName);
            }

            string Architecture = UEBuildPlatform.GetBuildPlatform(Platform).CreateContext(HostProjectFile, null).GetActiveArchitecture();

            string ReceiptFileName = TargetReceipt.GetDefaultPath(HostProjectPluginFile.Directory.FullName, TargetName, Platform, Configuration, Architecture);
            Arguments += String.Format(" -receipt {0}", CommandUtils.MakePathSafeToUseWithCommandLine(ReceiptFileName));
            ReceiptFileNames.Add(ReceiptFileName);

            if (!String.IsNullOrEmpty(InAdditionalArgs))
            {
                Arguments += InAdditionalArgs;
            }

            CommandUtils.RunUBT(CmdEnv, UE4Build.GetUBTExecutable(), String.Format("{0} {1} {2}{3} {4}", TargetName, Platform, Configuration, (HostProjectFile == null)? "" : String.Format(" -project=\"{0}\"", HostProjectFile.FullName), Arguments));
        }
    }
Exemplo n.º 3
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));
        }

        Log("************************* 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);
            }
        }

        Log("*************************");
        for (int Arg = 1; Arg < 100; Arg++)
        {
            string Parm   = String.Format("Target{0}", Arg);
            string Target = ParseParamValue(Parm, "");
            if (String.IsNullOrEmpty(Target))
            {
                break;
            }
            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)
                    {
                        if (UEBuildPlatform.ConvertStringToPlatform(SubPart) != UnrealTargetPlatform.Unknown)
                        {
                            Platforms.Add(UEBuildPlatform.ConvertStringToPlatform(SubPart));
                        }
                        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);
                        Log("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);
                        }
                    }
                }
            }
        }
        Log("*************************");

        Agenda.DoRetries = ParseParam("Retry");
        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();
    }
Exemplo n.º 4
0
        private static bool RequiresTempTarget(FileReference RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms, bool AssetNativizationRequested)
        {
            // check to see if we already have a Target.cs file
            if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Source", RawProjectPath.GetFileNameWithoutExtension() + ".Target.cs")))
            {
                return(false);
            }
            else if (Directory.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Source")))
            {
                // wasn't one in the main Source directory, let's check all sub-directories
                //@todo: may want to read each target.cs to see if it has a target corresponding to the project name as a final check
                FileInfo[] Files = (new DirectoryInfo(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Source")).GetFiles("*.Target.cs", SearchOption.AllDirectories));
                if (Files.Length > 0)
                {
                    return(false);
                }
            }

            //
            // once we reach this point, we can surmise that this is an asset-
            // only (code free) project

            if (AssetNativizationRequested)
            {
                // we're going to be converting some of the project's assets
                // into native code, so we require a distinct target (executable)
                // be generated for this project
                return(true);
            }

            // no Target file, now check to see if build settings have changed
            List <UnrealTargetPlatform> TargetPlatforms = ClientTargetPlatforms;

            if (ClientTargetPlatforms == null || ClientTargetPlatforms.Count < 1)
            {
                // No client target platforms, add all in
                TargetPlatforms = new List <UnrealTargetPlatform>();
                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        TargetPlatforms.Add(TargetPlatformType);
                    }
                }
            }

            // Change the working directory to be the Engine/Source folder. We are running from Engine/Binaries/DotNET
            string oldCWD = Directory.GetCurrentDirectory();

            if (BuildConfiguration.RelativeEnginePath == "../../Engine/")
            {
                string EngineSourceDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetOriginalLocation()), "..", "..", "..", "Engine", "Source");
                if (!Directory.Exists(EngineSourceDirectory))                 // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
                {
                    EngineSourceDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetOriginalLocation()), "..", "..", "..", "Engine", "Binaries");
                }
                Directory.SetCurrentDirectory(EngineSourceDirectory);
            }

            // Read the project descriptor, and find all the plugins available to this project
            ProjectDescriptor Project          = ProjectDescriptor.FromFile(RawProjectPath.FullName);
            List <PluginInfo> AvailablePlugins = Plugins.ReadAvailablePlugins(new DirectoryReference(BuildConfiguration.RelativeEnginePath), RawProjectPath);

            // check the target platforms for any differences in build settings or additional plugins
            bool RetVal = false;

            foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
            {
                UEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(TargetPlatformType, true);
                if (!Automation.IsEngineInstalled() && BuildPlat != null && !(BuildPlat as UEBuildPlatform).HasDefaultBuildConfig(TargetPlatformType, RawProjectPath.Directory))
                {
                    RetVal = true;
                    break;
                }

                // find if there are any plugins enabled or disabled which differ from the default
                foreach (PluginInfo Plugin in AvailablePlugins)
                {
                    bool bPluginEnabledForProject = UProjectInfo.IsPluginEnabledForProject(Plugin, Project, TargetPlatformType, TargetRules.TargetType.Game);
                    if ((bPluginEnabledForProject && !Plugin.Descriptor.bEnabledByDefault) || (bPluginEnabledForProject && Plugin.Descriptor.bInstalled))
                    {
                        if (Plugin.Descriptor.Modules.Any(Module => Module.IsCompiledInConfiguration(TargetPlatformType, TargetRules.TargetType.Game, bBuildDeveloperTools: false, bBuildEditor: false)))
                        {
                            RetVal = true;
                            break;
                        }
                    }
                }
            }

            // Change back to the original directory
            Directory.SetCurrentDirectory(oldCWD);
            return(RetVal);
        }
Exemplo n.º 5
0
        private static bool RequiresTempTarget(string RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms)
        {
            // check to see if we already have a Target.cs file
            // @todo: Target.cs may not be the same name as the project in the future, so look at a better way to determine this
            if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath), "Source", Path.GetFileNameWithoutExtension(RawProjectPath) + ".Target.cs")))
            {
                return(false);
            }

            // no Target file, now check to see if build settings have changed
            List <UnrealTargetPlatform> TargetPlatforms = ClientTargetPlatforms;

            if (ClientTargetPlatforms == null || ClientTargetPlatforms.Count < 1)
            {
                // No client target platforms, add all in
                TargetPlatforms = new List <UnrealTargetPlatform>();
                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        TargetPlatforms.Add(TargetPlatformType);
                    }
                }
            }

            // check the target platforms for any differences in build settings or additional plugins
            foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
            {
                IUEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(TargetPlatformType, true);
                if (BuildPlat != null && !(BuildPlat as UEBuildPlatform).HasDefaultBuildConfig(TargetPlatformType, Path.GetDirectoryName(RawProjectPath)))
                {
                    return(true);
                }
                // find if there are any plugins
                List <string> PluginList = new List <string>();
                // Use the project settings to update the plugin list for this target
                PluginList = UProjectInfo.GetEnabledPlugins(RawProjectPath, PluginList, TargetPlatformType);
                if (PluginList.Count > 0)
                {
                    foreach (var PluginName in PluginList)
                    {
                        // check the plugin info for this plugin itself
                        foreach (var Plugin in Plugins.AllPlugins)
                        {
                            if (Plugin.Name == PluginName)
                            {
                                foreach (var Module in Plugin.Modules)
                                {
                                    if (Module.Platforms.Count > 0 && Module.Platforms.Contains(TargetPlatformType))
                                    {
                                        return(true);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 6
0
        public SQLiteSupport(TargetInfo Target)
        {
            string PlatformName      = "";
            string ConfigurationName = "";

            switch (Target.Platform)
            {
            case UnrealTargetPlatform.Win32:
                PlatformName = "Win32/";
                break;

            case UnrealTargetPlatform.Win64:
                PlatformName = "x64/";
                break;

            case UnrealTargetPlatform.IOS:
            case UnrealTargetPlatform.TVOS:
                PlatformName = "IOS/";
                break;

            case UnrealTargetPlatform.Mac:
                PlatformName = "Mac/";
                break;

            case UnrealTargetPlatform.Linux:
                PlatformName = "Linux/";
                break;
            }

            switch (Target.Configuration)
            {
            case UnrealTargetConfiguration.Debug:
                ConfigurationName = "Debug/";
                break;

            case UnrealTargetConfiguration.DebugGame:
                ConfigurationName = "Debug/";
                break;

            default:
                ConfigurationName = "Release/";
                break;
            }

            if (UnrealBuildTool.RunningRocket())
            {
                throw new BuildException("This module requires a source code build of the engine from Github. Please refer to the Engine/Source/ThirdParty/sqlite/README.txt file prior to enabling this module.");
            }

            string LibraryPath     = "" + UEBuildConfiguration.UEThirdPartySourceDirectory + "sqlite/lib/" + PlatformName + ConfigurationName;
            string LibraryFilename = Path.Combine(LibraryPath, "sqlite" + UEBuildPlatform.GetBuildPlatform(Target.Platform).GetBinaryExtension(UEBuildBinaryType.StaticLibrary));

            if (!File.Exists(LibraryFilename))
            {
                throw new BuildException("Please refer to the Engine/Source/ThirdParty/sqlite/README.txt file prior to enabling this module.");
            }

            PublicIncludePaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "sqlite/sqlite/");

            PublicDependencyModuleNames.AddRange(
                new string[] {
                "Core",
                "DatabaseSupport",
            }
                );

            // Lib file
            PublicLibraryPaths.Add(LibraryPath);
            PublicAdditionalLibraries.Add(LibraryFilename);
        }
        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");
            }

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

                UnrealTargetPlatform      Platform;
                UnrealTargetConfiguration Configuration;
                if (Tokens.Length < 3 || !Enum.TryParse(Tokens[1], true, 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
                UEToolChain WindowsToolChain = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Win64).CreateContext(null).CreateToolChain(CPPTargetPlatform.Win64);

                // Figure out all the files for the archive
                Ionic.Zip.ZipFile Zip = new Ionic.Zip.ZipFile();
                Zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.Always;
                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));
                        WindowsToolChain.StripSymbols(BuildProduct, 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
                string ZipFileName = Path.Combine(OutputFolder, "Archive.zip");
                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   = ArchivePath.Substring(0, ArchivePath.IndexOf('/', ArchivePath.IndexOf('/', 2) + 1));
                    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.P4Port);
                    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);
                }
            }
        }
Exemplo n.º 8
0
    /// <summary>
    /// Modify the rules for a newly created module, where the target is a different host platform.
    /// This is not required - but allows for hiding details of a particular platform.
    /// </summary>
    /// <param name="ModuleName">The name of the module</param>
    /// <param name="Rules">The module rules</param>
    /// <param name="Target">The target being build</param>
    public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
    {
        // set PLATFORM_XXX to 0 in modules that XXX will set to 1, so that #if checks don't trigger the error of being undefined,
        // and we don't need to set PLATFORM_XXX to 0 in Core somewhere
        if (Rules.bAllowConfidentialPlatformDefines)
        {
            Rules.PublicDefinitions.Add("PLATFORM_XXX=0");
        }

        if (ModuleName == "RHI")
        {
            // these must be mirrored down below
            Rules.AppendStringToPublicDefinition("DDPI_EXTRA_SHADERPLATFORMS", "SP_XXX=32, ");
            Rules.AppendStringToPublicDefinition("DDPI_SHADER_PLATFORM_NAME_MAP", "{ TEXT(\"XXX\"), SP_XXX },");
        }

        // don't do any target platform stuff if SDK is not available
        if (!UEBuildPlatform.IsPlatformAvailable(Platform))
        {
            return;
        }

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            bool            bIsMonolithic = true;
            UEBuildPlatform BuildPlatform = GetBuildPlatform(Target.Platform);

            if (BuildPlatform != null)
            {
                bIsMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Target.Platform);
            }

            if ((Target.bBuildEditor == false) || !bIsMonolithic)
            {
                bool bBuildShaderFormats = Target.bForceBuildShaderFormats;

                if (!Target.bBuildRequiresCookedData)
                {
                    if (ModuleName == "Engine")
                    {
                        if (Target.bBuildDeveloperTools)
                        {
                            Rules.DynamicallyLoadedModuleNames.Add("XXXTargetPlatform");
                        }
                    }
                }

                // allow standalone tools to use target platform modules, without needing Engine
                if (ModuleName == "TargetPlatform")
                {
                    if (Target.bForceBuildTargetPlatforms)
                    {
                        Rules.DynamicallyLoadedModuleNames.Add("XXXTargetPlatform");
                    }

                    if (bBuildShaderFormats)
                    {
//                      Rules.DynamicallyLoadedModuleNames.Add("XXXShaderFormat");
                    }
                }
            }
        }
    }
Exemplo n.º 9
0
        /// <summary>
        /// Entry point for the commandlet
        /// </summary>
        public override void ExecuteBuild()
        {
            string OutputDir = ParseParamValue("OutputDir");
            string ContentOnlyPlatformsString = ParseParamValue("ContentOnlyPlatforms");
            IEnumerable <UnrealTargetPlatform> ContentOnlyPlatforms = Enumerable.Empty <UnrealTargetPlatform>();

            if (!String.IsNullOrWhiteSpace(ContentOnlyPlatformsString))
            {
                ContentOnlyPlatforms = ContentOnlyPlatformsString.Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).Select(x => (UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), x));
            }
            string AnalyticsTypeOverride = ParseParamValue("AnalyticsTypeOverride");

            // Write InstalledBuild.txt to indicate Engine is installed
            string InstalledBuildFile = CommandUtils.CombinePaths(OutputDir, "Engine/Build/InstalledBuild.txt");

            CommandUtils.CreateDirectory(CommandUtils.GetDirectoryName(InstalledBuildFile));
            CommandUtils.WriteAllText(InstalledBuildFile, "");

            string         OutputEnginePath     = Path.Combine(OutputDir, "Engine");
            string         OutputBaseEnginePath = Path.Combine(OutputEnginePath, "Config", "BaseEngine.ini");
            FileAttributes OutputAttributes     = FileAttributes.ReadOnly;
            List <String>  IniLines             = new List <String>();

            // Should always exist but if not, we don't need extra line
            if (File.Exists(OutputBaseEnginePath))
            {
                OutputAttributes = File.GetAttributes(OutputBaseEnginePath);
                IniLines.Add("");
            }
            else
            {
                CommandUtils.CreateDirectory(CommandUtils.GetDirectoryName(OutputBaseEnginePath));
                CommandUtils.WriteAllText(OutputBaseEnginePath, "");
                OutputAttributes = File.GetAttributes(OutputBaseEnginePath) | OutputAttributes;
            }

            // Create list of platform configurations installed in a Rocket build
            List <InstalledPlatformInfo.InstalledPlatformConfiguration> InstalledConfigs = new List <InstalledPlatformInfo.InstalledPlatformConfiguration>();

            foreach (UnrealTargetPlatform CodeTargetPlatform in Enum.GetValues(typeof(UnrealTargetPlatform)))
            {
                UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(CodeTargetPlatform, true);
                if (BuildPlatform != null)
                {
                    string Architecture = BuildPlatform.CreateContext(null).GetActiveArchitecture();

                    // Try to parse additional Architectures from the command line
                    string Architectures    = ParseParamValue(CodeTargetPlatform.ToString() + "Architectures");
                    string GPUArchitectures = ParseParamValue(CodeTargetPlatform.ToString() + "GPUArchitectures");

                    // Build a list of pre-compiled architecture combinations for this platform if any
                    List <string> AllArchNames;

                    if (!String.IsNullOrWhiteSpace(Architectures) && !String.IsNullOrWhiteSpace(GPUArchitectures))
                    {
                        AllArchNames = (from Arch in Architectures.Split('+')
                                        from GPUArch in GPUArchitectures.Split('+')
                                        select "-" + Arch + "-" + GPUArch).ToList();
                    }
                    else if (!String.IsNullOrWhiteSpace(Architectures))
                    {
                        AllArchNames = Architectures.Split('+').ToList();
                    }
                    else
                    {
                        AllArchNames = new List <string>();
                    }

                    // Check whether this platform should only be used for content based projects
                    EProjectType ProjectType = ContentOnlyPlatforms.Contains(CodeTargetPlatform) ? EProjectType.Content : EProjectType.Any;

                    // Allow Content only platforms to be shown as options in all projects
                    bool bCanBeDisplayed = ProjectType == EProjectType.Content;
                    foreach (UnrealTargetConfiguration CodeTargetConfiguration in Enum.GetValues(typeof(UnrealTargetConfiguration)))
                    {
                        // Need to check for development receipt as we use that for the Engine code in DebugGame
                        UnrealTargetConfiguration EngineConfiguration = (CodeTargetConfiguration == UnrealTargetConfiguration.DebugGame) ? UnrealTargetConfiguration.Development : CodeTargetConfiguration;
                        string ReceiptFileName = TargetReceipt.GetDefaultPath(OutputEnginePath, "UE4Game", CodeTargetPlatform, EngineConfiguration, Architecture);

                        if (File.Exists(ReceiptFileName))
                        {
                            // Strip the output folder so that this can be used on any machine
                            ReceiptFileName = new FileReference(ReceiptFileName).MakeRelativeTo(new DirectoryReference(OutputDir));

                            // If we have pre-compiled architectures for this platform then add an entry for each of these -
                            // there isn't a receipt for each architecture like some other platforms
                            if (AllArchNames.Count > 0)
                            {
                                foreach (string Arch in AllArchNames)
                                {
                                    InstalledConfigs.Add(new InstalledPlatformInfo.InstalledPlatformConfiguration(CodeTargetConfiguration, CodeTargetPlatform, TargetRules.TargetType.Game, Arch, ReceiptFileName, ProjectType, bCanBeDisplayed));
                                }
                            }
                            else
                            {
                                InstalledConfigs.Add(new InstalledPlatformInfo.InstalledPlatformConfiguration(CodeTargetConfiguration, CodeTargetPlatform, TargetRules.TargetType.Game, Architecture, ReceiptFileName, ProjectType, bCanBeDisplayed));
                            }
                        }
                    }
                }
            }

            UnrealBuildTool.InstalledPlatformInfo.WriteConfigFileEntries(InstalledConfigs, ref IniLines);

            if (!String.IsNullOrEmpty(AnalyticsTypeOverride))
            {
                // Write Custom Analytics type setting
                IniLines.Add("");
                IniLines.Add("[Analytics]");
                IniLines.Add(String.Format("UE4TypeOverride=\"{0}\"", AnalyticsTypeOverride));
            }

            // Make sure we can write to the the config file
            File.SetAttributes(OutputBaseEnginePath, OutputAttributes & ~FileAttributes.ReadOnly);
            File.AppendAllLines(OutputBaseEnginePath, IniLines);
            File.SetAttributes(OutputBaseEnginePath, OutputAttributes);
        }
    public override void Package(ProjectParams Params, DeploymentContext SC, int WorkingCL)
    {
        Log("Package {0}", Params.RawProjectPath);

        // ensure the ue4game binary exists, if applicable
        string FullExePath = CombinePaths(Path.GetDirectoryName(Params.ProjectGameExeFilename), SC.StageExecutables[0] + (UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac ? ".stub" : ""));

        if (!SC.IsCodeBasedProject && !FileExists_NoExceptions(FullExePath))
        {
            Log("Failed to find game binary " + FullExePath);
            throw new AutomationException(ErrorCodes.Error_MissingExecutable, "Stage Failed. Could not find binary {0}. You may need to build the UE4 project with your target configuration and platform.", FullExePath);
        }

        //@TODO: We should be able to use this code on both platforms, when the following issues are sorted:
        //   - Raw executable is unsigned & unstripped (need to investigate adding stripping to IPP)
        //   - IPP needs to be able to codesign a raw directory
        //   - IPP needs to be able to take a .app directory instead of a Payload directory when doing RepackageFromStage (which would probably be renamed)
        //   - Some discrepancy in the loading screen pngs that are getting packaged, which needs to be investigated
        //   - Code here probably needs to be updated to write 0 byte files as 1 byte (difference with IPP, was required at one point when using Ionic.Zip to prevent issues on device, maybe not needed anymore?)
        if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
        {
            // copy in all of the artwork and plist
            var DeployHandler = UEBuildDeploy.GetBuildDeploy(UnrealTargetPlatform.IOS);

            DeployHandler.PrepForUATPackageOrDeploy(Params.ShortProjectName,
                                                    Path.GetDirectoryName(Params.RawProjectPath),
                                                    CombinePaths(Path.GetDirectoryName(Params.ProjectGameExeFilename), SC.StageExecutables[0]),
                                                    CombinePaths(SC.LocalRoot, "Engine"),
                                                    Params.Distribution,
                                                    "",
                                                    false);

            // figure out where to pop in the staged files
            string AppDirectory = string.Format("{0}/Payload/{1}.app",
                                                Path.GetDirectoryName(Params.ProjectGameExeFilename),
                                                Path.GetFileNameWithoutExtension(Params.ProjectGameExeFilename));

            // delete the old cookeddata
            InternalUtils.SafeDeleteDirectory(AppDirectory + "/cookeddata", true);
            InternalUtils.SafeDeleteFile(AppDirectory + "/ue4commandline.txt", true);

            if (!Params.IterativeDeploy)
            {
                // copy the Staged files to the AppDirectory
                string[] StagedFiles = Directory.GetFiles(SC.StageDirectory, "*", SearchOption.AllDirectories);
                foreach (string Filename in StagedFiles)
                {
                    string DestFilename = Filename.Replace(SC.StageDirectory, AppDirectory);
                    Directory.CreateDirectory(Path.GetDirectoryName(DestFilename));
                    InternalUtils.SafeCopyFile(Filename, DestFilename, true);
                }
            }
            else
            {
                // copy just the root stage directory files
                string[] StagedFiles = Directory.GetFiles(SC.StageDirectory, "*", SearchOption.TopDirectoryOnly);
                foreach (string Filename in StagedFiles)
                {
                    string DestFilename = Filename.Replace(SC.StageDirectory, AppDirectory);
                    Directory.CreateDirectory(Path.GetDirectoryName(DestFilename));
                    InternalUtils.SafeCopyFile(Filename, DestFilename, true);
                }
            }
        }

        if (SC.StageTargetConfigurations.Count != 1)
        {
            throw new AutomationException("iOS is currently only able to package one target configuration at a time, but StageTargetConfigurations contained {0} configurations", SC.StageTargetConfigurations.Count);
        }
        bCreatedIPA = false;
        bool bNeedsIPA = false;

        if (Params.IterativeDeploy)
        {
            String NonUFSManifestPath = SC.GetNonUFSDeploymentDeltaPath();
            // check to determine if we need to update the IPA
            if (File.Exists(NonUFSManifestPath))
            {
                string   NonUFSFiles = File.ReadAllText(NonUFSManifestPath);
                string[] Lines       = NonUFSFiles.Split('\n');
                bNeedsIPA = Lines.Length > 0 && !string.IsNullOrWhiteSpace(Lines[0]);
            }
        }

        if (String.IsNullOrEmpty(Params.Provision))
        {
            UnrealBuildTool.IOSPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.IOS) as UnrealBuildTool.IOSPlatform;
            BuildPlat.SetUpProjectEnvironment(UnrealTargetPlatform.IOS);
            Params.Provision = UnrealBuildTool.IOSPlatform.MobileProvision;
        }
        if (String.IsNullOrEmpty(Params.Certificate))
        {
            UnrealBuildTool.IOSPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.IOS) as UnrealBuildTool.IOSPlatform;
            BuildPlat.SetUpProjectEnvironment(UnrealTargetPlatform.IOS);
            Params.Certificate = UnrealBuildTool.IOSPlatform.SigningCertificate;
        }

        var TargetConfiguration = SC.StageTargetConfigurations[0];

        // Scheme name and configuration for code signing with Xcode project
        string SchemeName          = Params.IsCodeBasedProject ? Path.GetFileNameWithoutExtension(Params.RawProjectPath) : "UE4";
        string SchemeConfiguration = TargetConfiguration.ToString();

        if (Params.Client)
        {
            SchemeConfiguration += " Client";
        }

        if (UnrealBuildTool.BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
        {
            var ProjectIPA  = MakeIPAFileName(TargetConfiguration, Params);
            var ProjectStub = Path.GetFullPath(Params.ProjectGameExeFilename);

            // package a .ipa from the now staged directory
            var IPPExe = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/DotNET/IOS/IPhonePackager.exe");

            Log("ProjectName={0}", Params.ShortProjectName);
            Log("ProjectStub={0}", ProjectStub);
            Log("ProjectIPA={0}", ProjectIPA);
            Log("IPPExe={0}", IPPExe);

            bool cookonthefly = Params.CookOnTheFly || Params.SkipCookOnTheFly;

            // if we are incremental check to see if we need to even update the IPA
            if (!Params.IterativeDeploy || !File.Exists(ProjectIPA) || bNeedsIPA)
            {
                // delete the .ipa to make sure it was made
                DeleteFile(ProjectIPA);

                bCreatedIPA = true;

                if (RemoteToolChain.bUseRPCUtil)
                {
                    string IPPArguments = "RepackageFromStage \"" + (Params.IsCodeBasedProject ? Params.RawProjectPath : "Engine") + "\"";
                    IPPArguments += " -config " + TargetConfiguration.ToString();
                    IPPArguments += " -schemename " + SchemeName + " -schemeconfig \"" + SchemeConfiguration + "\"";

                    if (TargetConfiguration == UnrealTargetConfiguration.Shipping)
                    {
                        IPPArguments += " -compress=best";
                    }

                    // Determine if we should sign
                    bool bNeedToSign = GetCodeSignDesirability(Params);

                    if (!String.IsNullOrEmpty(Params.BundleName))
                    {
                        // Have to sign when a bundle name is specified
                        bNeedToSign   = true;
                        IPPArguments += " -bundlename " + Params.BundleName;
                    }

                    if (bNeedToSign)
                    {
                        IPPArguments += " -sign";
                        if (Params.Distribution)
                        {
                            IPPArguments += " -distribution";
                        }
                    }

                    IPPArguments += (cookonthefly ? " -cookonthefly" : "");
                    IPPArguments += " -stagedir \"" + CombinePaths(Params.BaseStageDirectory, "IOS") + "\"";
                    IPPArguments += " -project \"" + Params.RawProjectPath + "\"";
                    if (Params.IterativeDeploy)
                    {
                        IPPArguments += " -iterate";
                    }
                    if (!string.IsNullOrEmpty(Params.Provision))
                    {
                        IPPArguments += " -provision \"" + Params.Provision + "\"";
                    }
                    if (!string.IsNullOrEmpty(Params.Certificate))
                    {
                        IPPArguments += " -certificate \"" + Params.Certificate + "\"";
                    }

                    RunAndLog(CmdEnv, IPPExe, IPPArguments);
                }
                else
                {
                    List <string> IPPArguments = new List <string>();
                    IPPArguments.Add("RepackageFromStage");
                    IPPArguments.Add(Params.IsCodeBasedProject ? Params.RawProjectPath : "Engine");
                    IPPArguments.Add("-config");
                    IPPArguments.Add(TargetConfiguration.ToString());
                    IPPArguments.Add("-schemename");
                    IPPArguments.Add(SchemeName);
                    IPPArguments.Add("-schemeconfig");
                    IPPArguments.Add("\"" + SchemeConfiguration + "\"");

                    if (TargetConfiguration == UnrealTargetConfiguration.Shipping)
                    {
                        IPPArguments.Add("-compress=best");
                    }

                    // Determine if we should sign
                    bool bNeedToSign = GetCodeSignDesirability(Params);

                    if (!String.IsNullOrEmpty(Params.BundleName))
                    {
                        // Have to sign when a bundle name is specified
                        bNeedToSign = true;
                        IPPArguments.Add("-bundlename");
                        IPPArguments.Add(Params.BundleName);
                    }

                    if (bNeedToSign)
                    {
                        IPPArguments.Add("-sign");
                    }

                    if (cookonthefly)
                    {
                        IPPArguments.Add(" -cookonthefly");
                    }
                    IPPArguments.Add(" -stagedir");
                    IPPArguments.Add(CombinePaths(Params.BaseStageDirectory, "IOS"));
                    IPPArguments.Add(" -project");
                    IPPArguments.Add(Params.RawProjectPath);
                    if (Params.IterativeDeploy)
                    {
                        IPPArguments.Add(" -iterate");
                    }
                    if (!string.IsNullOrEmpty(Params.Provision))
                    {
                        IPPArguments.Add(" -provision");
                        IPPArguments.Add(Params.Provision);
                    }
                    if (!string.IsNullOrEmpty(Params.Certificate))
                    {
                        IPPArguments.Add(" -certificate");
                        IPPArguments.Add(Params.Certificate);
                    }

                    if (RunIPP(IPPArguments.ToArray()) != 0)
                    {
                        throw new AutomationException("IPP Failed");
                    }
                }
            }

            // verify the .ipa exists
            if (!FileExists(ProjectIPA))
            {
                throw new AutomationException(ErrorCodes.Error_FailedToCreateIPA, "PACKAGE FAILED - {0} was not created", ProjectIPA);
            }

            if (WorkingCL > 0)
            {
                // Open files for add or edit
                var ExtraFilesToCheckin = new List <string>
                {
                    ProjectIPA
                };

                // check in the .ipa along with everything else
                UE4Build.AddBuildProductsToChangelist(WorkingCL, ExtraFilesToCheckin);
            }

            //@TODO: This automatically deploys after packaging, useful for testing on PC when iterating on IPP
            //Deploy(Params, SC);
        }
        else
        {
            // create the ipa
            string IPAName = CombinePaths(Path.GetDirectoryName(Params.RawProjectPath), "Binaries", "IOS", (Params.Distribution ? "Distro_" : "") + Params.ShortProjectName + (SC.StageTargetConfigurations[0] != UnrealTargetConfiguration.Development ? ("-IOS-" + SC.StageTargetConfigurations[0].ToString()) : "") + ".ipa");

            if (!Params.IterativeDeploy || !File.Exists(IPAName) || bNeedsIPA)
            {
                bCreatedIPA = true;

                // code sign the app
                CodeSign(Path.GetDirectoryName(Params.ProjectGameExeFilename), Params.IsCodeBasedProject ? Params.ShortProjectName : Path.GetFileNameWithoutExtension(Params.ProjectGameExeFilename), Params.RawProjectPath, SC.StageTargetConfigurations[0], SC.LocalRoot, Params.ShortProjectName, Path.GetDirectoryName(Params.RawProjectPath), SC.IsCodeBasedProject, Params.Distribution, Params.Provision, Params.Certificate, SchemeName, SchemeConfiguration);

                // now generate the ipa
                PackageIPA(Path.GetDirectoryName(Params.ProjectGameExeFilename), Params.IsCodeBasedProject ? Params.ShortProjectName : Path.GetFileNameWithoutExtension(Params.ProjectGameExeFilename), Params.ShortProjectName, Path.GetDirectoryName(Params.RawProjectPath), SC.StageTargetConfigurations[0], Params.Distribution);
            }
        }

        PrintRunTime();
    }
Exemplo n.º 11
0
        private static bool RequiresTempTarget(string RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms)
        {
            // check to see if we already have a Target.cs file
            if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath), "Source", Path.GetFileNameWithoutExtension(RawProjectPath) + ".Target.cs")))
            {
                return(false);
            }
            else
            {
                // wasn't one in the main Source directory, let's check all sub-directories
                //@todo: may want to read each target.cs to see if it has a target corresponding to the project name as a final check
                FileInfo[] Files = (new DirectoryInfo(Path.GetDirectoryName(RawProjectPath)).GetFiles("*.Target.cs", SearchOption.AllDirectories));
                if (Files.Length > 0)
                {
                    return(false);
                }
            }

            // no Target file, now check to see if build settings have changed
            List <UnrealTargetPlatform> TargetPlatforms = ClientTargetPlatforms;

            if (ClientTargetPlatforms == null || ClientTargetPlatforms.Count < 1)
            {
                // No client target platforms, add all in
                TargetPlatforms = new List <UnrealTargetPlatform>();
                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        TargetPlatforms.Add(TargetPlatformType);
                    }
                }
            }

            // Change the working directory to be the Engine/Source folder. We are running from Engine/Binaries/DotNET
            string oldCWD = Directory.GetCurrentDirectory();

            if (BuildConfiguration.RelativeEnginePath == "../../Engine/")
            {
                string EngineSourceDirectory = Path.Combine(UnrealBuildTool.Utils.GetExecutingAssemblyDirectory(), "..", "..", "..", "Engine", "Source");
                if (!Directory.Exists(EngineSourceDirectory))                 // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
                {
                    EngineSourceDirectory = Path.Combine(UnrealBuildTool.Utils.GetExecutingAssemblyDirectory(), "..", "..", "..", "Engine", "Binaries");
                }
                Directory.SetCurrentDirectory(EngineSourceDirectory);
            }

            // Read the project descriptor, and find all the plugins available to this project
            ProjectDescriptor Project          = ProjectDescriptor.FromFile(RawProjectPath);
            List <PluginInfo> AvailablePlugins = Plugins.ReadAvailablePlugins(RawProjectPath);

            // check the target platforms for any differences in build settings or additional plugins
            bool RetVal = false;

            foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
            {
                IUEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(TargetPlatformType, true);
                if (BuildPlat != null && !(BuildPlat as UEBuildPlatform).HasDefaultBuildConfig(TargetPlatformType, Path.GetDirectoryName(RawProjectPath)))
                {
                    RetVal = true;
                    break;
                }

                // find if there are any plugins enabled or disabled which differ from the default
                foreach (PluginInfo Plugin in AvailablePlugins)
                {
                    if (UProjectInfo.IsPluginEnabledForProject(Plugin, Project, TargetPlatformType) != Plugin.Descriptor.bEnabledByDefault)
                    {
                        if (Plugin.Descriptor.Modules.Any(Module => Module.IsCompiledInConfiguration(TargetPlatformType, TargetRules.TargetType.Game)))
                        {
                            RetVal = true;
                            break;
                        }
                    }
                }
            }

            // Change back to the original directory
            Directory.SetCurrentDirectory(oldCWD);
            return(RetVal);
        }
    public SQLiteDB(TargetInfo Target)
    {
        PublicIncludePaths.AddRange(
            new string[] {
            "SQLiteDB/Public"
            // ... add public include paths required here ...
        }
            );


        PrivateIncludePaths.AddRange(
            new string[] {
            "SQLiteDB/Private",
            // ... add other private include paths required here ...
        }
            );


        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            // ... add other public dependencies that you statically link with here ...
        }
            );


        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "CoreUObject",
            "Engine",
            "Slate",
            "SlateCore",
            // ... add private dependencies that you statically link with here ...
        }
            );


        DynamicallyLoadedModuleNames.AddRange(
            new string[]
        {
            // ... add any modules that your module loads dynamically here ...
        }
            );


        string PlatformName      = "";
        string ConfigurationName = "";

        switch (Target.Platform)
        {
        case UnrealTargetPlatform.Win32:
            PlatformName = "Win32/";
            break;

        case UnrealTargetPlatform.Win64:
            PlatformName = "x64/";
            break;

        case UnrealTargetPlatform.IOS:
        case UnrealTargetPlatform.TVOS:
            PlatformName = "IOS/";
            break;

        case UnrealTargetPlatform.Mac:
            PlatformName = "Mac/";
            break;

        case UnrealTargetPlatform.Linux:
            PlatformName = "Linux/";
            break;
        }

        switch (Target.Configuration)
        {
        case UnrealTargetConfiguration.Debug:
            ConfigurationName = "Debug/";
            break;

        case UnrealTargetConfiguration.DebugGame:
            ConfigurationName = "Debug/";
            break;

        default:
            ConfigurationName = "Release/";
            break;
        }

        string LibraryPath     = ThirdPartyPath + "/lib/" + PlatformName + ConfigurationName;
        string LibraryFilename = Path.Combine(LibraryPath, "sqlite" + UEBuildPlatform.GetBuildPlatform(Target.Platform).GetBinaryExtension(UEBuildBinaryType.StaticLibrary));

        if (!File.Exists(LibraryFilename))
        {
            //throw new BuildException("Please refer to the Engine/Source/ThirdParty/sqlite/README.txt file prior to enabling this module.");
        }

        PublicIncludePaths.Add(ThirdPartyPath + "/include/");

        PublicDependencyModuleNames.AddRange(
            new string[] {
            "Core",
            "DatabaseSupport",
        }
            );

        // Lib file
        PublicLibraryPaths.Add(LibraryPath);
        PublicAdditionalLibraries.Add(LibraryFilename);
    }