Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds 3.0.2 and 3.1.0 #12

Merged
merged 4 commits into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions bin_302/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">

<id>protoc-jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>bin_302</directory>
</fileSet>
</fileSets>
</assembly>
Binary file added bin_302/linux/protoc
Binary file not shown.
Binary file added bin_302/mac/protoc
Binary file not shown.
Binary file added bin_302/win32/protoc.exe
Binary file not shown.
24 changes: 24 additions & 0 deletions bin_310/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">

<id>protoc-jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>bin_310</directory>
</fileSet>
</fileSets>
</assembly>
Binary file added bin_310/linux/protoc
Binary file not shown.
Binary file added bin_310/mac/protoc
Binary file not shown.
Binary file added bin_310/win32/protoc.exe
Binary file not shown.
1 change: 0 additions & 1 deletion include/google/protobuf/any.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/any";
option java_package = "com.google.protobuf";
option java_outer_classname = "AnyProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// `Any` contains an arbitrary serialized protocol buffer message along with a
Expand Down
1 change: 0 additions & 1 deletion include/google/protobuf/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option java_package = "com.google.protobuf";
option java_outer_classname = "ApiProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// Api is a light-weight descriptor for a protocol buffer service.
Expand Down
23 changes: 7 additions & 16 deletions include/google/protobuf/descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB";
option java_generate_equals_and_hash = true;

// descriptor.proto must be optimized for speed because reflection-based
// algorithms don't work during bootstrapping.
Expand Down Expand Up @@ -306,19 +305,8 @@ message FileOptions {
// top-level extensions defined in the file.
optional bool java_multiple_files = 10 [default=false];

// If set true, then the Java code generator will generate equals() and
// hashCode() methods for all messages defined in the .proto file.
// This increases generated code size, potentially substantially for large
// protos, which may harm a memory-constrained application.
// - In the full runtime this is a speed optimization, as the
// AbstractMessage base class includes reflection-based implementations of
// these methods.
// - In the lite runtime, setting this option changes the semantics of
// equals() and hashCode() to more closely match those of the full runtime;
// the generated methods compute their results based on field values rather
// than object identity. (Implementations should not assume that hashcodes
// will be consistent across runtimes or versions of the protocol compiler.)
optional bool java_generate_equals_and_hash = 20 [default=false];
// This option does nothing.
optional bool java_generate_equals_and_hash = 20 [deprecated=true];

// If set true, then the Java2 code generator will generate code that
// throws an exception whenever an attempt is made to assign a non-UTF-8
Expand Down Expand Up @@ -448,6 +436,8 @@ message MessageOptions {

// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;

reserved 8; // javalite_serializable
}

message FieldOptions {
Expand All @@ -471,7 +461,6 @@ message FieldOptions {
// false will avoid using packed encoding.
optional bool packed = 2;


// The jstype option determines the JavaScript type used for values of the
// field. The option is permitted only for 64 bit integral and fixed types
// (int64, uint64, sint64, fixed64, sfixed64). By default these types are
Expand Down Expand Up @@ -512,7 +501,7 @@ message FieldOptions {
//
//
// Note that implementations may choose not to check required fields within
// a lazy sub-message. That is, calling IsInitialized() on the outher message
// a lazy sub-message. That is, calling IsInitialized() on the outer message
// may return true even if the inner message has missing required fields.
// This is necessary because otherwise the inner message would have to be
// parsed in order to perform the check, defeating the purpose of lazy
Expand All @@ -538,6 +527,8 @@ message FieldOptions {

// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;

reserved 4; // removed jtype
}

message OneofOptions {
Expand Down
8 changes: 7 additions & 1 deletion include/google/protobuf/duration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ syntax = "proto3";
package google.protobuf;

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
option go_package = "github.com/golang/protobuf/ptypes/duration";
option java_package = "com.google.protobuf";
option java_outer_classname = "DurationProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// A Duration represents a signed, fixed-length span of time represented
Expand Down Expand Up @@ -81,6 +81,12 @@ option objc_class_prefix = "GPB";
// end.nanos -= 1000000000;
// }
//
// Example 3: Compute Duration from datetime.timedelta in Python.
//
// td = datetime.timedelta(days=3, minutes=10)
// duration = Duration()
// duration.FromTimedelta(td)
//
//
message Duration {

Expand Down
1 change: 0 additions & 1 deletion include/google/protobuf/empty.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/empty";
option java_package = "com.google.protobuf";
option java_outer_classname = "EmptyProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";
option cc_enable_arenas = true;

Expand Down
7 changes: 3 additions & 4 deletions include/google/protobuf/field_mask.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ option java_package = "com.google.protobuf";
option java_outer_classname = "FieldMaskProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option java_generate_equals_and_hash = true;

// `FieldMask` represents a set of symbolic field paths, for example:
//
Expand Down Expand Up @@ -82,7 +81,7 @@ option java_generate_equals_and_hash = true;
// }
//
// A repeated field is not allowed except at the last position of a
// field mask.
// paths string.
//
// If a FieldMask object is not present in a get operation, the
// operation applies to all fields (as if a FieldMask of all fields
Expand All @@ -109,8 +108,8 @@ option java_generate_equals_and_hash = true;
//
// If a repeated field is specified for an update operation, the existing
// repeated values in the target resource will be overwritten by the new values.
// Note that a repeated field is only allowed in the last position of a field
// mask.
// Note that a repeated field is only allowed in the last position of a `paths`
// string.
//
// If a sub-message is specified in the last position of the field mask for an
// update operation, then the existing sub-message in the target resource is
Expand Down
1 change: 0 additions & 1 deletion include/google/protobuf/source_context.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option java_package = "com.google.protobuf";
option java_outer_classname = "SourceContextProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// `SourceContext` represents information about the source of a
Expand Down
2 changes: 1 addition & 1 deletion include/google/protobuf/struct.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ syntax = "proto3";
package google.protobuf;

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
option java_package = "com.google.protobuf";
option java_outer_classname = "StructProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";


Expand Down
9 changes: 3 additions & 6 deletions include/google/protobuf/timestamp.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ option go_package = "github.com/golang/protobuf/ptypes/timestamp";
option java_package = "com.google.protobuf";
option java_outer_classname = "TimestampProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// A Timestamp represents a point in time independent of any time zone
Expand Down Expand Up @@ -90,16 +89,14 @@ option objc_class_prefix = "GPB";
//
// Example 5: Compute Timestamp from current time in Python.
//
// now = time.time()
// seconds = int(now)
// nanos = int((now - seconds) * 10**9)
// timestamp = Timestamp(seconds=seconds, nanos=nanos)
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
//
message Timestamp {

// Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive.
int64 seconds = 1;

Expand Down
2 changes: 1 addition & 1 deletion include/google/protobuf/type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import "google/protobuf/any.proto";
import "google/protobuf/source_context.proto";

option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
option java_package = "com.google.protobuf";
option java_outer_classname = "TypeProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// A protocol buffer message type.
Expand Down
1 change: 0 additions & 1 deletion include/google/protobuf/wrappers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ option go_package = "github.com/golang/protobuf/ptypes/wrappers";
option java_package = "com.google.protobuf";
option java_outer_classname = "WrappersProto";
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";

// Wrapper message for `double`.
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/github/os72/protocjar/Protoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,14 @@ public void run() {
static Map<String,String> sVersionMap = new HashMap<String,String>();
static {
sVersionMap.put("-v3.0.0", "300");
sVersionMap.put("-v3.0.2", "302");
sVersionMap.put("-v3.1.0", "310");
sVersionMap.put("-v2.6.1", "261");
sVersionMap.put("-v2.5.0", "250");
sVersionMap.put("-v2.4.1", "241");
sVersionMap.put("-v300", "300");
sVersionMap.put("-v302", "302");
sVersionMap.put("-v310", "310");
sVersionMap.put("-v261", "261");
sVersionMap.put("-v250", "250");
sVersionMap.put("-v241", "241");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/github/os72/protocjar/ProtocVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

public class ProtocVersion
{
public static final String PROTOC_VERSION = "300";
public static final String PROTOC_VERSION = "310";
}
23 changes: 22 additions & 1 deletion src/test/java/com/github/os72/protocjar/ProtocTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,23 @@ public void testRunProtocBasic() throws Exception {
String[] args = {"--version", "-v3.0.0"};
Protoc.runProtoc(args);
}
{
String[] args = {"--version", "-v3.0.2"};
Protoc.runProtoc(args);
}
{
String[] args = {"--version", "-v3.1.0"};
Protoc.runProtoc(args);
}

}

@Test
public void testStdTypes() throws Exception {
{
String outDir = "target/test-protoc-stdtypes";
new File(outDir).mkdirs();
String[] args = {"-v3.0.0", "--include_std_types", "-I.", "--java_out="+outDir, sStdTypeExampleFile};
String[] args = {"-v3.1.0", "--include_std_types", "-I.", "--java_out="+outDir, sStdTypeExampleFile};
Protoc.runProtoc(args);
}
}
Expand Down Expand Up @@ -90,6 +99,18 @@ public void testRunProtocCompileShade() throws Exception {
String[] args = {"-v2.6.1", "--java_shaded_out="+outDir, sPersonSchemaFile};
Protoc.runProtoc(args);
}
{
String outDir = "target/test-protoc-shaded-302";
new File(outDir).mkdirs();
String[] args = {"-v3.0.2", "--java_shaded_out="+outDir, sPersonSchemaFile};
Protoc.runProtoc(args);
}
{
String outDir = "target/test-protoc-shaded-310";
new File(outDir).mkdirs();
String[] args = {"-v3.1.0", "--java_shaded_out="+outDir, sPersonSchemaFile};
Protoc.runProtoc(args);
}
}

static final String sPersonSchemaFile = "src/test/resources/PersonSchema.proto";
Expand Down