buildscripts: build windows artifacts in kokoro (#4253)

We always build the artifacts, but only store them in placer via
kokoro if MVN_ARTIFACTS is set to a non empty value.

The 32 bit script runs tests as well as builds artifacts.
The 64 bit script only builds artifacts.
This commit is contained in:
zpencer 2018-03-22 17:56:59 -07:00 committed by GitHub
parent a43845622f
commit 19a64cc336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 103 additions and 24 deletions

View File

@ -12,32 +12,16 @@ cd /d %~dp0\..\..
set WORKSPACE=T:\src\github\grpc-java
set ESCWORKSPACE=%WORKSPACE:\=\\%
mkdir grpc-java-helper
cd grpc-java-helper
@rem Clear JAVA_HOME to prevent a different Java version from being used
set JAVA_HOME=
set PATH=C:\Program Files\java\jdk1.8.0_152\bin;%PATH%
call "%VS120COMNTOOLS%\vsvars32.bat" || exit /b 1
call "%WORKSPACE%\buildscripts\make_dependencies.bat" || exit /b 1
cd "%WORKSPACE%"
cmd.exe /C "%WORKSPACE%\buildscripts\kokoro\windows32.bat" || exit /b 1
cmd.exe /C "%WORKSPACE%\buildscripts\kokoro\windows64.bat" || exit /b 1
echo targetArch=x86_32> gradle.properties
echo failOnWarnings=true>> gradle.properties
echo vcProtobufLibs=%ESCWORKSPACE%\\grpc-java-helper\\protobuf-%PROTOBUF_VER%\\cmake\\build\\Release>> gradle.properties
echo vcProtobufInclude=%ESCWORKSPACE%\\grpc-java-helper\\protobuf-%PROTOBUF_VER%\\cmake\\build\\include>> gradle.properties
cmd.exe /C "%WORKSPACE%\gradlew.bat build"
set GRADLEEXIT=%ERRORLEVEL%
@rem Rename test results .xml files to format parsable by Kokoro
@echo off
for /r %%F in (TEST-*.xml) do (
mkdir "%%~dpnF"
move "%%F" "%%~dpnF\sponge_log.xml" >NUL
IF DEFINED MVN_ARTIFACTS (
mkdir mvn-artifacts
move artifacts\x86_64 mvn-artifacts\x86_64
move artifacts\x86_32 mvn-artifacts\x86_32
)
@echo on
exit /b %GRADLEEXIT%

View File

@ -5,6 +5,6 @@ build_file: "grpc-java/buildscripts/kokoro/windows.bat"
timeout_mins: 45
action {
define_artifacts {
regex: "**/build/test-results/**/*.xml"
regex: ["**/build/test-results/**/*.xml", "**/mvn-artifacts/**"]
}
}

View File

@ -0,0 +1,51 @@
@rem ##########################################################################
@rem
@rem Runs tests and then builds artifacts to %WORKSPACE%\artifacts\
@rem
@rem ##########################################################################
type c:\VERSION
@rem Enter repo root
cd /d %~dp0\..\..
set WORKSPACE=T:\src\github\grpc-java
set ESCWORKSPACE=%WORKSPACE:\=\\%
@rem Clear JAVA_HOME to prevent a different Java version from being used
set JAVA_HOME=
set PATH=C:\Program Files\java\jdk1.8.0_152\bin;%PATH%
mkdir grpc-java-helper32
cd grpc-java-helper32
call "%VS120COMNTOOLS%\vsvars32.bat" || exit /b 1
call "%WORKSPACE%\buildscripts\make_dependencies.bat" || exit /b 1
cd "%WORKSPACE%"
SET TARGET_ARCH=x86_32
SET FAIL_ON_WARNINGS=true
SET VC_PROTOBUF_LIBS=%ESCWORKSPACE%\\grpc-java-helper32\\protobuf-%PROTOBUF_VER%\\cmake\\build\\Release
SET VC_PROTOBUF_INCLUDE=%ESCWORKSPACE%\\grpc-java-helper32\\protobuf-%PROTOBUF_VER%\\cmake\\build\\include
SET GRADLE_FLAGS=-PtargetArch=%TARGET_ARCH% -PfailOnWarnings=%FAIL_ON_WARNINGS% -PvcProtobufLibs=%VC_PROTOBUF_LIBS% -PvcProtobufInclude=%VC_PROTOBUF_INCLUDE%
cmd.exe /C "%WORKSPACE%\gradlew.bat %GRADLE_FLAGS% build"
set GRADLEEXIT=%ERRORLEVEL%
@rem Rename test results .xml files to format parsable by Kokoro
@echo off
for /r %%F in (TEST-*.xml) do (
mkdir "%%~dpnF"
move "%%F" "%%~dpnF\sponge_log.xml" >NUL
)
@echo on
IF NOT %GRADLEEXIT% == 0 (
exit /b %GRADLEEXIT%
)
@rem make sure no daemons have any files open
cmd.exe /C "%WORKSPACE%\gradlew.bat --stop"
cmd.exe /C "%WORKSPACE%\gradlew.bat %GRADLE_FLAGS% -Dorg.gradle.parallel=false -PrepositoryDir=%WORKSPACE%\artifacts\x86_32\ clean grpc-compiler:build grpc-compiler:uploadArchives" || exit /b 1

View File

@ -0,0 +1,35 @@
@rem ##########################################################################
@rem
@rem Builds artifacts for x86_64 into %WORKSPACE%\artifacts\
@rem
@rem ##########################################################################
type c:\VERSION
@rem Enter repo root
cd /d %~dp0\..\..
set WORKSPACE=T:\src\github\grpc-java
set ESCWORKSPACE=%WORKSPACE:\=\\%
@rem Clear JAVA_HOME to prevent a different Java version from being used
set JAVA_HOME=
set PATH=C:\Program Files\java\jdk1.8.0_152\bin;%PATH%
mkdir grpc-java-helper64
cd grpc-java-helper64
call "%VS120COMNTOOLS%\..\..\VC\bin\amd64\vcvars64.bat" || exit /b 1
call "%WORKSPACE%\buildscripts\make_dependencies.bat" || exit /b 1
cd "%WORKSPACE%"
SET TARGET_ARCH=x86_64
SET FAIL_ON_WARNINGS=true
SET VC_PROTOBUF_LIBS=%ESCWORKSPACE%\\grpc-java-helper64\\protobuf-%PROTOBUF_VER%\\cmake\\build\\Release
SET VC_PROTOBUF_INCLUDE=%ESCWORKSPACE%\\grpc-java-helper64\\protobuf-%PROTOBUF_VER%\\cmake\\build\\include
SET GRADLE_FLAGS=-PtargetArch=%TARGET_ARCH% -PfailOnWarnings=%FAIL_ON_WARNINGS% -PvcProtobufLibs=%VC_PROTOBUF_LIBS% -PvcProtobufInclude=%VC_PROTOBUF_INCLUDE%
@rem make sure no daemons have any files open
cmd.exe /C "%WORKSPACE%\gradlew.bat --stop"
cmd.exe /C "%WORKSPACE%\gradlew.bat %GRADLE_FLAGS% -Dorg.gradle.parallel=false -PrepositoryDir=%WORKSPACE%\artifacts\x86_64\ clean grpc-compiler:build grpc-compiler:uploadArchives" || exit /b 1

View File

@ -26,7 +26,16 @@ del protobuf.zip
pushd protobuf-%PROTOBUF_VER%\cmake
mkdir build
cd build
cmake -Dprotobuf_BUILD_TESTS=OFF -G "Visual Studio %VisualStudioVersion:~0,2%" .. || exit /b 1
@rem cmake does not detect x86_64 from the vcvars64.bat variables.
@rem If vcvars64.bat has set PLATFORM to X64, then inform cmake to use the Win64 version of VS
if "%PLATFORM%" == "X64" (
@rem Note the space
SET CMAKE_VSARCH= Win64
) else (
SET CMAKE_VSARCH=
)
cmake -Dprotobuf_BUILD_TESTS=OFF -G "Visual Studio %VisualStudioVersion:~0,2%%CMAKE_VSARCH%" .. || exit /b 1
msbuild /maxcpucount /p:Configuration=Release libprotoc.vcxproj || exit /b 1
call extract_includes.bat || exit /b 1
popd