Merge "Show the "platform tools" version in adb/fastboot --version."

This commit is contained in:
Treehugger Robot 2017-05-10 01:41:39 +00:00 committed by Gerrit Code Review
commit 6f4d47438d
6 changed files with 34 additions and 9 deletions

View File

@ -5,6 +5,8 @@
LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/../platform_tools_tool_version.mk
adb_host_sanitize :=
adb_target_sanitize :=
@ -13,7 +15,7 @@ ADB_COMMON_CFLAGS := \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wvla \
-DADB_REVISION=\"$(BUILD_NUMBER_FROM_FILE)\" \
-DADB_VERSION=\"$(tool_version)\" \
ADB_COMMON_posix_CFLAGS := \
-Wexit-time-destructors \

View File

@ -64,9 +64,9 @@ 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"
"Revision %s\n"
"Version %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());
}

View File

@ -233,9 +233,8 @@ int main(int argc, char** argv) {
adb_device_banner = optarg;
break;
case 'v':
printf("Android Debug Bridge Daemon version %d.%d.%d %s\n",
ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
ADB_REVISION);
printf("Android Debug Bridge Daemon version %d.%d.%d (%s)\n", ADB_VERSION_MAJOR,
ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_VERSION);
return 0;
default:
// getopt already prints "adbd: invalid option -- %c" for us.

View File

@ -14,8 +14,12 @@
LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/../platform_tools_tool_version.mk
include $(CLEAR_VARS)
LOCAL_CFLAGS += -DFASTBOOT_VERSION=\"$(tool_version)\"
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../adb \
$(LOCAL_PATH)/../mkbootimg \
@ -37,8 +41,6 @@ LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
LOCAL_CFLAGS += -DFASTBOOT_REVISION=\"$(BUILD_NUMBER_FROM_FILE)\"
LOCAL_SRC_FILES_linux := usb_linux.cpp
LOCAL_STATIC_LIBRARIES_linux := libselinux

View File

@ -1544,7 +1544,7 @@ int main(int argc, char **argv)
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 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());
return 0;
} else if (strcmp("slot", longopts[longindex].name) == 0) {

View 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)