Commit Graph

1402 Commits

Author SHA1 Message Date
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
Feng Xiao
7ddbf87008 Include well-known type protos in "make install". 2015-04-23 20:23:58 -07:00
Jisi Liu
fe7b5667eb Merge pull request #287 from zhangkun83/protoc-artifacts-fixup
A few fix-ups for protoc-artifacts
2015-04-21 10:50:48 -07:00
Feng Xiao
ba05454041 Merge pull request #290 from xfxyjwf/wkt
Include all well-known type protos.
2015-04-20 13:53:44 -07:00
Feng Xiao
ca9d1a053a Include all well-known type protos.
Change-Id: I122f1cee71a8a739ea603e52582cb0fa9698f0ed
2015-04-20 11:30:31 -07:00
Kun Zhang
90a7ed6fcc A few fix-ups.
1. make google/protobuf/stubs/pbconfig.h before making protoc, otherwise it
won't build a freshly checked-out code.
2. Document the build environments that have been tested to work.
3. Add support for MINGW64
2015-04-16 17:56:12 -07:00
Josh Haberman
4e63b52088 Factored conformance tests so they can run in-process.
This is necessary for testing on iOS.

Change-Id: I54ec1e3aa2e9fbfff9a6cd6580920a6a62069b63
2015-04-15 14:56:05 -07:00
Joshua Haberman
8fe135d212 Merge pull request #284 from cfallin/issue-283
Fix for issue 283: JSON handler cleanup typo causing segfault.
2015-04-13 15:28:44 -07:00
Chris Fallin
14fd96224c Bump gem version to release bugfix. 2015-04-13 14:04:12 -07:00
Chris Fallin
e9abbd23fb Fixed issue #283: crash in JSON handler cleanup.
Includes repro test case from @wfarr.
2015-04-13 14:02:43 -07:00
Joshua Haberman
be89e626a6 Merge pull request #276 from tamird/drop-apputils-dependency
Migrate Python tests to stdlib unittest, drop apputils dependency.
2015-04-11 14:14:29 -07:00
Tamir Duberstein
9f42f5f4a4 [PYTHON] Drop dependency on 'google.apputils'.
Use stdlib's 'unittest' instead.
2015-04-10 19:43:51 -04:00
Tamir Duberstein
dab96f19ee [PYTHON] Remove awkward duplicate tests
We already run all tests with and without `--cpp_implementation`
2015-04-10 19:43:50 -04:00
Tamir Duberstein
d632bc76f1 [PYTHON] README: explain homebrew shenanigans 2015-04-10 15:42:23 -04:00
Tamir Duberstein
a46a2e9422 [PYTHON] Remove unnecessary include_dir 2015-04-10 15:15:53 -04:00
Tamir Duberstein
ef1b747a42 [PYTHON] Clarify API version comment 2015-04-10 09:46:21 -04:00
Joshua Haberman
6003aa1e70 Merge pull request #278 from haberman/python-travis
Added Python to Travis build and clarified setup instructions.
2015-04-09 18:18:27 -07:00
Josh Haberman
2f56bf9819 Export LD_LIBRARY_PATH. 2015-04-09 17:12:00 -07:00
Josh Haberman
0f2e72668d Fix for current directory in Travis tests. 2015-04-09 17:05:38 -07:00
Josh Haberman
2bd813b1b5 Added Python to Travis build and clarified setup instructions. 2015-04-09 16:41:58 -07:00
Jisi Liu
f0b510ac22 Merge pull request #271 from zhangkun83/protoc-artifact-maven
Process to deploy artifacts for multiple platforms into a single release.
2015-04-09 10:36:14 -07:00
Joshua Haberman
8750f72533 Merge pull request #275 from tamird/remove-useless-file
Remove useless file that doesn't load
2015-04-08 16:02:40 -07:00
Tamir Duberstein
8ede2817a0 Remove useless file that doesn't load
This file was broken in ada6556.
2015-04-08 18:33:04 -04:00
Feng Xiao
f8808fb608 Merge gerrit/master and github/master. 2015-04-08 14:03:17 -07:00
Josh Haberman
35a1cc7a7c Added first version of conformance tests.
Change-Id: Ib75664194491643f8e4f1503a2ed942a2d1e1655
2015-04-08 13:14:10 -07:00
Kun Zhang
1c12612bad Strip Mac artifacts 2015-04-08 10:39:21 -07:00
Kun Zhang
62903ec075 Make the osx binary compatible with 10.7 and later 2015-04-08 00:14:36 -07:00
Kun Zhang
5c265faedb Fix osx dependency check. otool prints the file name in the first line. Should skip it 2015-04-07 21:06:37 -07:00
Kun Zhang
6f2bc19bb3 Add cross-compilation for Windows on Linux using MinGW. Check library dependencies of artifact 2015-04-07 20:43:20 -07:00
Kun Zhang
c679236366 List the platforms that we currently support. Document staging.repository. 2015-04-07 17:18:46 -07:00
Kun Zhang
c5a2a7c3db Process to deploy artifacts for multiple platforms into a single
release.

- Do not close the staging repository automatically
- Added staging.repository property
- Updated README with instructions for deployment
- Fix building 32-bit Mac artifact
2015-04-06 17:36:33 -07:00