Merge "Fix the Windows adb build."

This commit is contained in:
Elliott Hughes 2015-04-19 20:30:25 +00:00 committed by Gerrit Code Review
commit 34c91eddb0
3 changed files with 29 additions and 20 deletions

View File

@ -5,7 +5,11 @@
LOCAL_PATH:= $(call my-dir)
ADB_CLANG := true
ifeq ($(HOST_OS),windows)
adb_host_clang := false # libc++ for mingw not ready yet.
else
adb_host_clang := true
endif
# libadb
# =========================================================
@ -27,6 +31,11 @@ LIBADB_SRC_FILES := \
transport_local.cpp \
transport_usb.cpp \
LIBADB_TEST_SRCS := \
adb_io_test.cpp \
adb_utils_test.cpp \
transport_test.cpp \
LIBADB_CFLAGS := \
-Wall -Werror \
-Wno-unused-parameter \
@ -63,7 +72,7 @@ LOCAL_SRC_FILES := \
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CLANG := $(ADB_CLANG)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_MODULE := libadb
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=1
LOCAL_SRC_FILES := \
@ -81,13 +90,8 @@ endif
include $(BUILD_HOST_STATIC_LIBRARY)
LIBADB_TEST_SRCS := \
adb_io_test.cpp \
adb_utils_test.cpp \
transport_test.cpp \
include $(CLEAR_VARS)
LOCAL_CLANG := $(ADB_CLANG)
LOCAL_CLANG := true
LOCAL_MODULE := adbd_test
LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS)
LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS)
@ -96,7 +100,7 @@ LOCAL_SHARED_LIBRARIES := liblog libbase libcutils
include $(BUILD_NATIVE_TEST)
include $(CLEAR_VARS)
LOCAL_CLANG := $(ADB_CLANG)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_MODULE := adb_test
LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS)
LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp
@ -131,15 +135,11 @@ ifeq ($(HOST_OS),darwin)
endif
ifeq ($(HOST_OS),windows)
LOCAL_LDLIBS += -lws2_32 -lgdi32
EXTRA_STATIC_LIBS := AdbWinApi
ifneq ($(strip $(USE_MINGW)),)
# MinGW under Linux case
LOCAL_LDLIBS += -lws2_32 -lgdi32
USE_SYSDEPS_WIN32 := 1
endif
endif
LOCAL_CLANG := $(ADB_CLANG)
LOCAL_CLANG := $(adb_host_clang)
LOCAL_SRC_FILES := \
adb_main.cpp \
@ -162,12 +162,9 @@ LOCAL_STATIC_LIBRARIES := \
libadb \
libbase \
libcrypto_static \
libcutils \
$(EXTRA_STATIC_LIBS) \
ifeq ($(USE_SYSDEPS_WIN32),)
LOCAL_STATIC_LIBRARIES += libcutils
endif
include $(BUILD_HOST_EXECUTABLE)
$(call dist-for-goals,dist_files sdk,$(LOCAL_BUILT_MODULE))
@ -184,7 +181,7 @@ endif
include $(CLEAR_VARS)
LOCAL_CLANG := $(ADB_CLANG)
LOCAL_CLANG := true
LOCAL_SRC_FILES := \
adb_main.cpp \

View File

@ -21,6 +21,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "sysdeps.h"
bool getcwd(std::string* s) {
char* cwd = getcwd(nullptr, 0);
if (cwd != nullptr) *s = cwd;

View File

@ -1735,7 +1735,11 @@ static int install_multiple_app(transport_type transport, const char* serial, in
return 1;
}
#if defined(_WIN32) // Remove when we're using clang for Win32.
std::string cmd = android::base::StringPrintf("exec:pm install-create -S %u", (unsigned) total_size);
#else
std::string cmd = android::base::StringPrintf("exec:pm install-create -S %" PRIu64, total_size);
#endif
for (i = 1; i < first_apk; i++) {
cmd += " " + escape_arg(argv[i]);
}
@ -1775,9 +1779,15 @@ static int install_multiple_app(transport_type transport, const char* serial, in
goto finalize_session;
}
#if defined(_WIN32) // Remove when we're using clang for Win32.
std::string cmd = android::base::StringPrintf(
"exec:pm install-write -S %u %d %d_%s -",
(unsigned) sb.st_size, session_id, i, get_basename(file));
#else
std::string cmd = android::base::StringPrintf(
"exec:pm install-write -S %" PRIu64 " %d %d_%s -",
static_cast<uint64_t>(sb.st_size), session_id, i, get_basename(file));
#endif
int localFd = adb_open(file, O_RDONLY);
if (localFd < 0) {