2015-04-30 13:15:34 -04:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System ;
using System.Collections.Generic ;
using System.Text ;
using System.IO ;
namespace UnrealBuildTool
{
/// <summary>
/// Represents a folder within the master project (e.g. Visual Studio solution)
/// </summary>
public class KDevelopFolder : MasterProjectFolder
{
/// <summary>
/// Constructor
/// </summary>
2015-09-24 12:37:21 -04:00
public KDevelopFolder ( ProjectFileGenerator InitOwnerProjectFileGenerator , string InitFolderName )
2015-04-30 13:15:34 -04:00
: base ( InitOwnerProjectFileGenerator , InitFolderName )
{
}
}
public class KDevelopProjectFile : ProjectFile
{
2015-09-24 12:37:21 -04:00
public KDevelopProjectFile ( FileReference InitFilePath )
2015-04-30 13:15:34 -04:00
: base ( InitFilePath )
{
}
}
/// <summary>
/// KDevelop project file generator implementation
/// </summary>
public class KDevelopGenerator : ProjectFileGenerator
{
2015-09-24 12:37:21 -04:00
public KDevelopGenerator ( FileReference InOnlyGameProject )
: base ( InOnlyGameProject )
2015-09-17 09:15:44 -04:00
{
}
2015-04-30 13:15:34 -04:00
/// File extension for project files we'll be generating (e.g. ".vcxproj")
override public string ProjectFileExtension
{
get
{
return ".kdev4" ;
}
}
2015-09-24 12:37:21 -04:00
protected override bool WriteMasterProjectFile ( ProjectFile UBTProject )
2015-04-30 13:15:34 -04:00
{
bool bSuccess = true ;
return bSuccess ;
}
2015-09-24 12:37:21 -04:00
2015-04-30 13:15:34 -04:00
/// <summary>
/// Write the primare $ProjectName.kdev4 project file, the one that should be opened when loading the project
/// into KDevelop
/// </summary>
/// <param name="FileContent">File content.</param>
/// <param name="Name">Name.</param>
2015-09-24 12:37:21 -04:00
private void WriteKDevMasterProjectSection ( ref StringBuilder FileContent , string Name )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( "\n" ) ;
FileContent . Append ( "[Project] \n" ) ;
FileContent . Append ( "Manager=KDevCustomBuildSystem \n" ) ;
FileContent . Append ( "Name=" ) ;
FileContent . Append ( Name ) ;
FileContent . Append ( "\n" ) ;
2015-04-30 13:15:34 -04:00
}
/// <summary>
/// Write the Command Sub section for .kdev4/$ProjectName.kdev4 file
/// </summary>
/// <param name="FileContent">File content.</param>
/// <param name="TargetName">Target name.</param>
/// <param name="ConfName">Conf name.</param>
/// <param name="BuildConfigIndex">Build config index.</param>
/// <param name="Type">Type.</param>
private void WriteCommandSubSection ( ref StringBuilder FileContent , string TargetName , string ConfName , int BuildConfigIndex , int Type )
{
string ToolType = "" ;
string Executable = "" ;
string ProjectCmdArg = "" ;
string BuildCommand = "" ;
if ( TargetName = = GameProjectName )
2015-09-24 12:37:21 -04:00
{
2015-09-17 09:15:44 -04:00
ProjectCmdArg = " -project=\"" + OnlyGameProject . FullName + "\"" ;
2015-04-30 13:15:34 -04:00
Executable = "mono" ;
BuildCommand = "Engine/Binaries/DotNET/UnrealBuildTool.exe" ;
2015-09-24 12:37:21 -04:00
if ( Type = = 1 )
2015-04-30 13:15:34 -04:00
{
ProjectCmdArg = " -makefile -kdevelopfile " + ProjectCmdArg + " -game -engine " ;
}
2015-09-24 12:37:21 -04:00
}
else if ( TargetName = = ( GameProjectName + "Editor" ) )
{
2015-09-17 09:15:44 -04:00
ProjectCmdArg = " -editorrecompile -project=\"" + OnlyGameProject . FullName + "\"" ;
2015-04-30 13:15:34 -04:00
Executable = "mono" ;
BuildCommand = "Engine/Binaries/DotNET/UnrealBuildTool.exe" ;
2015-09-24 12:37:21 -04:00
if ( Type = = 1 )
2015-04-30 13:15:34 -04:00
{
ProjectCmdArg = " -makefile -kdevelopfile " + ProjectCmdArg + " -game -engine " ;
}
}
else
{
Executable = "bash" ;
BuildCommand = "Engine/Build/BatchFiles/Linux/Build.sh" ;
2015-09-24 12:37:21 -04:00
if ( Type = = 1 )
2015-04-30 13:15:34 -04:00
{
// Override BuildCommand and ProjectCmdArg
BuildCommand = "./GenerateProjectFiles.sh" ;
// ProjectCmdArg = "";
}
}
if ( Type = = 0 )
{
ToolType = "Build" ;
2015-09-24 12:37:21 -04:00
}
else if ( Type = = 1 )
2015-04-30 13:15:34 -04:00
{
ToolType = "Configure" ;
}
2015-09-24 12:37:21 -04:00
else if ( Type = = 3 )
2015-04-30 13:15:34 -04:00
{
ToolType = "Clean" ;
ConfName = ConfName + " -clean" ;
}
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "[CustomBuildSystem][BuildConfig{0}][Tool{1}]\n" , BuildConfigIndex , ToolType ) ) ;
FileContent . Append ( String . Format ( "Arguments={0} {1} {2} Linux {3}\n" , BuildCommand , ProjectCmdArg , TargetName , ConfName ) ) ;
FileContent . Append ( "Enabled=true\n" ) ;
FileContent . Append ( "Environment=\n" ) ;
FileContent . Append ( String . Format ( "Executable={0}\n" , Executable ) ) ;
FileContent . Append ( String . Format ( "Type={0}\n\n" , Type ) ) ;
2015-04-30 13:15:34 -04:00
}
/// <summary>
/// Write the Command section for a .kdev4/$ProjectName.kdev4 file.
/// </summary>
/// <param name="FileContent">File content.</param>
2015-09-24 12:37:21 -04:00
private void WriteCommandSection ( ref StringBuilder FileContent )
2015-04-30 13:15:34 -04:00
{
int BuildConfigIndex = 1 ;
var UnrealRootPath = Path . GetFullPath ( ProjectFileGenerator . RootRelativePath ) ;
2015-09-24 12:37:21 -04:00
FileContent . Append ( "[CustomBuildSystem]\n" ) ;
2015-04-30 13:15:34 -04:00
FileContent . Append ( "CurrentConfiguration=BuildConfig0\n\n" ) ; //
// The Basics to get up and running with the editor, utilizing the Makefile.
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "[CustomBuildSystem][BuildConfig0]\nBuildDir=file://{0}\n" , UnrealRootPath ) ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
FileContent . Append ( "Title=BuildMeFirst\n\n" ) ;
FileContent . Append ( "[CustomBuildSystem][BuildConfig0][ToolBuild]\n" ) ;
FileContent . Append ( "Arguments=-f Makefile UE4Editor UE4Game ShaderCompileWorker UnrealLightmass UnrealPak\n" ) ;
FileContent . Append ( "Enabled=true\n" ) ;
FileContent . Append ( "Environment=\n" ) ;
FileContent . Append ( "Executable=make\n" ) ;
FileContent . Append ( "Type=0\n\n" ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
FileContent . Append ( "[CustomBuildSystem][BuildConfig0][ToolClean]\n" ) ;
FileContent . Append ( "Arguments=-f Makefile UE4Editor UE4Game ShaderCompileWorker UnrealLightmass UnrealPak -clean\n" ) ;
FileContent . Append ( "Enabled=true\n" ) ;
FileContent . Append ( "Environment=\n" ) ;
FileContent . Append ( "Executable=make\n" ) ;
FileContent . Append ( "Type=3\n\n" ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
FileContent . Append ( "[CustomBuildSystem][BuildConfig0][ToolConfigure]\n" ) ;
FileContent . Append ( "Arguments=./GenerateProjectFiles.sh\n" ) ;
FileContent . Append ( "Enabled=true\n" ) ;
FileContent . Append ( "Environment=\n" ) ;
FileContent . Append ( "Executable=bash\n" ) ;
FileContent . Append ( "Type=1\n\n" ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
foreach ( var Project in GeneratedProjectFiles )
2015-04-30 13:15:34 -04:00
{
2015-07-21 13:39:28 -04:00
foreach ( var TargetFile in Project . ProjectTargets )
2015-04-30 13:15:34 -04:00
{
2015-07-21 13:39:28 -04:00
if ( TargetFile . TargetFilePath = = null )
2015-04-30 13:15:34 -04:00
{
2015-07-21 13:39:28 -04:00
continue ;
}
2015-04-30 13:15:34 -04:00
2015-09-03 08:47:24 -04:00
var TargetName = TargetFile . TargetFilePath . GetFileNameWithoutAnyExtensions ( ) ;
2015-07-21 13:39:28 -04:00
// Remove both ".cs" and ".
2015-09-24 12:37:21 -04:00
foreach ( UnrealTargetConfiguration CurConfiguration in Enum . GetValues ( typeof ( UnrealTargetConfiguration ) ) )
2015-07-21 13:39:28 -04:00
{
2015-09-24 12:37:21 -04:00
if ( CurConfiguration ! = UnrealTargetConfiguration . Unknown & & CurConfiguration ! = UnrealTargetConfiguration . Development )
2015-07-21 13:39:28 -04:00
{
2015-09-24 12:37:21 -04:00
if ( UnrealBuildTool . IsValidConfiguration ( CurConfiguration ) )
2015-04-30 13:15:34 -04:00
{
2015-07-21 13:39:28 -04:00
var ConfName = Enum . GetName ( typeof ( UnrealTargetConfiguration ) , CurConfiguration ) ;
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "[CustomBuildSystem][BuildConfig{0}]\nBuildDir=file://{1}\n" , BuildConfigIndex , UnrealRootPath ) ) ;
2015-07-21 13:39:28 -04:00
if ( TargetName = = GameProjectName )
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}-Linux-{1}\n\n" , TargetName , ConfName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 3 ) ;
}
else if ( TargetName = = ( GameProjectName + "Editor" ) )
2015-07-21 13:39:28 -04:00
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}-Linux-{1}\n\n" , TargetName , ConfName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 3 ) ;
}
2015-07-21 13:39:28 -04:00
else
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}-Linux-{1}\n\n" , TargetName , ConfName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , ConfName , BuildConfigIndex , 3 ) ;
2015-07-21 13:39:28 -04:00
}
BuildConfigIndex + + ;
2015-04-30 13:15:34 -04:00
}
}
}
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "[CustomBuildSystem][BuildConfig{0}]\nBuildDir=file://{1}\n" , BuildConfigIndex , UnrealRootPath ) ) ;
2015-07-21 13:39:28 -04:00
if ( TargetName = = GameProjectName )
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}\n\n" , TargetName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 3 ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
}
else if ( TargetName = = ( GameProjectName + "Editor" ) )
2015-07-21 13:39:28 -04:00
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}\n\n" , TargetName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 3 ) ;
2015-07-21 13:39:28 -04:00
}
else
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( String . Format ( "Title={0}\n\n" , TargetName ) ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 0 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 1 ) ;
WriteCommandSubSection ( ref FileContent , TargetName , "Development" , BuildConfigIndex , 3 ) ;
2015-07-21 13:39:28 -04:00
}
BuildConfigIndex + + ;
2015-04-30 13:15:34 -04:00
}
2015-07-21 13:39:28 -04:00
}
2015-04-30 13:15:34 -04:00
}
/// <summary>
/// Adds the include directory to the list, after converting it to an absolute path to UE4 root directory.
/// </summary>
/// <param name="FileContent">File content.</param>
private void WriteIncludeSection ( ref StringBuilder FileContent )
{
2015-09-24 12:37:21 -04:00
List < string > IncludeDirectories = new List < string > ( ) ;
List < string > SystemIncludeDirectories = new List < string > ( ) ;
2015-04-30 13:15:34 -04:00
var UnrealEngineRootPath = Path . GetFullPath ( ProjectFileGenerator . RootRelativePath ) ;
int IncludeIndex = 1 ;
// Iterate through all the include paths that
// UnrealBuildTool.exe generates
2015-09-24 12:37:21 -04:00
foreach ( var CurProject in GeneratedProjectFiles )
2015-04-30 13:15:34 -04:00
{
KDevelopProjectFile KDevelopProject = CurProject as KDevelopProjectFile ;
if ( KDevelopProject = = null )
{
2015-09-24 12:37:21 -04:00
System . Console . WriteLine ( "KDevelopProject == null" ) ;
2015-04-30 13:15:34 -04:00
continue ;
}
2015-09-24 12:37:21 -04:00
foreach ( var CurPath in KDevelopProject . IntelliSenseIncludeSearchPaths )
2015-04-30 13:15:34 -04:00
{
2015-09-03 08:47:24 -04:00
string FullProjectPath = ProjectFileGenerator . MasterProjectPath . FullName ;
2015-04-30 13:15:34 -04:00
string FullPath = "" ;
// need to test to see if this in the project souce tree
if ( CurPath . StartsWith ( "/" ) & & ! CurPath . StartsWith ( FullProjectPath ) )
{
// Full path to a folder outside of project
FullPath = CurPath ;
System . Console . WriteLine ( "FullPath starting with /: " + FullPath ) ;
}
else
{
2015-09-03 08:47:24 -04:00
FullPath = Path . GetFullPath ( Path . Combine ( Path . GetDirectoryName ( KDevelopProject . ProjectFilePath . FullName ) , CurPath ) ) ;
2015-04-30 13:15:34 -04:00
FullPath = Utils . MakePathRelativeTo ( FullPath , FullProjectPath ) ;
FullPath = FullPath . TrimEnd ( '/' ) ;
FullPath = Path . Combine ( UnrealEngineRootPath , FullPath ) ;
}
2015-09-24 12:37:21 -04:00
if ( ! IncludeDirectories . Contains ( FullPath ) & & ! FullPath . Contains ( "FortniteGame/" ) & & Directory . Exists ( FullPath ) )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
SystemIncludeDirectories . Add ( String . Format ( "{0}" , FullPath ) ) ;
2015-04-30 13:15:34 -04:00
IncludeIndex + + ;
}
}
2015-09-24 12:37:21 -04:00
foreach ( var CurPath in KDevelopProject . IntelliSenseSystemIncludeSearchPaths )
2015-04-30 13:15:34 -04:00
{
2015-09-03 08:47:24 -04:00
string FullProjectPath = ProjectFileGenerator . MasterProjectPath . FullName ;
2015-04-30 13:15:34 -04:00
string FullPath = "" ;
if ( CurPath . StartsWith ( "/" ) & & ! CurPath . StartsWith ( FullProjectPath ) )
{
// Full path to a folder outside of project
FullPath = CurPath ;
}
else
{
2015-09-03 08:47:24 -04:00
FullPath = Path . GetFullPath ( Path . Combine ( Path . GetDirectoryName ( KDevelopProject . ProjectFilePath . FullName ) , CurPath ) ) ;
2015-04-30 13:15:34 -04:00
FullPath = Utils . MakePathRelativeTo ( FullPath , FullProjectPath ) ;
FullPath = FullPath . TrimEnd ( '/' ) ;
FullPath = Path . Combine ( UnrealEngineRootPath , FullPath ) ;
}
2015-09-24 12:37:21 -04:00
if ( ! SystemIncludeDirectories . Contains ( FullPath ) & & ! FullPath . Contains ( "FortniteGame/" ) & & ! FullPath . Contains ( "Intermediate/" ) & & Directory . Exists ( FullPath ) ) // @todo: skipping Fortnite header paths to shorten clang command line for building UE4XcodeHelper
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
SystemIncludeDirectories . Add ( String . Format ( "{0}" , FullPath ) ) ;
2015-04-30 13:15:34 -04:00
IncludeIndex + + ;
}
}
}
2015-09-24 12:37:21 -04:00
foreach ( var CurPath in IncludeDirectories )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( CurPath ) ;
FileContent . Append ( " \n" ) ;
2015-04-30 13:15:34 -04:00
}
2015-09-24 12:37:21 -04:00
foreach ( var CurPath in SystemIncludeDirectories )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( CurPath ) ;
FileContent . Append ( " \n" ) ;
2015-04-30 13:15:34 -04:00
}
FileContent . Append ( "\n" ) ;
}
/// <summary>
/// Write the defines section to the .kdev4/$ProjectName.kdev4 project file.
/// </summary>
/// <param name="FileContent">File content.</param>
2015-09-24 12:37:21 -04:00
private void WriteDefineSection ( ref StringBuilder FileContent )
2015-04-30 13:15:34 -04:00
{
List < string > DefineHolder = new List < string > ( ) ;
foreach ( var CurProject in GeneratedProjectFiles )
{
KDevelopProjectFile KDevelopProject = CurProject as KDevelopProjectFile ;
if ( KDevelopProject = = null )
{
2015-09-24 12:37:21 -04:00
System . Console . WriteLine ( "KDevelopProject == null" ) ;
2015-04-30 13:15:34 -04:00
continue ;
}
foreach ( var CurDefine in KDevelopProject . IntelliSensePreprocessorDefinitions )
{
2015-09-24 12:37:21 -04:00
if ( ! DefineHolder . Contains ( CurDefine ) )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
DefineHolder . Add ( CurDefine ) ;
2015-04-30 13:15:34 -04:00
}
}
}
foreach ( var Def in DefineHolder )
{
2015-09-24 12:37:21 -04:00
FileContent . Append ( Def + "\n" ) ;
2015-04-30 13:15:34 -04:00
}
2015-09-24 12:37:21 -04:00
FileContent . Append ( "\n\n" ) ;
2015-04-30 13:15:34 -04:00
}
/// <summary>
/// Excludes list in one big ugly list.
/// </summary>
/// <param name="FileContent">File content.</param>
2015-09-24 12:37:21 -04:00
private void WriteExcludeSection ( ref StringBuilder FileContent )
2015-04-30 13:15:34 -04:00
{
// Default excludes list with Engine/Intermediate, *PCH.h, and *.gch added to the exclude list
2015-09-24 12:37:21 -04:00
FileContent . Append ( "[Filters]\nsize=30\n\n[Filters][0]\ninclusive=0\npattern=.*\ntargets=3\n\n" +
2015-04-30 13:15:34 -04:00
"[Filters][1]\ninclusive=0\npattern=.git\ntargets=2\n\n[Filters][10]\ninclusive=0\npattern=*.o\ntargets=1\n\n" +
"[Filters][11]\ninclusive=0\npattern=*.a\ntargets=1\n\n[Filters][12]\ninclusive=0\npattern=*.so\ntargets=1\n\n" +
"[Filters][13]\ninclusive=0\npattern=*.so.*\ntargets=1\n\n[Filters][14]\ninclusive=0\npattern=moc_*.cpp\ntargets=1\n\n" +
"[Filters][15]\ninclusive=0\npattern=*.moc\ntargets=1\n\n[Filters][16]\ninclusive=0\npattern=ui_*.h\ntargets=1\n\n" +
"[Filters][17]\ninclusive=0\npattern=qrc_*.cpp\ntargets=1\n\n[Filters][18]\ninclusive=0\npattern=*~\ntargets=1\n\n" +
"[Filters][19]\ninclusive=0\npattern=*.orig\ntargets=1\n\n[Filters][2]\ninclusive=0\npattern=CVS\ntargets=2\n\n" +
"[Filters][20]\ninclusive=0\npattern=.*.kate-swp\ntargets=1\n\n[Filters][21]\ninclusive=0\npattern=.*.swp\ntargets=1\n\n" +
"[Filters][22]\ninclusive=0\npattern=*.pyc\ntargets=1\n\n[Filters][23]\ninclusive=0\npattern=*.pyo\ntargets=1\n\n" +
"[Filters][24]\ninclusive=0\npattern=Engine/Intermediate\ntargets=2\n\n[Filters][25]\ninclusive=0\npattern=*PCH.h\ntargets=1\n\n" +
"[Filters][26]\ninclusive=0\npattern=*.gch\ntargets=1\n\n[Filters][27]\ninclusive=0\npattern=*.generated.h\ntargets=1\n\n" +
"[Filters][28]\ninclusive=0\npattern=Intermediate\ntargets=2\n\n[Filters][3]\ninclusive=0\npattern=.svn\ntargets=2\n\n" +
"[Filters][4]\ninclusive=0\npattern=_svn\ntargets=2\n\n[Filters][5]\ninclusive=0\npattern=SCCS\ntargets=2\n\n" +
"[Filters][6]\ninclusive=0\npattern=_darcs\ntargets=2\n\n[Filters][7]\ninclusive=0\npattern=.hg\ntargets=2\n\n" +
"[Filters][8]\ninclusive=0\npattern=.bzr\ntargets=2\n\n[Filters][9]\ninclusive=0\npattern=__pycache__\ntargets=2\n\n" +
"[Filters][29]\ninclusive=0\npattern=Engine/Source/ThirdParty\ntargets=2\n\n" ) ;
}
/// Simple Place to call all the Write*Section functions.
private bool WriteKDevelopPro ( )
{
/// RAKE! Take one KDevelopProjectFileContent and pass
/// it through each function that writes out the sections.
var KDevelopFileContent = new StringBuilder ( ) ;
2015-09-24 12:37:21 -04:00
var KDevelopMasterFileContent = new StringBuilder ( ) ;
2015-04-30 13:15:34 -04:00
// These are temp files until we can write them to the
// *.kdev4 filename directly
2015-09-24 12:37:21 -04:00
var DefinesFileContent = new StringBuilder ( ) ;
var IncludesFileContent = new StringBuilder ( ) ;
2015-04-30 13:15:34 -04:00
var FileName = MasterProjectName + ".kdev4" ;
var DefinesFileName = "Defines.txt" ; // RAKE! TEMP!
var IncludesFileName = "Includes.txt" ; // RAKE! TEMP!
2015-09-24 12:37:21 -04:00
WriteKDevMasterProjectSection ( ref KDevelopMasterFileContent , MasterProjectName ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
WriteCommandSection ( ref KDevelopFileContent ) ;
WriteIncludeSection ( ref IncludesFileContent ) ;
WriteDefineSection ( ref DefinesFileContent ) ;
WriteExcludeSection ( ref KDevelopFileContent ) ;
2015-04-30 13:15:34 -04:00
// Write the master kdev file.
2015-09-24 12:37:21 -04:00
var FullMasterProjectPath = Path . Combine ( MasterProjectPath . FullName , ".kdev4/" ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
if ( ! Directory . Exists ( FullMasterProjectPath ) )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
Directory . CreateDirectory ( FullMasterProjectPath ) ;
2015-04-30 13:15:34 -04:00
}
2015-09-03 08:47:24 -04:00
var FullKDevelopMasterFileName = Path . Combine ( MasterProjectPath . FullName , FileName ) ;
2015-09-24 12:37:21 -04:00
var FullKDevelopFileName = Path . Combine ( FullMasterProjectPath , FileName ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
var FullDefinesFileName = Path . Combine ( FullMasterProjectPath , DefinesFileName ) ;
var FullIncludesFileName = Path . Combine ( FullMasterProjectPath , IncludesFileName ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
WriteFileIfChanged ( FullDefinesFileName , DefinesFileContent . ToString ( ) ) ;
WriteFileIfChanged ( FullIncludesFileName , IncludesFileContent . ToString ( ) ) ;
2015-04-30 13:15:34 -04:00
2015-09-24 12:37:21 -04:00
return WriteFileIfChanged ( FullKDevelopMasterFileName , KDevelopMasterFileContent . ToString ( ) ) & &
WriteFileIfChanged ( FullKDevelopFileName , KDevelopFileContent . ToString ( ) ) ;
2015-04-30 13:15:34 -04:00
}
/// ProjectFileGenerator interface
//protected override bool WriteMasterProjectFile( ProjectFile UBTProject )
2015-09-24 12:37:21 -04:00
protected override bool WriteProjectFiles ( )
2015-04-30 13:15:34 -04:00
{
return WriteKDevelopPro ( ) ;
}
/// ProjectFileGenerator interface
2015-09-24 12:37:21 -04:00
public override MasterProjectFolder AllocateMasterProjectFolder ( ProjectFileGenerator InitOwnerProjectFileGenerator , string InitFolderName )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
return new KDevelopFolder ( InitOwnerProjectFileGenerator , InitFolderName ) ;
2015-04-30 13:15:34 -04:00
}
/// ProjectFileGenerator interface
/// <summary>
/// Allocates a generator-specific project file object
/// </summary>
/// <param name="InitFilePath">Path to the project file</param>
/// <returns>The newly allocated project file object</returns>
2015-09-24 12:37:21 -04:00
protected override ProjectFile AllocateProjectFile ( FileReference InitFilePath )
2015-04-30 13:15:34 -04:00
{
2015-09-24 12:37:21 -04:00
return new KDevelopProjectFile ( InitFilePath ) ;
2015-04-30 13:15:34 -04:00
}
/// ProjectFileGenerator interface
2015-09-03 08:47:24 -04:00
public override void CleanProjectFiles ( DirectoryReference InMasterProjectDirectory , string InMasterProjectName , DirectoryReference InIntermediateProjectFilesDirectory )
2015-04-30 13:15:34 -04:00
{
}
}
}