Ubuntu安装Bazel

参考Installing Bazel

Bazel是一个编译软件。

  1. sudo add-apt-repository ppa:webupd8team/java
  2. sudo apt-get update
  3. sudo apt-get install oracle-java8-installer
  4. echo “deb http://storage.googleapis.com/bazel-apt stable jdk1.8” | sudo tee /etc/apt/sources.list.d/bazel.list
  5. curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
  6. sudo apt-get update
  7. sudo apt-get install bazel
  8. sudo apt-get upgrade bazel
  9. Bazel基本用法
    • 参考Getting Started with Bazel
    • 创建/home/majing/workspace/bazel-project目录
    • 在bazel-project目录下创建WORKSPACE空文件
    • mkdir -p src/main/java/com/example
    • cat > src/main/java/com/example/ProjectRunner.java
      << EOF package com.example;
      public class ProjectRunner {
      public static void main(String args[]) {
      Greeting.sayHi();
      }
      }
      EOF
    • cat > src/main/java/com/example/Greeting.java << EOF
      package com.example;
      public class Greeting {
      public static void sayHi() {
      System.out.println(“Hi!”);
      }
      }
      EOF
    • 创建BUILD文件,写入# ~/gitroot/my-project/BUILD
      java_binary(
      name = “my-runner”,
      srcs = glob([“*/.java”]),
      main_class = “com.example.ProjectRunner”,
      )
    • bazel build //:my-runner
    • bazel-bin/my-runner
  10. 10.
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值