Skip to content

Commit

Permalink
[MMP] Allow resolving assemblies to the ones passed in command line a…
Browse files Browse the repository at this point in the history
…rgs (#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)

https://github.com/xamarin/xamarin-macios/blob/3113c5d2b5cca730372177e9b1cee17062a959ff/tools/mmp/driver.cs#L513
  • Loading branch information
Therzok authored and chamons committed Mar 2, 2018
1 parent f3055dd commit d4d542d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
4 changes: 2 additions & 2 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ public void RunRegistrar ()
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) {
Expand Down
8 changes: 4 additions & 4 deletions tools/common/CoreResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ public virtual AssemblyDefinition Load (string fileName)
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));
Expand Down
5 changes: 0 additions & 5 deletions tools/mmp/driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public static partial class Driver {
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;
Expand Down Expand Up @@ -312,10 +311,6 @@ static void Main2 (string [] args)
}
}
},
{ "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 {
Expand Down
8 changes: 0 additions & 8 deletions tools/mmp/resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public partial class MonoMacResolver : CoreResolver {
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> ();

Expand Down Expand Up @@ -87,12 +85,6 @@ public override AssemblyDefinition Resolve (AssemblyNameReference reference, Rea
if (assembly != null)
return assembly;

foreach (var directory in RecursiveSearchDirectories) {
assembly = SearchDirectory (name, directory, recursive: true);
if (assembly != null)
return assembly;
}

return null;
}
}
Expand Down

0 comments on commit d4d542d

Please sign in to comment.