Skip to content

Commit d757709

Browse files
authored
Stop looking for buck2 in the top-level ExecuTorch build (#13393)
We should no longer require buck for the main build. (Note that scripts/build_apple_frameworks.sh still requires it for a custom script, and the following PR will attempt to clean up mentions of BUCK2 from scripts.)
1 parent 2eb7a5f commit d757709

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ if(NOT PYTHON_EXECUTABLE)
7979
endif()
8080
announce_configured_options(PYTHON_EXECUTABLE)
8181

82-
if(NOT BUCK2)
83-
resolve_buck2()
84-
endif()
85-
announce_configured_options(BUCK2)
86-
8782
announce_configured_options(CMAKE_CXX_COMPILER_ID)
8883
announce_configured_options(CMAKE_TOOLCHAIN_FILE)
8984
announce_configured_options(BUILD_TESTING)

tools/cmake/Utils.cmake

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -119,74 +119,6 @@ function(extract_sources sources_file)
119119
endif()
120120
endfunction()
121121

122-
# Sets the value of the BUCK2 variable by searching for a buck2 binary with the
123-
# correct version.
124-
#
125-
# The resolve_buck.py script uses the following logic to find buck2: 1) If BUCK2
126-
# argument is set explicitly, use it. Warn if the version is incorrect. 2) Look
127-
# for a binary named buck2 on the system path. Take it if it is the correct
128-
# version. 3) Check for a previously downloaded buck2 binary (from step 4). 4)
129-
# Download and cache correct version of buck2.
130-
function(resolve_buck2)
131-
if(EXECUTORCH_ROOT)
132-
set(executorch_root ${EXECUTORCH_ROOT})
133-
else()
134-
set(executorch_root ${CMAKE_CURRENT_SOURCE_DIR})
135-
endif()
136-
137-
set(resolve_buck2_command
138-
${PYTHON_EXECUTABLE} ${executorch_root}/tools/cmake/resolve_buck.py
139-
--cache_dir=${executorch_root}/buck2-bin
140-
)
141-
142-
if(NOT ${BUCK2} STREQUAL "")
143-
list(APPEND resolve_buck2_command --buck2=${BUCK2})
144-
endif()
145-
146-
execute_process(
147-
COMMAND ${resolve_buck2_command}
148-
OUTPUT_VARIABLE resolve_buck2_output
149-
ERROR_VARIABLE resolve_buck2_error
150-
RESULT_VARIABLE resolve_buck2_exit_code
151-
WORKING_DIRECTORY ${executorch_root}
152-
OUTPUT_STRIP_TRAILING_WHITESPACE
153-
)
154-
155-
# $BUCK2 is a copy of the var from the parent scope. This block will set
156-
# $buck2 to the value we want to return.
157-
if(resolve_buck2_exit_code EQUAL 0)
158-
set(buck2 ${resolve_buck2_output})
159-
message(STATUS "Resolved buck2 as ${resolve_buck2_output}.")
160-
elseif(resolve_buck2_exit_code EQUAL 2)
161-
# Wrong buck version used. Stop here to ensure that the user sees the error.
162-
message(FATAL_ERROR "Failed to resolve buck2.\n${resolve_buck2_error}")
163-
else()
164-
# Unexpected failure of the script. Warn.
165-
message(WARNING "Failed to resolve buck2.")
166-
message(WARNING "${resolve_buck2_error}")
167-
168-
if("${BUCK2}" STREQUAL "")
169-
set(buck2 "buck2")
170-
endif()
171-
endif()
172-
173-
# Update the var in the parent scope. Note that this does not modify our local
174-
# $BUCK2 value.
175-
set(BUCK2
176-
"${buck2}"
177-
PARENT_SCOPE
178-
)
179-
180-
# The buck2 daemon can get stuck. Killing it can help.
181-
message(STATUS "Killing buck2 daemon")
182-
execute_process(
183-
# Note that we need to use the local buck2 variable. BUCK2 is only set in
184-
# the parent scope, and can still be empty in this scope.
185-
COMMAND "${buck2} killall"
186-
WORKING_DIRECTORY ${executorch_root} COMMAND_ECHO STDOUT
187-
)
188-
endfunction()
189-
190122
# Sets the value of the PYTHON_EXECUTABLE variable to 'python' if in an active
191123
# (non-base) conda environment, and 'python3' otherwise. This maintains
192124
# backwards compatibility for non-conda users and avoids conda users needing to

0 commit comments

Comments
 (0)