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
dde14310
Unverified
Commit
dde14310
authored
Nov 01, 2018
by
Thomas Van Lenten
Committed by
GitHub
Nov 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support suppressing the objc package prefix checks on a list of files.
parent
d52f2bb9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
objectivec_generator.cc
...ogle/protobuf/compiler/objectivec/objectivec_generator.cc
+6
-0
objectivec_helpers.cc
...google/protobuf/compiler/objectivec/objectivec_helpers.cc
+13
-0
objectivec_helpers.h
src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+1
-0
No files found.
src/google/protobuf/compiler/objectivec/objectivec_generator.cc
View file @
dde14310
...
...
@@ -89,6 +89,12 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector<const FileDescriptor*>&
// There is no validation that the prefixes are good prefixes, it is
// assumed that they are when you create the file.
generation_options
.
expected_prefixes_path
=
options
[
i
].
second
;
}
else
if
(
options
[
i
].
first
==
"expected_prefixes_suppressions"
)
{
// A semicolon delimited string that lists the paths of .proto files to
// exclude from the package prefix validations (expected_prefixes_path).
// This is provided as an "out", to skip some files being checked.
SplitStringUsing
(
options
[
i
].
second
,
";"
,
&
generation_options
.
expected_prefixes_suppressions
);
}
else
if
(
options
[
i
].
first
==
"generate_for_named_framework"
)
{
// The name of the framework that protos are being generated for. This
// will cause the #import statements to be framework based using this
...
...
src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
View file @
dde14310
...
...
@@ -76,6 +76,10 @@ Options::Options() {
if
(
file_path
)
{
expected_prefixes_path
=
file_path
;
}
const
char
*
suppressions
=
getenv
(
"GPB_OBJC_EXPECTED_PACKAGE_PREFIXES_SUPPRESSIONS"
);
if
(
suppressions
)
{
SplitStringUsing
(
suppressions
,
";"
,
&
expected_prefixes_suppressions
);
}
}
namespace
{
...
...
@@ -1169,6 +1173,15 @@ bool ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files,
}
for
(
int
i
=
0
;
i
<
files
.
size
();
i
++
)
{
bool
should_skip
=
(
std
::
find
(
generation_options
.
expected_prefixes_suppressions
.
begin
(),
generation_options
.
expected_prefixes_suppressions
.
end
(),
files
[
i
]
->
name
())
!=
generation_options
.
expected_prefixes_suppressions
.
end
());
if
(
should_skip
)
{
continue
;
}
bool
is_valid
=
ValidateObjCClassPrefix
(
files
[
i
],
generation_options
.
expected_prefixes_path
,
...
...
src/google/protobuf/compiler/objectivec/objectivec_helpers.h
View file @
dde14310
...
...
@@ -50,6 +50,7 @@ namespace objectivec {
struct
Options
{
Options
();
string
expected_prefixes_path
;
std
::
vector
<
string
>
expected_prefixes_suppressions
;
string
generate_for_named_framework
;
string
named_framework_to_proto_path_mappings_path
;
};
...
...
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