Merge "Changes bsdiff to be shared library in CrOS." am: 4ac53f28ec am: 84fc23869c

am: 62e8a65509

Change-Id: Ifb860a91eca1236fe2c8052ac2eb34296757a2b0
This commit is contained in:
Amin Hassani authored and android-build-merger committed 2017-07-21 23:02:57 +00:00
commit f7a89b41d5
6 files changed
+55 -15

No files matched your search

+28 -12
View File
@@ -23,12 +23,22 @@
],
'include_dirs': ['include'],
},
'variables': {
'bspatch_sources': [
'bspatch.cc',
'buffer_file.cc',
'extents.cc',
'extents_file.cc',
'file.cc',
'memory_file.cc',
'sink_file.cc',
],
},
'targets': [
# bsdiff library
{
'target_name': 'libbsdiff',
'type': 'static_library',
'standalone_static_library': 1,
'type': 'shared_library',
'link_settings': {
'libraries': [
'-lbz2',
@@ -54,21 +64,14 @@
# bspatch library
{
'target_name': 'libbspatch',
'standalone_static_library': 1,
'type': 'static_library',
'type': 'shared_library',
'link_settings': {
'libraries': [
'-lbz2',
],
},
'sources': [
'bspatch.cc',
'buffer_file.cc',
'extents.cc',
'extents_file.cc',
'file.cc',
'memory_file.cc',
'sink_file.cc',
'<@(bspatch_sources)',
],
},
# bspatch executable
@@ -86,12 +89,25 @@
'conditions': [
['USE_test == 1', {
'targets': [
# bspatch static library for test
{
'target_name': 'libbspatch_test',
'type': 'static_library',
'link_settings': {
'libraries': [
'-lbz2',
],
},
'sources': [
'<@(bspatch_sources)',
],
},
{
'target_name': 'bsdiff_unittest',
'type': 'executable',
'dependencies': [
'libbsdiff',
'libbspatch',
'libbspatch_test',
'../common-mk/testrunner.gyp:testrunner',
],
'variables': {
+4
View File
@@ -15,12 +15,16 @@
#include "divsufsort.h"
#endif
#include "bsdiff/common.h"
namespace bsdiff {
BSDIFF_EXPORT
int bsdiff(const char* old_filename,
const char* new_filename,
const char* patch_filename);
BSDIFF_EXPORT
int bsdiff(const u_char* old_buf,
off_t oldsize,
const u_char* new_buf,
+4
View File
@@ -13,12 +13,14 @@
namespace bsdiff {
BSDIFF_EXPORT
int bspatch(const char* old_filename,
const char* new_filename,
const char* patch_filename,
const char* old_extents,
const char* new_extents);
BSDIFF_EXPORT
int bspatch(const char* old_filename,
const char* new_filename,
const uint8_t* patch_data,
@@ -26,12 +28,14 @@ int bspatch(const char* old_filename,
const char* old_extents,
const char* new_extents);
BSDIFF_EXPORT
int bspatch(const uint8_t* old_data,
size_t old_size,
const uint8_t* patch_data,
size_t patch_size,
const std::function<size_t(const uint8_t*, size_t)>& sink);
BSDIFF_EXPORT
int bspatch(const std::unique_ptr<FileInterface>& old_file,
const std::unique_ptr<FileInterface>& new_file,
const uint8_t* patch_data,
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _BSDIFF_COMMON_H_
#define _BSDIFF_COMMON_H_
// We defined this export macro to avoid depending on brillo (BRILLO_EXPORT in
// "brillo/brillo_export.h")
#ifndef BSDIFF_EXPORT
#define BSDIFF_EXPORT __attribute__((__visibility__("default")))
#endif
#endif // _BSDIFF_COMMON_H_
+2 -2
View File
@@ -32,12 +32,12 @@
namespace bsdiff {
/* An extent, defined by an offset and a length. */
struct ex_t {
struct BSDIFF_EXPORT ex_t {
off_t off; // the extent offset; negative indicates a sparse extent.
uint64_t len; // the extent length.
};
class ExtentsFile : public FileInterface {
class BSDIFF_EXPORT ExtentsFile : public FileInterface {
public:
// Creates an ExtentsFile based on the underlying |file| passed. The positions
// in the ExtentsFile will be linearly mapped to the extents provided in
+3 -1
View File
@@ -7,9 +7,11 @@
#include <sys/types.h>
#include "bsdiff/common.h"
namespace bsdiff {
class FileInterface {
class BSDIFF_EXPORT FileInterface {
public:
virtual ~FileInterface() = default;