Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
create.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create a Clang toolchain for Linux hosts."""
10
11
12import argparse
13import os
14import subprocess
15
16
17def create_asset(target_dir):
18 # Create a local docker image tagged "clang_linux_asset" with a compiled clang for amd64 Linux.
19 # This will take a while. Output is in the image under /tmp/clang_output
20 args = ['docker', 'build', '-t', 'clang_linux_asset', './infra/bots/assets/clang_linux']
21 subprocess.run(args, check=True, encoding='utf8')
22
23 # Copy the assets out of the container by mounting target_dir
24 print('Copying clang from Docker container into CIPD folder')
25 os.makedirs(target_dir, exist_ok=True)
26 args = ['docker', 'run', '--mount', 'type=bind,source=%s,target=/OUT' % target_dir,
27 'clang_linux_asset', '/bin/sh', '-c',
28 # After copying, we need to make the files write-able by all users.
29 # Docker makes them owned by root by default, and without everyone being
30 # able to write (e.g. delete) them, this can cause issues.
31 'cp -R /tmp/clang_output/* /OUT && chmod -R a+w /OUT']
32 subprocess.run(args, check=True, encoding='utf8')
33
34
35def main():
36 parser = argparse.ArgumentParser()
37 parser.add_argument('--target_dir', '-t', required=True)
38 args = parser.parse_args()
39 create_asset(args.target_dir)
40
41
42if __name__ == '__main__':
43 main()
void print(void *str)
Definition bridge.cpp:126
Definition main.py:1