自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
Tradefed 配置对象
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
系统将解析 Tradefed XML 配置,并根据它创建一个 Configuration
对象,用来描述完整的配置。
该对象由 IConfiguration 接口进行描述,它包含 XML 中定义的所有对象的实例。
以下示例:
<configuration description="<description of the configuration>">
<!-- A build provider that takes local device information -->
<build_provider class="com.android.tradefed.build.BootstrapBuildProvider" />
<!-- Some target preparation, disabled by default -->
<target_preparer class="com.android.tradefed.targetprep.PreloadedClassesPreparer">
<option name="disable" value="true" />
</target_preparer>
<!-- One test running some unit tests -->
<test class="com.android.tradefed.testtype.HostTest">
<option name="class" value="com.android.tradefed.build.BuildInfoTest" />
</test>
</configuration>
将导致:
IConfiguration#getBuildProvider()
返回 BootstrapBuildProvider
实例。
IConfiguration#getTargetPreparers()
返回包含 PreloadedClassesPreparer
实例的 ITargetPreparer
的列表。
IConfiguration#getTests()
返回包含 HostTest
实例的 IRemoteTest
的列表。
配置对象中的每个对象均可映射到 XML 定义,因此理解 XML 定义通常有助于理解配置对象会返回什么内容。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[null,null,["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Tradefed configuration object\n\n[Tradefed XML configuration](/docs/core/tests/tradefed/architecture/xml-config)\nis parsed, and a `Configuration` object is created from it that describes the\ncomplete configuration.\n\nThe object is described by the\n[IConfiguration interface.](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/src/com/android/tradefed/config/IConfiguration.java)\nit will contain an instance of all the objects defined in the XML.\n\nThis example: \n\n \u003cconfiguration description=\"\u003cdescription of the configuration\u003e\"\u003e\n \u003c!-- A build provider that takes local device information --\u003e\n \u003cbuild_provider class=\"com.android.tradefed.build.BootstrapBuildProvider\" /\u003e\n\n \u003c!-- Some target preparation, disabled by default --\u003e\n \u003ctarget_preparer class=\"com.android.tradefed.targetprep.PreloadedClassesPreparer\"\u003e\n \u003coption name=\"disable\" value=\"true\" /\u003e\n \u003c/target_preparer\u003e\n\n \u003c!-- One test running some unit tests --\u003e\n \u003ctest class=\"com.android.tradefed.testtype.HostTest\"\u003e\n \u003coption name=\"class\" value=\"com.android.tradefed.build.BuildInfoTest\" /\u003e\n \u003c/test\u003e\n \u003c/configuration\u003e\n\nWill result in:\n\n- `IConfiguration#getBuildProvider()` to return a `BootstrapBuildProvider` instance.\n- `IConfiguration#getTargetPreparers()` to return a list of `ITargetPreparer` containing an instance of `PreloadedClassesPreparer`.\n- `IConfiguration#getTests()` to return a list of `IRemoteTest` containing an instance of `HostTest`.\n\nEvery single object in the configuration object can be mapped to the XML\ndefinition, so understanding the XML definition usually helps to understand\nwhat to expect from the configuration object."]]