Exemple #1
0
    FileReference[] CompilePlugin(FileReference HostProjectFile, FileReference HostProjectPluginFile, PluginDescriptor Plugin, List <UnrealTargetPlatform> HostPlatforms, List <UnrealTargetPlatform> TargetPlatforms, string AdditionalArgs)
    {
        List <FileReference> ManifestFileNames = new List <FileReference>();

        // Build the host platforms
        if (HostPlatforms.Count > 0)
        {
            CommandUtils.LogInformation("Building plugin for host platforms: {0}", String.Join(", ", HostPlatforms));
            foreach (UnrealTargetPlatform HostPlatform in HostPlatforms)
            {
                if (Plugin.SupportedPrograms != null && Plugin.SupportedPrograms.Contains("UnrealHeaderTool"))
                {
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UnrealHeaderTool", TargetType.Program, HostPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, String.Format("{0} -plugin={1}", AdditionalArgs, CommandUtils.MakePathSafeToUseWithCommandLine(HostProjectPluginFile.FullName)));
                }
                CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Editor", TargetType.Editor, HostPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, AdditionalArgs);
            }
        }

        // Add the game targets
        if (TargetPlatforms.Count > 0)
        {
            CommandUtils.LogInformation("Building plugin for target platforms: {0}", String.Join(", ", TargetPlatforms));
            foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms)
            {
                if (Plugin.SupportsTargetPlatform(TargetPlatform))
                {
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Game", TargetType.Game, TargetPlatform, UnrealTargetConfiguration.Development, ManifestFileNames, AdditionalArgs);
                    CompilePluginWithUBT(HostProjectFile, HostProjectPluginFile, Plugin, "UE4Game", TargetType.Game, TargetPlatform, UnrealTargetConfiguration.Shipping, ManifestFileNames, AdditionalArgs);
                }
            }
        }

        // Package the plugin to the output folder
        HashSet <FileReference> BuildProducts = new HashSet <FileReference>();

        foreach (FileReference ManifestFileName in ManifestFileNames)
        {
            BuildManifest Manifest = CommandUtils.ReadManifest(ManifestFileName);
            BuildProducts.UnionWith(Manifest.BuildProducts.Select(x => new FileReference(x)));
        }
        return(BuildProducts.ToArray());
    }