skia2/experimental/bazel_test/bazel_test.cpp
Kevin Lubick 9488e0237d [infra] Experiment generating BUILD.bazel files
This uses the gazelle extension from
https://skia-review.googlesource.com/c/buildbot/+/473357

Review Tips:
 - Ignore any changes to .h or .cpp files. Those have been
   pulled out into their own CLs.
 - Start with bazel/macros.bzl.
 - Read the CL with the generation code, if you haven't already.
 - Look at third_party/file_map_for_bazel.json.
 - See experimental/bazel_test for an idea of how a cc_binary
   would be made.
 - Spot check one or two of the BUILD.bazel files.

This CL generates the "atomic" rules for src/, include/ and
modules/skshaper, as a starting point.

`bazel build --config clang //include/...` works

`bazel build --config clang //src/...` starts compiling,
(which verifies that the BUILD.bazel files are all valid),
but runs into errors because not all third_party deps have
been resolved, and there are some files missing from the
toolchain still (e.g. EGL headers).

Change-Id: Ib7e0fb0efdb9f08655f06cbc56e9bb4cf416294b
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474240
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 18:53:16 +00:00

25 lines
823 B
C++

// Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "png.h"
#include <ctime>
#include <iostream>
#include "include/core/SkTypes.h"
void print_localtime() {
std::time_t result = std::time(nullptr);
std::cout << std::asctime(std::localtime(&result));
}
int main(int argc, char** argv) {
SkDebugf("Hello world\n");
print_localtime();
// https://docs.bazel.build/versions/main/test-encyclopedia.html#role-of-the-test-runner
if (png_access_version_number() == 10638) {
printf("PASS\n"); // This tells the human the test passed.
return 0; // This tells Bazel the test passed.
}
printf("FAIL\n"); // This tells the human the test failed.
return 1; // This tells Bazel the test failed.
}