Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .gni containing lists of files needed by GN #152

Open
BenjaminLawson opened this issue Jul 3, 2024 · 5 comments
Open

Add .gni containing lists of files needed by GN #152

BenjaminLawson opened this issue Jul 3, 2024 · 5 comments
Labels

Comments

@BenjaminLawson
Copy link
Contributor

BenjaminLawson commented Jul 3, 2024

Currently we have to maintain lists of Emboss files for use in GN build targets in Pigweed, including the compiler python files and the cpp_utils headers. It would be much more maintainable if there was a .gni file in upstream Emboss containing these file lists.

@EricRahm
Copy link
Collaborator

I totally get why you want this, I'm just not sure how the emboss project will keep it up to date. We're currently only setup for bazel builds. Maybe adding a tool that can generate these files as part of the bazel build is what we want?

@EricRahm
Copy link
Collaborator

EricRahm commented Jul 17, 2024

For concrete examples we have:

  1. Pigweed's build_defs.gni
  2. Fuchsia's build_defs.gni
  3. An unlanded but being prototyped version for Android:
python_library_host {
    name: "emboss_compiler",
    srcs: [
        "compiler/back_end/cpp/*.py",
        "compiler/back_end/util/*.py",
        "compiler/front_end/*.py",
        "compiler/util/*.py",
    ],
    data: [
        "compiler/back_end/cpp/generated_code_templates",
        "compiler/front_end/error_examples",
        "compiler/front_end/prelude.emb",
        "compiler/front_end/reserved_words",
    ],
}

Additionally each of those has some sort of target for the C++ header library as well, something along the lines of:

# GN
pw_source_set("cpp_utils") {
  # emboss depends on a separate checkout not included in pigweed, so
  # ignore gn check for this module.
  check_includes = false
  public = [
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_arithmetic.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_arithmetic_all_known_generated.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_arithmetic_maximum_operation_generated.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_array_view.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_bit_util.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_constant_view.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_cpp_types.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_cpp_util.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_defines.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_enum_view.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_maybe.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_memory_util.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_prelude.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_text_util.h",
    "$dir_pw_third_party_emboss/runtime/cpp/emboss_view_parameters.h",
  ]
  public_configs = [ ":disable_warnings" ]
  public_deps = [ pw_third_party_emboss_CONFIG ]
  visibility = [ "*" ]
}

# Cmake
pw_add_library(pw_third_party.emboss.cpp_utils INTERFACE
  HEADERS
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic_all_known_generated.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_arithmetic_maximum_operation_generated.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_array_view.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_bit_util.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_constant_view.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_cpp_types.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_cpp_util.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_defines.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_enum_view.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_maybe.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_memory_util.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_prelude.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_text_util.h
    ${dir_pw_third_party_emboss}/runtime/cpp/emboss_view_parameters.h
  PUBLIC_INCLUDES
    ${dir_pw_third_party_emboss}
  PUBLIC_DEPS
    pw_third_party.emboss.config_assert
    pw_third_party.emboss._disable_warnings
)

So it'd be nice to cover that case too.

@jasongraffius jasongraffius added the enhancement New feature or request label Jul 22, 2024
@studgeek
Copy link
Contributor

studgeek commented Aug 9, 2024

358665524 is an example of the kinds of bugs we run into. This is because Fuchsia builds require all inputs to listed - https://fuchsia.dev/fuchsia-src/development/build/hermetic_actions.

@studgeek
Copy link
Contributor

I created Pigweed issue Update emboss build rules to pull their file list from emboss repo [359386289] - Pigweed for the work that will need to happen in Pigweed alongside changes here in Emboss.

studgeek added a commit to studgeek/emboss that referenced this issue Aug 13, 2024
Provide a JSON file that lists files used in the build.

It will  to be used by downstream, non-bazel builds. For
example, https://fxrev.dev/1100339 is one planned usage of this.

Emboss Issue: google#152
Pigweed Bug: https://pwbug.dev/359386289

Change-Id: Id33d879cea95d86f6cc7a16cd395a8c1a4380cbf
studgeek added a commit to studgeek/emboss that referenced this issue Aug 13, 2024
Provide a JSON file that lists files used in the build.

It will be used by downstream, non-bazel builds. For
example, https://fxrev.dev/1100339 is one planned usage of this.

Emboss Issue: google#152
Pigweed Bug: https://pwbug.dev/359386289

Change-Id: Id33d879cea95d86f6cc7a16cd395a8c1a4380cbf
@studgeek
Copy link
Contributor

#171 provides a json file that handles this feature request.

I also filed #172 as a follow-up issue to keep bazel and the new build_info.json in sync.

studgeek added a commit to studgeek/emboss that referenced this issue Aug 13, 2024
Provide a JSON file that lists files used in the build.

It will be used by downstream, non-bazel builds. For
example, https://fxrev.dev/1100339 is one planned usage of this.

Emboss Issue: google#152
Pigweed Bug: https://pwbug.dev/359386289

Change-Id: Id33d879cea95d86f6cc7a16cd395a8c1a4380cbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants