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

Adding bazel C++ build support for gNOI repository #52

Merged
merged 18 commits into from
May 20, 2021

Conversation

vamsipunati
Copy link
Contributor

The thinkit test framework needs gNOI C++ compilation support.

Copy link

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vamsipunati, LGTM modulo some small issues.

BUILD Outdated
@@ -0,0 +1,22 @@
# Copyright 2021 Google LLC
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this file (and all other BUILD files) to BUILD.bazel, and similarly for the WORKSPACE file.
This is the recommended convention outside of google, since it makes the purpose of these files easy to research for non-Bazel experts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

WORKSPACE Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "gnoi")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name = "com_github_openconfig_gnoi"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Dependencies to build PINS infra."""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

WORKSPACE Outdated
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# -- Load Dependencies ---------------------------------------------------------
load("gnoi_infra_deps.bzl", "gnoi_infra_deps")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention is for these to be called "gnoi_deps.bzl" and "gnoi_deps", without the infra part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

WORKSPACE Outdated

gnoi_infra_deps()


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove extra new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

licenses = ["notice"],
)

filegroup(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

file/BUILD Outdated
licenses = ["notice"],
)

filegroup(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if not native.existing_rule("com_github_grpc_grpc"):
http_archive(
name = "com_github_grpc_grpc",
# Move to newer commit to avoid the use of com_github_google_re2.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this comment and instead use the latest release? (https://github.com/grpc/grpc/releases/tag/v1.37.1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

http_archive(
name = "com_google_protobuf",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-all-3.14.0.tar.gz",
strip_prefix = "protobuf-3.14.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use latest release (3.16.0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

system/BUILD Outdated

load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")

package(default_visibility = ["//visibility:public"],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: fix formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

BUILD Outdated
@@ -0,0 +1,22 @@
# Copyright 2021 Google LLC
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have BUILD files, we should also add a presubmit check to ensure the build never breaks.
You can take this one as a template and just adjust the last two steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo some formatting nits and including the CI script in this PR. Otherwise looks great!

wavelength_router/BUILD.bazel Outdated Show resolved Hide resolved
Copy link

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the changes I suggested in vamsipunati#1 (comment) didn't make it in

bazel-${{ runner.os }}-build-
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/$BAZEL"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I just realized that GitHub review comments get associated with an entire line, rather than specific characters one marks. So it looks like some of my previous comments we're confusing since they were out of context.

We removed a few thing too much here. We'll want to add back the following:

    - name: Install bazelisk
      run: |
        curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/$BAZEL"
        chmod +x $BAZEL
        sudo mv $BAZEL /usr/local/bin/bazel
        
      name: Build
      run: bazel build //...

Copy link

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo the last comment.

Before we merge this, one of the admins for this repo should also enable Github Actions for the repo and make sure the workflow passes: https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#managing-github-actions-permissions-for-your-repository

@robshakir robshakir merged commit c4a8573 into openconfig:master May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants