From 5f214c6e238da508b40ea63617c406c4f33ffbff Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Mon, 3 Oct 2022 11:57:26 +0100 Subject: [PATCH] Add and use python bootstrap toolchain --- examples/prelude/.buckconfig | 5 +++++ examples/prelude/toolchain/BUILD | 6 +++--- examples/prelude/toolchain/toolchain.bzl | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/examples/prelude/.buckconfig b/examples/prelude/.buckconfig index 12c9d6c1d1b8..83a5a0223443 100644 --- a/examples/prelude/.buckconfig +++ b/examples/prelude/.buckconfig @@ -5,3 +5,8 @@ name=BUILD prelude = ./prelude toolchains = ./toolchains root = . +platform = no +buck = no +fbcode = no +fbsource = no +ovr_config = no diff --git a/examples/prelude/toolchain/BUILD b/examples/prelude/toolchain/BUILD index 65c914112a8a..8919cf18c923 100644 --- a/examples/prelude/toolchain/BUILD +++ b/examples/prelude/toolchain/BUILD @@ -1,5 +1,5 @@ load(":cxx_hacks.bzl", "cxx_hacks") -load(":toolchain.bzl", "cxx_toolchain", "python_toolchain") +load(":toolchain.bzl", "cxx_toolchain", "python_toolchain", "python_bootstrap_toolchain") # Required to support the $(cxx-header-tree) macro cxx_hacks( @@ -21,7 +21,7 @@ python_toolchain( # the bootstrap toolchain is used # to poentially initialize other # toolchains -python_toolchain( +python_bootstrap_toolchain( name="python_bootstrap", visibility=["PUBLIC"], -) \ No newline at end of file +) diff --git a/examples/prelude/toolchain/toolchain.bzl b/examples/prelude/toolchain/toolchain.bzl index 9c254ff62a29..740b1a36613e 100644 --- a/examples/prelude/toolchain/toolchain.bzl +++ b/examples/prelude/toolchain/toolchain.bzl @@ -20,6 +20,10 @@ load( "PythonPlatformInfo", "PythonToolchainInfo", ) +load( + "@prelude//python_bootstrap:python_bootstrap.bzl", + "PythonBootstrapToolchainInfo", +) DEFAULT_MAKE_COMP_DB = "prelude//cxx/tools:make_comp_db" DEFAULT_MAKE_PEX_INPLACE = "prelude//python/tools:make_pex_inplace" @@ -130,3 +134,15 @@ python_toolchain = rule( }, is_toolchain_rule = True, ) + +def _python_bootstrap_toolchain(ctx): + return [ + DefaultInfo(), + PythonBootstrapToolchainInfo(interpreter="python") + ] + +python_bootstrap_toolchain = rule( + impl = _python_bootstrap_toolchain, + attrs = {}, + is_toolchain_rule = True, +)