mirror of https://github.com/grpc/grpc.git
parent
d01633944c
commit
f43322dfcb
3 changed files with 2012 additions and 0 deletions
@ -0,0 +1,188 @@ |
||||
# Copyright 2018 The Bazel Authors. All rights reserved. |
||||
# |
||||
# 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. |
||||
|
||||
# This becomes the BUILD file for @local_config_cc// under Windows. |
||||
|
||||
package(default_visibility = ["//visibility:public"]) |
||||
|
||||
load(":cc_toolchain_config.bzl", "cc_toolchain_config") |
||||
|
||||
cc_library( |
||||
name = "malloc", |
||||
) |
||||
|
||||
filegroup( |
||||
name = "empty", |
||||
srcs = [], |
||||
) |
||||
|
||||
# Hardcoded toolchain, legacy behaviour. |
||||
cc_toolchain_suite( |
||||
name = "toolchain", |
||||
toolchains = { |
||||
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", |
||||
"x64_windows|msvc-cl": ":cc-compiler-x64_windows", |
||||
"x64_windows|msys-gcc": ":cc-compiler-x64_windows_msys", |
||||
"x64_windows|mingw-gcc": ":cc-compiler-x64_windows_mingw", |
||||
"x64_windows_msys": ":cc-compiler-x64_windows_msys", |
||||
"x64_windows": ":cc-compiler-x64_windows", |
||||
"armeabi-v7a": ":cc-compiler-armeabi-v7a", |
||||
}, |
||||
) |
||||
|
||||
cc_toolchain( |
||||
name = "cc-compiler-x64_windows_msys", |
||||
toolchain_identifier = "msys_x64", |
||||
toolchain_config = ":msys_x64", |
||||
all_files = ":empty", |
||||
ar_files = ":empty", |
||||
as_files = ":empty", |
||||
compiler_files = ":empty", |
||||
dwp_files = ":empty", |
||||
linker_files = ":empty", |
||||
objcopy_files = ":empty", |
||||
strip_files = ":empty", |
||||
supports_param_files = 1, |
||||
) |
||||
|
||||
cc_toolchain_config( |
||||
name = "msys_x64", |
||||
cpu = "x64_windows", |
||||
compiler = "msys-gcc", |
||||
) |
||||
|
||||
toolchain( |
||||
name = "cc-toolchain-x64_windows_msys", |
||||
exec_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
"@bazel_tools//tools/cpp:msys", |
||||
], |
||||
target_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
], |
||||
toolchain = ":cc-compiler-x64_windows_msys", |
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
||||
) |
||||
|
||||
cc_toolchain( |
||||
name = "cc-compiler-x64_windows_mingw", |
||||
toolchain_identifier = "msys_x64_mingw", |
||||
toolchain_config = ":msys_x64_mingw", |
||||
all_files = ":empty", |
||||
ar_files = ":empty", |
||||
as_files = ":empty", |
||||
compiler_files = ":empty", |
||||
dwp_files = ":empty", |
||||
linker_files = ":empty", |
||||
objcopy_files = ":empty", |
||||
strip_files = ":empty", |
||||
supports_param_files = 0, |
||||
) |
||||
|
||||
cc_toolchain_config( |
||||
name = "msys_x64_mingw", |
||||
cpu = "x64_windows", |
||||
compiler = "mingw-gcc", |
||||
) |
||||
|
||||
toolchain( |
||||
name = "cc-toolchain-x64_windows_mingw", |
||||
exec_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
"@bazel_tools//tools/cpp:mingw", |
||||
], |
||||
target_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
], |
||||
toolchain = ":cc-compiler-x64_windows_mingw", |
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
||||
) |
||||
|
||||
cc_toolchain( |
||||
name = "cc-compiler-x64_windows", |
||||
toolchain_identifier = "msvc_x64", |
||||
toolchain_config = ":msvc_x64", |
||||
all_files = ":empty", |
||||
ar_files = ":empty", |
||||
as_files = ":empty", |
||||
compiler_files = ":empty", |
||||
dwp_files = ":empty", |
||||
linker_files = ":empty", |
||||
objcopy_files = ":empty", |
||||
strip_files = ":empty", |
||||
supports_param_files = 1, |
||||
) |
||||
|
||||
cc_toolchain_config( |
||||
name = "msvc_x64", |
||||
cpu = "x64_windows", |
||||
compiler = "msvc-cl", |
||||
) |
||||
|
||||
toolchain( |
||||
name = "cc-toolchain-x64_windows", |
||||
exec_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
], |
||||
target_compatible_with = [ |
||||
"@bazel_tools//platforms:x86_64", |
||||
"@bazel_tools//platforms:windows", |
||||
], |
||||
toolchain = ":cc-compiler-x64_windows", |
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
||||
) |
||||
|
||||
cc_toolchain( |
||||
name = "cc-compiler-armeabi-v7a", |
||||
toolchain_identifier = "stub_armeabi-v7a", |
||||
toolchain_config = ":stub_armeabi-v7a", |
||||
all_files = ":empty", |
||||
ar_files = ":empty", |
||||
as_files = ":empty", |
||||
compiler_files = ":empty", |
||||
dwp_files = ":empty", |
||||
linker_files = ":empty", |
||||
objcopy_files = ":empty", |
||||
strip_files = ":empty", |
||||
supports_param_files = 1, |
||||
) |
||||
|
||||
cc_toolchain_config( |
||||
name = "stub_armeabi-v7a", |
||||
cpu = "armeabi-v7a", |
||||
compiler = "compiler", |
||||
) |
||||
|
||||
toolchain( |
||||
name = "cc-toolchain-armeabi-v7a", |
||||
exec_compatible_with = [ |
||||
], |
||||
target_compatible_with = [ |
||||
"@bazel_tools//platforms:arm", |
||||
"@bazel_tools//platforms:android", |
||||
], |
||||
toolchain = ":cc-compiler-armeabi-v7a", |
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
||||
) |
||||
|
||||
filegroup( |
||||
name = "link_dynamic_library", |
||||
srcs = ["link_dynamic_library.sh"], |
||||
) |
||||
|
@ -0,0 +1,96 @@ |
||||
# This Dockerfile creates an image that: |
||||
# - Has the correct MTU setting for networking from inside the container to work. |
||||
# - Has Visual Studio 2015 Build Tools installed. |
||||
# - Has msys2 + git, curl, zip, unzip installed. |
||||
# - Has Python 2.7 installed. |
||||
# - Has Bazel installed. |
||||
|
||||
# TODO(jsharpe): Consider replacing "ADD $URI $DEST" with "Invoke-WebRequest -Method Get -Uri $URI -OutFile $DEST" |
||||
|
||||
# Use the latest Windows Server Core image. |
||||
# |
||||
# WARNING: What's the `:1803` about? There are two versions of Windows Server |
||||
# 2016: a "regular" one (corresponding to `microsoft/windowsservercore`) is on |
||||
# a slow release cadence, and a fast release cadence one (corresponding to |
||||
# `microsoft/windowsservercore:1803`). If you chose a different image than |
||||
# described above, probably omit the `:1803` or change it to a different |
||||
# number. |
||||
FROM microsoft/windowsservercore:1803 |
||||
|
||||
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command", "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $VerbosePreference = 'Continue';"] |
||||
|
||||
# TODO(b/112379377): Workaround until bug is fixed. |
||||
RUN netsh interface ipv4 set subinterface \"vEthernet (Ethernet)\" mtu=1460 store=persistent |
||||
|
||||
# Install Visual Studio 2015 Build Tools. |
||||
RUN Invoke-WebRequest "https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe" \ |
||||
-OutFile visualcppbuildtools_full.exe -UseBasicParsing ; \ |
||||
Start-Process -FilePath 'visualcppbuildtools_full.exe' -ArgumentList '/quiet', '/NoRestart' -Wait ; \ |
||||
Remove-Item .\visualcppbuildtools_full.exe; |
||||
|
||||
# TODO(jsharpe): Alternate install for msys2: https://github.com/StefanScherer/dockerfiles-windows/issues/30 |
||||
|
||||
# Install 7-Zip and add it to the path. |
||||
ADD https://www.7-zip.org/a/7z1801-x64.msi C:\\TEMP\\7z.msi |
||||
RUN Start-Process msiexec.exe -ArgumentList \"/i C:\\TEMP\\7z.msi /qn /norestart /log C:\\TEMP\\7z_install_log.txt\" -wait |
||||
RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ |
||||
$newpath = \"$oldpath;C:\Program Files\7-Zip\"; \ |
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath |
||||
|
||||
# Install msys2, and add some extra tools. |
||||
ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20161025.tar.xz C:\\TEMP\\msys2.tar.xz |
||||
RUN 7z x C:\TEMP\msys2.tar.xz -oC:\TEMP\msys2.tar |
||||
RUN 7z x C:\TEMP\msys2.tar -oC:\tools |
||||
RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ |
||||
$newpath = \"$oldpath;C:\tools\msys64;C:\tools\msys64\usr\bin\"; \ |
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath |
||||
RUN Start-Process msys2 -ArgumentList 'pacman -noconfirm -Syuu git curl zip unzip' -Wait |
||||
|
||||
# Install Visual C++ Redistributable for Visual Studio 2015: |
||||
ADD https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe C:\\TEMP\\vc_redist.x64.exe |
||||
RUN C:\TEMP\vc_redist.x64.exe /quiet /install |
||||
|
||||
# Install Python 2.7. |
||||
ADD https://www.python.org/ftp/python/2.7.14/python-2.7.14.amd64.msi C:\\TEMP\\python.msi |
||||
RUN Start-Process msiexec.exe -ArgumentList \"/i C:\\TEMP\\python.msi /qn /norestart /log C:\\TEMP\\python_install_log.txt\" -wait |
||||
RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ |
||||
$newpath = \"$oldpath;C:\Python27\"; \ |
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath |
||||
|
||||
# Install Bazel. |
||||
RUN Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name BAZEL_SH -Value \"C:\tools\msys64\usr\bin\bash.exe\" |
||||
RUN Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name BAZEL_VC -Value \"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\" |
||||
RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; |
||||
ADD https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-windows-x86_64.exe C:\\bin\\bazel.exe |
||||
RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ |
||||
$newpath = \"$oldpath;C:\bin\"; \ |
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath |
||||
|
||||
# TODO(jsharpe): This requires entropy so may be problematic on a headless machine: https://wiki.archlinux.org/index.php/Pacman/Package_signing#Initializing_the_keyring |
||||
RUN Start-Process msys2 -ArgumentList 'pacman-key --init' -Wait |
||||
# TODO(jsharpe): If you don't run this then the next command can't succeed since it needs to prompt to remove catgets. |
||||
RUN pacman --noconfirm -R libcatgets catgets |
||||
# Bazel documentation says to use -Syuu but this doesn't work in Docker. See |
||||
# http://g/foundry-windows/PDMVXbGew7Y |
||||
RUN pacman --noconfirm -Syy git curl zip unzip |
||||
|
||||
RUN \ |
||||
Add-Type -AssemblyName \"System.IO.Compression.FileSystem\"; \ |
||||
$zulu_url = \"https://cdn.azul.com/zulu/bin/zulu8.28.0.1-jdk8.0.163-win_x64.zip\"; \ |
||||
$zulu_zip = \"c:\\temp\\zulu8.28.0.1-jdk8.0.163-win_x64.zip\"; \ |
||||
$zulu_extracted_path = \"c:\\temp\\\" + [IO.Path]::GetFileNameWithoutExtension($zulu_zip); \ |
||||
$zulu_root = \"c:\\openjdk\"; \ |
||||
(New-Object Net.WebClient).DownloadFile($zulu_url, $zulu_zip); \ |
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zulu_zip, \"c:\\temp\"); \ |
||||
Move-Item $zulu_extracted_path -Destination $zulu_root; \ |
||||
Remove-Item $zulu_zip; \ |
||||
$env:PATH = [Environment]::GetEnvironmentVariable(\"PATH\", \"Machine\") + \";${zulu_root}\\bin\"; \ |
||||
[Environment]::SetEnvironmentVariable(\"PATH\", $env:PATH, \"Machine\"); \ |
||||
$env:JAVA_HOME = $zulu_root; \ |
||||
[Environment]::SetEnvironmentVariable(\"JAVA_HOME\", $env:JAVA_HOME, \"Machine\") |
||||
|
||||
# Restore default shell for Windows containers. |
||||
SHELL ["cmd.exe", "/s", "/c"] |
||||
|
||||
# Default to PowerShell if no other command specified. |
||||
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue