package()
migration<<_banner.md>>
In 2020 we introduced new build templates for defining packages, components, and their tests. The new templates more closely reflect the project's architectural goals and direction. They replace old templates from 2016, mainly package()
, test_package()
, and unittest_package()
.
Some of the benefits of the new templates include:
deps
on the build targets that define what you want your component to use or your package to contain..cml
or .cmx
file).Migrating to the new templates makes our build definitions more readable and more useful, and helps clean underlying tech debt related to packaging that is kept alive only in service of the legacy package()
template. Please help us replace all uses of the old templates with the new ones so we can move forward.
Please review the guide on building components.
General experience in working with BUILD.gn
files is recommended but not entirely necessary. Please consult the GN reference{:.external} guide.
The best place to start is the list in //build/BUILD.gn
under the group "deprecated_package"
.
Find a directory that you‘re familiar with, or pick one at random. In this directory’s BUILD.gn
file you will likely see build targets with the old templates, for instance:
package("foo") { ... }
Note: For reference purposes, see the legacy migration guide. This guide is no longer maintained now that the project is complete.
In your directory of choice, remove all uses in the BUILD.gn
file of the templates package()
, test_package()
, or unittest_package()
. Note that there may be other templates used in the file that wrap these templates. Make sure you got them all by deleting the associated line in //build/BUILD.gn
and seeing that you're still able to generate the build (run fx gen
and see that GN successfully generated the Ninja file without errors).
When preparing your change, make sure to remove any lines from //build/BUILD.gn
listing the directories that you cleaned up.
Send code reviews to owners of the directories with the build definitions that you're changing, or to people listed below who volunteered to help with these migrations:
New volunteer? Please add yourself to the list!
Reach out for questions or for status updates: