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

[Bazel][1.x][Part 2]: BazelDeps refactor #14959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
77e981f
BazelDeps refactor
franramirez688 Oct 18, 2023
e310e99
BazelToolchain refactor
franramirez688 Oct 18, 2023
349f4ee
bazel_layout refactor
franramirez688 Oct 18, 2023
92eeb02
Bazel helper refactor
franramirez688 Oct 18, 2023
485510f
Reverted BazelDeps
franramirez688 Oct 18, 2023
3fe380a
Applying suggestions
franramirez688 Oct 18, 2023
53688ed
Applying suggestions
franramirez688 Oct 18, 2023
2864c59
removed Conan 2 imports
franramirez688 Oct 18, 2023
1c4e099
Testing BazelToolchain and bazel_layout
franramirez688 Oct 19, 2023
42e00ef
Fixed tests on macos
franramirez688 Oct 19, 2023
0b1aa4e
Skipping windows
franramirez688 Oct 19, 2023
59f6b9d
reordering imports
franramirez688 Oct 19, 2023
d179f4a
Building all the targets by default
franramirez688 Oct 19, 2023
d12be74
1.x conftest tools
franramirez688 Oct 23, 2023
5412c1e
test refactored
franramirez688 Oct 23, 2023
d043d13
Keeping baward compatibility. Safer command runner. Fixed Windows rc …
franramirez688 Oct 26, 2023
a9207b5
Better comment
franramirez688 Oct 26, 2023
e5e10b9
Removed configure from templates. Useless
franramirez688 Oct 26, 2023
fe89752
removed strip attr and fastbuild as default value
franramirez688 Oct 26, 2023
27411d3
removed strip attr
franramirez688 Oct 26, 2023
ce5081c
Added validate step
franramirez688 Oct 26, 2023
81956f3
Validate test
franramirez688 Oct 26, 2023
d33c0d6
Keeping backward-compatibility. Added deprecated warnings
franramirez688 Oct 30, 2023
ad05e27
Keeping original bazel_layout. Applied suggestions
franramirez688 Oct 30, 2023
476dd27
BazelDeps refactor
franramirez688 Oct 18, 2023
69fad4c
Adapted to Conan 1.x
franramirez688 Oct 19, 2023
92b3f29
Added check build profile
franramirez688 Oct 20, 2023
9dac1f6
Removed useless tests
franramirez688 Oct 23, 2023
41bada3
WIP
franramirez688 Oct 24, 2023
42c4a6d
Fixing errors
franramirez688 Oct 24, 2023
b512619
Fixed
franramirez688 Oct 24, 2023
e60a640
docstrings
franramirez688 Oct 24, 2023
8ba5f7e
UNIX-like paths
franramirez688 Oct 24, 2023
c0558a7
Improved algorithms and unittests
franramirez688 Oct 25, 2023
a3ed549
Better docstring
franramirez688 Oct 25, 2023
b5d6000
Added filegroups. Prettier lists in Jinja
franramirez688 Oct 25, 2023
034a10a
Removed Linux skipifs
franramirez688 Oct 25, 2023
c4342e6
Trying to solve bazel issues for Win and Mac
franramirez688 Oct 25, 2023
38a8474
Quoting flags
franramirez688 Oct 26, 2023
49f775d
Quoting flags
franramirez688 Oct 26, 2023
7c366eb
Debugging CI errors (removing later)
franramirez688 Oct 26, 2023
babbf76
typo
franramirez688 Oct 26, 2023
b3d852c
Fixed typo
franramirez688 Oct 27, 2023
2f7b3ec
Added cc_shared_library mechanism
franramirez688 Oct 27, 2023
34bd76c
Trying to pass CI
franramirez688 Oct 27, 2023
52f870e
Trying to pass CI
franramirez688 Oct 27, 2023
c886f16
Making transitive deps tests available for shared/static option. Remo…
franramirez688 Oct 27, 2023
fd13c23
Messed with the rebase
franramirez688 Oct 30, 2023
e95e543
Merge remote-tracking branch 'conan/develop' into frm/bazeldeps_refac…
franramirez688 Oct 30, 2023
c3191e5
Improved new template and bazel_layout warning
franramirez688 Oct 31, 2023
8b9fc6d
Update conans/assets/templates/new_v2_bazel.py
franramirez688 Nov 2, 2023
f5e3269
Applying suggestions
franramirez688 Nov 2, 2023
c5716f4
Added bazel_repository_name and renamed bazel_target_name
franramirez688 Nov 3, 2023
08580c3
Fixed bug in dependecies.bzl if bazel_repository_name is set
franramirez688 Nov 6, 2023
4c44eb1
Clearer name
franramirez688 Nov 6, 2023
ac1be74
Removing useless macro
franramirez688 Nov 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions conan/tools/google/bazel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def __init__(self, conanfile, namespace=None):
# TODO: Remove namespace in Conan 2.x
if namespace:
self._conanfile.output.warning("In Bazel() call, namespace param has been "
"deprecated as it's not used anymore.")
"deprecated as it's not used anymore.")

def configure(self, args=None):
# TODO: Remove in Conan 2.x. Keeping it backward compatible
self._conanfile.output.warning("Bazel.configure() function has been deprecated."
" Removing in Conan 2.x.")
" Removing in Conan 2.x.")
pass

def _safe_run_command(self, command):
Expand All @@ -31,13 +31,15 @@ def _safe_run_command(self, command):
if platform.system() == "Windows":
self._conanfile.run("bazel shutdown")

def build(self, args=None, label=None, target="//..."):
def build(self, args=None, label=None, target="//...", clean=True):
"""
Runs "bazel <rcpaths> build <configs> <args> <targets>"

:param label: DEPRECATED: It'll disappear in Conan 2.x. It is the target label
:param target: It is the target label
:param args: list of extra arguments
:param clean: bool that indicates to run a "bazel clean" before running the "bazel build".
Notice that this is important to ensure a fresh bazel cache.
:return:
"""
# TODO: Remove in Conan 2.x. Superseded by target
Expand All @@ -61,6 +63,7 @@ def build(self, args=None, label=None, target="//..."):
bazelrc_paths.extend(rc_paths)
command = "bazel"
for rc in bazelrc_paths:
rc = rc.replace("\\", "/")
command += f" --bazelrc={rc}"
command += " build"
# TODO: Legacy Bazel allowed only one value or several ones separate by commas.
Expand All @@ -73,6 +76,8 @@ def build(self, args=None, label=None, target="//..."):
if args:
command += " ".join(f" {arg}" for arg in args)
command += f" {target}"
if clean:
self._safe_run_command("bazel clean")
self._safe_run_command(command)

def test(self, target=None):
Expand Down
Loading