1:: Copyright 2021 The Android Open Source Project 2:: 3:: Licensed under the Apache License, Version 2.0 (the "License"); 4:: you may not use this file except in compliance with the License. 5:: You may obtain a copy of the License at 6:: 7:: http://www.apache.org/licenses/LICENSE-2.0 8:: 9:: Unless required by applicable law or agreed to in writing, software 10:: distributed under the License is distributed on an "AS IS" BASIS, 11:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12:: See the License for the specific language governing permissions and 13:: limitations under the License. 14 15setlocal 16set TOP=%~dp0..\..\..\.. 17set PYTHON_SRC=%~dp0.. 18 19:: Remove Cygwin from the PATH so we use native tools (e.g. native Git). 20:: (It could leave Cygwin at the very end, but that's less of a problem.) 21set PATH=%PATH:C:\cygwin64\bin;=% 22 23:: The Kokoro image has two copies of MSBuild installed. Prefer the one in 24:: C:\VS\MSBuild over the one in 25:: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild" 26:: See https://yaqs.corp.google.com/eng/q/8657098259782696960#a1. 27if exist C:\VS\MSBuild\Current\Bin\amd64\MSBuild.exe (set "PATH=C:\VS\MSBuild\Current\Bin\amd64;%PATH%") 28 29:: When we're actually running in the Kokoro environment, the git checkouts are 30:: not owned by the current user, so when the Python build scripts query info 31:: about them, git fails. Fix this by disabling git's safe directory checking. 32IF DEFINED KOKORO_JOB_NAME (git config --global --add safe.directory *) 33 34IF NOT DEFINED KOKORO_BUILD_ID (set KOKORO_BUILD_ID=dev) 35 36:: Create the parent directories of the destination directory. Ordinarily, the 37:: "md" invocation in build.cmd would automatically create these parent 38:: directories, but it doesn't seem to work inside Kokoro's Docker-based Windows 39:: VM, so create them manually instead. See http://b/278137784#comment2. 40md "%TOP%\out" 2>NUL 41md "%TOP%\out\python3" 2>NUL 42 43call %~dp0build.cmd "%PYTHON_SRC%" "%TOP%\out\python3\artifact" 44if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% 45 46py -3 %TOP%\toolchain\ndk-kokoro\gen_manifest.py --root %TOP% ^ 47 -o %TOP%\out\python3\artifact\manifest-%KOKORO_BUILD_ID%.xml 48 49exit /b %ERRORLEVEL% 50