Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
f1019531
Commit
f1019531
authored
Apr 24, 2014
by
Max Cai
Committed by
Gerrit Code Review
Apr 24, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Adds --ignore_service nano proto compiler flag"
parents
56cba8ee
d9425a62
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
README.txt
java/README.txt
+8
-0
javanano_file.cc
src/google/protobuf/compiler/javanano/javanano_file.cc
+1
-1
javanano_generator.cc
src/google/protobuf/compiler/javanano/javanano_generator.cc
+2
-0
javanano_params.h
src/google/protobuf/compiler/javanano/javanano_params.h
+10
-1
No files found.
java/README.txt
View file @
f1019531
...
...
@@ -475,6 +475,7 @@ java_multiple_files -> true or false
java_nano_generate_has -> true or false [DEPRECATED]
optional_field_style -> default or accessors
enum_style -> c or java
ignore_services -> true or false
java_package:
java_outer_classname:
...
...
@@ -580,6 +581,13 @@ enum_style={c,java} (default: c)
compiler inlines all referenced enum constants into the call sites,
the interface remains unused and can be removed by ProGuard.
ignore_services={true,false} (default: false)
Skips services definitions.
Nano doesn't support services. By default, if a service is defined
it will generate a compilation error. If this flag is set to true,
services will be silently ignored, instead.
To use nano protobufs within the Android repo:
...
...
src/google/protobuf/compiler/javanano/javanano_file.cc
View file @
f1019531
...
...
@@ -105,7 +105,7 @@ bool FileGenerator::Validate(string* error) {
return
false
;
}
if
(
file_
->
service_count
()
!=
0
)
{
if
(
file_
->
service_count
()
!=
0
&&
!
params_
.
ignore_services
()
)
{
error
->
assign
(
file_
->
name
());
error
->
append
(
": Java NANO_RUNTIME does not support services
\"
"
);
...
...
src/google/protobuf/compiler/javanano/javanano_generator.cc
View file @
f1019531
...
...
@@ -142,6 +142,8 @@ bool JavaNanoGenerator::Generate(const FileDescriptor* file,
params
.
set_use_reference_types_for_primitives
(
option_value
==
"reftypes"
);
}
else
if
(
option_name
==
"generate_equals"
)
{
params
.
set_generate_equals
(
option_value
==
"true"
);
}
else
if
(
option_name
==
"ignore_services"
)
{
params
.
set_ignore_services
(
option_value
==
"true"
);
}
else
{
*
error
=
"Ignore unknown javanano generator option: "
+
option_name
;
}
...
...
src/google/protobuf/compiler/javanano/javanano_params.h
View file @
f1019531
...
...
@@ -62,6 +62,7 @@ class Params {
bool
optional_field_accessors_
;
bool
use_reference_types_for_primitives_
;
bool
generate_equals_
;
bool
ignore_services_
;
public
:
Params
(
const
string
&
base_name
)
:
...
...
@@ -73,7 +74,8 @@ class Params {
java_enum_style_
(
false
),
optional_field_accessors_
(
false
),
use_reference_types_for_primitives_
(
false
),
generate_equals_
(
false
)
{
generate_equals_
(
false
),
ignore_services_
(
false
)
{
}
const
string
&
base_name
()
const
{
...
...
@@ -195,6 +197,13 @@ class Params {
bool
generate_equals
()
const
{
return
generate_equals_
;
}
void
set_ignore_services
(
bool
value
)
{
ignore_services_
=
value
;
}
bool
ignore_services
()
const
{
return
ignore_services_
;
}
};
}
// namespace javanano
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment