diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs index 108c7922d49..420a38a12fb 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs @@ -23,8 +23,6 @@ public class ResolveAssemblies : Task [Required] public string ReferenceAssembliesDirectory { get; set; } - public ITaskItem[] DesignTimeFacadeDirectories { get; set; } - public string I18nAssemblies { get; set; } public string LinkMode { get; set; } @@ -58,12 +56,11 @@ bool Execute (DirectoryAssemblyResolver resolver) Log.LogDebugMessage (" I18nAssemblies: {0}", I18nAssemblies); Log.LogDebugMessage (" LinkMode: {0}", LinkMode); Log.LogDebugTaskItems (" Assemblies:", Assemblies); - Log.LogDebugTaskItems (" DesignTimeFacadeDirectories:", DesignTimeFacadeDirectories); foreach (var dir in ReferenceAssembliesDirectory.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) resolver.SearchDirectories.Add (dir); - var assemblies = new HashSet (new ITaskItemEqualityComparer ()); + var assemblies = new HashSet (); var topAssemblyReferences = new List (); @@ -79,7 +76,7 @@ bool Execute (DirectoryAssemblyResolver resolver) if (assemblyDef == null) throw new InvalidOperationException ("Failed to load assembly " + assembly.ItemSpec); topAssemblyReferences.Add (assemblyDef); - assemblies.Add (new TaskItem (Path.GetFullPath (assemblyDef.MainModule.FullyQualifiedName))); + assemblies.Add (Path.GetFullPath (assemblyDef.MainModule.FullyQualifiedName)); } } catch (Exception ex) { Log.LogError ("Exception while loading assemblies: {0}", ex); @@ -96,8 +93,8 @@ bool Execute (DirectoryAssemblyResolver resolver) // Add I18N assemblies if needed AddI18nAssemblies (resolver, assemblies); - ResolvedAssemblies = assemblies.ToArray (); - ResolvedSymbols = assemblies.Select (a => new TaskItem (a + ".mdb")).Where (a => File.Exists (a.ItemSpec)).ToArray (); + ResolvedAssemblies = assemblies.Select (a => new TaskItem (a)).ToArray (); + ResolvedSymbols = assemblies.Select (a => a + ".mdb").Where (a => File.Exists (a)).Select (a => new TaskItem (a)).ToArray (); ResolvedFrameworkAssemblies = ResolvedAssemblies.Where (p => MonoAndroidHelper.IsFrameworkAssembly (p.ItemSpec, true)).ToArray (); ResolvedUserAssemblies = ResolvedAssemblies.Where (p => !MonoAndroidHelper.IsFrameworkAssembly (p.ItemSpec, true)).ToArray (); ResolvedDoNotPackageAttributes = do_not_package_atts.ToArray (); @@ -113,14 +110,13 @@ bool Execute (DirectoryAssemblyResolver resolver) readonly List do_not_package_atts = new List (); int indent = 2; - void AddAssemblyReferences (DirectoryAssemblyResolver resolver, ICollection assemblies, AssemblyDefinition assembly, bool topLevel) + void AddAssemblyReferences (DirectoryAssemblyResolver resolver, ICollection assemblies, AssemblyDefinition assembly, bool topLevel) { var fqname = assembly.MainModule.FullyQualifiedName; var fullPath = Path.GetFullPath (fqname); - var item = new TaskItem (fullPath); // Don't repeat assemblies we've already done - if (!topLevel && assemblies.Contains (item)) + if (!topLevel && assemblies.Contains (fullPath)) return; foreach (var att in assembly.CustomAttributes.Where (a => a.AttributeType.FullName == "Java.Interop.DoNotPackageAttribute")) { @@ -133,11 +129,8 @@ void AddAssemblyReferences (DirectoryAssemblyResolver resolver, ICollection new AssemblyNameDefinition (a.ItemSpec, null).Name != assembly.Name.Name)) { - var path = Path.GetDirectoryName (fullPath); - item.SetMetadata ("ResolvedFrom", DesignTimeFacadeDirectories.Any (x => Path.GetDirectoryName (x.ItemSpec).StartsWith (Path.GetDirectoryName (path))) ? "ImplicitlyExpandDesignTimeFacades" : ""); - assemblies.Add (item); - } + if (!topLevel && assemblies.All (a => new AssemblyNameDefinition (a, null).Name != assembly.Name.Name)) + assemblies.Add (fullPath); // Recurse into each referenced assembly foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences) { @@ -159,7 +152,7 @@ static LinkModes ParseLinkMode (string linkmode) return mode; } - void AddI18nAssemblies (DirectoryAssemblyResolver resolver, ICollection assemblies) + void AddI18nAssemblies (DirectoryAssemblyResolver resolver, ICollection assemblies) { var i18n = Linker.ParseI18nAssemblies (I18nAssemblies); var link = ParseLinkMode (LinkMode); @@ -186,10 +179,10 @@ void AddI18nAssemblies (DirectoryAssemblyResolver resolver, ICollection - { - public bool Equals (ITaskItem x, ITaskItem y) - { - if (x == null || y == null) - return false; - return x.ItemSpec == y.ItemSpec; - } - - public int GetHashCode (ITaskItem obj) - { - if (obj == null) - return 0; - return obj.ItemSpec.GetHashCode (); - } - } -} diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj index 93b775b0c06..2324bb52335 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj @@ -393,9 +393,6 @@ Utilities\Files.cs - - Utilities\ITaskItemEqualityComparer.cs - Linker\Mono.Tuner\ApplyPreserveAttributeBase.cs diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 00fa227e6cb..1b65da7023a 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1220,7 +1220,6 @@ because xbuild doesn't support framework reference assemblies. _GetAdditionalResourcesFromAssemblies; _CreateAdditionalResourceCache; _GenerateAndroidResourceDir; - _ValidateAndroidPackageProperties; @@ -1394,7 +1393,6 @@ because xbuild doesn't support framework reference assemblies. Assemblies="$(OutDir)$(TargetFileName);@(FilteredAssemblies)" I18nAssemblies="$(MandroidI18n)" LinkMode="$(AndroidLinkMode)" - DesignTimeFacadeDirectories="@(DesignTimeFacadeDirectories)" ReferenceAssembliesDirectory="$(TargetFrameworkDirectory)"> @@ -1600,7 +1598,6 @@ because xbuild doesn't support framework reference assemblies. - @@ -1627,42 +1624,36 @@ because xbuild doesn't support framework reference assemblies. @@ -1728,7 +1719,6 @@ because xbuild doesn't support framework reference assemblies. _CheckDuplicateJavaLibraries; _GetAdditionalResourcesFromAssemblies; _CreateAdditionalResourceCache; - _DefineBuildTargetAbis; <_CreateBaseApkInputs> $(MSBuildAllProjects) @@ -2145,12 +2135,6 @@ because xbuild doesn't support framework reference assemblies. - - - <_FilteredShrunkFrameworkAssemblies Include="@(_ShrunkFrameworkAssemblies)" Condition="'%(_ShrunkFrameworkAssemblies.ResolvedFrom)' != 'ImplicitlyExpandDesignTimeFacades'" /> - - - <_PrepareBuildApkDependsOnTargets> _SetLatestTargetFrameworkVersion; @@ -2167,7 +2151,6 @@ because xbuild doesn't support framework reference assemblies. _ResolveSatellitePaths; _CheckApkPerAbiFlag ;_LintChecks - ;FilterDesignTimeFacades @@ -2203,7 +2186,7 @@ because xbuild doesn't support framework reference assemblies. SupportedAbis="$(_BuildTargetAbis)" AndroidSequencePointsMode="$(_SequencePointsMode)" AotAdditionalArguments="$(AndroidAotAdditionalArguments)" - ResolvedAssemblies="@(_ResolvedUserAssemblies);@(_FilteredShrunkFrameworkAssemblies)" + ResolvedAssemblies="@(_ResolvedUserAssemblies);@(_ShrunkFrameworkAssemblies)" AotOutputDirectory="$(_AndroidAotBinDirectory)" IntermediateAssemblyDir="$(MonoAndroidIntermediateAssemblyDir)" LinkMode="$(AndroidLinkMode)" @@ -2217,14 +2200,14 @@ because xbuild doesn't support framework reference assemblies. Condition=" '$(AndroidAotMode)' == 'Hybrid' And '$(AotAssemblies)' == 'True' " AndroidAotMode="$(AndroidAotMode)" ToolPath="$(_MonoAndroidToolsDirectory)" - ResolvedAssemblies="@(_FilteredShrunkFrameworkAssemblies)"> + ResolvedAssemblies="@(_ResolvedAssemblies)">