-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
third_party: Copybara script for importing fit::function from Fuchsia
pw::Function's implementation will be replaced with fit::function from Fuchsia. fit::function is more advanced than pw::Function and supports features like dynamic allocation and sharing callables between multiple fit::function instances. This copy.bara.sky script will be used to import the fit::function sources and transform them as needed. Change-Id: Iab420eb4c9fca13278f4a0cd19d88c17eea4456b Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103548 Pigweed-Auto-Submit: Wyatt Hepler <[email protected]> Commit-Queue: Auto-Submit <[email protected]> Reviewed-by: Vadim Spivak <[email protected]> Reviewed-by: Ted Pudlik <[email protected]>
- Loading branch information
Showing
5 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2022 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
import("//build_overrides/pigweed.gni") | ||
|
||
import("$dir_pw_docgen/docs.gni") | ||
|
||
pw_doc_group("docs") { | ||
sources = [ "docs.rst" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright 2022 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
fuchsia_repo_files = [ | ||
".clang-format", | ||
# fit | ||
"sdk/lib/fit/include/lib/fit/function.h", | ||
"sdk/lib/fit/include/lib/fit/function_internal.h", | ||
"sdk/lib/fit/include/lib/fit/nullable.h", | ||
"sdk/lib/fit/include/lib/fit/traits.h", | ||
"sdk/lib/fit/include/lib/fit/utility_internal.h", | ||
# stdcompat | ||
"sdk/lib/stdcompat/include/lib/stdcompat/optional.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/type_traits.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/utility.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/version.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/internal/constructors.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/internal/exception.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/internal/storage.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/internal/type_traits.h", | ||
"sdk/lib/stdcompat/include/lib/stdcompat/internal/utility.h", | ||
] | ||
|
||
# Replace __builtin_abort with PW_ASSERT. | ||
replace_builtin_abort_paths = glob([ | ||
"sdk/lib/fit/include/lib/fit/function_internal.h", | ||
]) | ||
|
||
replace_builtin_abort = [ | ||
core.replace( | ||
paths = replace_builtin_abort_paths, | ||
before = "namespace fit {", | ||
after = "#include \"pw_assert/assert.h\"\n\nnamespace fit {", | ||
), | ||
core.replace( | ||
paths = replace_builtin_abort_paths, | ||
before = "__builtin_abort()", | ||
after = "PW_ASSERT(false)", | ||
), | ||
] | ||
|
||
core.workflow( | ||
name = "default", | ||
description = "Imports files from Fuchsia's fit library", | ||
origin = git.origin( | ||
url = "https://fuchsia.googlesource.com/fuchsia", | ||
ref = "main", | ||
), | ||
destination = git.gerrit_destination( | ||
url = "https://pigweed.googlesource.com/pigweed/pigweed", | ||
fetch = "main", | ||
checker = leakr.disable_check("Syncing between OSS projects"), | ||
), | ||
origin_files = glob(fuchsia_repo_files), | ||
destination_files = glob(["third_party/fuchsia/repo/**"]), | ||
authoring = authoring.pass_thru("Fuchsia Authors <[email protected]>"), | ||
transformations = replace_builtin_abort + [ | ||
core.move("", "third_party/fuchsia/repo"), | ||
metadata.replace_message("third_party/fuchsia: Copybara import of fit library"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.. _module-pw_third_party_fuchsia: | ||
|
||
================= | ||
Fuchsia libraries | ||
================= | ||
`Fuchsia <https://fuchsia.dev/>`_ is a modern open source operating system | ||
developed by Google. | ||
|
||
Pigweed does not use the Fuchsia operating system itself, but uses some | ||
low-level libraries developed for it. | ||
|
||
-------- | ||
Features | ||
-------- | ||
Parts of two Fuchsia libraries are used in Pigweed: | ||
|
||
- `FIT <https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/lib/fit/>`_ -- | ||
Portable library of low-level C++ features. | ||
- `stdcompat <https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/lib/stdcompat/>`_ -- | ||
Implements newer C++ features for older standards. | ||
|
||
-------------------- | ||
Code synchronization | ||
-------------------- | ||
Unlike other third party libraries used by Pigweed, some Fuchsia source code is | ||
included in tree. A few factors drove this decision: | ||
|
||
- Core Pigweed features like :cpp:type:`pw::Function` depend on these Fuchsia | ||
libraries. Including the source in-tree avoids having Pigweed require an | ||
an external repository. | ||
- The Fuchsia repository is too large to require downstream projects to clone. | ||
|
||
If Fuchsia moves ``stdcompat`` and ``fit`` to separate repositories, the | ||
decision to include Fuchsia code in tree may be reconsidered. | ||
|
||
Process | ||
======= | ||
Code is synchronized between the `Fuchsia repository | ||
<https://fuchsia.googlesource.com/fuchsia>`_ and the `Pigweed repository | ||
<https://pigweed.googlesource.com/pigweed/pigweed>`_ using the | ||
`third_party/fuchsia/copy.bara.sky | ||
<https://cs.opensource.google/pigweed/pigweed/+/main:third_party/fuchsia/copy.bara.sky>`_) | ||
`Copybara <https://github.com/google/copybara>`_ script. | ||
|
||
To synchronize with the Fuchsia repository, run the ``copybara`` tool with the | ||
script: | ||
|
||
.. code-block:: bash | ||
copybara third_party/fuchsia/copy.bara.sky | ||
That creates a Gerrit change with updates from the Fuchsia repo, if any. | ||
|
||
Files are synced from Fuchsia repository to their original paths under the | ||
``third_party/fuchsia/repo`` directory in Pigweed. |