示例#1
0
 public override bool RunTask()
 {
     if (!string.IsNullOrEmpty(SupportedAbis))
     {
         Log.LogCodedWarning("XA0036", Properties.Resources.XA0036);
     }
     if (RuntimeIdentifiers != null && RuntimeIdentifiers.Length > 0)
     {
         SupportedAbis = string.Join(";", RuntimeIdentifiers.Select(rid => {
             var abi = AndroidRidAbiHelper.RuntimeIdentifierToAbi(rid);
             if (string.IsNullOrEmpty(abi))
             {
                 Log.LogCodedError("XA0035", Properties.Resources.XA0035, rid);
             }
             return(abi);
         }));
     }
     else if (!string.IsNullOrEmpty(RuntimeIdentifier))
     {
         SupportedAbis = AndroidRidAbiHelper.RuntimeIdentifierToAbi(RuntimeIdentifier);
         if (string.IsNullOrEmpty(SupportedAbis))
         {
             Log.LogCodedError("XA0035", Properties.Resources.XA0035, RuntimeIdentifier);
         }
     }
     else if (string.IsNullOrEmpty(SupportedAbis))
     {
         Log.LogCodedError("XA0035", Properties.Resources.XA0035, "");
     }
     return(!Log.HasLoggedErrors);
 }
        /// <summary>
        /// Sets %(DestinationSubDirectory) and %(DestinationSubPath) based on %(RuntimeIdentifier)
        /// </summary>
        void SetDestinationSubDirectory(ITaskItem assembly, string fileName, ITaskItem symbol)
        {
            var rid = assembly.GetMetadata("RuntimeIdentifier");
            var abi = AndroidRidAbiHelper.RuntimeIdentifierToAbi(rid);

            if (!string.IsNullOrEmpty(abi))
            {
                string destination = Path.Combine(assembly.GetMetadata("DestinationSubDirectory"), abi);
                assembly.SetMetadata("DestinationSubDirectory", destination + Path.DirectorySeparatorChar);
                assembly.SetMetadata("DestinationSubPath", Path.Combine(destination, fileName));
                if (symbol != null)
                {
                    destination = Path.Combine(symbol.GetMetadata("DestinationSubDirectory"), abi);
                    symbol.SetMetadata("DestinationSubDirectory", destination + Path.DirectorySeparatorChar);
                    symbol.SetMetadata("DestinationSubPath", Path.Combine(destination, Path.GetFileName(symbol.ItemSpec)));
                }
            }
            else
            {
                Log.LogDebugMessage($"Android ABI not found for: {assembly.ItemSpec}");
                assembly.SetDestinationSubPath();
                symbol?.SetDestinationSubPath();
            }
        }