From 6192c42682b47ae5707f69946a9c40173a1845b8 Mon Sep 17 00:00:00 2001 From: Isaac Torres Date: Wed, 23 Nov 2022 14:32:48 -0700 Subject: [PATCH 1/2] Add macro for constructing local include paths --- cc/local_include_prefix.bzl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 cc/local_include_prefix.bzl diff --git a/cc/local_include_prefix.bzl b/cc/local_include_prefix.bzl new file mode 100644 index 00000000..7a00c9e9 --- /dev/null +++ b/cc/local_include_prefix.bzl @@ -0,0 +1,16 @@ +# Copyright (C) 2022 Swift Navigation Inc. +# Contact: Swift Navigation +# +# This source is subject to the license found in the file 'LICENSE' which must +# be be distributed together with this source. All other rights reserved. +# +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + + +def local_include_prefix(): + root = Label(native.repository_name() + "//:WORKSPACE").workspace_root or "." + root = root + "/" + print(root) + return root From 1d0afa6b1909f38858f232ab184c43ef3265e0e4 Mon Sep 17 00:00:00 2001 From: Isaac Torres Date: Wed, 23 Nov 2022 14:49:12 -0700 Subject: [PATCH 2/2] Add package path --- cc/local_include_prefix.bzl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cc/local_include_prefix.bzl b/cc/local_include_prefix.bzl index 7a00c9e9..68c97877 100644 --- a/cc/local_include_prefix.bzl +++ b/cc/local_include_prefix.bzl @@ -8,9 +8,7 @@ # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - def local_include_prefix(): root = Label(native.repository_name() + "//:WORKSPACE").workspace_root or "." - root = root + "/" - print(root) - return root + package = native.package_name() + return root + "/" + package + "/"