Skip to content

Commit 7c1d78a

Browse files
authored
[Xamarin.ProjectTools] document test framework APIs (#10380)
This PR adds comprehensive XML documentation to the core classes and methods in the `src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/` directory, addressing the lack of documentation in the test suite supporting API. The `Xamarin.ProjectTools` test framework provides essential infrastructure for testing Xamarin.Android build scenarios, but many of its public, protected, and internal APIs lacked proper documentation. This made it difficult for developers to understand how to use the framework effectively.
1 parent e2d0ae2 commit 7c1d78a

18 files changed

+1156
-6
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/AndroidBuildActions.cs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,125 @@
77

88
namespace Xamarin.ProjectTools
99
{
10+
/// <summary>
11+
/// Contains constant values for Android-specific MSBuild item types (build actions).
12+
/// These constants provide a centralized way to reference Android build actions
13+
/// used in Xamarin.Android projects for various Android-specific file types.
14+
/// </summary>
15+
/// <remarks>
16+
/// These build actions are specific to Xamarin.Android and determine how Android
17+
/// assets, resources, libraries, and other Android-specific files are processed
18+
/// during the build. Used in conjunction with <see cref="BuildActions"/> for
19+
/// complete build item type coverage.
20+
/// </remarks>
21+
/// <seealso cref="BuildActions"/>
22+
/// <seealso cref="BuildItem"/>
23+
/// <seealso cref="AndroidItem"/>
1024
public static class AndroidBuildActions
1125
{
26+
/// <summary>
27+
/// Build action for Android resource files (layout, drawable, values, etc.).
28+
/// </summary>
1229
public const string AndroidResource = "AndroidResource";
30+
31+
/// <summary>
32+
/// Build action for Android asset files stored in the assets folder.
33+
/// </summary>
1334
public const string AndroidAsset = "AndroidAsset";
35+
36+
/// <summary>
37+
/// Build action for Android AAR library files.
38+
/// </summary>
1439
public const string AndroidAarLibrary = "AndroidAarLibrary";
40+
41+
/// <summary>
42+
/// Build action for Android environment variable files.
43+
/// </summary>
1544
public const string AndroidEnvironment = "AndroidEnvironment";
45+
46+
/// <summary>
47+
/// Build action for Android interface description language files.
48+
/// </summary>
1649
public const string AndroidInterfaceDescription = "AndroidInterfaceDescription";
50+
51+
/// <summary>
52+
/// Build action for Java source files to be compiled as part of the Android project.
53+
/// </summary>
1754
public const string AndroidJavaSource = "AndroidJavaSource";
55+
56+
/// <summary>
57+
/// Build action for Java library JAR files.
58+
/// </summary>
1859
public const string AndroidJavaLibrary = "AndroidJavaLibrary";
60+
61+
/// <summary>
62+
/// Build action for Android library project references.
63+
/// </summary>
1964
public const string AndroidLibrary = "AndroidLibrary";
65+
66+
/// <summary>
67+
/// Build action for Maven-based Android library dependencies.
68+
/// </summary>
2069
public const string AndroidMavenLibrary = "AndroidMavenLibrary";
70+
71+
/// <summary>
72+
/// Build action for Android Lint configuration files.
73+
/// </summary>
2174
public const string AndroidLintConfig = "AndroidLintConfig";
75+
76+
/// <summary>
77+
/// Build action for native library files (.so) for Android.
78+
/// </summary>
2279
public const string AndroidNativeLibrary = "AndroidNativeLibrary";
80+
81+
/// <summary>
82+
/// Internal build action for Android member remapping metadata.
83+
/// </summary>
2384
public const string _AndroidRemapMembers = "_AndroidRemapMembers";
85+
86+
/// <summary>
87+
/// Build action for ProGuard configuration files.
88+
/// </summary>
2489
public const string ProguardConfiguration = "ProguardConfiguration";
90+
91+
/// <summary>
92+
/// Build action for XML transform files.
93+
/// </summary>
2594
public const string TransformFile = "TransformFile";
95+
96+
/// <summary>
97+
/// Build action for input JAR files in Java binding projects.
98+
/// </summary>
2699
public const string InputJar = "InputJar";
100+
101+
/// <summary>
102+
/// Build action for reference JAR files in Java binding projects.
103+
/// </summary>
27104
public const string ReferenceJar = "ReferenceJar";
105+
106+
/// <summary>
107+
/// Build action for embedded JAR files in Java binding projects.
108+
/// </summary>
28109
public const string EmbeddedJar = "EmbeddedJar";
110+
111+
/// <summary>
112+
/// Build action for embedded native library files.
113+
/// </summary>
29114
public const string EmbeddedNativeLibrary = "EmbeddedNativeLibrary";
115+
116+
/// <summary>
117+
/// Build action for embedded reference JAR files in Java binding projects.
118+
/// </summary>
30119
public const string EmbeddedReferenceJar = "EmbeddedReferenceJar";
120+
121+
/// <summary>
122+
/// Build action for Android library project ZIP files.
123+
/// </summary>
31124
public const string LibraryProjectZip = "LibraryProjectZip";
125+
126+
/// <summary>
127+
/// Build action for Android library project properties files.
128+
/// </summary>
32129
public const string LibraryProjectProperties = "LibraryProjectProperties";
33130
}
34131
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/AndroidLinkMode.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,54 @@
22

33
namespace Xamarin.ProjectTools
44
{
5-
5+
/// <summary>
6+
/// Specifies the Android linker mode for IL trimming in Xamarin.Android projects.
7+
/// Determines how aggressively the linker removes unused code to reduce application size.
8+
/// </summary>
9+
/// <remarks>
10+
/// The Android linker analyzes IL code and removes unused methods, types, and assemblies
11+
/// to reduce the final application size. Different modes provide different levels of
12+
/// optimization with varying degrees of safety.
13+
/// </remarks>
14+
/// <seealso cref="TrimMode"/>
615
public enum AndroidLinkMode
716
{
17+
/// <summary>
18+
/// No linking is performed. All code is preserved in the final application.
19+
/// </summary>
820
None,
21+
22+
/// <summary>
23+
/// Only Android SDK and BCL assemblies are linked. User assemblies are preserved.
24+
/// </summary>
925
SdkOnly,
26+
27+
/// <summary>
28+
/// All assemblies including user assemblies are linked for maximum size reduction.
29+
/// </summary>
1030
Full,
1131
}
1232

33+
/// <summary>
34+
/// Specifies the trim mode for .NET trimming in modern .NET Android projects.
35+
/// Determines the aggressiveness of IL trimming for size optimization.
36+
/// </summary>
37+
/// <remarks>
38+
/// Trim modes are used in .NET 6+ Android projects to control how the .NET trimmer
39+
/// removes unused code. This is similar to but distinct from the traditional
40+
/// Xamarin.Android linker modes.
41+
/// </remarks>
42+
/// <seealso cref="AndroidLinkMode"/>
1343
public enum TrimMode
1444
{
45+
/// <summary>
46+
/// Partial trimming removes some unused code while preserving reflection safety.
47+
/// </summary>
1548
Partial,
49+
50+
/// <summary>
51+
/// Full trimming aggressively removes unused code for maximum size reduction.
52+
/// </summary>
1653
Full,
1754
}
1855
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010

1111
namespace Xamarin.ProjectTools
1212
{
13+
/// <summary>
14+
/// Represents a Xamarin.Android application project for testing purposes.
15+
/// This class provides a concrete implementation of an Android application project
16+
/// with default templates, resources, and configuration suitable for test scenarios.
17+
/// </summary>
18+
/// <remarks>
19+
/// This class extends <see cref="XamarinAndroidCommonProject"/> to provide a complete
20+
/// Android application project setup including:
21+
/// - Default MainActivity template
22+
/// - Default layout resources
23+
/// - Android manifest configuration
24+
/// - Application-specific MSBuild properties
25+
/// Used for testing build scenarios, deployment, and application-level functionality.
26+
/// </remarks>
27+
/// <seealso cref="XamarinAndroidCommonProject"/>
28+
/// <seealso cref="XamarinAndroidLibraryProject"/>
29+
/// <seealso cref="XamarinAndroidBindingProject"/>
1330
public class XamarinAndroidApplicationProject : XamarinAndroidCommonProject
1431
{
1532
const string default_strings_xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
@@ -36,6 +53,17 @@ static XamarinAndroidApplicationProject ()
3653

3754
}
3855

56+
/// <summary>
57+
/// Initializes a new instance of the XamarinAndroidApplicationProject class.
58+
/// Creates a complete Android application project with default templates and configuration.
59+
/// </summary>
60+
/// <param name="debugConfigurationName">The name for the debug configuration (default: "Debug").</param>
61+
/// <param name="releaseConfigurationName">The name for the release configuration (default: "Release").</param>
62+
/// <param name="packageName">The Android package name for the application. If empty, uses the caller's method name.</param>
63+
/// <remarks>
64+
/// Sets up the project as an executable (OutputType = "Exe") with nullable reference types enabled,
65+
/// default Android support properties, and includes standard application templates.
66+
/// </remarks>
3967
public XamarinAndroidApplicationProject (string debugConfigurationName = "Debug", string releaseConfigurationName = "Release", [CallerMemberName] string packageName = "")
4068
: base (debugConfigurationName, releaseConfigurationName)
4169
{

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidProject.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,42 @@
77

88
namespace Xamarin.ProjectTools
99
{
10+
/// <summary>
11+
/// Abstract base class for Xamarin.Android projects in the test framework.
12+
/// Extends <see cref="DotNetXamarinProject"/> to provide Android-specific functionality and defaults.
13+
/// </summary>
14+
/// <remarks>
15+
/// This class serves as the foundation for concrete Android project types like
16+
/// <see cref="XamarinAndroidApplicationProject"/> and <see cref="XamarinAndroidLibraryProject"/>.
17+
/// It sets up Android-specific default properties and language settings.
18+
/// </remarks>
19+
/// <seealso cref="DotNetXamarinProject"/>
20+
/// <seealso cref="XamarinAndroidApplicationProject"/>
21+
/// <seealso cref="XamarinAndroidLibraryProject"/>
22+
/// <seealso cref="XamarinAndroidProjectLanguage"/>
1023
public abstract class XamarinAndroidProject : DotNetXamarinProject
1124
{
25+
/// <summary>
26+
/// Initializes a new instance of the XamarinAndroidProject class with the specified configuration names.
27+
/// Sets the default language to C# and output type to Library.
28+
/// </summary>
29+
/// <param name="debugConfigurationName">The name for the debug configuration (default: "Debug").</param>
30+
/// <param name="releaseConfigurationName">The name for the release configuration (default: "Release").</param>
31+
/// <seealso cref="XamarinAndroidProjectLanguage"/>
32+
/// <seealso cref="KnownProperties.OutputType"/>
1233
protected XamarinAndroidProject (string debugConfigurationName = "Debug", string releaseConfigurationName = "Release")
1334
: base (debugConfigurationName, releaseConfigurationName)
1435
{
1536
Language = XamarinAndroidProjectLanguage.CSharp;
1637
SetProperty (KnownProperties.OutputType, "Library");
1738
}
1839

19-
40+
/// <summary>
41+
/// Gets the language settings specific to Xamarin.Android projects.
42+
/// </summary>
43+
/// <returns>The Android-specific language configuration.</returns>
44+
/// <seealso cref="XamarinAndroidProjectLanguage"/>
45+
/// <seealso cref="Language"/>
2046
public XamarinAndroidProjectLanguage XamarinAndroidLanguage {
2147
get { return (XamarinAndroidProjectLanguage) Language; }
2248
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/BuildActions.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,58 @@
77

88
namespace Xamarin.ProjectTools
99
{
10+
/// <summary>
11+
/// Contains constant values for commonly used MSBuild item types (build actions).
12+
/// These constants provide a centralized way to reference standard build actions
13+
/// used in project files and build items.
14+
/// </summary>
15+
/// <remarks>
16+
/// These build actions correspond to the standard MSBuild item types that determine
17+
/// how files are processed during the build. Used with <see cref="BuildItem"/>
18+
/// and throughout the test project system.
19+
/// </remarks>
20+
/// <seealso cref="BuildItem"/>
21+
/// <seealso cref="AndroidBuildActions"/>
1022
public static class BuildActions
1123
{
24+
/// <summary>
25+
/// Build action for files that should be included in the project but not compiled or processed.
26+
/// </summary>
1227
public const string None = "None";
28+
29+
/// <summary>
30+
/// Build action for references to other projects in the same solution.
31+
/// </summary>
1332
public const string ProjectReference = "ProjectReference";
33+
34+
/// <summary>
35+
/// Build action for NuGet package references.
36+
/// </summary>
1437
public const string PackageReference = "PackageReference";
38+
39+
/// <summary>
40+
/// Build action for assembly references.
41+
/// </summary>
1542
public const string Reference = "Reference";
43+
44+
/// <summary>
45+
/// Build action for source code files that should be compiled.
46+
/// </summary>
1647
public const string Compile = "Compile";
48+
49+
/// <summary>
50+
/// Build action for files that should be embedded as resources in the assembly.
51+
/// </summary>
1752
public const string EmbeddedResource = "EmbeddedResource";
53+
54+
/// <summary>
55+
/// Build action for content files that should be copied to the output directory.
56+
/// </summary>
1857
public const string Content = "Content";
58+
59+
/// <summary>
60+
/// Build action for folders in the project structure.
61+
/// </summary>
1962
public const string Folder = "Folder";
2063
}
2164
}

0 commit comments

Comments
 (0)