diff --git a/tools/install-source/InstallSourcesTests/MonoPathManglerTest.cs b/tools/install-source/InstallSourcesTests/MonoPathManglerTest.cs
index 8a178222ef..83cb3cc5cc 100644
--- a/tools/install-source/InstallSourcesTests/MonoPathManglerTest.cs
+++ b/tools/install-source/InstallSourcesTests/MonoPathManglerTest.cs
@@ -19,10 +19,11 @@ namespace InstallSourcesTests
monoPath = "/Users/test/xamarin-macios/external/mono/";
installDir = "/Users/test/xamarin-macios/_ios-build//Library/Frameworks/Xamarin.iOS.framework/Versions/git";
destinationDir = "/Users/test/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git";
- mangler = new MonoPathMangler {
+ mangler = new MonoPathMangler {
InstallDir = installDir,
MonoSourcePath = monoPath,
DestinationDir = destinationDir,
+ XamarinSourcePath = "/Users/test/xamarin-macios/src",
};
}
diff --git a/tools/install-source/MonoPathMangler.cs b/tools/install-source/MonoPathMangler.cs
index d22f4a5601..262df31e0e 100644
--- a/tools/install-source/MonoPathMangler.cs
+++ b/tools/install-source/MonoPathMangler.cs
@@ -7,6 +7,9 @@ namespace InstallSources
{
public static readonly string iOSFramework = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/";
public static readonly string MacFramework = "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/";
+ string monoSubmodulePath;
+ string xamarinSourcePath;
+
///
/// Gets and sets the location of the mono sources.
///
@@ -19,12 +22,29 @@ namespace InstallSources
/// The frame work dir.
public string DestinationDir { get; set; }
+ ///
+ /// Gets and sets the path to the xamarin source.
+ ///
+ /// The xamarin source path.
+ public string XamarinSourcePath {
+ get {
+ return xamarinSourcePath;
+ }
+ set {
+ xamarinSourcePath = value;
+ monoSubmodulePath = Path.Combine (value.Replace ("src/", ""), "external", "mono") + "/";
+ }
+ }
+
///
/// Gets or sets the install dir.
///
/// The install dir.
public string InstallDir { get; set; }
+ bool IsCheckout (string path)
+ => path.StartsWith (monoSubmodulePath, StringComparison.Ordinal);
+
public string GetSourcePath (string path)
{
// we are dealing with a Mono archive assembly
@@ -40,7 +60,7 @@ namespace InstallSources
public string GetTargetPath (string path)
{
- var relativePath = path.Substring (MonoSourcePath.Length);
+ var relativePath = path.Substring (IsCheckout (path) ? monoSubmodulePath.Length : MonoSourcePath.Length);
if (relativePath.StartsWith ("/", StringComparison.Ordinal))
relativePath = relativePath.Remove (0, 1);
var target = Path.Combine (DestinationDir, "src", (InstallDir.Contains("Xamarin.iOS")?"Xamarin.iOS":"Xamarin.Mac"), relativePath);
diff --git a/tools/install-source/PathManglerFactory.cs b/tools/install-source/PathManglerFactory.cs
index c0cc5f2004..e03447b125 100644
--- a/tools/install-source/PathManglerFactory.cs
+++ b/tools/install-source/PathManglerFactory.cs
@@ -28,7 +28,8 @@ namespace InstallSources
monoMangler = new MonoPathMangler {
InstallDir = InstallDir,
DestinationDir = DestinationDir,
- MonoSourcePath = MonoSourcePath
+ MonoSourcePath = MonoSourcePath,
+ XamarinSourcePath = XamarinSourcePath,
};
return monoMangler;
}