Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Commit 42aef87

Browse files
authored
bug: restore samples to the Bazel builds. (#614)
I accidentally removed the samples from the Bazel builds, this change restores them.
1 parent 5cf58c0 commit 42aef87

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

google/cloud/spanner/samples/BUILD

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ package(default_visibility = ["//visibility:public"])
1818

1919
licenses(["notice"]) # Apache 2.0
2020

21-
load(":spanner_client_samples.bzl", "spanner_client_samples")
21+
load(":spanner_client_integration_samples.bzl", "spanner_client_integration_samples")
22+
load(":spanner_client_unit_samples.bzl", "spanner_client_unit_samples")
2223

2324
[cc_test(
2425
name = "spanner_client_" + test.replace("/", "_").replace(".cc", ""),
@@ -31,4 +32,16 @@ load(":spanner_client_samples.bzl", "spanner_client_samples")
3132
"@com_github_googleapis_google_cloud_cpp//google/cloud/testing_util:google_cloud_cpp_testing",
3233
"@com_google_googletest//:gtest",
3334
],
34-
) for test in spanner_client_samples]
35+
) for test in spanner_client_integration_samples]
36+
37+
[cc_test(
38+
name = "spanner_client_" + test.replace("/", "_").replace(".cc", ""),
39+
srcs = [test],
40+
deps = [
41+
"//google/cloud/spanner:spanner_client",
42+
"//google/cloud/spanner:spanner_client_testing",
43+
"@com_github_googleapis_google_cloud_cpp//google/cloud:google_cloud_cpp_common",
44+
"@com_github_googleapis_google_cloud_cpp//google/cloud/testing_util:google_cloud_cpp_testing",
45+
"@com_google_googletest//:gtest",
46+
],
47+
) for test in spanner_client_unit_samples]

google/cloud/spanner/samples/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ function (spanner_client_define_samples)
3535

3636
# Export the list of unit tests to a .bzl file so we do not need to maintain
3737
# the list in two places.
38-
export_list_to_bazel("spanner_client_samples.bzl" "spanner_client_samples")
38+
export_list_to_bazel("spanner_client_integration_samples.bzl"
39+
"spanner_client_integration_samples")
40+
export_list_to_bazel("spanner_client_unit_samples.bzl"
41+
"spanner_client_unit_samples")
3942

4043
# Generate a target for each unit test.
4144
foreach (fname ${spanner_client_integration_samples}

google/cloud/spanner/samples/spanner_client_samples.bzl renamed to google/cloud/spanner/samples/spanner_client_integration_samples.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616

1717
"""Automatically generated unit tests list - DO NOT EDIT."""
1818

19-
spanner_client_samples = [
19+
spanner_client_integration_samples = [
20+
"samples.cc",
2021
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2019 Google LLC
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+
#
15+
# DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed
16+
17+
"""Automatically generated unit tests list - DO NOT EDIT."""
18+
19+
spanner_client_unit_samples = [
20+
"mock_execute_sql.cc",
21+
]

0 commit comments

Comments
 (0)