Merge "Show the "platform tools" version in adb/fastboot --version."
am: 6f4d47438d
Change-Id: I5ff109186b29b9770f61506eb4cfb99ce71db4e9
This commit is contained in:
commit
3602f6141a
6 changed files with 34 additions and 9 deletions
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
|
include $(LOCAL_PATH)/../platform_tools_tool_version.mk
|
||||||
|
|
||||||
adb_host_sanitize :=
|
adb_host_sanitize :=
|
||||||
adb_target_sanitize :=
|
adb_target_sanitize :=
|
||||||
|
|
||||||
|
|
@ -13,7 +15,7 @@ ADB_COMMON_CFLAGS := \
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
-Wvla \
|
-Wvla \
|
||||||
-DADB_REVISION=\"$(BUILD_NUMBER_FROM_FILE)\" \
|
-DADB_VERSION=\"$(tool_version)\" \
|
||||||
|
|
||||||
ADB_COMMON_posix_CFLAGS := \
|
ADB_COMMON_posix_CFLAGS := \
|
||||||
-Wexit-time-destructors \
|
-Wexit-time-destructors \
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,9 @@ std::string adb_version() {
|
||||||
// Don't change the format of this --- it's parsed by ddmlib.
|
// Don't change the format of this --- it's parsed by ddmlib.
|
||||||
return android::base::StringPrintf(
|
return android::base::StringPrintf(
|
||||||
"Android Debug Bridge version %d.%d.%d\n"
|
"Android Debug Bridge version %d.%d.%d\n"
|
||||||
"Revision %s\n"
|
"Version %s\n"
|
||||||
"Installed as %s\n",
|
"Installed as %s\n",
|
||||||
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_REVISION,
|
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_VERSION,
|
||||||
android::base::GetExecutablePath().c_str());
|
android::base::GetExecutablePath().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,9 +233,8 @@ int main(int argc, char** argv) {
|
||||||
adb_device_banner = optarg;
|
adb_device_banner = optarg;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("Android Debug Bridge Daemon version %d.%d.%d %s\n",
|
printf("Android Debug Bridge Daemon version %d.%d.%d (%s)\n", ADB_VERSION_MAJOR,
|
||||||
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
|
ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_VERSION);
|
||||||
ADB_REVISION);
|
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
// getopt already prints "adbd: invalid option -- %c" for us.
|
// getopt already prints "adbd: invalid option -- %c" for us.
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,12 @@
|
||||||
|
|
||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
|
include $(LOCAL_PATH)/../platform_tools_tool_version.mk
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -DFASTBOOT_VERSION=\"$(tool_version)\"
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/../adb \
|
$(LOCAL_PATH)/../adb \
|
||||||
$(LOCAL_PATH)/../mkbootimg \
|
$(LOCAL_PATH)/../mkbootimg \
|
||||||
|
|
@ -37,8 +41,6 @@ LOCAL_MODULE_TAGS := debug
|
||||||
LOCAL_MODULE_HOST_OS := darwin linux windows
|
LOCAL_MODULE_HOST_OS := darwin linux windows
|
||||||
LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
|
LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
|
||||||
|
|
||||||
LOCAL_CFLAGS += -DFASTBOOT_REVISION=\"$(BUILD_NUMBER_FROM_FILE)\"
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES_linux := usb_linux.cpp
|
LOCAL_SRC_FILES_linux := usb_linux.cpp
|
||||||
LOCAL_STATIC_LIBRARIES_linux := libselinux
|
LOCAL_STATIC_LIBRARIES_linux := libselinux
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1544,7 +1544,7 @@ int main(int argc, char **argv)
|
||||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||||
} else if (strcmp("version", longopts[longindex].name) == 0) {
|
} else if (strcmp("version", longopts[longindex].name) == 0) {
|
||||||
fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION);
|
fprintf(stdout, "fastboot version %s\n", FASTBOOT_VERSION);
|
||||||
fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
|
fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strcmp("slot", longopts[longindex].name) == 0) {
|
} else if (strcmp("slot", longopts[longindex].name) == 0) {
|
||||||
|
|
|
||||||
22
platform_tools_tool_version.mk
Normal file
22
platform_tools_tool_version.mk
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# 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' \
|
||||||
|
$(ANDROID_BUILD_TOP)/development/sdk/plat_tools_source.prop_template \
|
||||||
|
)
|
||||||
|
tool_version := $(platform_tools_version)-$(BUILD_NUMBER_FROM_FILE)
|
||||||
Loading…
Add table
Reference in a new issue