Commit ee9b347f authored by Greg Williams's avatar Greg Williams
Browse files

Updated to latest protobuf-c which required update to protobuf-2.6.0 as well.

Updated Rakefile to support updates to protobuf/protobuf-c.
parent dd36eaf4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
[submodule "protobuf-c"]
	path = vendor/protobuf-c
	url = https://github.com/atomicobject/protobuf-c
	branch = master
[submodule "kinetic-protocol"]
	path = vendor/kinetic-protocol
	url = https://github.com/Seagate/kinetic-protocol.git
@@ -19,3 +15,7 @@
[submodule "vendor/json-c"]
	path = vendor/json-c
	url = https://github.com/json-c/json-c
[submodule "vendor/protobuf-c"]
	path = vendor/protobuf-c
	url = https://github.com/protobuf-c/protobuf-c.git
	branch = master
+7 −9
Original line number Diff line number Diff line
@@ -33,19 +33,17 @@ end

HERE = File.expand_path(File.dirname(__FILE__))
VENDOR_PATH = File.join(HERE, 'vendor')
PROTOBUF_CORE = File.join(VENDOR_PATH, 'protobuf-2.5.0')
PROTOBUF_CORE = File.join(VENDOR_PATH, 'protobuf-2.6.0')
PROTOBUF_C = File.join(VENDOR_PATH, 'protobuf-c')
PROTO_IN = File.join(VENDOR_PATH, 'kinetic-protocol')
BUILD_ARTIFACTS = File.join(HERE, 'build', 'artifacts', 'release')
TEST_ARTIFACTS = File.join(HERE, 'build', 'artifacts', 'test')
PROTO_OUT = TEST_ARTIFACTS
PROTO_OUT = File.join(HERE, 'src', 'lib')
TEST_TEMP = File.join(HERE, 'build', 'test', 'temp')
DOCS_PATH = File.join(HERE, 'docs/api')

directory DOCS_PATH
CLOBBER.include DOCS_PATH
directory PROTO_OUT
CLOBBER.include PROTO_OUT
directory TEST_TEMP
CLOBBER.include TEST_TEMP

@@ -85,12 +83,12 @@ task :default => ['report_toolchain', 'test:delta']
desc "Generate protocol buffers"
task :proto => [PROTO_OUT] do

  report_banner "Building protobuf v2.5.0"
  report_banner "Building/installing #{PROTOBUF_CORE}"
  cd PROTOBUF_CORE do
    execute_command "./configure --disable-shared; make; make check; sudo make install"
  end

  report_banner "Building protobuf-c and installing protoc-c"
  report_banner "Building/installing #{PROTOBUF_C}"
  cd PROTOBUF_C do
    execute_command "./autogen.sh && ./configure && make && sudo make install"
    protoc_c = `which protoc-c`
@@ -105,13 +103,13 @@ task :proto => [PROTO_OUT] do
    report
  end

  report_banner "Generating Kinetic C protocol buffers"
  report_banner "Generating Kinetic C protocol buffers from #{"#{PROTO_IN}/kinetic.proto"}"
  cd PROTO_OUT do
    rm Dir["*.h", "*.c", "*.proto"]
    cp "#{PROTO_IN}/kinetic.proto", "."
    execute_command "protoc-c --c_out=. kinetic.proto"
    report "Generated #{Dir['*.h', '*.c'].join(', ')}\n\n"
    rm "kinetic.proto"
  end
  report "Generated #{Dir["#{PROTO_OUT}/kinetic.pb-c.*"]}\n\n"

end

+0 −1717

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −143
Original line number Diff line number Diff line
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// from google3/util/gtl/map-util.h
// Author: Anton Carver

#ifndef GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
#define GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__

#include <google/protobuf/stubs/common.h>

namespace google {
namespace protobuf {

// Perform a lookup in a map or hash_map.
// If the key is present in the map then the value associated with that
// key is returned, otherwise the value passed as a default is returned.
template <class Collection>
const typename Collection::value_type::second_type&
FindWithDefault(const Collection& collection,
                const typename Collection::value_type::first_type& key,
                const typename Collection::value_type::second_type& value) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return value;
  }
  return it->second;
}

// Perform a lookup in a map or hash_map.
// If the key is present a const pointer to the associated value is returned,
// otherwise a NULL pointer is returned.
template <class Collection>
const typename Collection::value_type::second_type*
FindOrNull(const Collection& collection,
           const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return 0;
  }
  return &it->second;
}

// Perform a lookup in a map or hash_map, assuming that the key exists.
// Crash if it does not.
//
// This is intended as a replacement for operator[] as an rvalue (for reading)
// when the key is guaranteed to exist.
//
// operator[] is discouraged for several reasons:
//  * It has a side-effect of inserting missing keys
//  * It is not thread-safe (even when it is not inserting, it can still
//      choose to resize the underlying storage)
//  * It invalidates iterators (when it chooses to resize)
//  * It default constructs a value object even if it doesn't need to
//
// This version assumes the key is printable, and includes it in the fatal log
// message.
template <class Collection>
const typename Collection::value_type::second_type&
FindOrDie(const Collection& collection,
          const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  GOOGLE_CHECK(it != collection.end()) << "Map key not found: " << key;
  return it->second;
}

// Perform a lookup in a map or hash_map whose values are pointers.
// If the key is present a const pointer to the associated value is returned,
// otherwise a NULL pointer is returned.
// This function does not distinguish between a missing key and a key mapped
// to a NULL value.
template <class Collection>
const typename Collection::value_type::second_type
FindPtrOrNull(const Collection& collection,
              const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return 0;
  }
  return it->second;
}

// Change the value associated with a particular key in a map or hash_map.
// If the key is not present in the map the key and value are inserted,
// otherwise the value is updated to be a copy of the value provided.
// True indicates that an insert took place, false indicates an update.
template <class Collection, class Key, class Value>
bool InsertOrUpdate(Collection * const collection,
                   const Key& key, const Value& value) {
  pair<typename Collection::iterator, bool> ret =
    collection->insert(typename Collection::value_type(key, value));
  if (!ret.second) {
    // update
    ret.first->second = value;
    return false;
  }
  return true;
}

// Insert a new key and value into a map or hash_map.
// If the key is not present in the map the key and value are
// inserted, otherwise nothing happens. True indicates that an insert
// took place, false indicates the key was already present.
template <class Collection, class Key, class Value>
bool InsertIfNotPresent(Collection * const collection,
                        const Key& key, const Value& value) {
  pair<typename Collection::iterator, bool> ret =
    collection->insert(typename Collection::value_type(key, value));
  return ret.second;
}

}  // namespace protobuf
}  // namespace google

#endif  // GOOGLE_PROTOBUF_STUBS_MAP_UTIL_H__
+48 −1
Original line number Diff line number Diff line
2014-08-15 version 2.6.0:

  General
  * Added oneofs(unions) feature. Fields in the same oneof will share
    memory and at most one field can be set at the same time. Use the
    oneof keyword to define a oneof like:
      message SampleMessage {
        oneof test_oneof {
          string name = 4;
          YourMessage sub_message = 9;
        }
      }
  * Files, services, enums, messages, methods and enum values can be marked
    as deprecated now.
  * Added Support for list values, including lists of mesaages, when
    parsing text-formatted protos in C++ and Java.
      For example:  foo: [1, 2, 3]

  C++
  * Enhanced customization on TestFormat printing.
  * Added SwapFields() in reflection API to swap a subset of fields.
    Added SetAllocatedMessage() in reflection API.
  * Repeated primitive extensions are now packable. The
    [packed=true] option only affects serializers. Therefore, it is
    possible to switch a repeated extension field to packed format
    without breaking backwards-compatibility.
  * Various speed optimizations.

  Java
  * writeTo() method in ByteString can now write a substring to an
    output stream. Added endWith() method for ByteString.
  * ByteString and ByteBuffer are now supported in CodedInputStream
    and CodedOutputStream.
  * java_generate_equals_and_hash can now be used with the LITE_RUNTIME.

  Python
  * A new C++-backed extension module (aka "cpp api v2") that replaces the
    old ("cpp api v1") one.  Much faster than the pure Python code.  This one
    resolves many bugs and is recommended for general use over the
    pure Python when possible.
  * Descriptors now have enum_types_by_name and extension_types_by_name dict
    attributes.
  * Support for Python 3.

2013-02-27 version 2.5.0:

  General
@@ -17,6 +61,9 @@
    be assigned the same numeric value. Default value is "true". Setting it to
    false causes the compiler to reject enum definitions where multiple symbols
    have the same numeric value.
    Note: We plan to flip the default value to "false" in a future release.
    Projects using enum aliases should set the option to "true" in their .proto
    files.

  C++
  * New generated method set_allocated_foo(Type* foo) for message and string
@@ -32,7 +79,7 @@
    comments for corresponding classes and data members.
  * Added Parser to parse directly into messages without a Builder. For
    example,
      Foo foo = Foo.getParser().ParseFrom(input);
      Foo foo = Foo.PARSER.ParseFrom(input);
    Using Parser is ~25% faster than using Builder to parse messages.
  * Added getters/setters to access the underlying ByteString of a string field
    directly.
Loading