Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99d89154 authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Allow importing starlark code in makefiles"

parents 8d18a7b5 c63ce1ab
Loading
Loading
Loading
Loading

core/all_versions.bzl

0 → 100644
+23 −0
Original line number Diff line number Diff line
# Copyright (C) 2023 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

_all_versions = ["OPR1", "OPD1", "OPD2", "OPM1", "OPM2", "PPR1", "PPD1", "PPD2", "PPM1", "PPM2", "QPR1"] + [
    version + subversion
    for version in ["Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
    for subversion in ["P1A", "P1B", "P2A", "P2B", "D1A", "D1B", "D2A", "D2B", "Q1A", "Q1B", "Q2A", "Q2B", "Q3A", "Q3B"]
]

variables_to_export_to_make = {
    "ALL_VERSIONS": _all_versions,
}
+1 −1
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ else
  endif

  $(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_board_config_results.mk \
    $(OUT_DIR)/rbcrun $(OUT_DIR)/rbc/boardlauncher.rbc)
    $(OUT_DIR)/rbcrun --mode=rbc $(OUT_DIR)/rbc/boardlauncher.rbc)
  ifneq ($(.SHELLSTATUS),0)
    $(error board configuration runner failed: $(.SHELLSTATUS))
  endif
+17 −6
Original line number Diff line number Diff line
@@ -24,14 +24,25 @@ endef
#$(warning $(call find_and_earlier,A B C,C))
#$(warning $(call find_and_earlier,A B C,D))

define version-list
$(1)P1A $(1)P1B $(1)P2A $(1)P2B $(1)D1A $(1)D1B $(1)D2A $(1)D2B $(1)Q1A $(1)Q1B $(1)Q2A $(1)Q2B $(1)Q3A $(1)Q3B
# Runs the starlark file given in $(1), and sets all the variables in its top-level
# variables_to_export_to_make variable as make variables.
#
# In order to avoid running starlark every time the stamp file is checked, we use
# $(KATI_shell_no_rerun). Then, to make sure that we actually do rerun kati when
# modifying the starlark files, we add the starlark files to the kati stamp file with
# $(KATI_extra_file_deps).
define run-starlark
$(eval _starlark_results := $(OUT_DIR)/starlark_results/$(subst /,_,$(1)).mk)
$(KATI_shell_no_rerun mkdir -p $(OUT_DIR)/starlark_results && $(OUT_DIR)/rbcrun --mode=make $(1) >$(_starlark_results) && touch -t 200001010000 $(_starlark_results))
$(if $(filter-out 0,$(.SHELLSTATUS)),$(error Starlark failed to run))
$(eval include $(_starlark_results))
$(KATI_extra_file_deps $(LOADED_STARLARK_FILES))
$(eval LOADED_STARLARK_FILES :=)
$(eval _starlark_results :=)
endef

PREV_VERSIONS := OPR1 OPD1 OPD2 OPM1 OPM2 PPR1 PPD1 PPD2 PPM1 PPM2 QPR1
ALL_VERSIONS := Q R S T U V W X Y Z
ALL_VERSIONS := $(PREV_VERSIONS) $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
PREV_VERSIONS :=
# defines ALL_VERSIONS
$(call run-starlark,build/make/core/all_versions.bzl)

# Filters ALL_VERSIONS down to the range [$1, $2], and errors if $1 > $2 or $3 is
# not in [$1, $2]
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ else
  endif

  $(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_product_config_results.mk \
    $(OUT_DIR)/rbcrun $(OUT_DIR)/rbc/launcher.rbc)
    $(OUT_DIR)/rbcrun --mode=rbc $(OUT_DIR)/rbc/launcher.rbc)
  ifneq ($(.SHELLSTATUS),0)
    $(error product configuration runner failed: $(.SHELLSTATUS))
  endif
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ bootstrap_go_package {
    pkgPath: "rbcrun",
    deps: [
        "go-starlark-starlark",
        "go-starlark-starlarkjson",
        "go-starlark-starlarkstruct",
        "go-starlark-starlarktest",
    ],
Loading