[clang] Add clang_runtimes recipe
This patch adds clang_runtimes recipe. It currently does nothing, but
it enables local led runs for prototyping.
Bug: 335328196
Change-Id: I72f397607797b69aca243d2079ee9d5d57811789
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/recipes/+/1039272
Fuchsia-Auto-Submit: Haowei Wu <haowei@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/recipes/contrib/clang_runtimes.expected/ci_linux_x64.json b/recipes/contrib/clang_runtimes.expected/ci_linux_x64.json
new file mode 100644
index 0000000..c1cf013
--- /dev/null
+++ b/recipes/contrib/clang_runtimes.expected/ci_linux_x64.json
@@ -0,0 +1,675 @@
+[
+ {
+ "cmd": [],
+ "name": "checkout"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0o777",
+ "[START_DIR]/fuchsia-third_party-llvm-project"
+ ],
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git init",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "remote",
+ "add",
+ "origin",
+ "https://fuchsia.googlesource.com/third_party/llvm-project"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git remote",
+ "timeout": 600.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "core.longpaths",
+ "true"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.set core.longpaths",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "fetch.uriprotocols",
+ "https"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.set fetch.uriprotocols",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.cache",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0o777",
+ "[CACHE]/git"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.ensure git cache dir",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "",
+ "[CACHE]/git/.GUARD_FILE"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.write git cache guard file",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0o777",
+ "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init",
+ "--bare"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.git init",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "remote.origin.url",
+ "https://fuchsia.googlesource.com/third_party/llvm-project"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.remote set-url",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "core.longpaths",
+ "true"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.set core.longpaths",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "fetch.uriprotocols",
+ "https"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.set fetch.uriprotocols",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "--replace-all",
+ "remote.origin.fetch",
+ "+refs/heads/*:refs/heads/*",
+ "\\+refs/heads/\\*:.*"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.replace fetch configs",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--prune",
+ "--tags",
+ "--jobs",
+ "4",
+ "origin"
+ ],
+ "cwd": "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.git fetch",
+ "timeout": 1200.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0o777",
+ "[START_DIR]/fuchsia-third_party-llvm-project/.git/objects/info"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.makedirs object/info",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project/objects\n",
+ "[START_DIR]/fuchsia-third_party-llvm-project/.git/objects/info/alternates"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.alternates",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_LOG_LINE@alternates@[CACHE]/git/fuchsia.googlesource.com-third_party-llvm--project/objects@@@",
+ "@@@STEP_LOG_END@alternates@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "remove",
+ "[CACHE]/git/.GUARD_FILE"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.cache.remove git cache guard file",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--tags",
+ "--jobs",
+ "4",
+ "origin"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git fetch",
+ "timeout": 1200.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git checkout",
+ "timeout": 600.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git rev-parse",
+ "timeout": 300.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.git clean",
+ "timeout": 600.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.submodule",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.submodule.git submodule sync",
+ "timeout": 600.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init",
+ "--jobs",
+ "4"
+ ],
+ "cwd": "[START_DIR]/fuchsia-third_party-llvm-project",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "fuchsia:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "checkout.submodule.git submodule update",
+ "timeout": 600.0,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipes/contrib/clang_runtimes.proto b/recipes/contrib/clang_runtimes.proto
new file mode 100644
index 0000000..0e1e51b
--- /dev/null
+++ b/recipes/contrib/clang_runtimes.proto
@@ -0,0 +1,24 @@
+// Copyright 2024 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+syntax = "proto3";
+
+package recipes.fuchsia.contrib.clang_runtimes;
+
+message InputProperties {
+ // Git repository.
+ string repository = 1;
+
+ // Git revision.
+ string revision = 2;
+
+ // CIPD platform for the target.
+ string platform = 3;
+
+ // runtime targets in triple
+ repeated string targets = 4;
+
+ // CAS URL for the toolchain package.
+ string cas_url = 5;
+}
diff --git a/recipes/contrib/clang_runtimes.py b/recipes/contrib/clang_runtimes.py
new file mode 100644
index 0000000..1a45ff3
--- /dev/null
+++ b/recipes/contrib/clang_runtimes.py
@@ -0,0 +1,36 @@
+# Copyright 2024 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""Recipe for building Clang toolchain without any runtimes."""
+
+from PB.recipes.fuchsia.contrib.clang_runtimes import InputProperties
+
+DEPS = [
+ "fuchsia/git_checkout",
+ "recipe_engine/buildbucket",
+ "recipe_engine/platform",
+ "recipe_engine/properties",
+]
+
+PROPERTIES = InputProperties
+
+
+def RunSteps(api, props):
+ api.git_checkout(props.repository, fallback_ref=props.revision)
+
+
+def GenTests(api):
+ yield (
+ api.test("ci_linux_x64")
+ + api.buildbucket.ci_build(
+ project="fuchsia",
+ bucket="ci",
+ git_repo="https://fuchsia.googlesource.com/third_party/llvm-project",
+ revision="a" * 40,
+ )
+ + api.platform.name("linux")
+ + api.properties(
+ repository="https://fuchsia.googlesource.com/third_party/llvm-project",
+ revision="a" * 40,
+ )
+ )