Exemplo n.º 1
0
 private static void ApplyUniqueMetadataProperties(ITaskItem candidate)
 {
     var extension = candidate.GetMetadata("Extension");
     var filename = candidate.GetMetadata("FileName");
     switch (extension)
     {
         case ".dll":
             if (string.IsNullOrEmpty(candidate.GetMetadata("AssetTraitName")))
             {
                 candidate.SetMetadata("AssetTraitName", "BlazorWebAssemblyResource");
                 candidate.SetMetadata("AssetTraitValue", "runtime");
             }
             break;
         case ".wasm":
         case ".blat":
         case ".dat" when filename.StartsWith("icudt"):
             candidate.SetMetadata("AssetTraitName", "BlazorWebAssemblyResource");
             candidate.SetMetadata("AssetTraitValue", "native");
             break;
         case ".pdb":
             candidate.SetMetadata("AssetTraitName", "BlazorWebAssemblyResource");
             candidate.SetMetadata("AssetTraitValue", "symbol");
             candidate.RemoveMetadata("OriginalItemSpec");
             break;
         default:
             break;
     }
 }
Exemplo n.º 2
0
        public void TestRemoveMetadata3()
        {
            item = new TaskItem("lalala");
            item.SetMetadata("a", "b");
            item.RemoveMetadata("a");

            Assert.AreEqual(11, item.MetadataCount, "A1");
        }
        private void VerifyTaskItem(ITaskItem input, ITaskItem output)
        {
            // remove unnecessary metadata to keep only ones that would be in result task items
            var removeMetadata = new[] { MetadataKeys.IsImplicitlyDefined };

            foreach (var rm in removeMetadata)
            {
                output.RemoveMetadata(rm);
                input.RemoveMetadata(rm);
            }

            input.ItemSpec.Should().Be(output.ItemSpec);
            foreach (var metadata in input.MetadataNames)
            {
                input.GetMetadata(metadata.ToString()).Should().Be(output.GetMetadata(metadata.ToString()));
            }
        }
        private void VerifyTargetTaskItem(DependencyType type, ITaskItem input, ITaskItem output)
        {
            type.ToString().Should().Be(output.GetMetadata(MetadataKeys.Type));

            // remove unnecessary metadata to keep only ones that would be in result task items
            var removeMetadata = new[] { MetadataKeys.Type, MetadataKeys.ResolvedPath };

            foreach (var rm in removeMetadata)
            {
                output.RemoveMetadata(rm);
                input.RemoveMetadata(rm);
            }

            foreach (var metadata in input.MetadataNames)
            {
                input.GetMetadata(metadata.ToString()).Should().Be(output.GetMetadata(metadata.ToString()));
            }
        }
Exemplo n.º 5
0
        private void VerifyTaskItem(ITaskItem input, ITaskItem output, string expectedItemSpec = null)
        {
            // remove unnecessary metadata to keep only ones that would be in result task items
            var removeMetadata = new[] {
                MetadataKeys.IsImplicitlyDefined,
                MetadataKeys.IsTopLevelDependency,
                MetadataKeys.Type
            };

            foreach (var rm in removeMetadata)
            {
                output.RemoveMetadata(rm);
                input.RemoveMetadata(rm);
            }
            if (expectedItemSpec != null)
            {
                expectedItemSpec.Should().Be(output.ItemSpec);
            }

            foreach (var metadata in input.MetadataNames)
            {
                input.GetMetadata(metadata.ToString()).Should().Be(output.GetMetadata(metadata.ToString()));
            }
        }
        public override bool Execute()
        {
            string [] fields = FieldsToRemove.Split(new char [] { ',', ';' });

            if (fields.Length == 0)
            {
                Log.LogWarning("No metadata field names specified, returning");
                return(true);
            }
            ProcessedItems = new ITaskItem[Items.Length];
            for (int i = 0; i < Items.Length; i++)
            {
                ITaskItem current = Items[i];
                foreach (string fieldName in fields)
                {
                    if (current.GetMetadata(fieldName) != null)
                    {
                        current.RemoveMetadata(fieldName);
                    }
                }
                ProcessedItems[i] = current;
            }
            return(true);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Some metadata should not be forwarded between the parent and child items.
 /// </summary>
 private static void RemoveNonForwardableMetadata(ITaskItem item)
 {
     item.RemoveMetadata(ItemMetadataNames.winmdImplmentationFile);
     item.RemoveMetadata(ItemMetadataNames.imageRuntime);
     item.RemoveMetadata(ItemMetadataNames.winMDFile);
 }
Exemplo n.º 8
0
 public void TestRemoveMetadata2()
 {
     item = new TaskItem("lalala");
     item.RemoveMetadata(null);
 }
Exemplo n.º 9
0
 public void TestRemoveMetadata1()
 {
     item = new TaskItem("lalala");
     item.RemoveMetadata("EXTension");
 }
Exemplo n.º 10
0
		public void TestRemoveMetadata3 ()
		{
			item = new TaskItem ("lalala");
			item.SetMetadata ("a", "b");
			item.RemoveMetadata ("a");

			Assert.AreEqual (11, item.MetadataCount, "A1");
		}
Exemplo n.º 11
0
		public void TestRemoveMetadata2 ()
		{
			item = new TaskItem ("lalala");
			item.RemoveMetadata (null);
		}
Exemplo n.º 12
0
		public void TestRemoveMetadata1 ()
		{
			item = new TaskItem ("lalala");
			item.RemoveMetadata ("EXTension");
		}
Exemplo n.º 13
0
 static void CopyAllMetadata(ITaskItem source, ITaskItem dest)
 {
     //  CopyMetadata adds an OriginalItemSpec, which we don't want.  So we subsequently remove it
     source.CopyMetadataTo(dest);
     dest.RemoveMetadata("OriginalItemSpec");
 }