Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
tools.macsdk_dir Namespace Reference

Functions

str GetWorkspaceDir ()
 
str GetBazelWorkspaceHash ()
 
str GetBazelRepositoryCacheDir ()
 
str GetBazelOutputDir ()
 
str GetBazelWorkspaceCacheDir ()
 
str GetMacSDKSymlinkDir ()
 

Detailed Description

This script writes the full path to the MacSDK that is being used
by the clang_mac toolchain for builds within this workspace. This
path is created by //toolchain/download_mac_toolchain.bzl when
downloading the mac toolchain, and the MacSDK directory is populated
with symlinks to XCode's MacSDK contents.

Function Documentation

◆ GetBazelOutputDir()

str tools.macsdk_dir.GetBazelOutputDir ( )
Return the Bazel output directory.

This is described in https://bazel.build/remote/output-directories

Definition at line 50 of file macsdk_dir.py.

50def GetBazelOutputDir() -> str:
51 """Return the Bazel output directory.
52
53 This is described in https://bazel.build/remote/output-directories"""
54 repo_cache_dir = Path(GetBazelRepositoryCacheDir())
55 # The repository cache is inside the output directory, so going up
56 # three levels returns the output directory.
57 output_dir = repo_cache_dir.parent.parent.parent
58 return str(output_dir)
59
60

◆ GetBazelRepositoryCacheDir()

str tools.macsdk_dir.GetBazelRepositoryCacheDir ( )
Return the Bazel repository cache directory.

Definition at line 39 of file macsdk_dir.py.

39def GetBazelRepositoryCacheDir() -> str:
40 """Return the Bazel repository cache directory."""
41
42 prev_cwd = os.getcwd()
43 os.chdir(GetWorkspaceDir())
44 cmd = ["bazelisk", "info", "repository_cache"]
45 output = subprocess.check_output(cmd)
46 decoded_output = codecs.decode(output, "utf-8")
47 return decoded_output.strip()
48
49

◆ GetBazelWorkspaceCacheDir()

str tools.macsdk_dir.GetBazelWorkspaceCacheDir ( )
Determine the output directory cache for this workspace.

Note: The Bazel docs(1) are very clear that the organization of the output
directory may change at any time.

(1) https://bazel.build/remote/output-directories

Definition at line 61 of file macsdk_dir.py.

61def GetBazelWorkspaceCacheDir() -> str:
62 """Determine the output directory cache for this workspace.
63
64 Note: The Bazel docs(1) are very clear that the organization of the output
65 directory may change at any time.
66
67 (1) https://bazel.build/remote/output-directories
68 """
69 return os.path.join(GetBazelOutputDir(), GetBazelWorkspaceHash())
70
71

◆ GetBazelWorkspaceHash()

str tools.macsdk_dir.GetBazelWorkspaceHash ( )
Return the Bazel hash for this workspace.

This is the MD5 has of the full path to the workspace. See
https://bazel.build/remote/output-directories#layout-diagram for more detail.

Definition at line 30 of file macsdk_dir.py.

30def GetBazelWorkspaceHash() -> str:
31 """Return the Bazel hash for this workspace.
32
33 This is the MD5 has of the full path to the workspace. See
34 https://bazel.build/remote/output-directories#layout-diagram for more detail."""
35 ws = GetWorkspaceDir().encode("utf-8")
36 return hashlib.md5(ws).hexdigest()
37
38
static void encode(uint8_t output[16], const uint32_t input[4])
Definition SkMD5.cpp:240

◆ GetMacSDKSymlinkDir()

str tools.macsdk_dir.GetMacSDKSymlinkDir ( )
Determine the MacSDK symlinks directory for this workspace.

Definition at line 72 of file macsdk_dir.py.

72def GetMacSDKSymlinkDir() -> str:
73 """Determine the MacSDK symlinks directory for this workspace."""
74 return os.path.join(GetBazelWorkspaceCacheDir(), "external", "clang_mac", "symlinks", "xcode", "MacSDK")
75
76

◆ GetWorkspaceDir()

str tools.macsdk_dir.GetWorkspaceDir ( )
Return the workspace directory containing this script.

Definition at line 24 of file macsdk_dir.py.

24def GetWorkspaceDir() -> str:
25 """Return the workspace directory containing this script."""
26 this_script_path = Path(os.path.realpath(__file__))
27 return str(this_script_path.parent.parent)
28
29