Merge pull request #1506 from rolfbjarne/mtouch-single-invocation
[mtouch] Build extensions and the container app in the same mtouch process.
This commit is contained in:
Коммит
3a480b53bf
|
@ -365,6 +365,10 @@ A last-straw solution would be to use a different version of Xamarin.iOS, one th
|
|||
|
||||
<h3><a name="MT0096"/>MT0096: No reference to Xamarin.iOS.dll was found.</h3>
|
||||
|
||||
<h3><a name="MT0099"/>Internal error *. Please file a bug report with a test case (http://bugzilla.xamarin.com).</h3>
|
||||
|
||||
This indicates a bug in Xamarin.iOS; please file a bug report at [http://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=iOS) with a test case.
|
||||
|
||||
# MT1xxx: Project related error messages
|
||||
|
||||
### MT10xx: Installer / mtouch
|
||||
|
|
|
@ -208,6 +208,17 @@ namespace Xamarin
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0008 ()
|
||||
{
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryAppDirectory ();
|
||||
mtouch.CustomArguments = new string [] { "foo.exe", "bar.exe" };
|
||||
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
|
||||
mtouch.AssertError (8, "You should provide one root assembly only, found 2 assemblies: 'foo.exe', 'bar.exe'");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0015 ()
|
||||
{
|
||||
|
@ -216,6 +227,28 @@ namespace Xamarin
|
|||
"error MT0015: Invalid ABI: invalid-arm. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64 and arm64+llvm.\n");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0017 ()
|
||||
{
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CreateTemporaryAppDirectory ();
|
||||
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
|
||||
mtouch.AssertError (17, "You should provide a root assembly.");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MT0018 ()
|
||||
{
|
||||
using (var mtouch = new MTouchTool ()) {
|
||||
mtouch.CustomArguments = new string [] { "--unknown", "-unknown" };
|
||||
mtouch.CreateTemporaryAppDirectory ();
|
||||
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
|
||||
mtouch.AssertError (18, "Unknown command line argument: '-unknown'");
|
||||
mtouch.AssertError (18, "Unknown command line argument: '--unknown'");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase (Profile.iOS, Profile.tvOS)]
|
||||
[TestCase (Profile.iOS, Profile.watchOS)]
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Xamarin
|
|||
public Profile Profile = Profile.iOS;
|
||||
public bool NoPlatformAssemblyReference;
|
||||
static XmlDocument device_list_cache;
|
||||
|
||||
public string [] CustomArguments; // Sometimes you want to pass invalid arguments to mtouch, in this case this array is used. No processing will be done, if quotes are required, they must be added to the arguments in the array.
|
||||
|
||||
public class DeviceInfo
|
||||
{
|
||||
|
@ -310,6 +310,12 @@ namespace Xamarin
|
|||
if (!string.IsNullOrEmpty (Device))
|
||||
sb.Append (" --device:").Append (MTouch.Quote (Device));
|
||||
|
||||
if (CustomArguments != null) {
|
||||
foreach (var arg in CustomArguments) {
|
||||
sb.Append (" ").Append (arg);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Xamarin.Bundler {
|
|||
// MM0089 ** Reserved mtouch **
|
||||
// MM0097 machine.config file '{0}' can not be found.
|
||||
// MM0098 AOT compilation is only available on Unified
|
||||
// MM0099 Internal error {0}. Please file a bug report with a test case (http://bugzilla.xamarin.com).
|
||||
// MM1xxx file copy / symlinks (project related)
|
||||
// MM14xx Product assemblies
|
||||
// MM1401 The required '{0}' assembly is missing from the references
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace Xamarin.Bundler {
|
|||
|
||||
public bool IsExtension;
|
||||
public List<string> Extensions = new List<string> (); // A list of the extensions this app contains.
|
||||
public List<Application> AppExtensions = new List<Application> ();
|
||||
|
||||
public bool FastDev;
|
||||
|
||||
|
@ -590,6 +591,26 @@ namespace Xamarin.Bundler {
|
|||
|
||||
void Initialize ()
|
||||
{
|
||||
if (EnableDebug && IsLLVM)
|
||||
ErrorHelper.Warning (3003, "Debugging is not supported when building with LLVM. Debugging has been disabled.");
|
||||
|
||||
if (!IsLLVM && (EnableAsmOnlyBitCode || EnableLLVMOnlyBitCode))
|
||||
throw ErrorHelper.CreateError (3008, "Bitcode support requires the use of LLVM (--abi=arm64+llvm etc.)");
|
||||
|
||||
if (EnableDebug) {
|
||||
if (!DebugTrack.HasValue) {
|
||||
DebugTrack = IsSimulatorBuild;
|
||||
}
|
||||
} else {
|
||||
if (DebugTrack.HasValue) {
|
||||
ErrorHelper.Warning (32, "The option '--debugtrack' is ignored unless '--debug' is also specified.");
|
||||
}
|
||||
DebugTrack = false;
|
||||
}
|
||||
|
||||
if (EnableAsmOnlyBitCode)
|
||||
LLVMAsmWriter = true;
|
||||
|
||||
if (!File.Exists (RootAssembly))
|
||||
throw new MonoTouchException (7, true, "The root assembly '{0}' does not exist", RootAssembly);
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ namespace Xamarin.Bundler {
|
|||
// MT0096 No reference to Xamarin.iOS.dll was found.
|
||||
// MT0097 <used by mmp>
|
||||
// MT0098 <used by mmp>
|
||||
// MT0099 Internal error {0}. Please file a bug report with a test case (http://bugzilla.xamarin.com).
|
||||
// MT1xxx file copy / symlinks (project related)
|
||||
// MT10xx installer.cs / mtouch.cs
|
||||
// MT1001 Could not find an application at the specified directory: {0}
|
||||
|
|
|
@ -113,8 +113,6 @@ namespace Xamarin.Bundler
|
|||
LaunchWatchApp,
|
||||
}
|
||||
|
||||
static Action action;
|
||||
|
||||
static bool xcode_version_check = true;
|
||||
|
||||
//
|
||||
|
@ -332,7 +330,7 @@ namespace Xamarin.Bundler
|
|||
return output.ToString ().Trim ();
|
||||
}
|
||||
|
||||
static void ValidateXcode ()
|
||||
static void ValidateXcode (Action action)
|
||||
{
|
||||
// Allow a few actions, since these seem to always work no matter the Xcode version.
|
||||
var accept_any_xcode_version = action == Action.ListDevices || action == Action.ListCrashReports || action == Action.ListApps || action == Action.LogDev;
|
||||
|
@ -960,31 +958,9 @@ namespace Xamarin.Bundler
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetAction (Action value)
|
||||
{
|
||||
switch (action) {
|
||||
case Action.None:
|
||||
action = value;
|
||||
break;
|
||||
case Action.KillApp:
|
||||
if (value == Action.LaunchDevice) {
|
||||
action = Action.KillAndLaunch;
|
||||
break;
|
||||
}
|
||||
goto default;
|
||||
case Action.LaunchDevice:
|
||||
if (value == Action.KillApp) {
|
||||
action = Action.KillAndLaunch;
|
||||
break;
|
||||
}
|
||||
goto default;
|
||||
default:
|
||||
throw new MonoTouchException (19, true, "Only one --[log|install|kill|launch]dev or --[launch|debug|list]sim option can be used.");
|
||||
}
|
||||
}
|
||||
|
||||
static int Main2 (string [] args)
|
||||
static Application ParseArguments (string [] args, out Action a)
|
||||
{
|
||||
var action = Action.None;
|
||||
var app = new Application ();
|
||||
var assemblies = new List<string> ();
|
||||
|
||||
|
@ -998,6 +974,29 @@ namespace Xamarin.Bundler
|
|||
string tls_provider = null;
|
||||
string http_message_handler = null;
|
||||
|
||||
Action<Action> SetAction = (Action value) =>
|
||||
{
|
||||
switch (action) {
|
||||
case Action.None:
|
||||
action = value;
|
||||
break;
|
||||
case Action.KillApp:
|
||||
if (value == Action.LaunchDevice) {
|
||||
action = Action.KillAndLaunch;
|
||||
break;
|
||||
}
|
||||
goto default;
|
||||
case Action.LaunchDevice:
|
||||
if (value == Action.KillApp) {
|
||||
action = Action.KillAndLaunch;
|
||||
break;
|
||||
}
|
||||
goto default;
|
||||
default:
|
||||
throw new MonoTouchException (19, true, "Only one --[log|install|kill|launch]dev or --[launch|debug|list]sim option can be used.");
|
||||
}
|
||||
};
|
||||
|
||||
var os = new OptionSet () {
|
||||
{ "h|?|help", "Displays the help", v => SetAction (Action.Help) },
|
||||
{ "version", "Output version information and exit.", v => SetAction (Action.Version) },
|
||||
|
@ -1272,48 +1271,61 @@ namespace Xamarin.Bundler
|
|||
throw new MonoTouchException (10, true, e, "Could not parse the command line arguments: {0}", e);
|
||||
}
|
||||
|
||||
if (watch_level > 0) {
|
||||
watch = new Stopwatch ();
|
||||
watch.Start ();
|
||||
}
|
||||
a = action;
|
||||
|
||||
if (action == Action.Help) {
|
||||
ShowHelp (os);
|
||||
return 0;
|
||||
return null;
|
||||
} else if (action == Action.Version) {
|
||||
Console.Write ("mtouch {0}.{1}", Constants.Version, Constants.Revision);
|
||||
Console.WriteLine ();
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
app.SetDefaultFramework ();
|
||||
app.SetDefaultAbi ();
|
||||
|
||||
if (app.EnableDebug && app.IsLLVM)
|
||||
ErrorHelper.Warning (3003, "Debugging is not supported when building with LLVM. Debugging has been disabled.");
|
||||
app.RuntimeOptions = RuntimeOptions.Create (app, http_message_handler, tls_provider);
|
||||
|
||||
if (!app.IsLLVM && (app.EnableAsmOnlyBitCode || app.EnableLLVMOnlyBitCode))
|
||||
ErrorHelper.Error (3008, "Bitcode support requires the use of LLVM (--abi=arm64+llvm etc.)");
|
||||
if (action == Action.Build || action == Action.RunRegistrar) {
|
||||
if (assemblies.Count != 1) {
|
||||
var exceptions = new List<Exception> ();
|
||||
for (int i = assemblies.Count - 1; i >= 0; i--) {
|
||||
if (assemblies [i].StartsWith ("-", StringComparison.Ordinal)) {
|
||||
exceptions.Add (new MonoTouchException (18, true, "Unknown command line argument: '{0}'", assemblies [i]));
|
||||
assemblies.RemoveAt (i);
|
||||
}
|
||||
}
|
||||
if (assemblies.Count > 1) {
|
||||
exceptions.Add (new MonoTouchException (8, true, "You should provide one root assembly only, found {0} assemblies: '{1}'", assemblies.Count, string.Join ("', '", assemblies.ToArray ())));
|
||||
} else if (assemblies.Count == 0) {
|
||||
exceptions.Add (new MonoTouchException (17, true, "You should provide a root assembly."));
|
||||
}
|
||||
|
||||
if (app.EnableDebug) {
|
||||
if (!app.DebugTrack.HasValue) {
|
||||
app.DebugTrack = app.IsSimulatorBuild;
|
||||
throw new AggregateException (exceptions);
|
||||
}
|
||||
} else {
|
||||
if (app.DebugTrack.HasValue) {
|
||||
ErrorHelper.Warning (32, "The option '--debugtrack' is ignored unless '--debug' is also specified.");
|
||||
}
|
||||
app.DebugTrack = false;
|
||||
app.RootAssembly = assemblies [0];
|
||||
}
|
||||
|
||||
if (app.EnableAsmOnlyBitCode)
|
||||
app.LLVMAsmWriter = true;
|
||||
return app;
|
||||
}
|
||||
|
||||
static int Main2 (string[] args)
|
||||
{
|
||||
Action action;
|
||||
var app = ParseArguments (args, out action);
|
||||
|
||||
if (app == null)
|
||||
return 0;
|
||||
|
||||
if (watch_level > 0) {
|
||||
watch = new Stopwatch ();
|
||||
watch.Start ();
|
||||
}
|
||||
|
||||
ErrorHelper.Verbosity = verbose;
|
||||
|
||||
app.RuntimeOptions = RuntimeOptions.Create (app, http_message_handler, tls_provider);
|
||||
|
||||
ValidateXcode ();
|
||||
ValidateXcode (action);
|
||||
|
||||
switch (action) {
|
||||
/* Device actions */
|
||||
|
@ -1374,23 +1386,6 @@ namespace Xamarin.Bundler
|
|||
if (!Directory.Exists (app.AppDirectory))
|
||||
Directory.CreateDirectory (app.AppDirectory);
|
||||
|
||||
if (assemblies.Count != 1) {
|
||||
var exceptions = new List<Exception> ();
|
||||
for (int i = assemblies.Count - 1; i >= 0; i--) {
|
||||
if (assemblies [i].StartsWith ("-", StringComparison.Ordinal)) {
|
||||
exceptions.Add (new MonoTouchException (18, true, "Unknown command line argument: '{0}'", assemblies [i]));
|
||||
assemblies.RemoveAt (i);
|
||||
}
|
||||
}
|
||||
if (assemblies.Count > 1) {
|
||||
exceptions.Add (new MonoTouchException (8, true, "You should provide one root assembly only, found {0} assemblies: '{1}'", assemblies.Count, string.Join ("', '", assemblies.ToArray ())));
|
||||
} else if (assemblies.Count == 0) {
|
||||
exceptions.Add (new MonoTouchException (17, true, "You should provide a root assembly."));
|
||||
}
|
||||
|
||||
throw new AggregateException (exceptions);
|
||||
}
|
||||
|
||||
if (app.EnableRepl && app.BuildTarget != BuildTarget.Simulator)
|
||||
throw new MonoTouchException (29, true, "REPL (--enable-repl) is only supported in the simulator (--sim)");
|
||||
|
||||
|
@ -1402,11 +1397,36 @@ namespace Xamarin.Bundler
|
|||
|
||||
Watch ("Setup", 1);
|
||||
|
||||
app.RootAssembly = assemblies [0];
|
||||
if (action == Action.RunRegistrar) {
|
||||
app.RunRegistrar ();
|
||||
} else if (action == Action.Build) {
|
||||
if (app.IsExtension && !app.IsWatchExtension) {
|
||||
var sb = new StringBuilder ();
|
||||
foreach (var arg in args)
|
||||
sb.AppendLine (arg);
|
||||
File.WriteAllText (Path.Combine (Path.GetDirectoryName (app.AppDirectory), "build-arguments.txt"), sb.ToString ());
|
||||
} else {
|
||||
foreach (var appex in app.Extensions) {
|
||||
var f_path = Path.Combine (appex, "..", "build-arguments.txt");
|
||||
if (!File.Exists (f_path))
|
||||
continue;
|
||||
Action app_action;
|
||||
app.AppExtensions.Add (ParseArguments (File.ReadAllLines (f_path), out app_action));
|
||||
if (app_action != Action.Build)
|
||||
throw ErrorHelper.CreateError (99, "Internal error: Extension build action is '{0}' when it should be 'Build'. Please file a bug report with a test case (http://bugzilla.xamarin.com).", app_action);
|
||||
}
|
||||
|
||||
foreach (var appex in app.AppExtensions) {
|
||||
Log ("Building {0}...", appex.BundleId);
|
||||
appex.Build ();
|
||||
}
|
||||
|
||||
if (app.AppExtensions.Count > 0)
|
||||
Log ("Building {0}...", app.BundleId);
|
||||
app.Build ();
|
||||
}
|
||||
} else {
|
||||
app.Build ();
|
||||
throw ErrorHelper.CreateError (99, "Internal error: Invalid action: {0}. Please file a bug report with a test case (http://bugzilla.xamarin.com).", action);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче