Convert fastboot to Soong
Also fix adb's version number to match. See build/soong/README.md for more information. Test: cd system/core/fastboot; mma Test: fastboot --version Test: adb --version Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
This commit is contained in:
parent
7b02605bf2
commit
ab971b5e7e
6 changed files with 204 additions and 177 deletions
|
@ -142,6 +142,8 @@ cc_library_host_static {
|
|||
"client/fastdeploycallbacks.cpp",
|
||||
],
|
||||
|
||||
generated_headers: ["platform_tools_version"],
|
||||
|
||||
target: {
|
||||
linux: {
|
||||
srcs: ["client/usb_linux.cpp"],
|
||||
|
@ -311,6 +313,8 @@ cc_library_static {
|
|||
"daemon/include",
|
||||
],
|
||||
|
||||
generated_headers: ["platform_tools_version"],
|
||||
|
||||
static_libs: [
|
||||
"libdiagnose_usb",
|
||||
"libqemu_pipe",
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <build/version.h>
|
||||
#include <platform_tools_version.h>
|
||||
|
||||
#include "adb_auth.h"
|
||||
#include "adb_io.h"
|
||||
|
@ -65,10 +66,11 @@ std::string adb_version() {
|
|||
// Don't change the format of this --- it's parsed by ddmlib.
|
||||
return android::base::StringPrintf(
|
||||
"Android Debug Bridge version %d.%d.%d\n"
|
||||
"Version %s\n"
|
||||
"Version %s-%s\n"
|
||||
"Installed as %s\n",
|
||||
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
|
||||
android::build::GetBuildNumber().c_str(), android::base::GetExecutablePath().c_str());
|
||||
PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(),
|
||||
android::base::GetExecutablePath().c_str());
|
||||
}
|
||||
|
||||
void fatal(const char *fmt, ...) {
|
||||
|
|
|
@ -21,67 +21,66 @@ cc_library_host_static {
|
|||
|
||||
compile_multilib: "first",
|
||||
srcs: [
|
||||
"bootimg_utils.cpp",
|
||||
"fs.cpp",
|
||||
"socket.cpp",
|
||||
"tcp.cpp",
|
||||
"udp.cpp",
|
||||
"util.cpp",
|
||||
"fastboot_driver.cpp",
|
||||
"bootimg_utils.cpp",
|
||||
"fs.cpp",
|
||||
"socket.cpp",
|
||||
"tcp.cpp",
|
||||
"udp.cpp",
|
||||
"util.cpp",
|
||||
"fastboot_driver.cpp",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
"libziparchive",
|
||||
"libsparse",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"libz",
|
||||
"libdiagnose_usb",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libgtest",
|
||||
"libgtest_main",
|
||||
"libbase",
|
||||
"libadb_host"
|
||||
"libziparchive",
|
||||
"libsparse",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"libz",
|
||||
"libdiagnose_usb",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libgtest",
|
||||
"libgtest_main",
|
||||
"libbase",
|
||||
"libadb_host",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"bootimg_headers"
|
||||
"bootimg_headers",
|
||||
],
|
||||
|
||||
export_header_lib_headers: [
|
||||
"bootimg_headers"
|
||||
"bootimg_headers",
|
||||
],
|
||||
|
||||
|
||||
target: {
|
||||
linux: {
|
||||
srcs: ["usb_linux.cpp"],
|
||||
},
|
||||
linux: {
|
||||
srcs: ["usb_linux.cpp"],
|
||||
},
|
||||
|
||||
darwin: {
|
||||
srcs: ["usb_osx.cpp"],
|
||||
darwin: {
|
||||
srcs: ["usb_osx.cpp"],
|
||||
|
||||
host_ldlibs: [
|
||||
"-framework CoreFoundation",
|
||||
"-framework IOKit",
|
||||
],
|
||||
},
|
||||
host_ldlibs: [
|
||||
"-framework CoreFoundation",
|
||||
"-framework IOKit",
|
||||
],
|
||||
},
|
||||
|
||||
windows: {
|
||||
srcs: ["usb_windows.cpp"],
|
||||
windows: {
|
||||
srcs: ["usb_windows.cpp"],
|
||||
|
||||
host_ldlibs: [
|
||||
"-lws2_32",
|
||||
],
|
||||
},
|
||||
host_ldlibs: [
|
||||
"-lws2_32",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-Wunreachable-code",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-Wunreachable-code",
|
||||
],
|
||||
|
||||
export_include_dirs: ["."],
|
||||
|
@ -141,3 +140,155 @@ cc_binary {
|
|||
|
||||
cpp_std: "c++17",
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "fastboot_host_defaults",
|
||||
|
||||
use_version_lib: true,
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-Wunreachable-code",
|
||||
],
|
||||
|
||||
target: {
|
||||
darwin: {
|
||||
cflags: ["-Wno-unused-parameter"],
|
||||
host_ldlibs: [
|
||||
"-lpthread",
|
||||
"-framework CoreFoundation",
|
||||
"-framework IOKit",
|
||||
"-framework Carbon",
|
||||
],
|
||||
},
|
||||
windows: {
|
||||
enabled: true,
|
||||
|
||||
host_ldlibs: ["-lws2_32"],
|
||||
},
|
||||
},
|
||||
|
||||
stl: "libc++_static",
|
||||
|
||||
// Don't add anything here, we don't want additional shared dependencies
|
||||
// on the host fastboot tool, and shared libraries that link against libc++
|
||||
// will violate ODR.
|
||||
shared_libs: [],
|
||||
|
||||
header_libs: ["bootimg_headers"],
|
||||
static_libs: [
|
||||
"libziparchive",
|
||||
"libsparse",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"libz",
|
||||
"libdiagnose_usb",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libgtest_host",
|
||||
],
|
||||
}
|
||||
|
||||
//
|
||||
// Build host libfastboot.
|
||||
//
|
||||
|
||||
cc_library_host_static {
|
||||
name: "libfastboot",
|
||||
defaults: ["fastboot_host_defaults"],
|
||||
|
||||
cpp_std: "c++17",
|
||||
srcs: [
|
||||
"bootimg_utils.cpp",
|
||||
"engine.cpp",
|
||||
"fastboot.cpp",
|
||||
"fs.cpp",
|
||||
"socket.cpp",
|
||||
"tcp.cpp",
|
||||
"udp.cpp",
|
||||
"util.cpp",
|
||||
"fastboot_driver.cpp",
|
||||
],
|
||||
|
||||
// Only version the final binaries
|
||||
use_version_lib: false,
|
||||
static_libs: ["libbuildversion"],
|
||||
|
||||
generated_headers: ["platform_tools_version"],
|
||||
|
||||
target: {
|
||||
windows: {
|
||||
srcs: ["usb_windows.cpp"],
|
||||
|
||||
include_dirs: ["development/host/windows/usb/api"],
|
||||
},
|
||||
darwin: {
|
||||
srcs: ["usb_osx.cpp"],
|
||||
},
|
||||
linux_glibc: {
|
||||
srcs: ["usb_linux.cpp"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
//
|
||||
// Build host fastboot / fastboot.exe
|
||||
//
|
||||
|
||||
cc_binary_host {
|
||||
name: "fastboot",
|
||||
defaults: ["fastboot_host_defaults"],
|
||||
|
||||
srcs: ["main.cpp"],
|
||||
static_libs: ["libfastboot"],
|
||||
|
||||
required: [
|
||||
"mke2fs",
|
||||
"make_f2fs",
|
||||
],
|
||||
|
||||
target: {
|
||||
not_windows: {
|
||||
required: [
|
||||
"e2fsdroid",
|
||||
"mke2fs.conf",
|
||||
"sload_f2fs",
|
||||
],
|
||||
},
|
||||
windows: {
|
||||
required: ["AdbWinUsbApi"],
|
||||
shared_libs: ["AdbWinApi"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
//
|
||||
// Build host fastboot_test.
|
||||
//
|
||||
|
||||
cc_test_host {
|
||||
name: "fastboot_test",
|
||||
defaults: ["fastboot_host_defaults"],
|
||||
|
||||
srcs: [
|
||||
"fastboot_test.cpp",
|
||||
"socket_mock.cpp",
|
||||
"socket_test.cpp",
|
||||
"tcp_test.cpp",
|
||||
"udp_test.cpp",
|
||||
],
|
||||
|
||||
static_libs: ["libfastboot"],
|
||||
|
||||
target: {
|
||||
windows: {
|
||||
shared_libs: ["AdbWinApi"],
|
||||
},
|
||||
windows_x86_64: {
|
||||
// Avoid trying to build for win64
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -14,89 +14,6 @@
|
|||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(LOCAL_PATH)/../platform_tools_tool_version.mk
|
||||
|
||||
fastboot_cflags := -Wall -Wextra -Werror -Wunreachable-code
|
||||
fastboot_cflags += -DFASTBOOT_VERSION="\"$(tool_version)\""
|
||||
fastboot_cflags_darwin := -Wno-unused-parameter
|
||||
fastboot_ldlibs_darwin := -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
|
||||
fastboot_ldlibs_windows := -lws2_32
|
||||
# Don't add anything here, we don't want additional shared dependencies
|
||||
# on the host fastboot tool, and shared libraries that link against libc++
|
||||
# will violate ODR.
|
||||
fastboot_shared_libs :=
|
||||
fastboot_static_libs := \
|
||||
libziparchive \
|
||||
libsparse \
|
||||
libutils \
|
||||
liblog \
|
||||
libz \
|
||||
libdiagnose_usb \
|
||||
libbase \
|
||||
libcutils \
|
||||
libgtest_host \
|
||||
|
||||
fastboot_stl := libc++_static
|
||||
|
||||
#
|
||||
# Build host libfastboot.
|
||||
#
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libfastboot
|
||||
LOCAL_MODULE_HOST_OS := darwin linux windows
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
bootimg_utils.cpp \
|
||||
engine.cpp \
|
||||
fastboot.cpp \
|
||||
fs.cpp \
|
||||
socket.cpp \
|
||||
tcp.cpp \
|
||||
udp.cpp \
|
||||
util.cpp \
|
||||
fastboot_driver.cpp \
|
||||
|
||||
LOCAL_SRC_FILES_darwin := usb_osx.cpp
|
||||
LOCAL_SRC_FILES_linux := usb_linux.cpp
|
||||
LOCAL_SRC_FILES_windows := usb_windows.cpp
|
||||
|
||||
LOCAL_C_INCLUDES_windows := development/host/windows/usb/api
|
||||
LOCAL_CFLAGS := $(fastboot_cflags)
|
||||
LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
|
||||
LOCAL_CPP_STD := c++17
|
||||
LOCAL_CXX_STL := $(fastboot_stl)
|
||||
LOCAL_HEADER_LIBRARIES := bootimg_headers
|
||||
LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
|
||||
LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
|
||||
LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
|
||||
LOCAL_STATIC_LIBRARIES := $(fastboot_static_libs)
|
||||
include $(BUILD_HOST_STATIC_LIBRARY)
|
||||
|
||||
#
|
||||
# Build host fastboot / fastboot.exe
|
||||
#
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := fastboot
|
||||
LOCAL_MODULE_HOST_OS := darwin linux windows
|
||||
|
||||
LOCAL_CFLAGS := $(fastboot_cflags)
|
||||
LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
|
||||
LOCAL_CXX_STL := $(fastboot_stl)
|
||||
LOCAL_HEADER_LIBRARIES := bootimg_headers
|
||||
LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
|
||||
LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
|
||||
LOCAL_REQUIRED_MODULES := mke2fs make_f2fs
|
||||
LOCAL_REQUIRED_MODULES_darwin := e2fsdroid mke2fs.conf sload_f2fs
|
||||
LOCAL_REQUIRED_MODULES_linux := e2fsdroid mke2fs.conf sload_f2fs
|
||||
LOCAL_REQUIRED_MODULES_windows := AdbWinUsbApi
|
||||
LOCAL_SRC_FILES := main.cpp
|
||||
LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
|
||||
LOCAL_SHARED_LIBRARIES_windows := AdbWinApi
|
||||
LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs)
|
||||
include $(BUILD_HOST_EXECUTABLE)
|
||||
|
||||
#
|
||||
# Package fastboot-related executables.
|
||||
#
|
||||
|
@ -111,30 +28,3 @@ ifdef HOST_CROSS_OS
|
|||
$(call dist-for-goals,dist_files sdk win_sdk,$(ALL_MODULES.host_cross_fastboot.BUILT))
|
||||
endif
|
||||
my_dist_files :=
|
||||
|
||||
#
|
||||
# Build host fastboot_test.
|
||||
#
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := fastboot_test
|
||||
LOCAL_MODULE_HOST_OS := darwin linux windows
|
||||
LOCAL_MODULE_HOST_CROSS_ARCH := x86 # Avoid trying to build for win64.
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
fastboot_test.cpp \
|
||||
socket_mock.cpp \
|
||||
socket_test.cpp \
|
||||
tcp_test.cpp \
|
||||
udp_test.cpp \
|
||||
|
||||
LOCAL_CFLAGS := $(fastboot_cflags)
|
||||
LOCAL_CFLAGS_darwin := $(fastboot_cflags_darwin)
|
||||
LOCAL_CXX_STL := $(fastboot_stl)
|
||||
LOCAL_HEADER_LIBRARIES := bootimg_headers
|
||||
LOCAL_LDLIBS_darwin := $(fastboot_ldlibs_darwin)
|
||||
LOCAL_LDLIBS_windows := $(fastboot_ldlibs_windows)
|
||||
LOCAL_SHARED_LIBRARIES := $(fastboot_shared_libs)
|
||||
LOCAL_SHARED_LIBRARIES_windows := AdbWinApi
|
||||
LOCAL_STATIC_LIBRARIES := libfastboot $(fastboot_static_libs)
|
||||
include $(BUILD_HOST_NATIVE_TEST)
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include <android-base/strings.h>
|
||||
#include <android-base/test_utils.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <build/version.h>
|
||||
#include <platform_tools_version.h>
|
||||
#include <sparse/sparse.h>
|
||||
#include <ziparchive/zip_archive.h>
|
||||
|
||||
|
@ -1538,7 +1540,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
|
|||
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||
} else if (name == "version") {
|
||||
fprintf(stdout, "fastboot version %s\n", FASTBOOT_VERSION);
|
||||
fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str());
|
||||
fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
|
||||
return 0;
|
||||
#if !defined(_WIN32)
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
# Copyright (C) 2017 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# We rewrite ${PLATFORM_SDK_VERSION} with 0 rather than $(PLATFORM_SDK_VERSION)
|
||||
# because on the actual platform tools release branches the file contains a
|
||||
# literal instead. Using 0 lets us easily distinguish non-canonical builds.
|
||||
platform_tools_version := $(shell sed \
|
||||
's/$${PLATFORM_SDK_VERSION}/0/ ; s/^Pkg.Revision=\(.*\)/\1/p ; d' \
|
||||
development/sdk/plat_tools_source.prop_template \
|
||||
)
|
||||
tool_version := $(platform_tools_version)-$(BUILD_NUMBER_FROM_FILE)
|
Loading…
Reference in a new issue