Giter VIP home page Giter VIP logo

codelabs's Introduction

Bazel Codelab

Before you get started

Take a look at these informational slides to learn about Bazel.

Section 1: Hello, Bazel!

  1. Edit: java/src/main/java/bazel/bootcamp/BUILD
  2. Add a java_binary target for the HelloBazelBootcamp.java file
  3. Run the binary using bazel run //java/src/main/java/bazel/bootcamp:HelloBazelBootcamp

Section 2: Go server

  1. Edit the BUILD file for logger.proto

    HintCheck out the compilers attribute for go_proto_library in the grpc example
    HintGo libraries each declare the import path at which they would like to be imported by other go files. server.go imports the proto file at bootcamp/proto/logger so the importpath attribute of go_proto_library should match that.
  2. Edit the BUILD file for server.go

  3. Run the go binary using bazel run

  4. Go to http://localhost:8081 to see results (there won't be any logs yet)

Section 3: Java client

  1. Edit the BUILD file for logger.proto
  2. Edit the BUILD file for JavaLoggingClientLibrary.java
  3. Edit the BUILD file for JavaLoggingClient.java
  4. bazel run the Java binary you wrote
  5. bazel run the Go binary from Section 2
  6. Send messages from the client to the server and view them on http://localhost:8081

Section 4: Java client unit tests

  1. Edit the BUILD file for JavaLoggingClientLibraryTest.java
    HintNames matter for tests. The java_test for this file should be named JavaLoggingClientLibraryTest
  2. Edit the BUILD file for JavaLoggingClientTest.java
  3. Run the tests using bazel test

Section 5: Typescript web frontend

  1. Edit the WORKSPACE to uncomment the typescript relevant portions
  2. Edit the BUILD file for logger.proto
  3. Edit the BUILD file for app.ts
  4. Run the webserver using bazel run. It will print out a link which you can click on. If the link doesn't work, go to http://localhost:8080 instead
  5. Run the Go server and Java client from the previous steps. Send messages from the Java client to the Go server and see them appear on the web frontend

Section 6: Integration test

  1. Edit the BUILD file for integrationtest.sh
  2. Run the test using bazel test and make sure that it passes
  3. Run the test using bazel test <target> --runs_per_test=10 and make sure that it passes
    HintYou may need to modify the BUILD file again to make this work

Section 7: Query

  1. https://docs.bazel.build/versions/master/query-how-to.html

codelabs's People

Contributors

aiuto avatar dkelmer avatar dslomov avatar eytankidron avatar hicksjoseph avatar jeromeduval-nam avatar laszlocsomor avatar laurentlb avatar meistert avatar meteorcloudy avatar rupertks avatar yannic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codelabs's Issues

Flag --incompatible_use_platforms_repo_for_constraints will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_use_platforms_repo_for_constraints will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Fix build failure with Bazel@HEAD

In bazelbuild/bazel#11665, Bazel upgraded java_tools to v9.0 which has a new error prone version.

The build is failing with:

external/io_grpc_grpc_java/core/src/main/java/io/grpc/internal/RetriableStream.java:702: error: [GuardedBy] This access should be guarded by 'this.scheduledHedging.lock'; instead found: 'this.lock'
        futureToBeCancelled = scheduledHedging.markCancelled();
                                              ^
    (see https://errorprone.info/bugpattern/GuardedBy)

https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1545#9679232e-e81f-4dbd-9b7c-526c9cfd0af2

Breakage with breaks with the Bazel flag `--incompatible_disable_legacy_proto_provider`, to be flipped in Bazel 1.0

The breakage looks like this:

ERROR: /var/lib/buildkite-agent/builds/bk-docker-knlk/bazel-downstream-projects/codelabs/proto/logger/BUILD:31:1: in ts_proto_library rule //proto/logger:logger_ts_proto:
--
  | Traceback (most recent call last):
  | File "/var/lib/buildkite-agent/builds/bk-docker-knlk/bazel-downstream-projects/codelabs/proto/logger/BUILD", line 31
  | ts_proto_library(name = 'logger_ts_proto')
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/a3cacd8feec2143defdbcf39e90c9abd/external/npm_bazel_typescript/internal/protobufjs/ts_proto_library.bzl", line 74, in _ts_proto_library
  | fail(("ts_proto_library dep %s must b...))
  | ts_proto_library dep //proto/logger:logger_proto must be a proto_library rule

Which indicates that it uses a version of ts_proto_library which does not contain bazelbuild/rules_nodejs#925 .

Flag --incompatible_disable_target_provider_fields will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_disable_target_provider_fields will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_load_proto_rules_from_bzl will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_load_proto_rules_from_bzl will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

io_grpc_grpc_java declares maven repos with broken URLs

At 3087a32 using Bazel 2.0.0 on Linux, com_google_code_findbugs_jsr305 and other repos cannot be fetched because they reference http://central.maven.org/maven2, which no longer works because of "http". These repos are declared by "@io_grpc_grpc_java//:repositories.bzl".

io_grpc_grpc_java updated its references to use "https" in grpc/grpc-java@a4299eb, so this needs to update its reference.

Flag --incompatible_no_implicit_file_export will break Bazel Codelabs in a future Bazel release

Incompatible flag --incompatible_no_implicit_file_export will be enabled by default in a future Bazel release [1], thus breaking Bazel Codelabs.

The flag is documented here: bazelbuild/bazel#10225

Please check the following CI builds for build and test results:

Never heard of incompatible flags before? We have documentation that explains everything.

If you don't want to receive any future issues for Bazel Codelabs or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.

Flag --incompatible_disallow_empty_glob will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_disallow_empty_glob will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_restrict_string_escapes will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_restrict_string_escapes will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_load_java_rules_from_bzl will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_load_java_rules_from_bzl will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_disable_depset_items will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_disable_depset_items will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

It is far too hard to update the bootcamp codelab

The codelab contains BUILD and WORKSPACE files that have hints rather than real rules.
As part of the lab, the user uncomments some parts and fills in others.

There is a tool which creates the fully formed BUILD files, but we need the other direction, so you can instantiate the BUILD, test everything, then revert to the hints for committing.

Flag --incompatible_disable_depset_items will break Bazel Codelabs in a future Bazel release

Incompatible flag --incompatible_disable_depset_items will be enabled by default in a future Bazel release [1], thus breaking Bazel Codelabs.

The flag is documented here: bazelbuild/bazel#9017

Please check the following CI builds for build and test results:

Never heard of incompatible flags before? We have documentation that explains everything.

If you don't want to receive any future issues for Bazel Codelabs or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.

Flag --incompatible_no_implicit_file_export will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_no_implicit_file_export will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_load_cc_rules_from_bzl will break Bazel Codelabs in Bazel 1.2.1

Incompatible flag --incompatible_load_cc_rules_from_bzl will break Bazel Codelabs once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.