コード例 #1
0
        public override void Configure(CommandLineArguments Arguments)
        {
            base.Configure(Arguments);

            if (BaseDir == null)
            {
                for (DirectoryReference ParentDir = DirectoryReference.GetCurrentDirectory(); ParentDir != null; ParentDir = ParentDir.ParentDirectory)
                {
                    if (Repository.Exists(ParentDir))
                    {
                        BaseDir = ParentDir;
                        break;
                    }
                }

                if (BaseDir == null)
                {
                    throw new FatalErrorException("Unable to find existing repository in current working tree. Specify -BaseDir=... explicitly.");
                }
            }
        }
コード例 #2
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);
            }

            if (ClientTargetPlatforms != null)
            {
                foreach (UnrealTargetPlatform ClientPlatform in ClientTargetPlatforms)
                {
                    String   EncryptionKey;
                    String[] SigningKeys;
                    EncryptionAndSigning.ParseEncryptionIni(RawProjectPath.Directory, ClientPlatform, out SigningKeys, out EncryptionKey);
                    if (SigningKeys != null || !string.IsNullOrEmpty(EncryptionKey))
                    {
                        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
            DirectoryReference oldCWD = DirectoryReference.GetCurrentDirectory();

            try
            {
                DirectoryReference EngineSourceDirectory = DirectoryReference.Combine(CommandUtils.EngineDirectory, "Source");
                if (!DirectoryReference.Exists(EngineSourceDirectory))                 // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
                {
                    EngineSourceDirectory = DirectoryReference.Combine(CommandUtils.EngineDirectory, "Binaries");
                }
                Directory.SetCurrentDirectory(EngineSourceDirectory.FullName);

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

                // check the target platforms for any differences in build settings or additional plugins
                bool RetVal = false;
                foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
                {
                    if (!Automation.IsEngineInstalled() && !PlatformExports.HasDefaultBuildConfig(RawProjectPath, TargetPlatformType))
                    {
                        RetVal = true;
                        break;
                    }

                    // find if there are any plugins enabled or disabled which differ from the default
                    foreach (PluginInfo Plugin in AvailablePlugins)
                    {
                        bool bPluginEnabledForProject = Plugins.IsPluginEnabledForProject(Plugin, Project, TargetPlatformType, TargetType.Game);
                        if ((bPluginEnabledForProject != Plugin.EnabledByDefault) || (bPluginEnabledForProject && Plugin.Descriptor.bInstalled))
                        {
                            // NOTE: this code was only marking plugins that compiled for the platform to upgrade to code project, however
                            // this doesn't work in practice, because the runtime code will look for the plugin, without a .uplugin file,
                            // and will fail. This is the safest way to make sure all platforms are acting the same. However, if you
                            // whitelist the plugin in the .uproject file, the above UProjectInfo.IsPluginEnabledForProject check won't pass
                            // so you won't get in here. Leaving this commented out code in there, because someone is bound to come looking
                            // for why a non-whitelisted platform module is causing a project to convert to code-based.
                            // As an aside, if you run the project with UE4Game (not your Project's binary) from the debugger, it will work
                            // _in this case_ because the .uplugin file will have been staged, and there is no needed library
                            // if(Plugin.Descriptor.Modules.Any(Module => Module.IsCompiledInConfiguration(TargetPlatformType, TargetType.Game, bBuildDeveloperTools: false, bBuildEditor: false)))
                            {
                                RetVal = true;
                                break;
                            }
                        }
                    }
                }
                return(RetVal);
            }
            finally
            {
                // Change back to the original directory
                Directory.SetCurrentDirectory(oldCWD.FullName);
            }
        }