static bool custom_mode = true;
static string embedded_options = null;
static string runtime = null;
+ static bool aot_compile = false;
+ static string aot_args = "static";
static string sdk_path = null;
static string lib_path = null;
static Dictionary<string,string> environment = new Dictionary<string,string>();
return 1;
}
if (sdk_path != null || runtime != null)
- Error ("You can not specify one of --runtime, --sdk or --cross");
+ Error ("You can only specify one of --runtime, --sdk or --cross");
custom_mode = false;
autodeps = true;
cross_target = args [++i];
autodeps = true;
sdk_path = args [++i];
if (cross_target != null || runtime != null)
- Error ("You can not specify one of --runtime, --sdk or --cross");
+ Error ("You can only specify one of --runtime, --sdk or --cross");
break;
case "--runtime":
if (i+1 == top){
case "--bundled-header":
bundled_header = true;
break;
+ case "--aot-compile":
+ aot_compile = true;
+ break;
+ case "--aot-args":
+ if (i+1 == top) {
+ Console.WriteLine ("AOT arguments are passed as a comma-delimited list");
+ return 1;
+ }
+ aot_args = String.Format("static,{0}", args [++i]);
+ break;
default:
sources.Add (args [i]);
break;
}
-
}
// Modern bundling starts here
if (!custom_mode){
foreach (string file in assemblies)
if (!QueueAssembly (files, file))
return 1;
+ if (aot_compile)
+ AotCompile (files);
if (custom_mode)
GenerateBundles (files);
else
Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
fileStream.CopyTo (package);
package.Position = package.Position + (align - (package.Position % align));
-
return (int) ret;
}
}
}
}
+ if (aot_compile) {
+ // Read in static AOT file
+ }
+
if (config_file != null){
FileStream conf;
try {
}
if (error != null) {
+ Console.Error.WriteLine ("Failure to load i18n assemblies, the following directories were searched for the assemblies:");
+ foreach (var path in link_paths){
+ Console.Error.WriteLine (" Path: " + path);
+ }
+ if (custom_mode){
+ Console.WriteLine ("In Custom mode, you need to provide the directory to lookup assemblies from using -L");
+ }
+
Error ("Couldn't load one or more of the i18n assemblies: " + error);
Environment.Exit (1);
}
static readonly Universe universe = new Universe ();
static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
- static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}";
public static string GetAssemblyName (string path)
{
+ string resourcePathSeparator = style == "windows" ? "\\\\" : "/";
string name = Path.GetFileName (path);
// A bit of a hack to support satellite assemblies. They all share the same name but
return true;
try {
Assembly a = universe.LoadFile (path);
+ if (a == null) {
+ Error ("Unable to to load assembly `{0}'", path);
+ return false;
+ }
foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
a = LoadAssembly (an.Name);
+ if (a == null) {
+ Error ("Unable to load assembly `{0}' referenced by `{1}'", an.Name, path);
+ return false;
+ }
+
if (!QueueAssembly (files, a.CodeBase))
return false;
}
Assembly a = null;
try {
+ if (!quiet)
+ Console.WriteLine ("Attempting to load assembly: {0}", assembly);
a = universe.LoadFile (assembly);
+ if (!quiet)
+ Console.WriteLine ("Assembly {0} loaded successfully.", assembly);
+
} catch (FileNotFoundException){
Error ($"Cannot find assembly `{assembly}'");
} catch (IKVM.Reflection.BadImageFormatException f) {
string total_log = "";
foreach (string dir in link_paths){
string full_path = Path.Combine (dir, assembly);
+ if (!quiet)
+ Console.WriteLine ("Attempting to load assembly from: " + full_path);
if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
full_path += ".dll";
}
}
+ static void AotCompile (List<string> files)
+ {
+ foreach (var fileName in files) {
+ string path = LocateFile (new Uri (fileName).LocalPath);
+ Execute (String.Format ("{0} --aot={1} {2}", runtime, aot_args, path));
+ }
+ }
+
static void Execute (string cmdLine)
{
if (IsUnix) {