Move .proto and generated sources

This commit is contained in:
Vinnie Falco
2014-05-01 09:44:39 -07:00
parent b5348980e2
commit a10c48182f
7 changed files with 86 additions and 61 deletions

View File

@@ -19,7 +19,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\build\proto\ripple.pb.cc" />
<ClCompile Include="..\..\src\ripple\beast\ripple_beast.cpp" />
<ClCompile Include="..\..\src\ripple\beast\ripple_beastc.c" />
<ClCompile Include="..\..\src\ripple\common\impl\KeyCache.cpp">
@@ -188,6 +187,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\proto\ripple.pb.cc" />
<ClCompile Include="..\..\src\ripple\radmap\impl\BasicFullBelowCache.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -2727,6 +2727,7 @@
<ClInclude Include="..\..\src\ripple\peerfinder\sim\Predicates.h" />
<ClInclude Include="..\..\src\ripple\peerfinder\sim\sync_timer.h" />
<ClInclude Include="..\..\src\ripple\peerfinder\sim\WrappedSink.h" />
<ClInclude Include="..\..\src\ripple\proto\ripple.pb.h" />
<ClInclude Include="..\..\src\ripple\radmap\api\BasicFullBelowCache.h" />
<ClInclude Include="..\..\src\ripple\radmap\api\Tuning.h" />
<ClInclude Include="..\..\src\ripple\radmap\ripple_radmap.h" />
@@ -3192,17 +3193,6 @@
<ItemGroup>
<None Include="..\..\doc\CheatSheet.md" />
<None Include="..\..\doc\CodingStyle.md" />
<CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">protoc --cpp_out=$(RepoDir)\build\proto -I=$(RepoDir)\src\ripple_data\protocol\ "$(RepoDir)\src\ripple_data\protocol\%(Filename)%(Extension)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">protoc --cpp_out=$(RepoDir)\build\proto -I=$(RepoDir)\src\ripple_data\protocol\ "$(RepoDir)\src\ripple_data\protocol\%(Filename)%(Extension)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">protoc --cpp_out=$(RepoDir)\build\proto -I=$(RepoDir)\src\ripple_data\protocol\ "$(RepoDir)\src\ripple_data\protocol\%(Filename)%(Extension)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">protoc --cpp_out=$(RepoDir)\build\proto -I=$(RepoDir)\src\ripple_data\protocol\ "$(RepoDir)\src\ripple_data\protocol\%(Filename)%(Extension)"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(RepoDir)\build\proto\%(Filename).pb.h;$(RepoDir)\build\proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(RepoDir)\build\proto\%(Filename).pb.h;$(RepoDir)\build\proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(RepoDir)\build\proto\%(Filename).pb.h;$(RepoDir)\build\proto\%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(RepoDir)\build\proto\%(Filename).pb.h;$(RepoDir)\build\proto\%(Filename).pb.cc</Outputs>
</CustomBuild>
<None Include="..\..\doc\Doxyfile" />
<None Include="..\..\doc\rippled-example.cfg" />
<None Include="..\..\LICENSE" />
@@ -3227,6 +3217,22 @@
<None Include="..\..\src\ripple\json\TODO.md" />
<None Include="..\..\src\ripple\peerfinder\README.md" />
<None Include="..\..\src\ripple\peerfinder\TODO.md" />
<CustomBuild Include="..\..\src\ripple\proto\ripple.proto">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(RelativeDir)%(Filename).pb.h;%(RelativeDir)%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(RelativeDir)%(Filename).pb.h;%(RelativeDir)%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(RelativeDir)%(Filename).pb.h;%(RelativeDir)%(Filename).pb.cc</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(RelativeDir)%(Filename).pb.h;%(RelativeDir)%(Filename).pb.cc</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">protoc --cpp_out=%(RelativeDir) --proto_path=%(RelativeDir) %(Identity)</Message>
</CustomBuild>
<None Include="..\..\src\ripple\radmap\README.md" />
<None Include="..\..\src\ripple\radmap\TODO.md" />
<None Include="..\..\src\ripple\resource\README.md" />

View File

@@ -331,6 +331,9 @@
<Filter Include="[2] Old Ripple\ripple_rpc\handlers">
<UniqueIdentifier>{f8e935e2-e54d-4681-9e7d-7e4a01192d6b}</UniqueIdentifier>
</Filter>
<Filter Include="[1] Ripple\proto">
<UniqueIdentifier>{ae6e40a1-a2ff-4a9e-b510-92192b96db44}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\ripple_basics\containers\RangeSet.cpp">
@@ -876,9 +879,6 @@
<ClCompile Include="..\..\src\ripple_app\ripple_app_pt8.cpp">
<Filter>[2] Old Ripple\ripple_app</Filter>
</ClCompile>
<ClCompile Include="..\..\build\proto\ripple.pb.cc">
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple_basics\ripple_basics.cpp">
<Filter>[2] Old Ripple\ripple_basics</Filter>
</ClCompile>
@@ -1722,6 +1722,9 @@
<ClCompile Include="..\..\src\ripple_app\misc\FeeVoteImpl.cpp">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\proto\ripple.pb.cc">
<Filter>[1] Ripple\proto</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h">
@@ -3345,11 +3348,9 @@
<ClInclude Include="..\..\src\ripple_app\misc\FeatureTable.h">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto">
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
</CustomBuild>
<ClInclude Include="..\..\src\ripple\proto\ripple.pb.h">
<Filter>[1] Ripple\proto</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\doc\CheatSheet.md">
@@ -3473,4 +3474,9 @@
<Filter>[2] Old Ripple\ripple_overlay</Filter>
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\src\ripple\proto\ripple.proto">
<Filter>[1] Ripple\proto</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View File

@@ -210,8 +210,7 @@ INCLUDE_PATHS = [
'.',
'src/leveldb',
'src/leveldb/port',
'src/leveldb/include',
'build/proto'
'src/leveldb/include'
]
# if BOOST_HOME:
@@ -446,8 +445,10 @@ for var in config_vars:
sys.stdout.write("\nBuilding:\n")
PROTO_SRCS = env.Protoc([], 'src/ripple_data/protocol/ripple.proto', PROTOCOUTDIR='build/proto', PROTOCPYTHONOUTDIR=None)
env.Clean(PROTO_SRCS, 'site_scons/site_tools/protoc.pyc')
PROTO_SRCS = env.Protoc([], 'src/ripple/proto/ripple.proto',
PROTOCOUTDIR='src/ripple/proto',
PROTOCPROTOPATH=['src/ripple/proto'],
PROTOCPYTHONOUTDIR=None)
# Only tag actual Ripple files.
TAG_SRCS = copy.copy(COMPILED_FILES)

View File

@@ -1,13 +1,38 @@
#!python
#
# Copyright (c) 2009 Scott Stafford
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Author : Scott Stafford
# Date : 2009-12-09 20:36:14
#
# Changes : Vinnie Falco <vinnie.falco@gmail.com>
# Date : 2014--4-25
"""
protoc.py: Protoc Builder for SCons
This Builder invokes protoc to generate C++ and Python
from a .proto file.
This Builder invokes protoc to generate C++ and Python from a .proto file.
NOTE: Java is not currently supported.
From: http://www.scons.org/wiki/ProtocBuilder
"""
__author__ = "Scott Stafford"
@@ -25,42 +50,25 @@ import os.path
protocs = 'protoc'
ProtocAction = SCons.Action.Action('$PROTOCCOM', '$PROTOCCOMSTR')
def ProtocEmitter(target, source, env):
dirOfCallingSConscript = Dir('.').srcnode()
env.Prepend(PROTOCPROTOPATH = dirOfCallingSConscript.path)
source_with_corrected_path = []
for src in source:
commonprefix = os.path.commonprefix([dirOfCallingSConscript.path, src.srcnode().path])
if len(commonprefix)>0:
source_with_corrected_path.append( src.srcnode().path[len(commonprefix + os.sep):] )
else:
source_with_corrected_path.append( src.srcnode().path )
source = source_with_corrected_path
for src in source:
modulename = os.path.splitext(os.path.basename(src))[0]
if env['PROTOCOUTDIR']:
base = os.path.join(env['PROTOCOUTDIR'] , modulename)
target.extend( [ base + '.pb.cc', base + '.pb.h' ] )
if env['PROTOCPYTHONOUTDIR']:
base = os.path.join(env['PROTOCPYTHONOUTDIR'] , modulename)
target.append( base + '_pb2.py' )
def ProtocEmitter(target, source, env):
PROTOCOUTDIR = env['PROTOCOUTDIR']
PROTOCPYTHONOUTDIR = env['PROTOCPYTHONOUTDIR']
for source_path in [str(x) for x in source]:
base = os.path.splitext(os.path.basename(source_path))[0]
if PROTOCOUTDIR:
target.extend([os.path.join(PROTOCOUTDIR, base + '.pb.cc'),
os.path.join(PROTOCOUTDIR, base + '.pb.h')])
if PROTOCPYTHONOUTDIR:
target.append(os.path.join(PROTOCPYTHONOUTDIR, base + '_pb2.py'))
try:
target.append(env['PROTOCFDSOUT'])
except KeyError:
pass
# XXX KLUDGE: Force things to be right.
env['PROTOCOUTDIR'] = 'build/proto'
env['PROTOCPROTOPATH'] = ['src/ripple_data/protocol']
#~ print "PROTOC SOURCE:", [str(s) for s in source]
#~ print "PROTOC TARGET:", [str(s) for s in target]
#print "PROTOC SOURCE:", [str(s) for s in source]
#print "PROTOC TARGET:", [str(s) for s in target]
return target, source
@@ -75,7 +83,7 @@ def generate(env):
except KeyError:
bld = ProtocBuilder
env['BUILDERS']['Protoc'] = bld
env['PROTOC'] = env.Detect(protocs) or 'protoc'
env['PROTOCFLAGS'] = SCons.Util.CLVar('')
env['PROTOCPROTOPATH'] = SCons.Util.CLVar('')
@@ -85,4 +93,4 @@ def generate(env):
env['PROTOCSRCSUFFIX'] = '.proto'
def exists(env):
return env.Detect(protocs)
return env.Detect(protocs)

4
src/ripple/proto/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# These files are generated by protoc and should not be part of the repository.
*.pb.cc
*.pb.h

View File

@@ -20,7 +20,7 @@
#ifndef RIPPLE_OVERLAY_MESSAGE_H_INCLUDED
#define RIPPLE_OVERLAY_MESSAGE_H_INCLUDED
#include "ripple.pb.h"
#include "../../ripple/proto/ripple.pb.h"
#include "../beast/modules/beast_core/system/BeforeBoost.h"
#include <boost/enable_shared_from_this.hpp>