Commit Graph

1440 Commits

Author SHA1 Message Date
Adam Greene
cd7ebbe54f make repeated_field quack like an array 2015-05-14 10:38:11 -07:00
Feng Xiao
5bd8b680ba Merge branch 'gerrit' 2015-05-13 16:18:56 -07:00
Chris Fallin
2fe0483848 Merge pull request #383 from cfallin/ruby-travis
Add Ruby to Travis testing
2015-05-13 15:39:45 -07:00
Chris Fallin
eb37551ae4 Added Ruby to Travis testing.
- Added RVM-based Ruby test driver that tests MRI and JRuby.
- Fixed JRuby compilation (at least in my current setup): force source
  version to 1.6 (Java 6) to allow generics and annotations.
- Modify the skipped JRuby JSON tests so that the exit code is 0 (skip()
  results in a failing exit code from `rake test`). An upcoming PR
  should fix JSON under JRuby in general soon.
2015-05-13 14:58:48 -07:00
Jisi Liu
23bb79d4a3 Merge pull request #371 from zhangkun83/docker
Dockerfile for building protoc on Centos 6.6
2015-05-12 15:11:31 -07:00
Kun Zhang
2aaf5c603a Dockerfile for building protoc on Centos 6.6 2015-05-12 15:07:36 -07:00
Feng Xiao
8543073871 Merge pull request #369 from ensonic/master
Uncomment conflict fields from pkg-config files.
2015-05-12 11:39:28 -07:00
Stefan Sauer
37e7a3c4b8 Uncomment conflict fields from pkg-config files.
The referenced bug was fixed in 2007 and has been released in pkg-config-0.23
(16.Jan.2008). The fixed version is widely available.
2015-05-12 17:50:05 +02:00
Feng Xiao
33c92803d5 Include generated code of well-known types in protobuf C++ runtime.
Change-Id: I23dee1c1d27b6440658680e9c273b6250213123c
2015-05-11 13:47:41 -07:00
Joshua Haberman
cd141089a1 Merge pull request #255 from btabibian/master
adding globals() to exec call for python3 compatibility
2015-05-07 21:45:15 -07:00
Feng Xiao
de5d45500c Merge branch 'gerrit' to 'master' 2015-05-07 14:07:30 -07:00
Jisi Liu
699db2d51a Merge pull request #345 from brianduff/update_aosp_again
Handle 0-length byte buffers in micro and nano protobufs
2015-05-07 13:13:10 -07:00
Feng Xiao
03e170446b Merge pull request #101 from fizbin/fix_large_proto_java_code
Fix java compilation issues when processing large .proto files
2015-05-07 10:28:52 -07:00
Behzad Tabibian
2bf92b3be9 mend 2015-05-07 19:04:56 +02:00
Joshua Haberman
048f123ed6 Merge pull request #349 from haberman/conformance-java-travis
Run conformance tests against Java for the Travis build.
2015-05-06 18:18:28 -07:00
Josh Haberman
9681ef4273 Run conformance tests against Java for the Travis build.
Change-Id: I8ef8664f7facf86028be3f4f0d5d2efc8a685d6d
2015-05-06 17:32:10 -07:00
Paul Yang
b89de5f6e0 Merge pull request #331 from thomasvl/objc_alpha1_drop
Objective C compiler plugin and runtime
2015-05-06 17:32:07 -07:00
Joshua Haberman
f47db47cd9 Merge pull request #281 from tamird/cleanup-setup-py
Cleanup setup.py
2015-05-06 16:38:05 -07:00
Tamir Duberstein
21a7cf965a Noramlize 'setup.py' to fit conventions:
- Comply with flake8, except for indentation width, which is 2.

- Move human-centric metadata to top of 'setup()' call.

- Add Trove classifiers for supported Python versions.

- Use 'find_packages()' + MANIFEST.in to avoid errors in listing
  modules and packages.

Closes #131 and #161.
2015-05-06 17:02:57 -04:00
Tamir Duberstein
6d3e61676a [PYTHON] gitignore eggs 2015-05-06 17:02:57 -04:00
Tamir Duberstein
4f5cbe6ead Whitespace 2015-05-06 17:02:57 -04:00
Tamir Duberstein
9d9d0b70de Don't hard-code the python path 2015-05-06 17:02:57 -04:00
Josh Haberman
1f34eb6e7a Merge Gerrit master into GitHub master.
Adds conformance test support for Java.
2015-05-06 13:16:57 -07:00
Thomas Van Lenten
30650d81d9 Alpha 1 drop of Google's Objective C plugin and runtime support for protobufs. 2015-05-06 13:19:14 -04:00
Andre Eisenbach
15bff99de6 Handle 0-length byte buffers in micro and nano protobufs
Change-Id: I845ee1ab1005d25c8d77a8c2ed801c0f7b7c847b
2015-05-04 17:58:26 -07:00
Chris Fallin
16a283f794 Merge pull request #334 from skippy/allow-msg-to-accept-nil
ruby: allow a message field to be unset
2015-05-02 19:02:08 -07:00
Chris Fallin
dcf1213683 Merge pull request #332 from skippy/nil-out-of-bounds
ruby: return nil for out of bounds
2015-05-02 19:00:44 -07:00
Adam Greene
64678265c5 allow a message field to be unset 2015-05-02 13:48:23 -07:00
Adam Greene
d55733c76e return nil if array index indicie is out of bounds
ruby arrays don't throw an exception; they return nil.  Lets do the
same!

this fix also includes the ability to use negative array indicies
2015-05-01 22:50:57 -07:00
Chris Fallin
4b2a6328bd Merge pull request #328 from skippy/add-size
ruby: Add size to RepeatField
2015-05-01 14:11:13 -07:00
Adam Greene
c70b6058ea add size alias for length
starting to make `RepeatedField` quack like an array

additional changes:
* make sure gemspec gets all ruby code files
* add homepage in gem spec removes one of the warnings, and the gem spec authors are pushing
everyone to include a homepage in the gem
* remove excess whitespace in test suite to bring formatting inline with the rest of the file
2015-05-01 11:48:04 -07:00
Chris Fallin
c881159557 Merge pull request #327 from skippy/build-cleanup
ruby: build cleanups
2015-05-01 10:25:18 -07:00
Adam Greene
761cfa08e6 build cleanups
* update docs to simplify build steps
* Gemfile.lock seemed to have an older version specified
* do not check in the pkg dir
2015-05-01 08:48:56 -07:00
Jisi Liu
614063ab85 Merge pull request #325 from TeBoring/master
Generate pbconfig.h in generate_descriptor_proto.sh
2015-04-30 10:53:04 -07:00
Bo Yang
efa666cf0a Generate pbconfig.h in generate_descriptor_proto.sh 2015-04-30 10:29:47 -07:00
Jisi Liu
0e122ce8c5 Merge pull request #315 from brianduff/sync_from_aosp
Sync nanoproto from AOSP
2015-04-29 10:44:35 -07:00
Feng Xiao
5a9863b584 Merge pull request #303 from xfxyjwf/wkt
Include well-known type protos in "make install".
2015-04-29 10:41:35 -07:00
Jeff Davidson
9d546c85bd Generate a CREATOR for each Parcelable message.
This is less ideal from a dex count perspective because it requires a
new variable for each message, and because most apps have proguard
rules that will ensure that CREATOR classes are retained.

However, it is required to be able to use nano protos inside of AIDL
files, as the autogenerated AIDL code fails to compile otherwise. This
is a substantial benefit as it allows for backwards-compatible
parameters and return types in AIDL methods along the lines of
safeparcel.

Bug: 19084705
Change-Id: I66a2c0424b96cf8ff6b631b186cc4f9407dfc1f4
2015-04-28 13:12:37 -07:00
Charles Munger
6732dd7e58 Throw OutOfSpaceException instead of IllegalArgumentException.
When a MessageNano containing a String is serialized into a buffer that
is too small to contain it, and the buffer's boundary happens to be
where the string field's length delimiting varint is serialized,
and the string's length and 3*length have the same length when
encoded as a varint, an IllegalArgumentException is thrown rather than
an OutOfSpaceException.

Github issue: https://github.com/google/protobuf/issues/292

Change-Id: If478d68cf15bfd0662252d008e42b2bf1ff1c75e
2015-04-28 13:10:49 -07:00
Brian Duff
a69b461e1e Inline unknownFieldData{Equals,HashCode} to generated code.
It turns out dex (apparently) was inlining these protected final
methods from ExtendableMessageNano into every message class. Removing
these methods from the base class and inlining their code reduces
the method count by 2 methods / message when the store_unknown_fields
option is on.

Change-Id: I0aa09f2016d39939c4c8b8219601793b8fab301f
2015-04-28 13:02:33 -07:00
Brian Duff
dac7e02d2b Expose generate_clear as an option.
I wasn't able to get the clear() method to inline into the
constructor when optimizations are on in proguard. As a result,
every message has an extra superfluous kept method assuming the
app never uses clear() directly.

There are a couple of instances where setting this option false is
necessary in order to get code dexing successfully without hitting
the method limit, e.g. https://goto.google.com/tltzq

In this example, I tried turning on the method/inlining/unique and
method/inlining/short optimizations before resorting to adding the
generate_clear option, but the method count did not decrease. The
clear() methods were contributing over a thousand extra methods.

Change-Id: If6a9651d6a59cdf70b1040d8248779710ac73105
2015-04-28 13:01:48 -07:00
Jeff Davidson
ec19be2f3c Generate @IntDef annotations for nanoproto enums.
@IntDef is a support library annotation which allows build tools to
determine the valid set of values for a given integer field when that
field is intended to be restricted like an enum. This avoids the
overhead of enums while still allowing for compile-time type checking
in most circumstances.

Change-Id: Iee02e0b49a8e069f6456572f538e0a0d301fdfd5
2015-04-28 13:01:12 -07:00
Shai Barack
41f0294cd6 Add reset() and position() to CodedOutputByteBufferNano.
Change-Id: Ie2a9e36276ac35e10b3f8d379b5742d50a0374e9
2015-04-28 12:47:42 -07:00
Kweku Adams
2712c42136 DO NOT MERGE Overloading createMessageTyped to accept a tag as an integer.
When building, some instances expect createMessageTyped to have the signature
(int, Class, long), while others expect (int, Class, int). Simply having
the former signature meant that builds expecting the latter would fail.

This is a cherrypick of change b2a9d4321578139677c146ce37eba5e27e8f5c79
from master.

Change-Id: Ib02dbf66173510f4edea32c7b43e82c1a7a38aa2
2015-04-28 12:46:35 -07:00
Brian Duff
714dba3ab8 Exclude cachedSize when printing fields.
Change-Id: I85563b74237d38c1e447b7286f5f6e62d57e3d63
2015-04-28 12:44:08 -07:00
Brian Duff
d099a88685 Add clone() method support for nano.
Upstreamed from Another Place (cr/57247854).

Change-Id: I2aaf59544c0f5ae21a51891d8a5eeda1dc722c90
2015-04-28 12:42:55 -07:00
Brian Duff
fb96026b8d When no clear() is generated, still initialize fields.
https://android-review.googlesource.com/#/c/67890/ removed field
initialization from the ctor, making it just call clear() instead.

When I added the generate_clear option back (as part of the reftypes
compat mode) in https://android-review.googlesource.com/#/c/109530/,
I forgot to ensure that what clear() used to do was inlined in the
constructor.

This change fixes NPEs that are happening for users of
reftypes_compat_mode who rely on unset repeated fields being empty
arrays rather than null.

Change-Id: Idb58746c60f4a4054b7ebb5c3b0e76b16ff88184
2015-04-28 12:28:05 -07:00
Brian Duff
9ffaa50d55 Fix comments.
Forgot to update these in https://android-review.googlesource.com/#/c/109809/

Change-Id: I53f838e2f134f53964161d9620d5ead00c4a3939
2015-04-28 12:14:54 -07:00
Charles Munger
54511f701f Optimize measurement and serialization of nano protos.
Measuring the serialized size of nano protos is now a zero-alloc operation, and serializing a proto now allocates no memory (other than the output buffer) instead of O(total length of strings).

Change-Id: Id5e2ac3bdc4ac56c0bf13d725472da3a00c9baec
Signed-off-by: Charles Munger <clm@google.com>
2015-04-28 12:10:28 -07:00
Brian Duff
ec2f244554 Fix bug with large extension field numbers.
Previously, extensions with field numbers greater than 268435455 would
result in a compile time error in generated code that looks something
like this:

Foo.java:3178: error: integer number too large: 3346754610
                3346754610);

This is because we were trying to represent the tag number (an
unsigned int) using a java int constant, but java int constants are
signed, and can't exceed Integer.MAX_VALUE.

Fixed by declaring it as a long instead, and casting it down to an
int in the implementation. This is safe, because the tag value always
fits in 32 bis.

Change-Id: If2017bacb4e20af667eaeaf9b65ddc2c30a7709f
2015-04-28 11:42:01 -07:00