Skip to content

Commit

Permalink
Merge pull request cake-contrib#11 from SotoiGhost/build-settings
Browse files Browse the repository at this point in the history
Added BuildSettings property to build Xcode project with custom settings
  • Loading branch information
Redth authored Sep 5, 2019
2 parents 9f61ebb + 248f00f commit 282b5d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Cake.XCode.Tests/Test.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Cake.CocoaPods;
using Cake.Common.IO;
Expand All @@ -21,7 +21,7 @@ public XCodeTests ()
//context.CakeContext.CleanDirectories("./TestProjects/**/obj");

if (context.CakeContext.DirectoryExists ("./TestProjects/tmp"))
context.CakeContext.DeleteDirectory ("./TestProjects/tmp", true);
context.CakeContext.DeleteDirectory ("./TestProjects/tmp", new DeleteDirectorySettings { Recursive = true });

context.CakeContext.CreateDirectory ("./TestProjects/tmp");
}
Expand Down Expand Up @@ -128,7 +128,12 @@ public void XCodeBuild ()
Arch = "i386",
Configuration = "Release",
DerivedDataPath = "./TestProjects/tmp/build",
Clean = true
Clean = true,
BuildSettings = new Dictionary<string, string>
{
{ "ENABLE_BITCODE", "YES" },
{ "BITCODE_GENERATION_MODE", "bitcode" },
}
});

Assert.True (context.CakeContext.DirectoryExists ("./TestProjects/tmp/build/Build/"));
Expand Down
8 changes: 8 additions & 0 deletions src/Cake.XCode/XCodeBuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ public class XCodeBuildSettings : XCodeSettings
/// <value>The export language.</value>
public string ExportLanguage { get; set; }

/// <summary>
/// Overrides specified build settings or adds User-Defined build settings
/// </summary>
/// <value>The build settings key value pairs.</value>
public Dictionary<string, string> BuildSettings { get; set; }

/// <summary>
/// Gets or sets a value indicating whether project should be cleaned.
/// </summary>
Expand Down Expand Up @@ -408,6 +414,8 @@ public void Build (XCodeBuildSettings settings)
if (settings.Clean)
builder.Append ("clean");

if (settings.BuildSettings != null && settings.BuildSettings.Count > 0)
builder.Append(string.Join(" ", settings.BuildSettings.Select(kvp => string.Format("{0}={1}", kvp.Key, kvp.Value))));

Run (settings, builder, settings.ToolPath);
}
Expand Down

0 comments on commit 282b5d0

Please sign in to comment.