Skip to content

Commit

Permalink
refactor: relocate golden files (#10454)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolduc committed Dec 17, 2022
1 parent a7ff2f6 commit 00764bf
Show file tree
Hide file tree
Showing 108 changed files with 705 additions and 782 deletions.
6 changes: 3 additions & 3 deletions ci/cloudbuild/builds/generate-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ if [ -z "${GENERATE_GOLDEN_ONLY}" ]; then
else
io::log_red "Only formatting generated golden code."
git ls-files -z -- 'generator/integration_tests/golden/internal/*.h' \
'generator/integration_tests/golden/*.h' \
'generator/integration_tests/golden/internal/*.cc' \
'generator/integration_tests/golden/*.cc' |
'generator/integration_tests/golden/v1/*.h' \
'generator/integration_tests/golden/v1/internal/*.cc' \
'generator/integration_tests/golden/v1/*.cc' |
xargs -P "$(nproc)" -n 1 -0 clang-format -i
fi

Expand Down
14 changes: 7 additions & 7 deletions generator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ cc_grpc_library(
filegroup(
name = "golden_srcs",
srcs = glob([
"golden/*.cc",
"golden/internal/*.cc",
"golden/v1/*.cc",
"golden/v1/internal/*.cc",
]),
)

filegroup(
name = "golden_hdrs",
srcs = glob([
"golden/*.h",
"golden/internal/*.h",
"golden/mocks/*.h",
"golden/v1/*.h",
"golden/v1/internal/*.h",
"golden/v1/mocks/*.h",
]),
)

Expand Down Expand Up @@ -132,7 +132,7 @@ filegroup(
) for test in google_cloud_cpp_generator_golden_tests]

[cc_test(
name = sample.replace(".cc", "").replace("_", "/"),
name = sample.replace("/", "_").replace(".cc", ""),
srcs = [sample],
copts = [
"-I$(BINDIR)",
Expand All @@ -142,4 +142,4 @@ filegroup(
":google_cloud_cpp_generator_golden",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
],
) for sample in glob(["golden/samples/*.cc"])]
) for sample in glob(["golden/v1/samples/*.cc"])]
6 changes: 3 additions & 3 deletions generator/integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ set_target_properties(google_cloud_cpp_generator_golden_protos
file(
GLOB google_cloud_cpp_generator_golden_files
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"golden/*.h" "golden/*.cc" "golden/internal/*.h" "golden/internal/*.cc"
"golden/mocks/*.h")
"golden/v1/*.h" "golden/v1/*.cc" "golden/v1/internal/*.h"
"golden/v1/internal/*.cc" "golden/v1/mocks/*.h")
list(SORT google_cloud_cpp_generator_golden_files)

# Create a library from the where the golden code was copied to.
Expand Down Expand Up @@ -161,7 +161,7 @@ endforeach ()
file(
GLOB
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"golden/samples/*.cc")
"golden/v1/samples/*.cc")
foreach (fname IN LISTS samples_cc)
google_cloud_cpp_add_executable(target "generator" "${fname}")
target_link_libraries(
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test.proto

#include "generator/integration_tests/golden/golden_kitchen_sink_client.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_client.h"
#include <memory>

namespace google {
namespace cloud {
namespace golden {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

GoldenKitchenSinkClient::GoldenKitchenSinkClient(
Expand Down Expand Up @@ -158,6 +158,6 @@ GoldenKitchenSinkClient::ExplicitRouting2(google::test::admin::database::v1::Exp
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden
} // namespace golden_v1
} // namespace cloud
} // namespace google
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test.proto

#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CLIENT_H
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CLIENT_H
#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CLIENT_H
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CLIENT_H

#include "generator/integration_tests/golden/golden_kitchen_sink_connection.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection.h"
#include "google/cloud/future.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
Expand All @@ -31,7 +31,7 @@

namespace google {
namespace cloud {
namespace golden {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

///
Expand Down Expand Up @@ -410,8 +410,8 @@ class GoldenKitchenSinkClient {
};

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden
} // namespace golden_v1
} // namespace cloud
} // namespace google

#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CLIENT_H
#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CLIENT_H
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test.proto

#include "generator/integration_tests/golden/golden_kitchen_sink_connection.h"
#include "generator/integration_tests/golden/golden_kitchen_sink_options.h"
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_connection_impl.h"
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_option_defaults.h"
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_stub_factory.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_options.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_connection_impl.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_option_defaults.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_stub_factory.h"
#include "google/cloud/background_threads.h"
#include "google/cloud/common_options.h"
#include "google/cloud/credentials.h"
Expand All @@ -30,7 +30,7 @@

namespace google {
namespace cloud {
namespace golden {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

GoldenKitchenSinkConnection::~GoldenKitchenSinkConnection() = default;
Expand Down Expand Up @@ -109,16 +109,16 @@ std::shared_ptr<GoldenKitchenSinkConnection> MakeGoldenKitchenSinkConnection(
internal::CheckExpectedOptions<CommonOptionList, GrpcOptionList,
UnifiedCredentialsOptionList,
GoldenKitchenSinkPolicyOptionList>(options, __func__);
options = golden_internal::GoldenKitchenSinkDefaultOptions(
options = golden_v1_internal::GoldenKitchenSinkDefaultOptions(
std::move(options));
auto background = internal::MakeBackgroundThreadsFactory(options)();
auto stub = golden_internal::CreateDefaultGoldenKitchenSinkStub(
auto stub = golden_v1_internal::CreateDefaultGoldenKitchenSinkStub(
background->cq(), options);
return std::make_shared<golden_internal::GoldenKitchenSinkConnectionImpl>(
return std::make_shared<golden_v1_internal::GoldenKitchenSinkConnectionImpl>(
std::move(background), std::move(stub), std::move(options));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden
} // namespace golden_v1
} // namespace cloud
} // namespace google
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test.proto

#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CONNECTION_H
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CONNECTION_H
#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CONNECTION_H
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CONNECTION_H

#include "generator/integration_tests/golden/golden_kitchen_sink_connection_idempotency_policy.h"
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_retry_traits.h"
#include "generator/integration_tests/golden/internal/golden_kitchen_sink_stub.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_retry_traits.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_stub.h"
#include "google/cloud/backoff_policy.h"
#include "google/cloud/internal/async_read_write_stream_impl.h"
#include "google/cloud/options.h"
Expand All @@ -32,18 +32,18 @@

namespace google {
namespace cloud {
namespace golden {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

using GoldenKitchenSinkRetryPolicy = ::google::cloud::internal::TraitBasedRetryPolicy<
golden_internal::GoldenKitchenSinkRetryTraits>;
golden_v1_internal::GoldenKitchenSinkRetryTraits>;

using GoldenKitchenSinkLimitedTimeRetryPolicy = ::google::cloud::internal::LimitedTimeRetryPolicy<
golden_internal::GoldenKitchenSinkRetryTraits>;
golden_v1_internal::GoldenKitchenSinkRetryTraits>;

using GoldenKitchenSinkLimitedErrorCountRetryPolicy =
::google::cloud::internal::LimitedErrorCountRetryPolicy<
golden_internal::GoldenKitchenSinkRetryTraits>;
golden_v1_internal::GoldenKitchenSinkRetryTraits>;

/**
* The `GoldenKitchenSinkConnection` object for `GoldenKitchenSinkClient`.
Expand All @@ -55,7 +55,7 @@ using GoldenKitchenSinkLimitedErrorCountRetryPolicy =
*
* To create a concrete instance, see `MakeGoldenKitchenSinkConnection()`.
*
* For mocking, see `golden_mocks::MockGoldenKitchenSinkConnection`.
* For mocking, see `golden_v1_mocks::MockGoldenKitchenSinkConnection`.
*/
class GoldenKitchenSinkConnection {
public:
Expand Down Expand Up @@ -109,7 +109,7 @@ class GoldenKitchenSinkConnection {
* - `google::cloud::CommonOptionList`
* - `google::cloud::GrpcOptionList`
* - `google::cloud::UnifiedCredentialsOptionList`
* - `google::cloud::golden::GoldenKitchenSinkPolicyOptionList`
* - `google::cloud::golden_v1::GoldenKitchenSinkPolicyOptionList`
*
* @note Unexpected options will be ignored. To log unexpected options instead,
* set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment.
Expand All @@ -121,8 +121,8 @@ std::shared_ptr<GoldenKitchenSinkConnection> MakeGoldenKitchenSinkConnection(
Options options = {});

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden
} // namespace golden_v1
} // namespace cloud
} // namespace google

#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_GOLDEN_KITCHEN_SINK_CONNECTION_H
#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CONNECTION_H
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test.proto

#include "generator/integration_tests/golden/golden_kitchen_sink_connection_idempotency_policy.h"
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.h"
#include "absl/memory/memory.h"
#include <memory>

namespace google {
namespace cloud {
namespace golden {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

using ::google::cloud::Idempotency;
Expand Down Expand Up @@ -72,6 +72,6 @@ std::unique_ptr<GoldenKitchenSinkConnectionIdempotencyPolicy>
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden
} // namespace golden_v1
} // namespace cloud
} // namespace google
Loading

0 comments on commit 00764bf

Please sign in to comment.