Skip to content

Commit

Permalink
Clean up path usage in build files (#20574)
Browse files Browse the repository at this point in the history
Templates should rebase paths to the build dir before passing them to
scripts as scripts generally do not understand GN's // syntax for
specifying paths relative to the root.

In other cases, paths should be left alone so that build file relative
paths can be specified. This is needed for consistency; all GN builtins
accept both relative-to-BUILD.gn paths (default) and
relative-to-build-root (//) paths.
  • Loading branch information
mspang authored Jul 14, 2022
1 parent f5eec6e commit 415ee2f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions build/chip/linux/gdbus_library.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

glib_config = rebase_path(":glib")
gen_dbus_wrapper = rebase_path("gen_gdbus_wrapper.py")
glib_config = get_label_info(":glib", "label_no_toolchain")
gen_dbus_wrapper = get_path_info("gen_gdbus_wrapper.py", "abspath")

# Runs gdbus-codegen and defines the resulting library.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ executable("chip-all-clusters-app") {

tizen_sdk_package("chip-all-clusters-app:tpk") {
deps = [ ":chip-all-clusters-app" ]
manifest = rebase_path("tizen-manifest.xml")
manifest = "tizen-manifest.xml"
sign_security_profile = "CHIP"
}

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ executable("chip-all-clusters-minimal-app") {

tizen_sdk_package("chip-all-clusters-minimal-app:tpk") {
deps = [ ":chip-all-clusters-minimal-app" ]
manifest = rebase_path("tizen-manifest.xml")
manifest = "tizen-manifest.xml"
sign_security_profile = "CHIP"
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ executable("chip-lighting-app") {

tizen_sdk_package("chip-lighting-app:tpk") {
deps = [ ":chip-lighting-app" ]
manifest = rebase_path("tizen-manifest.xml")
manifest = "tizen-manifest.xml"
sign_security_profile = "CHIP"
}

Expand Down
27 changes: 14 additions & 13 deletions src/controller/data_model/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,25 @@ if (current_os == "android") {
script = "${chip_root}/scripts/codegen.py"

_idl_file = "controller-clusters.matter"
_output_files = exec_script("${chip_root}/scripts/codegen.py",
[
"--generator",
"java",
"--log-level",
"fatal",
"--name-only",
rebase_path("controller-clusters.matter"),
],
"list lines",
[ "controller-clusters.matter" ])
_output_files =
exec_script("${chip_root}/scripts/codegen.py",
[
"--generator",
"java",
"--log-level",
"fatal",
"--name-only",
rebase_path("controller-clusters.matter", root_build_dir),
],
"list lines",
[ "controller-clusters.matter" ])

args = [
"--generator",
"java",
"--output-dir",
rebase_path(target_gen_dir),
rebase_path(_idl_file),
rebase_path(target_gen_dir, root_build_dir),
rebase_path(_idl_file, root_build_dir),
]

deps = [ "${chip_root}/scripts/idl" ]
Expand Down
6 changes: 4 additions & 2 deletions third_party/tizen/tizen_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/tizen.gni")

import("${build_root}/config/tizen/config.gni")

tizen_manifest_parser = rebase_path("tizen_manifest_parser.py")
tizen_manifest_parser = get_path_info("tizen_manifest_parser.py", "abspath")

template("tizen_sdk") {
forward_variables_from(invoker,
Expand Down Expand Up @@ -74,7 +74,9 @@ template("tizen_sdk_package") {
"should be used for signing TPK package.")

# Extract data from Tizen XML manifest.
manifest = exec_script(tizen_manifest_parser, [ invoker.manifest ], "json")
manifest = exec_script(tizen_manifest_parser,
[ rebase_path(invoker.manifest, root_build_dir) ],
"json")
manifest_package = manifest["package"]
manifest_apps = manifest["apps"]

Expand Down

0 comments on commit 415ee2f

Please sign in to comment.