2015-03-30 17:51:13 +00:00
|
|
|
# Build scripts that publish pre-compiled protoc artifacts
|
|
|
|
``protoc`` is the compiler for ``.proto`` files. It generates language bindings
|
|
|
|
for the messages and/or RPC services from ``.proto`` files.
|
|
|
|
|
|
|
|
Because ``protoc`` is a native executable, the scripts under this directory
|
|
|
|
build and publish a ``protoc`` executable (a.k.a. artifact) to Maven
|
2015-03-30 17:57:00 +00:00
|
|
|
repositories. The artifact can be used by build automation tools so that users
|
|
|
|
would not need to compile and install ``protoc`` for their systems.
|
|
|
|
|
|
|
|
## Versioning
|
|
|
|
The version of the ``protoc`` artifact must be the same as the version of the
|
|
|
|
Protobuf project.
|
2015-03-30 17:51:13 +00:00
|
|
|
|
|
|
|
## Artifact name
|
|
|
|
The name of a published ``protoc`` artifact is in the following format:
|
|
|
|
``protoc-<version>-<os>-<arch>.exe``, e.g., ``protoc-3.0.0-alpha-3-windows-x86_64.exe``.
|
|
|
|
|
2015-03-30 18:02:02 +00:00
|
|
|
## System requirement
|
2015-04-01 19:06:24 +00:00
|
|
|
Install [Apache Maven](http://maven.apache.org/) if you don't have it.
|
|
|
|
|
|
|
|
The scripts only work under Unix-like environments, e.g., Linux, MacOSX, and
|
2015-03-30 18:02:02 +00:00
|
|
|
Cygwin or MinGW for Windows. Please see ``README.md`` of the Protobuf project
|
|
|
|
for how to set up the build environment.
|
|
|
|
|
2015-03-30 17:51:13 +00:00
|
|
|
## To install artifacts locally
|
|
|
|
The following command will install the ``protoc`` artifact to your local Maven repository.
|
|
|
|
```
|
2015-04-01 19:06:24 +00:00
|
|
|
$ mvn install
|
2015-03-30 17:51:13 +00:00
|
|
|
```
|
|
|
|
|
2015-04-01 23:32:21 +00:00
|
|
|
## Cross-compilation
|
|
|
|
The Maven script will try to detect the OS and the architecture from Java
|
2015-04-02 17:25:13 +00:00
|
|
|
system properties. It's possible to build a protoc binary for an architecture
|
2015-04-01 23:32:21 +00:00
|
|
|
that is different from what Java has detected, as long as you have the proper
|
|
|
|
compilers installed. For example, MingGW32 only ships with 32-bit compilers,
|
|
|
|
but you can still build 32-bit protoc under a 64-bit system, with the following
|
|
|
|
command:
|
|
|
|
```
|
|
|
|
$ mvn install -Dos.detected.arch=x86_32
|
|
|
|
```
|
|
|
|
|
2015-03-30 17:51:13 +00:00
|
|
|
## To push artifacts to Maven Central
|
2015-04-01 19:06:24 +00:00
|
|
|
Before you can upload artifacts to Maven Central repository, make sure you have
|
|
|
|
read [this page](http://central.sonatype.org/pages/apache-maven.html) on how to
|
2015-04-02 17:25:13 +00:00
|
|
|
configure GPG and Sonatype account.
|
2015-03-30 17:51:13 +00:00
|
|
|
|
|
|
|
Use the following command to upload artifacts:
|
|
|
|
```
|
2015-04-01 19:06:24 +00:00
|
|
|
$ mvn clean deploy -P release
|
2015-03-30 17:51:13 +00:00
|
|
|
```
|
|
|
|
|