Commit Graph

33 Commits

Author SHA1 Message Date
Ted Pudlik
8b8ad3820d pw_sys_io: Remove multiplexer, constraints
Bug: 347998044
Change-Id: I01a5ebd45ee98aee5263fa291687ed94cda1e67c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/218736
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Pigweed-Auto-Submit: Ted Pudlik <tpudlik@google.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
2024-06-28 22:25:01 +00:00
Ted Pudlik
c7128f5797 bazel: Fix unsorted-dict-items instances
Fix all instances of
https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#unsorted-dict-items
in upstream Pigweed.

This change was auto-generated by adding unsorted-dict-items to the list
of warnings fixed by `pw format` (see followup change), and then running
`pw format --fix`.

Bug: 340637744
Change-Id: Ifa238c23f4ca9547c073389690607a040626966f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/209880
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
2024-05-15 21:15:53 +00:00
Austin Foxley
4f238babeb pw_sys_io_stdio: Expand allowed uses beyond host
Select compatible targets via the constraint for the backend instead of
limiting to only hosts. There are embedded use cases where stdio output
makes sense (semi-hosting/simulators/etc).

Change-Id: I1d99dc054c808c8cfa1202422a596b210a745a18
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/208511
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Austin Foxley <afoxley@google.com>
2024-05-06 23:02:45 +00:00
Taylor Cramer
9a0e93fe50 *: Replace string_view& with string_view
References to `string_view` are nearly always unnecessary indirection.

Additionally, this CL clarifies that pw_sys_io WriteLine arguments do
not need to be null-terminated.

Fix: b/334933335
Fix: b/279159436

Change-Id: I13e0f8ad65d070e8363888242bc1a9b962be64ec
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/204591
Reviewed-by: Wyatt Hepler <hepler@google.com>
2024-04-22 20:42:22 +00:00
Carlos Chinchilla
9bbfe80a2f pw_{log_basic,sys_io}: Fix Soong definitions
- Define pw_log_basic, and pw_sys_io facades as cc_defaults.
- Define the pw_sys_io_stdio backend as cc_static_library
  following the new guidance at: https://pigweed.dev/pw_build_android/.

Bug: 328503970
Test: presubmits in Android main pass
Change-Id: I88cc3e52d89d009e2dea23dfb0fa809e7905adf0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/199034
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Pigweed-Auto-Submit: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Cindy Liu <hcindyl@google.com>
Reviewed-by: Matthew Sedam <matthewsedam@google.com>
2024-03-27 01:47:46 +00:00
Ted Pudlik
96c4cc2fc4 bazel: Use pw_facade
Replaces all uses of the Bazel macro pw_cc_facade with
pw_facade.

Bug: 328679085
Change-Id: Ifb9a14f0b57ece7fe656d2365d19c68f00075f1f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/195383
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
2024-03-12 23:45:36 +00:00
Ted Pudlik
77dbd41823 bazel: Replace pw_cc_library with cc_library
This change was automatically generated by running,

    buildozer 'set kind cc_library' ...:%pw_cc_library
    buildozer 'fix unusedLoads' ...:__pkg__

The first command converted all `pw_cc_library` targets to `cc_library`.
The second removed the (now unused) loads of `pw_cc_library` from the
affected BUILD.bazel files.

This change is just a no-op cleanup, since `pw_cc_library` became an
alias for `cc_library` in http://pwrev.dev/178924.

Bug: 267498492
Change-Id: Iefcc21fc5819a21612bbaffaafd1ffbec42faa26
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/186763
Reviewed-by: Armando Montanez <amontanez@google.com>
Pigweed-Auto-Submit: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-03 23:59:35 +00:00
Anthony DiGirolamo
fce548b115 docs: Cleanup indentation
- Remove accidental blockquotes around lists and code-blocks
- Reindent most directives to 3 spaces
- Add code-block:: proto where appropriate

Change-Id: I8b4e17c2a607b2cab042693304b9cc35f807b593
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168537
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
2023-08-25 04:25:14 +00:00
Ted Pudlik
7834d83c09 pw_sys_io: Add facade constraint_setting, docs
Adds a constraint_setting associated with the pw_sys_io facade, and
constraint_values for the backends for this facade provided by Pigweed.
Also documents how this mechanism should be used.

pw_sys_io is just the first facade to receive this treatment: the rest
will be handled in followup CLs.

Bug: b/272090220
Change-Id: Id1f670ce194757f4ccfe489e0f29ac936f36a1ab
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/133290
Reviewed-by: Erik Gilling <konkers@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Reviewed-by: Kayce Basques <kayce@google.com>
2023-07-13 22:53:01 +00:00
Ewout van Bekkum
b44a2d723a pw_build/cmake: Migrate pw_add_module_library -> pw_add_library
Updates pw_add_library to replace pw_add_module_library where
the library type must be explicitly specified, just like
pw_add_library_generic.

Migrates all pw_add_module_library uses to pw_add_library.

Change-Id: I62efdeca1e227a3c82667cac5e46fe383c280cc2
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/119318
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2022-11-15 02:09:30 +00:00
Tim Laurence
2621ad173e all_modules: Update OWNERS files to match styling
Change-Id: Iabcf3a22486904b8ac50622a5ac9ba92fbdaf321
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/116330
Commit-Queue: Tim Laurence <timlaurence@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
2022-11-06 22:58:43 +00:00
Rob Mohr
812c7d550e OWNERS: Add keep_sorted lines
Bug: b/250875082
Change-Id: I676f75e02a8609b3f62cab7f290e21b9fc5d4e83
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/112713
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
2022-10-08 03:18:27 +00:00
Wyatt Hepler
8f425499e1 pw_build: Require "tests" and "docs" targets in all modules
- Allow empty pw_test_group targets.
- Create empty pw_test_group targets for modules that need them.
- Create stub docs pages for modules that are missing them.
- Require odules to provide "tests" and "docs" targets by assuming
  they're present in the module list generation code.
- Update the generated modules list.

Change-Id: I5a67741afa0a8a5d2e2ba508435027f750a471c4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103487
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
2022-07-26 22:43:15 +00:00
Wyatt Hepler
6c5df358e6 pw_span: Switch from std::span to pw::span
This changes uses of std::span to pw::span. No changes are made to build
dependencies in this commit.

This change was made with the following shell script:

  #!/bin/bash

  readonly FILES="$(git ls-files '*.rst' '*.md' '*.h' '*.cc' '*.py')"
  readonly PW_NS_FILES="$(git grep -l 'namespace pw\>' | grep -v generate_decoding_test_data.cc)"

  echo "Updating #includes"
  sed -i --follow-symlinks \
      's/#include <span>/#include "pw_span\/span.h"/g' ${FILES}

  for name in span as_bytes as_writable_bytes dynamic_extent; do
    echo Renaming std::$name to pw::$name
    sed -i --follow-symlinks "s/std::$name/pw::$name/g" ${FILES}
    sed -i --follow-symlinks "s/pw::$name/$name/g" ${PW_NS_FILES}
    sed -i --follow-symlinks "s/using $name;//" ${PW_NS_FILES}
  done

  git checkout pw_span

  pw format -b origin/main --fix

Bug: b/235237667
Change-Id: I32edfbcb7cadf3ab39009596fdb7275fcc5ea3f5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98264
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
2022-06-29 00:15:46 +00:00
Ewout van Bekkum
688f8036f0 pw_sys_io: Improve CMake support
Change-Id: I947f00449a836481aaaa8919e1a6bad00542cca7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/97744
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2022-06-10 23:08:30 +00:00
Rob Mohr
77d8571bb0 OWNERS: Add throughout tree
These are likely incomplete but not incorrect.

Change-Id: Ie6a240fccea8c7f61420ed684b649390d3eb840f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/67140
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-11-03 21:46:37 +00:00
Akira Baruah
40a9c3f128 bazel: Rename BUILD to BUILD.bazel
Avoids potential naming conflicts with other build systems.

Change-Id: Ib6569cc05c028d5680879724304b17dfc1fae0af
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/49306
Commit-Queue: Akira Baruah <akirabaruah@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: Nathaniel Brough <nathaniel.brough@gmail.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-07-14 19:36:41 +00:00
Rob Mohr
5fc2541e8a bazel: Remove unnecessary license comments
We get warnings when these are imported into google3.

Change-Id: I8daaef65c3ae35d81e75815460d659b53c122ee3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/50580
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-06-29 15:37:52 +00:00
Nathaniel Brough
c2d5781a76 workspace: Switches Bazel builds to using facades
Switches over all packages that were previously working with Bazel
to use the new facades API. In the process of doing this a few new
modules where newly compatible with Bazel. This is reflected in the
changes to the presubmit.

Change-Id: I12aa67fa43b9ac2b947f33814f901dd00f929543
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/41561
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Akira Baruah <akirabaruah@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Keir Mierle <keir@google.com>
2021-05-01 16:57:23 +00:00
Wyatt Hepler
1b3da3a983 pw_status: Replace Status::Ok() with OkStatus()
- Mark Status::Ok() and StatusWithSize::Ok() as deprecated.
- Replace Status::Ok() with OkStatus().
- Replace StatusWithSize::Ok() with StatusWithSize().

Change-Id: If7192282446bf6d7f90990bb0b4f1b1b89a9228a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29003
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-01-11 20:28:12 +00:00
Keir Mierle
6909f18e6b pw_sys_io: Add TryReadByte(byte* dest) function
This adds a non-blocking version of ReadByte() that enables writing, for
example, a superloop that combines custom processing simultaneously with
byte input handling for the RPC subsystem.

Change-Id: I9cb1e6ae8c944ca7cdff6d4bff101ac52e80b53a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23980
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Keir Mierle <keir@google.com>
2020-11-07 01:17:28 +00:00
Wyatt Hepler
0a6f763b12 CMake: Revamp CMake build
- Define CMake cache variables (similar to gn args) for facade backends.
- Create simple initial toolchain files for GCC and Clang.
- Misc updates to pigweed.cmake and pw_build/CMakeLists.txt.
- Add or expand various CMakeLists.txt files.
- Watch CMake files in watch.py to support using CMake in pw watch.

Change-Id: I490d157485d02811a11f6a3589a0508ea1851f58
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22840
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-11-04 22:31:07 +00:00
Wyatt Hepler
d49f8fe3f3 BUILD.gn files: Improve import formatting
The "# gn-format disable" comments are no longer necessary. Delete these
comments and reformat with a Vim macro and gn format.

Change-Id: Ia62c40ad73eef91187d0d443d6e3b0fa723e5aa9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21380
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-10-15 18:12:55 +00:00
Wyatt Hepler
f9fb90f299 docs: Make labels consistent; remove boilerplate
- Update labels so they use consistent naming. Instead of the
  copy-and-pasted `chapter` prefix, name labels with a prefix consistent
  with what they point to:
  - "module-" for module
  - "target-" for targets
  - "docs-" for general documentation
- Remove the unnecessary highlight and default-domain directives.
  Neither is necessary since the Pigweed docs always specify the
  language in code snippets and other directives.

Change-Id: I55c34e9ec919f6f4670e5d3d008e0edf5fecf05b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19328
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-10-01 21:47:35 +00:00
Wyatt Hepler
d78f7c6b75 pw_status: Update Status::CODE to Status::Code()
- Update Status::CODE style to Status::Code() using
  pw_status/update_style.py.
- Make minor adjustments to the pw_assert tests to get them passing.

Change-Id: Ie54c3c605178fd1e42c7cedbcff324115f3ed279
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19165
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
2020-09-30 18:09:44 +00:00
Wyatt Hepler
e2cbadfa0c pw_span: Switch from pw::span to std::span
Replace pw::span with std::span and "pw_span/span.h" with <span>
throughout the codebase.

Change-Id: Ib1fa873168b6093794e861611d750fcad6285d6c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12801
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-07-01 01:37:27 +00:00
Armando Montanez
a761e32bf9 Update docs
First pass at docs to bring them up to date with The Great GN Refactor.
More to follow.

Change-Id: I02dc977fcdc7bf3efa8fc9080282dee9b1455cdd
2020-06-16 10:00:17 -07:00
Armando Montanez
82bbce4aeb Remove legacy_target.gni
Transition to args is done, so this import is no longer needed.

Change-Id: Id42e06ec9fcc16eace2cc7ef51a5dacaf012147a
2020-06-16 09:50:59 -07:00
Alexei Frolov
4c0428a0d8 Define Linux clang target as toolchain
This change configures the Linux clang -Og target as a toolchain with
args. To support this, all Pigweed variables from pw_vars_default are
made into build args, defined within their respective modules.

The Linux clang target/toolchain is the only one that currently works.
Pigweed's other targets will be ported in later changes.

Change-Id: I051e29fde7577e41a3184c37031a4e04936404e1
2020-06-16 09:50:59 -07:00
Armando Montanez
fb3d3fba79 Don't declare pigweed variables as globals
Require targets to explicitly import pigweed variable definitions. This
moves out some necessary logic from the BUILDCONFIG.gn file.

Change-Id: If9c9fe5a680cc9d897a0e8a55889873be618ed84
2020-06-16 09:50:59 -07:00
Alexei Frolov
edd2f148be pw_build: Switch to pw_* target types
This change replaces the implicit overrides of the default GN target
types in BUILDCONFIG.gn with explicit pw_* versions. This is done to
allow Pigweed to build within larger GN projects without modifying their
BUILDCONFIG files.

Change-Id: I1d1e41d5e9bde8fe076f7031f3c2b98b9630ff70
2020-06-16 09:50:59 -07:00
Armando Montanez
0054a9be70 Docs: Add missing RST docs
Adds dcos.rst files for all modules lacking documentation.

Change-Id: Ief5594831d31fcb876381a4a3886382fab7d595e
2020-03-17 00:13:35 +00:00
Armando Montanez
f7a5a742ab Rename pw_dumb_io to pw_sys_io
Rename pw_dumb_io facade and backends to use the more deliberate name
pw_sys_io moving forward.

Change-Id: I968480715967ab8de491856afa1b7692b973ed7e
2020-03-03 18:19:17 +00:00