Skip to content

Commit e8fe2d1

Browse files
Kevin0626Kevin Kang
andauthored
support SSH for git clone llvm (#2011)
Co-authored-by: Kevin Kang <wilson.qch1685@gmail.com>
1 parent 2a5a224 commit e8fe2d1

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

build-scripts/build_llvm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def clone_llvm(dst_dir, llvm_repo, llvm_branch):
2323

2424
if not llvm_dir.exists():
2525
GIT_CLONE_CMD = f"git clone --depth 1 --branch {llvm_branch} {llvm_repo} llvm"
26+
print(GIT_CLONE_CMD)
2627
subprocess.check_output(shlex.split(GIT_CLONE_CMD), cwd=dst_dir)
2728

2829
return llvm_dir
@@ -250,14 +251,17 @@ def main():
250251
llvm_repo_and_branch = {
251252
"arc": {
252253
"repo": "https://github.com/llvm/llvm-project.git",
254+
"repo_ssh": "git@github.com:llvm/llvm-project.git",
253255
"branch": "release/15.x",
254256
},
255257
"xtensa": {
256-
"repo": "https://github.com/espressif/llvm-project.git",
258+
"repo": "https://github.com/espressif/llvm-project.git",
259+
"repo_ssh": "git@github.com:espressif/llvm-project.git",
257260
"branch": "xtensa_release_15.x",
258261
},
259262
"default": {
260263
"repo": "https://github.com/llvm/llvm-project.git",
264+
"repo_ssh": "git@github.com:llvm/llvm-project.git",
261265
"branch": "release/15.x",
262266
},
263267
}
@@ -278,7 +282,13 @@ def main():
278282
print(commit_hash)
279283
return commit_hash is not None
280284

281-
llvm_dir = clone_llvm(deps_dir, llvm_info["repo"], llvm_info["branch"])
285+
repo_addr = llvm_info["repo"]
286+
if os.environ['USE_GIT_SSH'] == "true":
287+
repo_addr = llvm_info["repo_ssh"]
288+
else:
289+
print("To use ssh for git clone, run: export USE_GIT_SSH=true")
290+
291+
llvm_dir = clone_llvm(deps_dir, repo_addr, llvm_info["branch"])
282292
if (
283293
build_llvm(
284294
llvm_dir, platform, options.arch, options.project, options.use_clang,

0 commit comments

Comments
 (0)