自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
提供非核心程式碼
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
為讓為 tradefederation 專案提供非核心來源代碼的團隊擁有審查程序的完整所有權,我們已建立以下專案,並為所有團隊提供公開 +2 權限。這可讓核心貿易聯盟團隊不必負擔與核心架構無關的所有程式碼審查工作,同時讓其他團隊在審查週期中更快進行迭代。
非核心 src 是指 tradefederation 架構不必使用才能運作的程式碼 (例如自訂測試、設定、特定測試公用程式)。
重要事項 非核心 src 不應擴充核心 tradefederation 類別。這會影響日後的重構/清理作業。如果不確定程式碼屬於核心或貢獻程式碼,請與 android-tradefed@ 聯絡,以便釐清。核心貿易聯盟團隊很樂意提供建議,並接收功能要求。
核心 tradefederation 類別的範例是 com.google.android.tradefed.build
套件中的任何類別,例如:com.google.android.tradefed.build.LaunchControlProvider
再次提醒,如果您不清楚哪些類別會被視為 android-tradefed@ 的核心類別,請與我們聯絡。
[TOC]
貢獻專案的路徑
這些貢獻專案適用於哪些對象?
如果您目前在 tradefederation 專案中編寫測試/測試公用程式/設定,這些專案就是為您建立的。
貢獻專案中的程式碼審查
貢獻專案的目標是讓您在 Tradefed 中進行開發,而無須經過核心團隊 (android-tradefed@) 的審查。因此,我們希望您的團隊或任何熟悉您情況的人員,都能對您的 CL 進行程式碼審查。
如果您在特定案例中遇到問題或需要指引,歡迎隨時與 android-tradefed@ 聯絡,但請不要預設依賴該團隊在 contrib 中進行程式碼審查。Tradefed 團隊在 contrib 中沒有程式碼審查的服務水準目標。
我該從哪裡開始進行這些專案?
這些專案已新增至下列分支資訊清單,並已納入主要平台的檢查作業,因此如果您在環境中看不到這些專案,表示您需要進行存放區同步處理才能貢獻內容。
- main
- tradefed
- oc-dev
- oc-dev-plus-aosp
- nyc-mr2-dev-plus-aosp
- main-daydream-dev
- main-without-vendor
- wear-main
開發和測試
contrib 中的開發作業應與 Android 存放區中的其他任何位置一樣,符合相同的品質標準:
- 遵守 Android 格式規範
- 測試程式碼並提交測試
- 設計精心周到且合理
如何在 contrib 中進行本機測試?
Android 開放原始碼計劃
在 AOSP 中,貢獻內容的單元測試位於 platform/tools/tradefederation/contrib/tests/src/,且單元測試應加入 com.android.tradefed.prodtests.UnitTests,以便在提交前和本機測試指令碼中選取。
執行 lunch 後的 Aosp 本機指令碼:
tools/tradefederation/core/tests/run_tradefed_aosp_presubmit.sh
更新貢獻專案的建構規則
建構規則 (Makefile) 位於各自的 build/
資料夾中,並由 OWNERS
檔案鎖定,因此您必須經過核心團隊的額外審查,才能修改這些規則。這是 contrib 專案唯一的限制。
我們需要進行這項審查,確保在未經核心團隊同意或知情情況下,不會在整體 Tradefed 專案中新增任何意外的依附元件。如果您確實需要新增一些依附元件,請與 android-tradefed@
聯絡,讓他們查看您的用途並提供建議。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Contribute non-core code\n\nTo enable teams that contribute non-core src to the tradefederation projects\nfull ownership of the review process, the following projects have been created\nwith open +2 rights for all teams. This relieves the core tradefederation team\nfrom the burden of all code reviews un-related to the core framework while also\nallowing the other teams to iterate faster in their review cycle.\n\n**Non-core src** is defined as code that is not required by the tradefederation\nframework to be functional (e.g. custom tests, configs, specific test\nutilities).\n\u003e ***IMPORTANT*** Non-core src should not extend core tradefederation classes.\n\u003e Doing so impacts future refactoring/clean up. If you are unsure if your code\n\u003e belongs in core or contrib, reach out to android-tradefed@ for clarification.\n\u003e The core tradefederation team is happy to advise and receive feature requests.\n\u003e\n\u003e An example core tradefederation class would be any class in the\n\u003e `com.google.android.tradefed.build` package like:\n\u003e `com.google.android.tradefed.build.LaunchControlProvider`\n\u003e\n\u003e Again, please reach out if you are unclear what would be considered a core\n\u003e class to android-tradefed@.\n\n\\[TOC\\]\n\nContrib projects' paths\n-----------------------\n\n- [platform/tools/tradefederation/contrib](https://android.googlesource.com/platform/tools/tradefederation/contrib/+/refs/heads/main)\n\nWho are these contrib projects for?\n-----------------------------------\n\nIf you currently work in the tradefederation projects writing tests/test\nutilities/configs, these projects were created for you.\n\nCode reviews in contrib projects\n--------------------------------\n\nThe goal of the contrib projects is to allow you to do development in Tradefed\nwithout needing the review of the core team (android-tradefed@). So we expect\nyour team or anybody familiar with your context to perform the code reviews on\nyour CLs.\n\nAlways feel free to reach out to android-tradefed@ if stuck or need guidance on\na particular case, but do not rely on it by default to do your code review in\ncontrib. **Tradefed team has no SLO when it comes to code reviews in contrib.**\n\nWhere can I start working on these projects?\n--------------------------------------------\n\nThey have been added to the following branch manifests and are already part of\nmain platform checkout so if you don't see the projects in your environment,\nyou're a repo sync away from contributing.\n\n- main\n- tradefed\n- oc-dev\n- oc-dev-plus-aosp\n- nyc-mr2-dev-plus-aosp\n- main-daydream-dev\n- main-without-vendor\n- wear-main\n\nDevelopment and testing\n-----------------------\n\nDevelopment in contrib is expected to have the same quality bar as anywhere else\nin the Android repositories:\n\n- Respect the Android formatting guidelines\n- Code is tested and submitted with tests\n- Design is thoughtful and makes sense\n\n### How do I test locally in contrib?\n\n#### AOSP\n\nIn aosp, unit tests of contrib are located in\n[platform/tools/tradefederation/contrib/tests/src/](https://android.googlesource.com/platform/tools/tradefederation/contrib/+/refs/heads/android16-release/tests/src/com/android)\nand unit tests should be added to\n[com.android.tradefed.prodtests.UnitTests](https://android.googlesource.com/platform/tools/tradefederation/contrib/+/refs/heads/android16-release/tests/src/com/android/tradefed/prodtests/UnitTests.java)\nto be picked up in presubmit and local testing scripts.\n\nAosp local scripts after running lunch: \n\n tools/tradefederation/core/tests/run_tradefed_aosp_presubmit.sh\n\nBuild rules update to contrib projects\n--------------------------------------\n\nThe build rules (makefiles) are under their own `build/` folder and locked by an\n`OWNERS` file that will prevent your from modifying them without an extra review\nfrom the core team. This is the only limitation to the contrib project.\n\nWe need this review to ensure no unexpected dependencies are added to the\noverall Tradefed projects without the knowledge or agreement from the core team.\nIf you really need some new dependencies to be added, please contact\n`android-tradefed@` to look into your use cases and advise you."]]