Progress on XCode project generation
This commit is contained in:
@@ -20,6 +20,7 @@ Source/*.csproj
|
|||||||
*.lastbuilddate
|
*.lastbuilddate
|
||||||
*.opendb
|
*.opendb
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
*.xcodeproj
|
||||||
|
|
||||||
# NUNIT
|
# NUNIT
|
||||||
*.VisualState.xml
|
*.VisualState.xml
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Flax.Build.Projects
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ProjectFileExtension => "pbxproj";
|
public override string ProjectFileExtension => string.Empty;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string SolutionFileExtension => "xcodeproj";
|
public override string SolutionFileExtension => "xcodeproj";
|
||||||
@@ -44,39 +44,117 @@ namespace Flax.Build.Projects
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void GenerateProject(Project project)
|
public override void GenerateProject(Project project)
|
||||||
{
|
{
|
||||||
Console.WriteLine(project.Path);
|
|
||||||
var contents = new StringBuilder();
|
|
||||||
|
|
||||||
contents.AppendLine("// !$*UTF8*$!");
|
|
||||||
contents.AppendLine("{");
|
|
||||||
contents.AppendLine("\tarchiveVersion = 1;");
|
|
||||||
contents.AppendLine("\tclasses = {");
|
|
||||||
contents.AppendLine("\t};");
|
|
||||||
contents.AppendLine("\tobjectVersion = 46;");
|
|
||||||
contents.AppendLine("\tobjects = {");
|
|
||||||
|
|
||||||
contents.AppendLine("\t};");
|
|
||||||
contents.AppendLine("\trootObject = " + GetRandomGuid() + " /* Project object */;");
|
|
||||||
contents.AppendLine("}");
|
|
||||||
|
|
||||||
Utilities.WriteFileIfChanged(Path.Combine(project.Path), contents.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void GenerateSolution(Solution solution)
|
public override void GenerateSolution(Solution solution)
|
||||||
{
|
{
|
||||||
|
// TOOD: use random IDs for project and configurations
|
||||||
|
var groupId = "04FD6344277A0F15000EA5CA";
|
||||||
|
var projectId = "04FD6345277A0F15000EA5CA";
|
||||||
|
var projectName = solution.Name;
|
||||||
|
var projectWorkspacePath = Path.Combine(solution.Path, projectName + ".xcworkspace");
|
||||||
|
|
||||||
|
// Generate folders
|
||||||
Directory.CreateDirectory(solution.Path);
|
Directory.CreateDirectory(solution.Path);
|
||||||
|
Directory.CreateDirectory(projectWorkspacePath);
|
||||||
|
|
||||||
var contents = new StringBuilder();
|
// Generate XCode project
|
||||||
|
|
||||||
contents.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
||||||
contents.AppendLine("<Workspace version=\"1.0\">");
|
|
||||||
foreach (var project in solution.Projects)
|
|
||||||
{
|
{
|
||||||
}
|
var contents = new StringBuilder();
|
||||||
contents.AppendLine("</Workspace>");
|
|
||||||
|
|
||||||
Utilities.WriteFileIfChanged(Path.Combine(solution.Path, solution.Name + ".xcworkspace", "contents.xcworkspacedata"), contents.ToString());
|
contents.AppendLine("// !$*UTF8*$!");
|
||||||
|
contents.AppendLine("{");
|
||||||
|
contents.AppendLine("\tarchiveVersion = 1;");
|
||||||
|
contents.AppendLine("\tclasses = {");
|
||||||
|
contents.AppendLine("\t};");
|
||||||
|
contents.AppendLine("\tobjectVersion = 55;");
|
||||||
|
contents.AppendLine("\tobjects = {");
|
||||||
|
|
||||||
|
contents.AppendLine("");
|
||||||
|
contents.AppendLine("/* Begin PBXGroup section */");
|
||||||
|
contents.AppendLine("\t\t" + groupId + " = {");
|
||||||
|
contents.AppendLine("\t\t\tisa = PBXGroup;");
|
||||||
|
contents.AppendLine("\t\t\tchildren = (");
|
||||||
|
contents.AppendLine("\t\t\t);");
|
||||||
|
contents.AppendLine("\t\t\tsourceTree = \"<group>\";");
|
||||||
|
contents.AppendLine("\t\t};");
|
||||||
|
contents.AppendLine("/* End PBXGroup section */");
|
||||||
|
|
||||||
|
contents.AppendLine("");
|
||||||
|
contents.AppendLine("/* Begin PBXProject section */");
|
||||||
|
contents.AppendLine("\t\t" + projectId + " /* Project object */ = {");
|
||||||
|
contents.AppendLine("\t\t\tisa = PBXProject;");
|
||||||
|
contents.AppendLine("\t\t\tattributes = {");
|
||||||
|
contents.AppendLine("\t\t\t\tBuildIndependentTargetsInParallel = 1;");
|
||||||
|
contents.AppendLine("\t\t\t\tLastUpgradeCheck = 1320;");
|
||||||
|
contents.AppendLine("\t\t\t};");
|
||||||
|
contents.AppendLine("\t\t\tbuildConfigurationList = 04FD6348277A0F15000EA5CA /* Build configuration list for PBXProject \"" + projectName + "\" */;");
|
||||||
|
contents.AppendLine("\t\t\tcompatibilityVersion = \"Xcode 13.0\";");
|
||||||
|
contents.AppendLine("\t\t\tdevelopmentRegion = en;");
|
||||||
|
contents.AppendLine("\t\t\thasScannedForEncodings = 0;");
|
||||||
|
contents.AppendLine("\t\t\tknownRegions = (");
|
||||||
|
contents.AppendLine("\t\t\t\ten,");
|
||||||
|
contents.AppendLine("\t\t\t\tBase,");
|
||||||
|
contents.AppendLine("\t\t\t);");
|
||||||
|
contents.AppendLine("\t\t\tmainGroup = " + groupId+ ";");
|
||||||
|
contents.AppendLine("\t\t\tprojectDirPath = \"\";");
|
||||||
|
contents.AppendLine("\t\t\tprojectRoot = \"\";");
|
||||||
|
contents.AppendLine("\t\t\ttargets = (");
|
||||||
|
contents.AppendLine("\t\t\t);");
|
||||||
|
contents.AppendLine("\t\t};");
|
||||||
|
contents.AppendLine("/* End PBXProject section */");
|
||||||
|
|
||||||
|
contents.AppendLine("");
|
||||||
|
contents.AppendLine("/* Begin XCBuildConfiguration section */");
|
||||||
|
contents.AppendLine("\t\t04FD6349277A0F15000EA5CA /* Debug */ = {");
|
||||||
|
contents.AppendLine("\t\t\tisa = XCBuildConfiguration;");
|
||||||
|
contents.AppendLine("\t\t\tbuildSettings = {");
|
||||||
|
contents.AppendLine("\t\t\t};");
|
||||||
|
contents.AppendLine("\t\t\tname = Debug;");
|
||||||
|
contents.AppendLine("\t\t};");
|
||||||
|
contents.AppendLine("\t\t04FD634A277A0F15000EA5CA /* Release */ = {");
|
||||||
|
contents.AppendLine("\t\t\tisa = XCBuildConfiguration;");
|
||||||
|
contents.AppendLine("\t\t\tbuildSettings = {");
|
||||||
|
contents.AppendLine("\t\t\t};");
|
||||||
|
contents.AppendLine("\t\t\tname = Release;");
|
||||||
|
contents.AppendLine("\t\t};");
|
||||||
|
contents.AppendLine("/* End XCBuildConfiguration section */");
|
||||||
|
|
||||||
|
contents.AppendLine("");
|
||||||
|
contents.AppendLine("/* Begin XCConfigurationList section */");
|
||||||
|
contents.AppendLine("\t\t04FD6348277A0F15000EA5CA /* Build configuration list for PBXProject \"" + projectName + "\" */ = {");
|
||||||
|
contents.AppendLine("\t\t\tisa = XCConfigurationList;");
|
||||||
|
contents.AppendLine("\t\t\tbuildConfigurations = (");
|
||||||
|
contents.AppendLine("\t\t\t\t04FD6349277A0F15000EA5CA /* Debug */,");
|
||||||
|
contents.AppendLine("\t\t\t\t04FD634A277A0F15000EA5CA /* Release */,");
|
||||||
|
contents.AppendLine("\t\t\t);");
|
||||||
|
contents.AppendLine("\t\t\tdefaultConfigurationIsVisible = 0;");
|
||||||
|
contents.AppendLine("\t\t\tdefaultConfigurationName = Release;");
|
||||||
|
contents.AppendLine("\t\t};");
|
||||||
|
contents.AppendLine("/* End XCConfigurationList section */");
|
||||||
|
|
||||||
|
contents.AppendLine("\t};");
|
||||||
|
contents.AppendLine("\trootObject = " + projectId + " /* Project object */;");
|
||||||
|
contents.AppendLine("}");
|
||||||
|
|
||||||
|
Utilities.WriteFileIfChanged(Path.Combine(solution.Path, "project.pbxproj"), contents.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate XCode workspace data
|
||||||
|
{
|
||||||
|
var contents = new StringBuilder();
|
||||||
|
|
||||||
|
contents.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
|
contents.AppendLine("<Workspace");
|
||||||
|
contents.AppendLine(" version = \"1.0\">");
|
||||||
|
contents.AppendLine(" <FileRef");
|
||||||
|
contents.AppendLine(" location = \"self:\">");
|
||||||
|
contents.AppendLine(" </FileRef>");
|
||||||
|
contents.AppendLine("</Workspace>");
|
||||||
|
|
||||||
|
Utilities.WriteFileIfChanged(Path.Combine(projectWorkspacePath, "contents.xcworkspacedata"), contents.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetRandomGuid()
|
private string GetRandomGuid()
|
||||||
|
|||||||
Reference in New Issue
Block a user