-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: Added Xamarin Apple Target (#675)
abstracted IHaveBundleIdentifier abstracted IHaveInfoPlist abstracted IXamarinAppleTarget
- Loading branch information
1 parent
648abe4
commit 7641565
Showing
13 changed files
with
153 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// ReSharper disable once CheckNamespace | ||
|
||
namespace Rocket.Surgery.Nuke.Xamarin; | ||
|
||
/// <summary> | ||
/// Has a bundle identifier. | ||
/// </summary> | ||
public interface IHaveBundleIdentifier : IHave | ||
{ | ||
/// <summary> | ||
/// Gets the path for the info plist. | ||
/// </summary> | ||
[Parameter("The application bundle identifier.")] | ||
public string BundleIdentifier => "com.rocketbooster.nuke"; | ||
|
||
/// <summary> | ||
/// Gets the suffix for the bundle identifier. | ||
/// </summary> | ||
[Parameter("The identifier suffix.")] | ||
public string Suffix { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Nuke.Common.IO; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Rocket.Surgery.Nuke.Xamarin; | ||
|
||
/// <summary> | ||
/// Has an info.plist file. | ||
/// </summary> | ||
public interface IHaveInfoPlist : IHave | ||
{ | ||
/// <summary> | ||
/// Gets the path for the info plist. | ||
/// </summary> | ||
[Parameter("The path to the info.plist.")] | ||
public AbsolutePath InfoPlist { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Serilog; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Rocket.Surgery.Nuke.Xamarin; | ||
|
||
/// <summary> | ||
/// Represents an application with a apple head, and associated concerns. | ||
/// </summary> | ||
public interface IXamarinAppleTarget : IHaveBundleIdentifier, IHaveGitVersion, IHaveInfoPlist | ||
{ | ||
/// <summary> | ||
/// modify info.plist | ||
/// </summary> | ||
public Target ModifyInfoPlist => _ => _ | ||
.Executes( | ||
() => | ||
{ | ||
Log.Verbose("Info.plist Path: {InfoPlist}", InfoPlist); | ||
var plist = Plist.Deserialize(InfoPlist); | ||
|
||
Log.Verbose("Deserialized Plist:\n {@Plist}\n", plist); | ||
|
||
plist["CFBundleIdentifier"] = $"{BundleIdentifier}.{Suffix.ToLower()}".TrimEnd('.'); | ||
Log.Information("CFBundleIdentifier: {CFBundleIdentifier}", plist["CFBundleIdentifier"]); | ||
|
||
plist["CFBundleShortVersionString"] = $"{GitVersion?.Major}.{GitVersion?.Minor}.{GitVersion?.Patch}"; | ||
Log.Information( | ||
"CFBundleShortVersionString: {CFBundleShortVersionString}", | ||
plist["CFBundleShortVersionString"] | ||
); | ||
|
||
plist["CFBundleVersion"] = $"{GitVersion?.FullSemanticVersion()}"; | ||
Log.Information("CFBundleVersion: {CFBundleVersion}", plist["CFBundleVersion"]); | ||
|
||
Plist.Serialize(InfoPlist, plist); | ||
Log.Verbose("Serialized Plist:\n {@Plist}\n", plist); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Nuke.Common.Tools.MSBuild; | ||
using static Nuke.Common.Tools.MSBuild.MSBuildTasks; | ||
|
||
#pragma warning disable CA1304 | ||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable once CheckNamespace | ||
namespace Rocket.Surgery.Nuke.Xamarin; | ||
|
||
/// <summary> | ||
/// Xamarin iOS build | ||
/// </summary> | ||
public interface ICanBuildXamariniOS : IXamarinAppleTarget, | ||
IHaveBuildTarget, | ||
IHaveRestoreTarget, | ||
IHaveSolution, | ||
IHaveConfiguration, | ||
IHaveOutputLogs, | ||
IHaveiOSTargetPlatform, | ||
ICan | ||
{ | ||
/// <summary> | ||
/// msbuild | ||
/// </summary> | ||
public Target BuildiPhone => _ => _ | ||
.DependsOn(Restore) | ||
.Executes( | ||
() => MSBuild( | ||
settings => settings.SetSolutionFile(Solution) | ||
.SetProperty("Platform", iOSTargetPlatform) | ||
.SetConfiguration(Configuration) | ||
.SetDefaultLoggers(LogsDirectory / "build.log") | ||
.SetGitVersionEnvironment(GitVersion) | ||
.SetAssemblyVersion(GitVersion?.FullSemanticVersion()) | ||
.SetPackageVersion(GitVersion?.NuGetVersionV2) | ||
) | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Nuke.Common.Tools.MSBuild; | ||
using static Nuke.Common.Tools.MSBuild.MSBuildTasks; | ||
|
||
#pragma warning disable CA1304 | ||
// ReSharper disable once CheckNamespace | ||
namespace Rocket.Surgery.Nuke.Xamarin; | ||
|
||
/// <summary> | ||
/// Xamarin mac build | ||
/// </summary> | ||
public interface ICanBuildXamarinMac : IXamarinAppleTarget, | ||
IHaveBuildTarget, | ||
IHaveRestoreTarget, | ||
IHaveSolution, | ||
IHaveConfiguration, | ||
IHaveOutputLogs, | ||
ICan | ||
{ | ||
/// <summary> | ||
/// msbuild | ||
/// </summary> | ||
public new Target Build => _ => _ | ||
.DependsOn(Restore) | ||
.Executes( | ||
() => MSBuild( | ||
settings => settings | ||
.SetSolutionFile(Solution) | ||
.SetProperty("Platform", TargetPlatform.AnyCPU) | ||
.SetConfiguration(Configuration) | ||
.SetDefaultLoggers(LogsDirectory / "build.log") | ||
.SetGitVersionEnvironment(GitVersion) | ||
.SetAssemblyVersion(GitVersion?.FullSemanticVersion()) | ||
.SetPackageVersion(GitVersion?.NuGetVersionV2) | ||
) | ||
); | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.