blob: abfcda277aed1ce2d4bdea9e8c28263af544d359 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
- name: install bazel build requirements (CentOS)
become: yes
dnf:
name:
- cmake
- gcc-c++
- java-11-openjdk-devel
- python3
- unzip
- which
- zip
state: present
when: ansible_os_family == 'RedHat'
- name: install bazel build requirements (Debian)
become: yes
apt:
name:
- cmake
- g++
- openjdk-11-jdk-headless
- python3
- unzip
- zip
state: present
when: ansible_os_family == 'Debian'
- name: fetch bazel {{ bazel_version }} source
get_url:
url: "https://github.com/bazelbuild/bazel/releases/download/{{ bazel_version }}/bazel-{{ bazel_version }}-dist.zip"
dest: "{{ build_dir.path }}"
mode: 0600
- name: create directory to build bazel {{ bazel_version }}
file:
path: "{{ build_dir.path }}/bazel-{{ bazel_version }}/"
state: directory
- name: unpack bazel {{ bazel_version }} source
unarchive:
src: "{{ build_dir.path }}/bazel-{{ bazel_version }}-dist.zip"
dest: "{{ build_dir.path }}/bazel-{{ bazel_version }}"
remote_src: yes
creates: "{{ build_dir.path }}/bazel-{{ bazel_version }}/compile.sh"
- name: create /usr/bin/python symlink
become: yes
file:
src: /usr/bin/python3
dest: /usr/bin/python
state: link
- name: build bazel {{ bazel_version }}
shell:
cmd: |
set -xe
EXTRA_BAZEL_ARGS='--host_javabase=@local_jdk//:jdk' ./compile.sh
chdir: "{{ build_dir.path }}/bazel-{{ bazel_version }}/"
creates: "{{ build_dir.path }}/bazel-{{ bazel_version }}/output/bazel"
executable: /bin/bash
- name: install bazel {{ bazel_version }}
become: yes
copy:
src: "{{ build_dir.path }}/bazel-{{ bazel_version }}/output/bazel"
dest: /usr/local/bin/bazel
mode: 0755
force: yes
remote_src: yes
- name: clean bazel cache
file:
path: ~/.cache/bazel
state: absent
|