[dotnet-linker] Rework Application creation to happen earlier.
Refactor Application creation to happen earlier, and to split out the cache creation. This way we can create the Application instance before processing the configuration, and as we process any configuration we can set properties on the Application instance.
This commit is contained in:
Родитель
c0728c02cb
Коммит
1f326e82bb
|
@ -224,7 +224,16 @@ namespace Xamarin.Bundler {
|
|||
|
||||
public bool IsDualBuild { get { return Is32Build && Is64Build; } } // if we're building both a 32 and a 64 bit version.
|
||||
|
||||
public Application ()
|
||||
{
|
||||
}
|
||||
|
||||
public Application (string [] arguments)
|
||||
{
|
||||
CreateCache (arguments);
|
||||
}
|
||||
|
||||
public void CreateCache (string [] arguments)
|
||||
{
|
||||
Cache = new Cache (arguments);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace Xamarin.Bundler {
|
|||
public partial class Application {
|
||||
public LinkerConfiguration Configuration { get; private set; }
|
||||
|
||||
public Application (LinkerConfiguration configuration, string[] arguments)
|
||||
: this (arguments)
|
||||
public Application (LinkerConfiguration configuration)
|
||||
{
|
||||
this.Configuration = configuration;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,9 @@ namespace Xamarin.Linker {
|
|||
if (!File.Exists (linker_file))
|
||||
throw new FileNotFoundException ($"The custom linker file {linker_file} does not exist.");
|
||||
|
||||
Application = new Application (this);
|
||||
Target = new Target (Application);
|
||||
|
||||
var lines = File.ReadAllLines (linker_file);
|
||||
var significantLines = new List<string> (); // This is the input the cache uses to verify if the cache is still valid
|
||||
for (var i = 0; i < lines.Length; i++) {
|
||||
|
@ -145,9 +148,7 @@ namespace Xamarin.Linker {
|
|||
|
||||
ErrorHelper.Platform = Platform;
|
||||
|
||||
Application = new Application (this, significantLines.ToArray ());
|
||||
Target = new Target (Application);
|
||||
|
||||
Application.CreateCache (significantLines.ToArray ());
|
||||
Application.Cache.Location = CacheDirectory;
|
||||
Application.DeploymentTarget = DeploymentTarget;
|
||||
Application.SdkVersion = SdkVersion;
|
||||
|
|
Загрузка…
Ссылка в новой задаче