Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public override bool RunTask ()
var parser = new ManagedResourceParser () { Log = Log, JavaPlatformDirectory = javaPlatformDirectory, ResourceFlagFile = ResourceFlagFile };
resources = parser.Parse (ResourceDirectory, RTxtFile ?? string.Empty, AdditionalResourceDirectories?.Select (x => x.ItemSpec), IsApplication, resource_fixup);
} else {
if (JavaResgenInputFile == null) {
throw new ArgumentNullException (nameof (JavaResgenInputFile));
}
var parser = new JavaResourceParser () { Log = Log };
resources = parser.Parse (JavaResgenInputFile, IsApplication, resource_fixup);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/GenerateRtxt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override bool RunTask ()

var javaPlatformDirectory = JavaPlatformJarPath.IsNullOrEmpty () ? "" : Path.GetDirectoryName (JavaPlatformJarPath);
var parser = new FileResourceParser () { Log = Log, JavaPlatformDirectory = javaPlatformDirectory, ResourceFlagFile = ResourceFlagFile};
var resources = parser.Parse (ResourceDirectory, AdditionalResourceDirectories, AarLibraries, resource_fixup);
var resources = parser.Parse (ResourceDirectory, AdditionalResourceDirectories ?? [], AarLibraries ?? [], resource_fixup);

// only update if it changed.
writer.Write (RTxtFile, resources);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
3 changes: 2 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Utilities/Aapt2Daemon.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
Expand Down Expand Up @@ -252,7 +253,7 @@ private void Aapt2DaemonStart ()
}
// wait for the file we expect to be created. There can be a delay between
// the daemon saying "Done" and the file finally being written to disk.
if (!string.IsNullOrEmpty (job.OutputFile) && !errored) {
if (!job.OutputFile.IsNullOrEmpty () && !errored) {
while (!File.Exists (job.OutputFile)) {
// If either the AsyncTask.CancellationToken or tcs.Token are cancelled, we need to abort
tcs.Token.ThrowIfCancellationRequested ();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -91,7 +92,7 @@ static bool ResourceNeedsToBeLowerCased (string? value, string? resourceBasePath
// path to the msbuild's intermediate output directory and that location can be changed by the
// user. It's better to be safe than sorry.
resourceBasePath = resourceBasePath?.Trim ();
if (string.IsNullOrEmpty (resourceBasePath))
if (resourceBasePath.IsNullOrEmpty ())
return true;

// Avoid resource names that are all whitespace
Expand Down Expand Up @@ -159,7 +160,7 @@ private static void TryFixResourceAlias (XElement elem, string? resourceBasePath
// <item type="layout" name="">@layout/Page1</item>
// <item type="layout" name="">@drawable/Page1</item>
// and corrects the alias to be lower case.
if (elem.Name == "item" && !string.IsNullOrEmpty(elem.Value) ) {
if (elem.Name == "item" && !elem.Value.IsNullOrEmpty() ) {
string value = elem.Value.Trim();
Match m = r.Match (value);
if (m.Success) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
namespace Xamarin.Android.Tasks;

public enum AndroidRuntime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;

namespace Xamarin.Android.Tasks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;

namespace Xamarin.Android.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Buffers;
Expand Down Expand Up @@ -37,7 +38,7 @@ public AssemblyData (string sourcePath, uint descriptorIndex)

public void SetData (string sourcePath, uint descriptorIndex)
{
if (String.IsNullOrEmpty (sourcePath))
if (sourcePath.IsNullOrEmpty ())
throw new ArgumentException ("must not be null or empty", nameof (sourcePath));
SourcePath = sourcePath;
DescriptorIndex = descriptorIndex;
Expand All @@ -62,7 +63,7 @@ static CompressionResult Compress (AssemblyData data, string outputFilePath)

var outputDirectory = Path.GetDirectoryName (outputFilePath);

if (String.IsNullOrEmpty (outputDirectory))
if (outputDirectory.IsNullOrEmpty ())
throw new ArgumentException ("must not be null or empty", nameof (outputDirectory));

Directory.CreateDirectory (outputDirectory);
Expand Down Expand Up @@ -172,7 +173,7 @@ static string GetCompressedAssemblyOutputDirectory (ITaskItem assembly, string c
string subDirectory = assembly.GetMetadata ("DestinationSubDirectory");
string abi = MonoAndroidHelper.GetAssemblyAbi (assembly);

if (!string.IsNullOrEmpty (subDirectory) && !(subDirectory.EndsWith ($"{abi}/", StringComparison.Ordinal) || subDirectory.EndsWith ($"{abi}\\", StringComparison.Ordinal))) {
if (!subDirectory.IsNullOrEmpty () && !(subDirectory.EndsWith ($"{abi}/", StringComparison.Ordinal) || subDirectory.EndsWith ($"{abi}\\", StringComparison.Ordinal))) {
assemblyOutputDir = Path.Combine (compressedOutputDir, abi, subDirectory);
} else {
assemblyOutputDir = Path.Combine (compressedOutputDir, abi);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
Expand All @@ -12,7 +13,7 @@ internal class AssemblyIdentityMap
public void Load (string mapFile)
{
map.Clear ();
if (string.IsNullOrWhiteSpace (mapFile) || !File.Exists (mapFile))
if (mapFile.IsNullOrWhiteSpace () || !File.Exists (mapFile))
return;
foreach (var s in File.ReadLines (mapFile)) {
if (!map.Contains (s))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using Java.Interop.Tools.Cecil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.IO;

Expand Down Expand Up @@ -39,7 +40,7 @@ public AssemblyStoreAssemblyInfo (string sourceFilePath, ITaskItem assembly, boo

string nameNoExt = Path.GetFileNameWithoutExtension (name);
string? culture = assembly.GetMetadata ("Culture");
if (!String.IsNullOrEmpty (culture)) {
if (!culture.IsNullOrEmpty ()) {
name = $"{culture}/{name}";
nameNoExt = $"{culture}/{nameNoExt}";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
namespace Xamarin.Android.Tasks;

partial class AssemblyStoreGenerator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;

using Microsoft.Build.Utilities;
using Xamarin.Android.Tasks;

/// <para>
/// When bundle configuration uses standard settings for split configs, the per-ABI library
Expand Down Expand Up @@ -181,7 +183,7 @@ static void TransitionState (Strings strings, Utf8JsonReader reader, Stack<Bundl
_ => throw new InvalidOperationException ($"Internal error: unsupported state transition to '{need}'")
};

if (!String.IsNullOrEmpty (objectName) && Xamarin.Android.Tasks.MonoAndroidHelper.StringEquals (needName, objectName)) {
if (!objectName.IsNullOrEmpty () && Xamarin.Android.Tasks.MonoAndroidHelper.StringEquals (needName, objectName)) {
state.Push (need);
} else {
state.Push (BundleConfigObject.Other);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.IO;
using Microsoft.Build.Framework;
Expand Down Expand Up @@ -25,7 +26,7 @@ public CompressedAssemblyInfo (uint fileSize, uint descriptorIndex, AndroidTarge

public static string GetKey (string projectFullPath)
{
if (String.IsNullOrEmpty (projectFullPath))
if (projectFullPath.IsNullOrEmpty ())
throw new ArgumentException ("must be a non-empty string", nameof (projectFullPath));

return $"{CompressedAssembliesInfoKey}:{projectFullPath}";
Expand All @@ -35,7 +36,7 @@ public static string GetDictionaryKey (ITaskItem assembly)
{
// Prefer %(DestinationSubPath) if set
var path = assembly.GetMetadata ("DestinationSubPath");
if (!string.IsNullOrEmpty (path)) {
if (!path.IsNullOrEmpty ()) {
return path;
}
// MSBuild sometimes only sets %(DestinationSubDirectory)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -61,7 +62,7 @@ public static Config GetConfig (TaskLoggingHelper log, string androidBinUtilsDir

foreach (ITaskItem packLibDir in runtimePackLibraryDirs) {
string ?packRID = packLibDir.GetMetadata ("RuntimeIdentifier");
if (String.IsNullOrEmpty (packRID)) {
if (packRID.IsNullOrEmpty ()) {
continue;
}

Expand Down
15 changes: 8 additions & 7 deletions src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Concurrent;
using System.IO;
Expand All @@ -20,7 +21,7 @@ static class ELFHelper
{
public static void AssertValidLibraryAlignment (TaskLoggingHelper log, int alignmentInPages, string path, ITaskItem? item)
{
if (String.IsNullOrEmpty (path) || !File.Exists (path)) {
if (path.IsNullOrEmpty () || !File.Exists (path)) {
return;
}

Expand Down Expand Up @@ -79,22 +80,22 @@ static void AssertValidLibraryAlignment (TaskLoggingHelper log, uint pageSize, s
}

string? metaValue = item.GetMetadata ("PathInPackage");
if (String.IsNullOrEmpty (metaValue)) {
if (metaValue.IsNullOrEmpty ()) {
metaValue = item.GetMetadata ("OriginalFile");
if (String.IsNullOrEmpty (metaValue)) {
if (metaValue.IsNullOrEmpty ()) {
metaValue = item.ItemSpec;
}
}
string originalFile = metaValue;
metaValue = item.GetMetadata ("NuGetPackageId");
if (String.IsNullOrEmpty (metaValue)) {
if (metaValue.IsNullOrEmpty ()) {
return (Unknown, Unknown, originalFile);
}

string id = metaValue;
string version;
metaValue = item.GetMetadata ("NuGetPackageVersion");
if (!String.IsNullOrEmpty (metaValue)) {
if (!metaValue.IsNullOrEmpty ()) {
version = metaValue;
} else {
version = Unknown;
Expand All @@ -106,7 +107,7 @@ static void AssertValidLibraryAlignment (TaskLoggingHelper log, uint pageSize, s

public static bool IsEmptyAOTLibrary (TaskLoggingHelper log, string path)
{
if (String.IsNullOrEmpty (path) || !File.Exists (path)) {
if (path.IsNullOrEmpty () || !File.Exists (path)) {
return false;
}

Expand All @@ -121,7 +122,7 @@ public static bool IsEmptyAOTLibrary (TaskLoggingHelper log, string path)

public static bool ReferencesLibrary (string libraryPath, string referencedLibraryName)
{
if (String.IsNullOrEmpty (libraryPath) || !File.Exists (libraryPath)) {
if (libraryPath.IsNullOrEmpty () || !File.Exists (libraryPath)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
1 change: 1 addition & 0 deletions src/Xamarin.Android.Build.Tasks/Utilities/Features.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
namespace Xamarin.Android.Tools {

static class Features {
Expand Down
Loading