[d16-5] [Packaging] Ensure that when we build from source, the srcs go to the correct place. (#7408)

* [Packaging] Ensure that when we build from source, the srcs go to the correct plance.

When building from source, the install-sources command was not moving
the files correctly. This change makes sure that, if we build from
source, we do add the mono sources in the correct location.

Fixes: https://github.com/xamarin/xamarin-macios/issues/7393
This commit is contained in:
monojenkins 2019-11-12 15:05:17 +01:00 коммит произвёл Manuel de la Pena
Родитель bde12ca5d4
Коммит 28a560c8b3
3 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -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",
};
}

Просмотреть файл

@ -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;
/// <summary>
/// Gets and sets the location of the mono sources.
/// </summary>
@ -19,12 +22,29 @@ namespace InstallSources
/// <value>The frame work dir.</value>
public string DestinationDir { get; set; }
/// <summary>
/// Gets and sets the path to the xamarin source.
/// </summary>
/// <value>The xamarin source path.</value>
public string XamarinSourcePath {
get {
return xamarinSourcePath;
}
set {
xamarinSourcePath = value;
monoSubmodulePath = Path.Combine (value.Replace ("src/", ""), "external", "mono") + "/";
}
}
/// <summary>
/// Gets or sets the install dir.
/// </summary>
/// <value>The install dir.</value>
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);

Просмотреть файл

@ -28,7 +28,8 @@ namespace InstallSources
monoMangler = new MonoPathMangler {
InstallDir = InstallDir,
DestinationDir = DestinationDir,
MonoSourcePath = MonoSourcePath
MonoSourcePath = MonoSourcePath,
XamarinSourcePath = XamarinSourcePath,
};
return monoMangler;
}