Skip to content

Commit

Permalink
[mtouch/mmp] Move Driver's LOCAL_BUILD_DIR and FRAMEWORK_LOCATION_VAR…
Browse files Browse the repository at this point in the history
…IABLE constants to Application instance fields. (dotnet#9320)
  • Loading branch information
rolfbjarne authored Aug 10, 2020
1 parent d8665dd commit 916e79b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
29 changes: 29 additions & 0 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,35 @@ public bool IsDefaultMarshalManagedExceptionMode {
public List<Application> SharedCodeApps = new List<Application> (); // List of appexes we're sharing code with.
public string RegistrarOutputLibrary;

public string LocalBuildDir {
get {
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return "_ios-build";
case ApplePlatform.MacOSX:
return "_mac-build";
default:
throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName);
}
}
}

public string FrameworkLocationVariable {
get {
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return "MD_MTOUCH_SDK_ROOT";
case ApplePlatform.MacOSX:
return "XAMMAC_FRAMEWORK_PATH";
default:
throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName);
}
}
}
public static int Concurrency => Driver.Concurrency;
public Version DeploymentTarget;
public Version SdkVersion;
Expand Down
4 changes: 2 additions & 2 deletions tools/common/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ public static string WalkUpDirHierarchyLookingForLocalBuild (Application app)
var localPath = Path.GetDirectoryName (GetFullPath ());
while (localPath.Length > 1) {
if (File.Exists (Path.Combine (localPath, "Make.config"))) {
local_build = Path.Combine (localPath, LOCAL_BUILD_DIR, "Library", "Frameworks", app.ProductName + ".framework", "Versions", "Current");
local_build = Path.Combine (localPath, app.LocalBuildDir, "Library", "Frameworks", app.ProductName + ".framework", "Versions", "Current");
return local_build;
}

Expand All @@ -754,7 +754,7 @@ public static string WalkUpDirHierarchyLookingForLocalBuild (Application app)
public static string GetFrameworkCurrentDirectory (Application app)
{
if (framework_dir == null) {
var env_framework_dir = Environment.GetEnvironmentVariable (FRAMEWORK_LOCATION_VARIABLE);
var env_framework_dir = Environment.GetEnvironmentVariable (app.FrameworkLocationVariable);
if (!string.IsNullOrEmpty (env_framework_dir)) {
framework_dir = env_framework_dir;
} else {
Expand Down
2 changes: 0 additions & 2 deletions tools/mmp/driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ enum Action {

public static partial class Driver {
internal const string NAME = "mmp";
const string LOCAL_BUILD_DIR = "_mac-build";
const string FRAMEWORK_LOCATION_VARIABLE = "XAMMAC_FRAMEWORK_PATH";
internal static Application App = new Application (Environment.GetCommandLineArgs ());
static Target BuildTarget;
static List<string> resources = new List<string> ();
Expand Down
2 changes: 0 additions & 2 deletions tools/mtouch/mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ namespace Xamarin.Bundler
{
public partial class Driver {
internal const string NAME = "mtouch";
const string LOCAL_BUILD_DIR = "_ios-build";
const string FRAMEWORK_LOCATION_VARIABLE = "MD_MTOUCH_SDK_ROOT";

public static void ShowHelp (OptionSet os)
{
Expand Down

0 comments on commit 916e79b

Please sign in to comment.