Skip to content

[Xamarin.Android.Build.Tasks] Add more warning codes #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
+ [XA0115](xa0115.md): Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Please update your project properties.
+ [XA0116](xa0116.md): Unable to find `EmbeddedResource` of name `{ResourceName}`.
+ [XA0117](xa0117.md): The TargetFrameworkVersion {TargetFrameworkVersion} is deprecated. Please update it to be v4.4 or higher.
+ [XA0118](xa0118.md): Could not parse '{TargetMoniker}'

### XA1xxx Project Related

+ [XA1000](xa1000.md): There was an problem parsing {file}. This is likely due to incomplete or invalid xml.
+ [XA1001](xa1001.md): AndroidResgen: Warning while updating Resource XML '{filename}': {Message}
+ [XA1002](xa1002.md): We found a matching key '{Key}' for '{Item}'. But the casing was incorrect. Please correct the casing
+ [XA1003](xa1003.md): '{zip}' does not exist. Please rebuild the project.
+ [XA1005](xa1005.md): Attempting naive type name fixup for element with ID '{id}' and type '{managedType}'

### XA2xxx Linker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ void CreateWidget (XPathNavigator current, string filePath, string androidNS, st
managedType = managedType.Substring (0, idx).Trim ();

if (mayNeedTypeFixup && (idx = managedType.LastIndexOf ('.')) >= 0) {
LogWarning ($"Attempting naive type name fixup for element with ID '{id}' and type '{managedType}'");
LogMessage ("If the above fixup fails, please add `tools:managedType` attribute to the element with fully qualified managed type name of the element");
LogCodedWarning ("XA1005", $"Attempting naive type name fixup for element with ID '{id}' and type '{managedType}'");
LogCodedWarning ("XA1005", "If the above fixup fails, please add `xamarin:managedType` attribute to the element with fully qualified managed type name of the element");

oldType = managedType;
string ns = managedType.Substring (0, idx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private void AddRename (string android, string user)
var ext = Path.GetExtension (android);
var dir = Path.GetDirectoryName (user);

Log.LogWarning ("Resource target names differ; got '{0}', expected '{1}'.",
Log.LogDebugMessage ("Resource target names differ; got '{0}', expected '{1}'.",
Path.Combine (dir, Path.GetFileName (to) + ext),
Path.Combine (dir, Path.GetFileName (curTo) + ext));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ void AddAttributeValue (ICollection<string> items, CustomAttribute attr, string
bool isDirectory, string fullPath)
{
if (!attr.HasConstructorArguments || attr.ConstructorArguments.Count != 1) {
LogWarning ("Attribute {0} doesn't have expected one constructor agrument", attr.AttributeType.FullName);
LogCodedWarning (errorCode, "Attribute {0} doesn't have expected one constructor agrument", attr.AttributeType.FullName);
return;
}

CustomAttributeArgument arg = attr.ConstructorArguments.First ();
string path = arg.Value as string;
if (string.IsNullOrEmpty (path)) {
LogWarning ("Attribute {0} contructor argument is empty or not set to string", attr.AttributeType.FullName);
LogCodedWarning (errorCode, "Attribute {0} contructor argument is empty or not set to string", attr.AttributeType.FullName);
return;
}
path = SubstituteEnvVariables (path).TrimEnd (Path.DirectorySeparatorChar);
Expand Down Expand Up @@ -298,7 +298,7 @@ string MakeSureLibraryIsInPlace (string destinationBase, string url, string vers
string file = Path.Combine (zipDir, !uri.IsFile ? hash + ".zip" : Path.GetFileName (uri.AbsolutePath));
if (string.IsNullOrEmpty (extraPath) && (!File.Exists (file) || !IsValidDownload (file, sha1) || !MonoAndroidHelper.IsValidZip (file))) {
if (DesignTimeBuild) {
LogWarning ($"DesignTimeBuild={DesignTimeBuild}. Skipping download of {url}");
LogDebugMessage ($"DesignTimeBuild={DesignTimeBuild}. Skipping download of {url}");
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override bool Execute ()
Log.LogDebugMessage ("Task ReadAdditionalResourcesFromAssemblyCache");
Log.LogDebugMessage (" CacheFile: {0}", CacheFile);
if (!File.Exists (CacheFile)) {
Log.LogWarning ("{0} does not exist. No Additional Resources found", CacheFile);
Log.LogDebugMessage ("{0} does not exist. No Additional Resources found", CacheFile);
return !Log.HasLoggedErrors;
}
var doc = XDocument.Load (CacheFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override bool Execute ()
Log.LogDebugMessage ("Task ReadImportedLibrariesCache");
Log.LogDebugMessage (" CacheFile: {0}", CacheFile);
if (!File.Exists (CacheFile)) {
Log.LogWarning ("{0} does not exist. No Imported Libraries found", CacheFile);
Log.LogDebugMessage ("{0} does not exist. No Imported Libraries found", CacheFile);
return !Log.HasLoggedErrors;
}
var doc = XDocument.Load (CacheFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override bool Execute ()
Log.LogDebugMessage ("Task ReadLibraryProjectImportsCache");
Log.LogDebugMessage (" CacheFile: {0}", CacheFile);
if (!File.Exists (CacheFile)) {
Log.LogWarning ("{0} does not exist. No Project Library Imports found", CacheFile);
Log.LogDebugMessage ("{0} does not exist. No Project Library Imports found", CacheFile);
return !Log.HasLoggedErrors;
}
var doc = XDocument.Load (CacheFile);
Expand Down
4 changes: 2 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ AssemblyDefinition ResolveRuntimeAssemblyForReferenceAssembly (LockFile lockFile

var framework = NuGetFramework.Parse (TargetMoniker);
if (framework == null) {
LogWarning ($"Could not parse '{TargetMoniker}'");
LogCodedWarning ("XA0118", $"Could not parse '{TargetMoniker}'");
return null;
}
var target = lockFile.GetTarget (framework, string.Empty);
if (target == null) {
LogWarning ($"Could not resolve target for '{TargetMoniker}'");
LogCodedWarning ("XA0118", $"Could not resolve target for '{TargetMoniker}'");
return null;
}
foreach (var folder in lockFile.PackageFolders) {
Expand Down