This avoids conflicting names in a couple of cases.
1. Within google, we want to sync files but not name them BUILD (since the structure doesn't match).
2. On case-insensitive filesystems, `build` may be used for a build directory. Naming `BUILD.bazel` avoids potentioal conflicts.
This change adds `rules_pkg`-based targets that will produce source distribution archives, similar to `make dist`.
These rules produce nearly the same outputs as `make dist`. However, there are some differences and caveats:
1. The outputs do not contain vendored googletest sources.
2. You have to run `autogen.sh` before `blaze build pkg:all`. This produces several autotools-related files directly into the source tree.
3. The output .zip files do not have a directory prefix like `protobuf-3.20.1-rc-1` (this will be addressed after [Substitute package variables in `pkg_zip#package_dir`. bazelbuild/rules_pkg#577](https://github.com/bazelbuild/rules_pkg/pull/577); the tar files do have this prefix, though.)
4. One file is missing from the archives, which is produced during the `make` build: benchmarks/gogo/cpp_no_group/cpp_benchmark.cc
5. In several places, I have explicitly excluded some files that are not in the autotools distribution outputs. I think most of those files should probably be included, but for now, I'm aiming for parity with `make dist`. These are marked with comments, so it should be easy to clean them up later.
Update the Go example to use Go modules: Move the example into a
directory containing a go.mod file, change the installation instructions
to use "go install".
Update the go_package option in addressbook.proto to an actual module path.
Update examples to use the google.golang.org/protobuf/proto module.
And update the java_package value accordingly.
Enabling java_multiple_files is preferred nowadays.
Refs CL 348101638 which updates the tutorial accordingly.
* Set execute bit on files if and only if they begin with (#!).
Git only tracks the 'x' (executable) bit on each file. Prior to this
CL, our files were a random mix of executable and non-executable.
This change imposes some order by making files executable if and only
if they have shebang (#!) lines at the beginning.
We don't have any executable binaries checked into the repo, so
we shouldn't need to worry about that case.
* Added fix_permissions.sh script to set +x iff a file begins with (#!).
* [bazel] Move Java runtime/toolchains into //java
This change moves `java_library` targets from the top-level BUILD file
into `//java/{core,lite,util}` and declares `alias` targets to point to
their new locations (hence, this is not a breaking change).
This will allow users that don't use Java to stop depending on
`@rules_java` (e.g. as requested in
https://github.com/bazelbuild/rules_scala/pull/989#issuecomment-583405161).
Note that there is no intention to deprecate + remove the top-level
targets in the foreseeable future.
* Add BUILD files in //java to java_EXTRA_DIST
This change adds the required loads to examples and zlib.
For full compatibility with --incompatible_load_{cc,java,proto}_rules_from_bzl,
we will need to roll gtest to a newer version.
To make this work, I created a symlink to the existing zlib.BUILD file.
Maybe there is a better way to do this, but this is at least a quick
workaround to fix the build.
@bazel_skylib//:lib is supposedly deprecated. The 'versions' struct in lib.bzl was committed to bazel-skylib at the same time as //lib:versions.bzl, so there should be no backward incompatibility.
The example utilizes native bazel rules (proto_library, cc_proto_library,
java_proto_library, java_lite_proto_library) to show how easy it is to
build protobuf with bazel's native support. It also makes use of well
known types which was not possible until the latest bazel 0.5.4 release
and https://github.com/google/protobuf/pull/3594 .
A series of improvements:
- Improved Protobuf module compatibility (disabled by default);
- Hide advanced settings;
- Added build tree configuration;
- Added build of examples.
This will allow us to like to specific snippets of code in the
documentation. I plan to create a tutorial similar to the C# tutorial
https://developers.google.com/protocol-buffers/docs/csharptutorial
Since that tutorial has sections for populating a proto, parsing, and
serializing, I made a region for each of these for Go. To make the
populating sample more self-contained, I refactor the listing example
slightly.
Since these tags might be confusing, added a note that these are not
part of the normal protocol buffers syntax. I also linked to the main
tutorials page that uses these examples
https://developers.google.com/protocol-buffers/docs/tutorials so that
anyone who arrived here without going through that info first can get
more explanation if they want.
This follows the other examples so that it can be used as a tutorial,
such as the ones at:
https://developers.google.com/protocol-buffers/docs/tutorials
Even though Go generally does not use Makefiles, I added targets for the
Go examples to be consistent with the other languages.
Edit:
Fix Travis run. Change to use $HOME instead of ~. Add protoc to path.
GOPATH entry cannot start with shell metacharacter '~': "~/gocode"
Edit(2):
Fix Go code style to address comments.