This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] moved Xamarin.Android path logic to XamarinAndroid.cs
- `FindDirectory` goes to `Helpers` - Paths for Xamarin.Android go to `XamarinAndroid` - Added a couple of smoke tests for `XamarinAndroid` - Removed `RefreshAndroidSdk` in favor of static ctor on `XamarinAndroid`
- Loading branch information
1 parent
f6641f2
commit 735629b
Showing
10 changed files
with
177 additions
and
102 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
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,80 @@ | ||
using System; | ||
using System.IO; | ||
using CppSharp; | ||
using Xamarin.Android.Tools; | ||
using static System.IO.Path; | ||
|
||
namespace MonoEmbeddinator4000 | ||
{ | ||
/// <summary> | ||
/// Contains various path logic for Xamarin.Android | ||
/// </summary> | ||
static class XamarinAndroid | ||
{ | ||
public const string TargetFrameworkVersion = "v2.3"; | ||
public const string MinSdkVersion = "9"; | ||
public const string TargetSdkVersion = "25"; | ||
|
||
static XamarinAndroid() | ||
{ | ||
AndroidLogger.Info += AndroidLogger_Info; | ||
AndroidLogger.Warning += AndroidLogger_Warning; | ||
AndroidLogger.Error += AndroidLogger_Error; | ||
|
||
AndroidSdk.Refresh(); | ||
} | ||
|
||
static void AndroidLogger_Info(string task, string message) | ||
{ | ||
Diagnostics.Debug(message); | ||
} | ||
|
||
static void AndroidLogger_Warning(string task, string message) | ||
{ | ||
Diagnostics.Warning(message); | ||
} | ||
|
||
static void AndroidLogger_Error(string task, string message) | ||
{ | ||
Diagnostics.Error(message); | ||
} | ||
|
||
static string GetMonoDroidPath() | ||
{ | ||
string external = Combine(Helpers.FindDirectory("external"), "Xamarin.Android"); | ||
if (Directory.Exists(external)) | ||
return external; | ||
|
||
string binPath = MonoDroidSdk.BinPath; | ||
|
||
//On Windows, it is generally correct, but probe for "lib" | ||
if (File.Exists(Combine(binPath, "lib"))) | ||
return GetFullPath(MonoDroidSdk.BinPath); | ||
|
||
//On Mac, it is up one directory from BinPath | ||
return GetFullPath(Combine(MonoDroidSdk.BinPath, "..")); | ||
} | ||
|
||
static string GetMonoDroidLibPath() | ||
{ | ||
var libPath = Combine(Path, "lib", "xbuild", "Xamarin", "Android", "lib"); | ||
if (!Directory.Exists(libPath)) | ||
libPath = Combine(Path, "lib"); | ||
return libPath; | ||
} | ||
|
||
static Lazy<string> path = new Lazy<string>(GetMonoDroidPath); | ||
|
||
public static string Path | ||
{ | ||
get { return path.Value; } | ||
} | ||
|
||
static Lazy<string> libraryPath = new Lazy<string>(GetMonoDroidLibPath); | ||
|
||
public static string LibraryPath | ||
{ | ||
get { return libraryPath.Value; } | ||
} | ||
} | ||
} |
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
Oops, something went wrong.