Skip to content

Commit

Permalink
Sample archiving recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidokert committed Jan 13, 2025
1 parent 6c07cf6 commit 33c9f48
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,4 @@ vs-chromium-project.txt

# Intermediate Gradle outputs from builds
starboard/android/apk/.gradle/
cobalt/recipes/.recipe_deps/
28 changes: 28 additions & 0 deletions cobalt/infra/config/recipes.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"api_version": 2,
"deps": {
"recipe_engine": {
"branch": "refs/heads/main",
"revision": "aec6c66bcf1d44e78a0c1029b6a53965b97957d0",
"url": "https://chromium.googlesource.com/infra/luci/recipes-py"
},
"build": {
"branch" : "refs/heads/main",
"revision" : "36a4165460701da3b9cf2a49ab37e794bde3f240",
"url" : "https://chromium.googlesource.com/chromium/tools/build.git"
},
"depot_tools": {
"branch": "refs/heads/main",
"revision": "24d9ad69facfe9f73b542e434f47881a5caa1db4",
"url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
},
"infra": {
"branch": "refs/heads/main",
"revision": "0640c3e0d897b6f27ea09ff3a29bcdf2b6a7e6b0",
"url": "https://chromium.googlesource.com/infra/infra.git"
}
},
"project_id": "cobalt",
"recipes_path": "recipes",
"py3_only": true
}
41 changes: 41 additions & 0 deletions cobalt/recipes/recipes/upload_archive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Testing if we can use recipes
"""
from google.protobuf import json_format
from PB.recipe_modules.build.archive.properties import ArchiveData

DEPS = [
'recipe_engine/step', 'recipe_engine/file', 'recipe_engine/json',
'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties',
'build/archive'
]


def RunSteps(api):
api.step('Print testing archive API', ['echo', 'just', 'a', 'test'])
archive_spec_path = 'infra/archive_config/android-archive-rel.json'
abs_archive = api.path.abspath(archive_spec_path)
checkout_dir = api.path.abs_to_path(api.path.abspath('.'))
source_dir = api.path.abs_to_path(api.path.abspath('.'))
build_dir = api.path.abs_to_path(api.path.abspath('out/Android'))
print('checkout_dir:', checkout_dir)
print('source_dir:', source_dir)
print('build_dir:', build_dir)
update_properties = {}

archive_spec = api.file.read_json(
'read archive spec (%s)' % api.path.basename(abs_archive),
abs_archive,
test_data={})
source_side_config = json_format.ParseDict(
archive_spec, ArchiveData(), ignore_unknown_fields=True)

api.archive.gcs_archive(
checkout_dir=checkout_dir,
source_dir=source_dir,
build_dir=build_dir,
update_properties=update_properties,
archive_data=source_side_config)


def GenTests(api):
return ()
4 changes: 4 additions & 0 deletions test_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./third_party/depot_tools/recipes/recipes.py \
--package=cobalt/infra/config/recipes.cfg \
--log-level WARNING \
run upload_archive

0 comments on commit 33c9f48

Please sign in to comment.