اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
للاطّلاع على قائمة بالأوامر المتاحة، شغِّل: npm run
أنشئ جميع أهداف الإصدار والاختبار باستخدام:
npm run build:prod
يمكنك تشغيل Winscope باستخدام:
npm run start
إنشاء أجزاء منفصلة
يمكنك إنشاء أجزاء فردية من Winscope بشكل منفصل باستخدام الطوبوص التالية:
الأمر
الوصف
build:trace_processor
تتحقّق من أحدث إصدار من trace_processor في Perfetto وتعيد إنشائه.
build:protos
تعيد تجميع تعريفات proto.
إجراء الاختبارات
يحتوي Winscope على اختبارات الوحدة والاختبارات الشاملة. لتنفيذها، استخدِم npm run
<command>:
الأمر
الوصف
test:unit:ci
لتشغيل اختبارات الوحدة بتنسيق أقل تفصيلاً لدمج الإصدارات التلقائية
أو أداة الربط المُسبَق لإرسال المحتوى
test:unit:dev
لتشغيل اختبارات الوحدات بتنسيق أكثر تفصيلاً
للتطوير على الجهاز يراقب هذا الوضع التغييرات و
يعيد تلقائيًا إجراء الاختبارات الصحيحة.
test:e2e
تشغيل الاختبارات الشاملة، مثل الاختبارات المتعلقة
ببروتوكول الأدوات المتعددة
test:presubmit:quiet
تُنشئ جميع اختبارات الوحدة وأدوات فحص الأخطاء وتحليل الرسم البياني
قبل إرسال الرمز البرمجي بتنسيق أقل تفصيلاً لعمليات التكامل المستمر أو ميزة
presubmithook.
test:presubmit
إنشاء جميع الاختبارات الوحداتية وأدوات التدقيق وتحليل
الرسوم البيانية قبل إرسالها بتنسيق أكثر تفصيلاً
للتحقّق من التطوير على الجهاز
test:all
يُجري جميع الاختبارات (الاختبارات على مستوى الوحدة والاختبارات الشاملة) وأدوات التدقيق و
تحليل الرسوم البيانية بتنسيق أكثر تفصيلاً لعملية
التطوير على الجهاز.
تعديل تعيين @IntDef
@IntDef هو تعليق توضيحي يُستخدَم في Android لتقييد القيم المحتملة لسلسلة رمز برمجي
عددية. يستخدم Winscope تعيينًا لهذه التعليقات التوضيحية لعرض اسم
القيمة بدلاً من عددها الصحيح.
بالإضافة إلى عمليات الإنشاء والاختبارات، تحتوي نصوص Winscope البرمجية على إمكانات أخرى، كما هو موضح في الجدول. لتنفيذها، استخدِم npm run command:
الأمر
الوصف
format:check
التحقّق من المشاكل في تنسيق الرموز باستخدام prettier
format:fix
التحقّق من مشاكل تنسيق الرموز البرمجية وإصلاحها تلقائيًا باستخدام prettier
eslint:check
التحقّق من المشاكل في تنسيق الرموز باستخدام eslint
eslint:fix
التحقّق من مشاكل تنسيق الرموز البرمجية وإصلاحها تلقائيًا باستخدام eslint
tslint:check
التحقّق من المشاكل في تنسيق الرموز باستخدام tslint
tslint:fix
التحقّق من مشاكل تنسيق الرموز البرمجية وإصلاحها تلقائيًا باستخدام tslint
deps_graph:check_cycles
لتحليل الرمز البرمجي للاعتماديات الدورية
تحديد المشاكل وحلّها
اتّبِع النصائح التالية لتحديد المشاكل وحلّها:
الخطأ ProtocolError: missing required '<FIELD>' أو TypeError: Cannot
read property '<PROP>' of null
يحدث ذلك عند إنشاء ملف التتبُّع باستخدام تعريف proto جديد،
يحتوي على حقول مطلوب جديدة.
تأكَّد من فتح عملية التتبُّع على إصدار Winscope الصحيح
(master أو S أو R).
في حال إنشاء الحقل الجديد في ملف proto، أعِد تجميع ملفات proto في
Winscope باستخدام npm run build:protos.
بعض إصدارات الملحقات المثبَّتة غير صحيحة (تعذُّر إنشاء الحِزمة)
ألغِ التغييرات التي أجريتها على package.json وpackage-lock.json. أزِل
node_modules. شغِّل npm install مرة أخرى.
لقد أضفت حقلًا جديدًا إلى أحد ملفات proto. كيف يمكنني عرضها؟
يستخدم Winscope تعريفات proto منذ وقت تجميعه، لذا لن تظهر الحقول
الجديدة تلقائيًا. لعرض حقول جديدة، أعِد إنشاء ملفات protos
باستخدام npm run build:protos.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-24 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-08-24 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Run Winscope\n\nWinscope tracing is part of the Android framework. This page outlines the\nsteps required to download, build, and run the Winscope trace viewer locally.\n\nBuild Winscope locally\n----------------------\n\nFollow these steps to set up your PC to run the Winscope tracer:\n\n1. [Download the Android source](/docs/setup/build/building).\n2. Navigate to the Winscope folder:\n\n cd development/tools/winscope\n\n3. Install dependencies using:\n\n npm install\n\n To see a list of available commands, run: `npm run`\n4. Build all prod and test targets using:\n\n npm run build:prod\n\n5. Run Winscope using:\n\n npm run start\n\n| **Note:** You can also download and build Winscope to host on a standard web server to get a shareable link to the tool.\n\nBuild separate parts\n--------------------\n\nYou can build individual parts of Winscope separately using the following\ncommands:\n\n| Command | Description |\n|-------------------------|-----------------------------------------------------------------------------|\n| `build:trace_processor` | Checks out and rebuilds the latest version of Perfetto's `trace_processor`. |\n| `build:protos` | Recompiles the proto definitions. |\n\nRun tests\n---------\n\n| **Tip:** Winscope doesn't build on Soong and can't be built by Tradefed, so it's recommended to have a local Git hook to the tests in your local environment.\n\nWinscope contains unit and end-to-end tests. To run them use `npm run\n\u003ccommand\u003e`:\n\n| Command | Description |\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `test:unit:ci` | Runs the unit tests in a less verbose format for CI or presubmit hook. |\n| `test:unit:dev` | Runs the unit tests in a more verbose format for local development. This mode watches for changes and automatically reruns the correct tests. |\n| `test:e2e` | Runs the end-to-end tests, such as those for the cross-tool protocol. |\n| `test:presubmit:quiet` | Builds all presubmit unit tests, linters, and graph analysis in a less verbose format for CI or presubmit hook. |\n| `test:presubmit` | Builds all presubmit unit tests, linters, and graph analysis in a more verbose format for local development. |\n| `test:all` | Runs all tests (unit and end-to-end), linters, and graph analysis in a more verbose format for local development. |\n\n### Update @IntDef mapping\n\n`@IntDef` is an annotation used in Android to restrict the possible values of an\ninteger. Winscope uses a mapping of these annotations to display the name of the\nvalue instead of the integer.\n\nTo update the `@IntDef` mapping, do the following:\n\n1. Build `:framework-minus-apex-intdefs` for the annotation preprocessor to run:\n\n mp :framework-minus-apex-intdefs\n\n2. Copy the generated `intDefMapping.json` file to the prebuilts repository:\n\n $ python3 -c 'import sys,json,collections; print(json.dumps(collections.OrderedDict(sorted(collections.ChainMap(*map(lambda x:json.load(open(x)), sys.argv[1:])).items())), indent=2))' $(find out/soong/.intermediates/frameworks/base -iname intDefMapping.json) \u003e ./development/tools/winscope/src/common/intDefMapping.json\n\n3. Upload the changes in Winscope using `repo upload`.\n\nOther commands\n--------------\n\nIn addition to build and tests, Winscope scripts contain other capabilities, as\nshown in the table. To run them use `npm run `\u003cvar translate=\"no\"\u003ecommand\u003c/var\u003e:\n\n| Command | Description |\n|---------------------------|----------------------------------------------------------------|\n| `format:check` | Checks for code formatting issues using `prettier`. |\n| `format:fix` | Checks and auto fixes code formatting issues using `prettier`. |\n| `eslint:check` | Checks for code formatting issues using `eslint`. |\n| `eslint:fix` | Checks and auto fixes code formatting issues using `eslint`. |\n| `tslint:check` | Checks for code formatting issues using `tslint`. |\n| `tslint:fix` | Checks and auto fixes code formatting issues using `tslint`. |\n| `deps_graph:check_cycles` | Analyzes the code for cyclical dependencies. |\n\nTroubleshoot\n------------\n\nUse the following tips for troubleshooting:\n\n- **Error `ProtocolError: missing required '\u003cFIELD\u003e'` or `TypeError: Cannot\n read property '\u003cPROP\u003e' of null`**\n\n - This occurs when the trace file was created with a new proto definition,\n containing new *required* fields.\n\n 1. Make sure you're opening the trace on the correct Winscope version (master, S, or R).\n 2. If you create the new field on the proto, recompile the protos in\n Winscope using `npm run build:protos`.\n\n | **Note:** You shouldn't need a new required field, because the protos should be backward compatible.\n- **Some installed dependency versions are wrong (build fails)**\n\n - Revert changes to `package.json` and `package-lock.json`. Remove `node_modules`. Run `npm install` again.\n- **I added a new field to one of the proto files. How do I display it?**\n\n - Winscope uses the proto definitions from when it was compiled, so new fields won't appear by default. To show new fields, rebuild the protos using `npm run build:protos`."]]