[MMP] Allow resolving assemblies to the ones passed in command line args (#3575)

* [MMP] Revert recursive search dirs changes
* [MMP] Allow resolving assemblies to the ones passed in command line args

This is what actually makes the MonoMacResolver actually resolve to
assemblies given as arguments.

This mirrors the behaviour of Pack, which is called on the other
code-path (that's not --runregistrar)

3113c5d2b5/tools/mmp/driver.cs (L513)
This commit is contained in:
Marius Ungureanu 2018-03-02 20:59:25 +02:00 коммит произвёл Chris Hamons
Родитель f3055ddd6d
Коммит d4d542d051
4 изменённых файлов: 6 добавлений и 19 удалений

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

@ -526,10 +526,10 @@ namespace Xamarin.Bundler {
var resolver = new PlatformResolver () {
FrameworkDirectory = Driver.GetPlatformFrameworkDirectory (this),
RootDirectory = Path.GetDirectoryName (RootAssembly),
};
#if MMP
resolver.RecursiveSearchDirectories.AddRange (Driver.RecursiveSearchDirectories);
CommandLineAssemblies = RootAssemblies,
#endif
};
if (Platform == ApplePlatform.iOS || Platform == ApplePlatform.MacOSX) {
if (Is32Build) {

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

@ -102,17 +102,17 @@ namespace Xamarin.Bundler {
return assembly;
}
protected AssemblyDefinition SearchDirectory (string name, string directory, string extension = ".dll", bool recursive = false)
protected AssemblyDefinition SearchDirectory (string name, string directory, string extension = ".dll")
{
var file = DirectoryGetFile (directory, name + extension, recursive);
var file = DirectoryGetFile (directory, name + extension);
if (file.Length > 0)
return Load (file);
return null;
}
static string DirectoryGetFile (string directory, string file, bool recursive)
static string DirectoryGetFile (string directory, string file)
{
var files = Directory.GetFiles (directory, file, recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
var files = Directory.GetFiles (directory, file);
if (files != null && files.Length > 0) {
if (files.Length > 1) {
ErrorHelper.Warning (133, "Found more than 1 assembly matching '{0}', choosing first:{1}{2}", file, Environment.NewLine, string.Join ("\n", files));

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

@ -83,7 +83,6 @@ namespace Xamarin.Bundler {
static string app_name;
static bool generate_plist;
public static RegistrarMode Registrar { get { return App.Registrar; } private set { App.Registrar = value; } }
public static List<string> RecursiveSearchDirectories { get; } = new List<string> ();
static bool no_executable;
static bool embed_mono = true;
static bool? profiling = false;
@ -312,10 +311,6 @@ namespace Xamarin.Bundler {
}
}
},
{ "recursive-directories:", "Specify extra recursive search directories to use when probing assemblies", v => {
RecursiveSearchDirectories.AddRange (v.Split (Path.PathSeparator));
}
},
{ "sdk=", "Specifies the SDK version to compile against (version, for example \"10.9\")",
v => {
try {

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

@ -31,8 +31,6 @@ namespace Xamarin.Bundler {
public static bool IsClassic { get { return Driver.IsClassic; } }
public static bool IsUnified { get { return Driver.IsUnified; } }
public List<string> RecursiveSearchDirectories { get; } = new List<string> ();
public List <string> CommandLineAssemblies { get; set; }
public List<Exception> Exceptions = new List<Exception> ();
@ -87,12 +85,6 @@ namespace Xamarin.Bundler {
if (assembly != null)
return assembly;
foreach (var directory in RecursiveSearchDirectories) {
assembly = SearchDirectory (name, directory, recursive: true);
if (assembly != null)
return assembly;
}
return null;
}
}