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
fb15862b
Commit
fb15862b
authored
Dec 19, 2016
by
Adam Cozzette
Committed by
GitHub
Dec 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2517 from acozzette/js-embed
Auto-generate well_known_types_embed.cc
parents
f39cf88a
98d89d42
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
10 deletions
+34
-10
.gitignore
.gitignore
+2
-0
libprotoc.cmake
cmake/libprotoc.cmake
+12
-0
tests.cmake
cmake/tests.cmake
+1
-0
Makefile.am
src/Makefile.am
+12
-2
embed.cc
src/google/protobuf/compiler/js/embed.cc
+7
-8
well_known_types_embed.cc
src/google/protobuf/compiler/js/well_known_types_embed.cc
+0
-0
No files found.
.gitignore
View file @
fb15862b
...
@@ -47,6 +47,7 @@ any_test.pb.*
...
@@ -47,6 +47,7 @@ any_test.pb.*
map*unittest.pb.*
map*unittest.pb.*
unittest*.pb.*
unittest*.pb.*
cpp_test*.pb.*
cpp_test*.pb.*
src/google/protobuf/compiler/js/well_known_types_embed.cc
src/google/protobuf/util/**/*.pb.cc
src/google/protobuf/util/**/*.pb.cc
src/google/protobuf/util/**/*.pb.h
src/google/protobuf/util/**/*.pb.h
...
@@ -60,6 +61,7 @@ python/build/
...
@@ -60,6 +61,7 @@ python/build/
python/google/protobuf/compiler/
python/google/protobuf/compiler/
python/google/protobuf/util/
python/google/protobuf/util/
src/js_embed
src/protoc
src/protoc
src/unittest_proto_middleman
src/unittest_proto_middleman
...
...
cmake/libprotoc.cmake
View file @
fb15862b
...
@@ -94,6 +94,18 @@ set(libprotoc_files
...
@@ -94,6 +94,18 @@ set(libprotoc_files
${
protobuf_source_dir
}
/src/google/protobuf/compiler/zip_writer.cc
${
protobuf_source_dir
}
/src/google/protobuf/compiler/zip_writer.cc
)
)
set
(
js_well_known_types_sources,
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/well_known_types/any.js
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/well_known_types/struct.js
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/well_known_types/timestamp.js
)
add_executable
(
js_embed
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/embed.cc
)
add_custom_command
(
OUTPUT
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/well_known_types_embed.cc
DEPENDS js_embed
${
js_well_known_types_sources
}
COMMAND js_embed
${
js_well_known_types_sources
}
>
${
protobuf_source_dir
}
/src/google/protobuf/compiler/js/well_known_types_embed.cc
)
add_library
(
libprotoc
${
protobuf_SHARED_OR_STATIC
}
add_library
(
libprotoc
${
protobuf_SHARED_OR_STATIC
}
${
libprotoc_files
}
)
${
libprotoc_files
}
)
target_link_libraries
(
libprotoc libprotobuf
)
target_link_libraries
(
libprotoc libprotobuf
)
...
...
cmake/tests.cmake
View file @
fb15862b
...
@@ -214,4 +214,5 @@ target_link_libraries(lite-arena-test libprotobuf-lite gmock_main)
...
@@ -214,4 +214,5 @@ target_link_libraries(lite-arena-test libprotobuf-lite gmock_main)
add_custom_target
(
check
add_custom_target
(
check
COMMAND tests
COMMAND tests
DEPENDS tests test_plugin
WORKING_DIRECTORY
${
protobuf_source_dir
}
)
WORKING_DIRECTORY
${
protobuf_source_dir
}
)
src/Makefile.am
View file @
fb15862b
...
@@ -483,10 +483,20 @@ libprotoc_la_SOURCES = \
...
@@ -483,10 +483,20 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_wrapper_field.cc
\
google/protobuf/compiler/csharp/csharp_wrapper_field.cc
\
google/protobuf/compiler/csharp/csharp_wrapper_field.h
google/protobuf/compiler/csharp/csharp_wrapper_field.h
bin_PROGRAMS
=
protoc
bin_PROGRAMS
=
protoc
js_embed
protoc_LDADD
=
$(PTHREAD_LIBS)
libprotobuf.la libprotoc.la
protoc_LDADD
=
$(PTHREAD_LIBS)
libprotobuf.la libprotoc.la
protoc_SOURCES
=
google/protobuf/compiler/main.cc
protoc_SOURCES
=
google/protobuf/compiler/main.cc
# The special JS code for the well-known types is linked into the compiler via
# well_known_types_embed.cc, which is generated from .js source files.
js_embed_SOURCES
=
google/protobuf/compiler/js/embed.cc
js_well_known_types_sources
=
\
google/protobuf/compiler/js/well_known_types/any.js
\
google/protobuf/compiler/js/well_known_types/struct.js
\
google/protobuf/compiler/js/well_known_types/timestamp.js
google/protobuf/compiler/js/well_known_types_embed.cc
:
js_embed$(EXEEXT) $(js_well_known_types_sources)
./js_embed
$(EXEEXT)
$(js_well_known_types_sources)
>
$@
# Tests ==============================================================
# Tests ==============================================================
protoc_inputs
=
\
protoc_inputs
=
\
...
@@ -661,7 +671,7 @@ protoc_outputs = \
...
@@ -661,7 +671,7 @@ protoc_outputs = \
google/protobuf/util/message_differencer_unittest.pb.cc
\
google/protobuf/util/message_differencer_unittest.pb.cc
\
google/protobuf/util/message_differencer_unittest.pb.h
google/protobuf/util/message_differencer_unittest.pb.h
BUILT_SOURCES
=
$(protoc_outputs)
BUILT_SOURCES
=
$(protoc_outputs)
google/protobuf/compiler/js/well_known_types_embed.cc
if
USE_EXTERNAL_PROTOC
if
USE_EXTERNAL_PROTOC
...
...
src/google/protobuf/compiler/js/embed.cc
View file @
fb15862b
...
@@ -48,7 +48,8 @@ static char ToDecimalDigit(int num) {
...
@@ -48,7 +48,8 @@ static char ToDecimalDigit(int num) {
static
std
::
string
CEscape
(
const
std
::
string
&
str
)
{
static
std
::
string
CEscape
(
const
std
::
string
&
str
)
{
std
::
string
dest
;
std
::
string
dest
;
for
(
unsigned
char
ch
:
str
)
{
for
(
int
i
=
0
;
i
<
str
.
size
();
++
i
)
{
unsigned
char
ch
=
str
[
i
];
switch
(
ch
)
{
switch
(
ch
)
{
case
'\n'
:
dest
+=
"
\\
n"
;
break
;
case
'\n'
:
dest
+=
"
\\
n"
;
break
;
case
'\r'
:
dest
+=
"
\\
r"
;
break
;
case
'\r'
:
dest
+=
"
\\
r"
;
break
;
...
@@ -96,18 +97,16 @@ static void AddFile(const char* name, std::basic_ostream<char>* out) {
...
@@ -96,18 +97,16 @@ static void AddFile(const char* name, std::basic_ostream<char>* out) {
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
auto
&
out
=
std
::
cout
;
std
::
cout
<<
"#include "
out
<<
"#include "
"
\"
google/protobuf/compiler/js/well_known_types_embed.h
\"\n
"
;
"
\"
google/protobuf/compiler/js/well_known_types_embed.h
\"\n
"
;
out
<<
"struct FileToc well_known_types_js[] = {
\n
"
;
std
::
c
out
<<
"struct FileToc well_known_types_js[] = {
\n
"
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
AddFile
(
argv
[
i
],
&
out
);
AddFile
(
argv
[
i
],
&
std
::
c
out
);
}
}
out
<<
" {NULL, NULL} // Terminate the list.
\n
"
;
std
::
c
out
<<
" {NULL, NULL} // Terminate the list.
\n
"
;
out
<<
"};
\n
"
;
std
::
c
out
<<
"};
\n
"
;
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
src/google/protobuf/compiler/js/well_known_types_embed.cc
deleted
100755 → 0
View file @
f39cf88a
This diff is collapsed.
Click to expand it.
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