Od 27 marca 2025 r. zalecamy używanie android-latest-release
zamiast aosp-main
do kompilowania i wspołtworzenia AOSP. Więcej informacji znajdziesz w artykule o zmianach w AOSP.
Obiekt konfiguracji Tradefed
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Konfiguracja XML z usługą Tradefed jest analizowana, a na jej podstawie tworzony jest obiekt Configuration
opisujący pełną konfigurację.
Obiekt jest opisany przez interfejs IConfiguration.Zawiera on instancję wszystkich obiektów zdefiniowanych w pliku XML.
W tym przykładzie:
<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>
Spowoduje to:
IConfiguration#getBuildProvider()
, aby zwrócić instancję BootstrapBuildProvider
.
IConfiguration#getTargetPreparers()
zwraca listę ITargetPreparer
zawierającą instancję PreloadedClassesPreparer
.
IConfiguration#getTests()
zwraca listę IRemoteTest
zawierającą instancję HostTest
.
Każdy obiekt w obiekcie konfiguracji można zmapować na definicję XML, więc zrozumienie definicji XML zwykle pomaga zrozumieć, czego można oczekiwać od obiektu konfiguracji.
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],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."]]