Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[tasks] avoid passing dupe assemblies to Cecil #4624

Merged
merged 2 commits into from Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Xamarin.Forms.Build.Tasks/XamlCTask.cs
Expand Up @@ -48,14 +48,14 @@ public override bool Execute(out IList<Exception> thrownExceptions)
var resolver = DefaultAssemblyResolver ?? new XamlCAssemblyResolver();
if (resolver is XamlCAssemblyResolver xamlCResolver) {
if (!string.IsNullOrEmpty(DependencyPaths)) {
foreach (var dep in DependencyPaths.Split(';')) {
foreach (var dep in DependencyPaths.Split(';').Distinct()) {
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}Adding searchpath {dep}");
xamlCResolver.AddSearchDirectory(dep);
}
}

if (!string.IsNullOrEmpty(ReferencePath)) {
var paths = ReferencePath.Replace("//", "/").Split(';');
var paths = ReferencePath.Replace("//", "/").Split(';').Distinct();
StephaneDelcroix marked this conversation as resolved.
Show resolved Hide resolved
foreach (var p in paths) {
var searchpath = Path.GetDirectoryName(p);
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}Adding searchpath {searchpath}");
Expand Down
12 changes: 6 additions & 6 deletions Xamarin.Forms.Build.Tasks/XamlGenerator.cs
Expand Up @@ -385,20 +385,20 @@ void GatherXmlnsDefinitionAttributes()
_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
_xmlnsModules = new Dictionary<string, ModuleDefinition>();

if (string.IsNullOrEmpty(this.References))
if (string.IsNullOrEmpty(References))
return;

string[] paths = this.References.Split(';');
string[] paths = References.Split(';').Distinct().ToArray();

foreach ( var path in paths ) {
foreach (var path in paths) {
string asmName = Path.GetFileName(path);
if ( AssemblyIsSystem(asmName) )
if (AssemblyIsSystem(asmName))
// Skip the myriad "System." assemblies and others
continue;

using (var asmDef = AssemblyDefinition.ReadAssembly(path)) {
foreach ( var ca in asmDef.CustomAttributes ) {
if ( ca.AttributeType.FullName == typeof(XmlnsDefinitionAttribute).FullName) {
foreach (var ca in asmDef.CustomAttributes) {
if (ca.AttributeType.FullName == typeof(XmlnsDefinitionAttribute).FullName) {
_xmlnsDefinitions.Add(ca.GetXmlnsDefinition(asmDef));
_xmlnsModules[asmDef.FullName] = asmDef.MainModule;
}
Expand Down