Skip to content

smukherj1/codelabs

 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 30.4%
  • Shell 29.0%
  • Python 17.1%
  • TypeScript 11.9%
  • Go 11.6%