Skip to content

Commit f057d5a

Browse files
committed
Use the new RegisterTaskObject API [WIP]
1 parent 8c24b8f commit f057d5a

16 files changed

Lines changed: 34 additions & 34 deletions

src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class Aapt : AndroidAsyncTask
9494
AssemblyIdentityMap assemblyMap = new AssemblyIdentityMap ();
9595
string resourceDirectory;
9696

97-
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4);
97+
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4, ProjectSpecificTaskObjectKey);
9898

9999
bool ManifestIsUpToDate (string manifestFile)
100100
{

src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class Aapt2 : AndroidAsyncTask {
2525
private static readonly int DefaultMaxAapt2Daemons = 6;
2626
protected Dictionary<string, string> _resource_name_case_map;
2727

28-
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4);
28+
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4, ProjectSpecificTaskObjectKey);
2929

3030
protected virtual int ProcessorCount => Environment.ProcessorCount;
3131

src/Xamarin.Android.Build.Tasks/Tasks/AndroidComputeResPaths.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
//
1+
//
22
// AndroidUpdateResDir.cs
3-
//
3+
//
44
// Author:
55
// Michael Hutchinson <mhutchinson@novell.com>
6-
//
6+
//
77
// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
8-
//
8+
//
99
// Permission is hereby granted, free of charge, to any person obtaining a copy
1010
// of this software and associated documentation files (the "Software"), to deal
1111
// in the Software without restriction, including without limitation the rights
1212
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1313
// copies of the Software, and to permit persons to whom the Software is
1414
// furnished to do so, subject to the following conditions:
15-
//
15+
//
1616
// The above copyright notice and this permission notice shall be included in
1717
// all copies or substantial portions of the Software.
18-
//
18+
//
1919
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2020
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2121
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -41,18 +41,18 @@ public class AndroidComputeResPaths : AndroidTask
4141

4242
[Required]
4343
public ITaskItem[] ResourceFiles { get; set; }
44-
44+
4545
[Required]
4646
public string IntermediateDir { get; set; }
47-
47+
4848
public string Prefixes { get; set; }
4949

5050
public bool LowercaseFilenames { get; set; }
5151

5252
public string ProjectDir { get; set; }
5353

5454
public string AndroidLibraryFlatFilesDirectory { get; set; }
55-
55+
5656
[Output]
5757
public ITaskItem[] IntermediateFiles { get; set; }
5858

@@ -63,7 +63,7 @@ public override bool RunTask ()
6363
{
6464
var intermediateFiles = new List<ITaskItem> (ResourceFiles.Length);
6565
var resolvedFiles = new List<ITaskItem> (ResourceFiles.Length);
66-
66+
6767
string[] prefixes = Prefixes != null ? Prefixes.Split (';') : null;
6868
if (prefixes != null) {
6969
for (int i = 0; i < prefixes.Length; i++) {
@@ -145,7 +145,7 @@ public override bool RunTask ()
145145

146146
IntermediateFiles = intermediateFiles.ToArray ();
147147
ResolvedResourceFiles = resolvedFiles.ToArray ();
148-
MonoAndroidHelper.SaveResourceCaseMap (BuildEngine4, nameCaseMap);
148+
MonoAndroidHelper.SaveResourceCaseMap (BuildEngine4, nameCaseMap, ProjectSpecificTaskObjectKey);
149149
return !Log.HasLoggedErrors;
150150
}
151151
}

src/Xamarin.Android.Build.Tasks/Tasks/CalculateLayoutCodeBehind.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ string RegisterGroupWidgets (ICollection<LayoutWidget> widgets)
527527
{
528528
string key = Guid.NewGuid ().ToString ();
529529
LogDebugMessage ($"Registering {widgets?.Count} widgets for key {key}");
530-
BuildEngine4.RegisterTaskObjectAssemblyLocal (key, widgets, RegisteredTaskObjectLifetime.Build, allowEarlyCollection: false);
530+
BuildEngine4.RegisterTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (key), widgets, RegisteredTaskObjectLifetime.Build, allowEarlyCollection: false);
531531
return key;
532532
}
533533

src/Xamarin.Android.Build.Tasks/Tasks/ConvertCustomView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public class ConvertCustomView : AndroidTask {
2727
public ITaskItem [] Processed { get; set; }
2828

2929
Dictionary<string, string> _resource_name_case_map;
30-
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4);
30+
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4, ProjectSpecificTaskObjectKey);
3131

3232
public override bool RunTask ()
3333
{
34-
var acw_map = MonoAndroidHelper.LoadMapFile (BuildEngine4, AcwMapFile, StringComparer.Ordinal);
34+
var acw_map = MonoAndroidHelper.LoadMapFile (BuildEngine4, Path.GetFullPath (AcwMapFile), StringComparer.Ordinal);
3535
var customViewMap = MonoAndroidHelper.LoadCustomViewMapFile (BuildEngine4, CustomViewMapFile);
3636
var processed = new HashSet<string> ();
3737

src/Xamarin.Android.Build.Tasks/Tasks/ConvertResourcesCases.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ConvertResourcesCases : AndroidTask
2727
Dictionary<string,string> _resource_name_case_map;
2828
Dictionary<string, HashSet<string>> customViewMap;
2929

30-
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4);
30+
Dictionary<string, string> resource_name_case_map => _resource_name_case_map ??= MonoAndroidHelper.LoadResourceCaseMap (BuildEngine4, ProjectSpecificTaskObjectKey);
3131

3232
public override bool RunTask ()
3333
{
@@ -73,7 +73,7 @@ void FixupResources (ITaskItem item)
7373
lastUpdate = File.GetLastWriteTimeUtc (AndroidConversionFlagFile);
7474
}
7575
Log.LogDebugMessage (" AndroidConversionFlagFile modified: {0}", lastUpdate);
76-
76+
7777
var resourcedirectories = new List<string> ();
7878
foreach (var dir in ResourceDirectories) {
7979
if (dir == item)

src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ bool CreateJavaSources (IEnumerable<TypeDefinition> javaTypes, TypeDefinitionCac
521521
}
522522

523523
if (useMarshalMethods) {
524-
BuildEngine4.RegisterTaskObjectAssemblyLocal (MarshalMethodsRegisterTaskKey, new MarshalMethodsState (classifier.MarshalMethods), RegisteredTaskObjectLifetime.Build);
524+
BuildEngine4.RegisterTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (MarshalMethodsRegisterTaskKey), new MarshalMethodsState (classifier.MarshalMethods), RegisteredTaskObjectLifetime.Build);
525525
}
526526

527527
return ok;
@@ -575,7 +575,7 @@ void WriteTypeMappings (List<TypeDefinition> types, TypeDefinitionCache cache)
575575
if (!tmg.Generate (Debug, SkipJniAddNativeMethodRegistrationAttributeScan, types, cache, TypemapOutputDirectory, GenerateNativeAssembly, out ApplicationConfigTaskState appConfState))
576576
throw new XamarinAndroidException (4308, Properties.Resources.XA4308);
577577
GeneratedBinaryTypeMaps = tmg.GeneratedBinaryTypeMaps.ToArray ();
578-
BuildEngine4.RegisterTaskObjectAssemblyLocal (ApplicationConfigTaskState.RegisterTaskObjectKey, appConfState, RegisteredTaskObjectLifetime.Build);
578+
BuildEngine4.RegisterTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (ApplicationConfigTaskState.RegisterTaskObjectKey), appConfState, RegisteredTaskObjectLifetime.Build);
579579
}
580580
}
581581
}

src/Xamarin.Android.Build.Tasks/Tasks/GenerateJniRemappingNativeCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void Generate (JniRemappingAssemblyGenerator jniRemappingGenerator, int typeRepl
9393
}
9494

9595
BuildEngine4.RegisterTaskObjectAssemblyLocal (
96-
JniRemappingNativeCodeInfoKey,
96+
ProjectSpecificTaskObjectKey (JniRemappingNativeCodeInfoKey),
9797
new JniRemappingNativeCodeInfo (typeReplacementsCount, jniRemappingGenerator.ReplacementMethodIndexEntryCount),
9898
RegisteredTaskObjectLifetime.Build
9999
);

src/Xamarin.Android.Build.Tasks/Tasks/GenerateLayoutBindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void GenerateSourceForLayoutGroup (BindingGenerator generator, LayoutGroup group
209209
if (!GetRequiredMetadata (item, CalculateLayoutCodeBehind.WidgetCollectionKeyMetadata, out collectionKey))
210210
return;
211211

212-
ICollection<LayoutWidget> widgets = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<ICollection<LayoutWidget>> (collectionKey, RegisteredTaskObjectLifetime.Build);
212+
ICollection<LayoutWidget> widgets = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<ICollection<LayoutWidget>> (ProjectSpecificTaskObjectKey (collectionKey), RegisteredTaskObjectLifetime.Build);
213213
if ((widgets?.Count ?? 0) == 0) {
214214
string inputPaths = String.Join ("; ", resourceItems.Select (i => i.ItemSpec));
215215
LogCodedWarning ("XA4222", Properties.Resources.XA4222, inputPaths);

src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ void AddEnvironment ()
370370
}
371371

372372
bool haveRuntimeConfigBlob = !String.IsNullOrEmpty (RuntimeConfigBinFilePath) && File.Exists (RuntimeConfigBinFilePath);
373-
var appConfState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<ApplicationConfigTaskState> (ApplicationConfigTaskState.RegisterTaskObjectKey, RegisteredTaskObjectLifetime.Build);
374-
var jniRemappingNativeCodeInfo = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfo> (GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfoKey, RegisteredTaskObjectLifetime.Build);
373+
var appConfState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<ApplicationConfigTaskState> (ProjectSpecificTaskObjectKey (ApplicationConfigTaskState.RegisterTaskObjectKey), RegisteredTaskObjectLifetime.Build);
374+
var jniRemappingNativeCodeInfo = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfo> (ProjectSpecificTaskObjectKey (GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfoKey), RegisteredTaskObjectLifetime.Build);
375375
var appConfigAsmGen = new ApplicationConfigNativeAssemblyGenerator (environmentVariables, systemProperties, Log) {
376376
IsBundledApp = IsBundledApplication,
377377
UsesMonoAOT = usesMonoAOT,
@@ -404,7 +404,7 @@ void AddEnvironment ()
404404
};
405405
appConfigAsmGen.Init ();
406406

407-
var marshalMethodsState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<MarshalMethodsState> (GenerateJavaStubs.MarshalMethodsRegisterTaskKey, RegisteredTaskObjectLifetime.Build);
407+
var marshalMethodsState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<MarshalMethodsState> (ProjectSpecificTaskObjectKey (GenerateJavaStubs.MarshalMethodsRegisterTaskKey), RegisteredTaskObjectLifetime.Build);
408408
MarshalMethodsNativeAssemblyGenerator marshalMethodsAsmGen;
409409

410410
if (enableMarshalMethods) {

0 commit comments

Comments
 (0)