@@ -16,56 +16,56 @@ package(default_visibility = ["//visibility:public"])
1616
1717licenses (["notice" ]) # Apache 2.0
1818
19- cc_binary (
20- name = "storage_bucket_samples" ,
21- srcs = ["storage_bucket_samples.cc" ],
22- deps = ["//google/cloud/storage:storage_client" ],
23- )
19+ load (":storage_examples_common.bzl" , "storage_examples_common_hdrs" , "storage_examples_common_srcs" )
2420
25- cc_binary (
26- name = "storage_bucket_acl_samples" ,
27- srcs = ["storage_bucket_acl_samples.cc" ],
28- deps = ["//google/cloud/storage:storage_client" ],
21+ cc_library (
22+ name = "storage_examples_common" ,
23+ srcs = storage_examples_common_srcs ,
24+ hdrs = storage_examples_common_hdrs ,
25+ deps = [
26+ "//google/cloud/storage:storage_client" ,
27+ "@com_github_googleapis_google_cloud_cpp_common//google/cloud:google_cloud_cpp_common" ,
28+ ],
2929)
3030
31- cc_binary (
32- name = "storage_bucket_iam_samples" ,
33- srcs = ["storage_bucket_iam_samples.cc" ],
34- deps = ["//google/cloud/storage:storage_client" ],
35- )
31+ load (":storage_examples_unit_tests.bzl" , "storage_examples_unit_tests" )
3632
37- cc_binary (
38- name = "storage_default_object_acl_samples" ,
39- srcs = ["storage_default_object_acl_samples.cc" ],
40- deps = ["//google/cloud/storage:storage_client" ],
41- )
33+ [cc_test (
34+ name = test .replace ("/" , "_" ).replace (".cc" , "" ),
35+ srcs = [test ],
36+ deps = [
37+ ":storage_examples_common" ,
38+ "//google/cloud/storage:storage_client" ,
39+ "@com_github_googleapis_google_cloud_cpp_common//google/cloud:google_cloud_cpp_common" ,
40+ "@com_github_googleapis_google_cloud_cpp_common//google/cloud/testing_util:google_cloud_cpp_testing" ,
41+ "@com_google_googletest//:gtest" ,
42+ ],
43+ ) for test in storage_examples_unit_tests ]
4244
43- cc_binary (
44- name = "storage_object_samples" ,
45- srcs = ["storage_object_samples.cc" ],
46- deps = ["//google/cloud/storage:storage_client" ],
47- )
45+ load (":storage_examples.bzl" , "storage_examples" )
4846
49- cc_binary (
50- name = "storage_object_acl_samples" ,
51- srcs = ["storage_object_acl_samples.cc" ],
52- deps = ["//google/cloud/storage:storage_client" ],
53- )
47+ # TODO(#3523) - add auto-runnable examples to this list until all
48+ # examples are auto-runnable and then cleanup this code.
49+ auto_runnable_storage_examples = []
5450
55- cc_binary (
56- name = "storage_notification_samples" ,
57- srcs = ["storage_notification_samples.cc" ],
58- deps = ["//google/cloud/storage:storage_client" ],
59- )
51+ auto_runnable_tags = [
52+ "storage-integration-tests" ,
53+ "integration-tests" ,
54+ ]
6055
61- cc_binary (
62- name = "storage_quickstart" ,
63- srcs = ["storage_quickstart.cc" ],
64- deps = ["//google/cloud/storage:storage_client" ],
65- )
56+ integration_test_tags = [
57+ "integration-tests" ,
58+ ]
6659
67- cc_binary (
68- name = "storage_service_account_samples" ,
69- srcs = ["storage_service_account_samples.cc" ],
70- deps = ["//google/cloud/storage:storage_client" ],
71- )
60+ [cc_test (
61+ name = test .replace ("/" , "_" ).replace (".cc" , "" ),
62+ srcs = [test ],
63+ tags = auto_runnable_tags if test in auto_runnable_storage_examples else integration_test_tags ,
64+ deps = [
65+ ":storage_examples_common" ,
66+ "//google/cloud/storage:storage_client" ,
67+ "@com_github_googleapis_google_cloud_cpp_common//google/cloud:google_cloud_cpp_common" ,
68+ "@com_github_googleapis_google_cloud_cpp_common//google/cloud/testing_util:google_cloud_cpp_testing" ,
69+ "@com_google_googletest//:gtest" ,
70+ ],
71+ ) for test in storage_examples ]
0 commit comments