Skip to content

Commit

Permalink
Test bazel on windows (open-telemetry#58)
Browse files Browse the repository at this point in the history
* Test bazelisk on windows

* Fix install_bazelisk script

* Limit windows bazel testing

* Use separate windows_bazel job

* s/WIN32/_WIN32/

* Fix windows bazel compilation issue

* Fix windows bazel compilation issue
  • Loading branch information
rnburn authored Mar 27, 2020
1 parent f5bd54c commit 8b3dd9c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ jobs:
- run: ./ci/setup_windows_ci_environment.ps1
- run: ./ci/do_ci.ps1 cmake.test

windows_bazel:
executor: win/vs2019
steps:
- checkout
- run: ./ci/install_windows_bazelisk.ps1
- run: ./ci/do_ci.ps1 bazel.build

windows_plugin_test:
executor: win/vs2019
steps:
Expand All @@ -146,4 +153,5 @@ workflows:
- benchmark
- osx_test
- windows
- windows_bazel
- windows_plugin_test
2 changes: 1 addition & 1 deletion api/include/opentelemetry/nostd/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace nostd
class string_view
{
public:
static constexpr std::size_t npos = std::string::npos;
static constexpr std::size_t npos = static_cast<std::size_t>(-1);

string_view() noexcept : length_(0), data_(nullptr) {}

Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/plugin/dynamic_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <string>

#ifdef WIN32
#ifdef _WIN32
# include "opentelemetry/plugin/detail/dynamic_load_windows.h"
#else
# include "opentelemetry/plugin/detail/dynamic_load_unix.h"
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/plugin/hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "opentelemetry/plugin/factory.h"
#include "opentelemetry/version.h"

#ifdef WIN32
#ifdef _WIN32

/**
* Cross-platform helper macro to declare the symbol used to load an OpenTelemetry implementation
Expand Down
10 changes: 10 additions & 0 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ $action = $args[0]

$SRC_DIR=(Get-Item -Path ".\").FullName

$BAZEL_OPTIONS=""
$BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors"

if (!(test-path build)) {
mkdir build
}
Expand All @@ -18,6 +21,13 @@ $PLUGIN_DIR="$SRC_DIR\plugin"
$VCPKG_DIR="$SRC_DIR\vcpkg"

switch ($action) {
"bazel.build" {
bazel build $BAZEL_OPTIONS -- //... -//api/test/... -//sdk/test/...
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
}
"cmake.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
Expand Down
8 changes: 8 additions & 0 deletions ci/install_windows_bazelisk.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$ErrorActionPreference = "Stop"
trap { $host.SetShouldExit(1) }

$BAZELISK_VERSION="1.3.0"
$CWD=(Get-Item -Path ".\").FullName
(new-object System.Net.WebClient). `
DownloadFile("https://github.com/bazelbuild/bazelisk/releases/download/v$BAZELISK_VERSION/bazelisk-windows-amd64.exe",
"C:\windows\system32\bazel.exe")

0 comments on commit 8b3dd9c

Please sign in to comment.