Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ jobs:
upload-src:
name: Upload the source
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build_and_install.outputs.version }}
steps:
- name: prep ubuntu
run: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -yq \
${{ matrix.pkgs }} cmake git libbrotli-dev \
${{ matrix.pkgs }} cargo cmake git libbrotli-dev \
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
libzstd-dev make pandoc pkg-config protobuf-compiler xz-utils
- name: checkout
Expand All @@ -22,26 +24,48 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: get vendor modules
run: |
cd vendor/adb/client/adbmdns
cargo vendor
mkdir -p .cargo
cat > .cargo/config.toml << 'EOF'
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
EOF
- name: generate man page
run: |
cd vendor/adb/docs/user
pandoc -s -t man adb.1.md -o adb.1
- name: build & install
- id: build_and_install
name: build & install
run: |
export SOURCE_DATE_EPOCH=$(date +%s)
echo "SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
cmake \
-DANDROID_TOOLS_USE_BUNDLED_CORROSION=ON \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
-DANDROID_TOOLS_ADB_ENABLE_MDNS=ON \
-B build
cmake --build build --target package_source
cmake --build build --target package_source vendor_source
for x in sha1sum sha256sum sha512sum b2sum; do
printf "$x " && $x ${{ github.workspace }}/build/android-tools-*.tar.xz | cut -d " " -f 1
printf "$x " && $x ${{ github.workspace }}/build/android-tools-*.tar.xz
done
VERSION=$(grep PLATFORM_TOOLS_VERSION ${{ github.workspace }}/build/vendor/platform_tools_version.h | awk '{print substr($3, 2, length($3) - 2)}')
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: upload package_source
uses: actions/upload-artifact@v7
with:
path: ${{ github.workspace }}/build/android-tools-*.tar.xz
path: ${{ github.workspace }}/build/android-tools-${{ steps.build_and_install.outputs.version }}.tar.xz
archive: false
- name: upload vendor_source
uses: actions/upload-artifact@v7
with:
path: ${{ github.workspace }}/build/android-tools-${{ steps.build_and_install.outputs.version }}-vendor.tar.xz
archive: false

linux:
Expand Down Expand Up @@ -93,7 +117,7 @@ jobs:
if: startsWith(matrix.os, 'opensuse')
run: |
zypper -n ref
zypper -n in ${{ matrix.pkgs }} cmake gtest pcre2-devel pkgconfig \
zypper -n in ${{ matrix.pkgs }} cargo cmake gtest pcre2-devel pkgconfig \
'pkgconfig(libbrotlicommon)' 'pkgconfig(liblz4)' \
'pkgconfig(libunwind-generic)' \
'pkgconfig(libzstd)' 'pkgconfig(protobuf)' ninja tar xz zlib-devel
Expand All @@ -102,35 +126,35 @@ jobs:
if: startsWith(matrix.os, 'archlinux')
run: |
pacman -Syu --needed --noconfirm \
${{ matrix.pkgs }} brotli cmake gtest libunwind \
${{ matrix.pkgs }} brotli cargo cmake gtest libunwind \
lz4 pcre2 pkgconfig protobuf zstd ninja

- name: prep ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
${{ matrix.pkgs }} cmake libbrotli-dev \
${{ matrix.pkgs }} cargo cmake libbrotli-dev \
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
libzstd-dev pkg-config protobuf-compiler ninja-build xz-utils

- name: prep alpine
if: startsWith(matrix.os, 'alpine')
run: |
apk add build-base pcre2-dev linux-headers gtest-dev samurai \
cmake protobuf-dev brotli-dev zstd-dev lz4-dev
cargo cmake protobuf-dev brotli-dev zstd-dev lz4-dev

- name: prep fedora
if: startsWith(matrix.os, 'fedora')
run: |
dnf install -y ${{ matrix.pkgs }} cmake ninja-build \
dnf install -y ${{ matrix.pkgs }} cargo cmake ninja-build \
brotli-devel gtest-devel lz4-devel pcre2-devel protobuf-devel \
libzstd-devel tar xz

- name: download source
uses: actions/download-artifact@v8
with:
pattern: android-tools-*.tar.xz
pattern: android-tools-${{ needs.upload-src.outputs.version }}.tar.xz

- name: build & install
run: |
Expand All @@ -143,8 +167,10 @@ jobs:
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_TOOLS_USE_BUNDLED_CORROSION=ON \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
-DANDROID_TOOLS_ADB_ENABLE_MDNS=ON \
-GNinja \
..
ninja --verbose
Expand Down Expand Up @@ -178,12 +204,12 @@ jobs:
run: |
rm -rf /opt/homebrew/include/openssl /usr/local/opt/openssl /usr/local/include/openssl
brew install --overwrite --quiet brotli cmake googletest lz4 \
ninja pcre2 protobuf zstd
ninja pcre2 protobuf rust zstd

- name: download source
uses: actions/download-artifact@v8
with:
pattern: android-tools-*.tar.xz
pattern: android-tools-${{ needs.upload-src.outputs.version }}.tar.xz

- name: build & install
run: |
Expand All @@ -195,8 +221,10 @@ jobs:
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/android-tools \
-DANDROID_TOOLS_USE_BUNDLED_CORROSION=ON \
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
-DANDROID_TOOLS_ADB_ENABLE_MDNS=ON \
-GNinja \
..
ninja --verbose
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@
shallow = true
path = vendor/fs_mgr
url = https://android.googlesource.com/platform/system/fs/fs_mgr.git
[submodule "vendor/corrosion"]
shallow = true
path = vendor/corrosion
url = https://github.com/corrosion-rs/corrosion.git
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ include(GNUInstallDirs)
# This helps to build vendor projects with or without any patching. Also if any
# files are changed in vendor projects those can be retained with this option.
option(ANDROID_TOOLS_PATCH_VENDOR "Patch vendor projects using patches directory" ON)
option(ANDROID_TOOLS_USE_BUNDLED_CORROSION "Use bundled corrosion instead of system provided one" OFF)
option(ANDROID_TOOLS_USE_BUNDLED_FMT "Use bundled fmt library instead of system provided one" OFF)
option(ANDROID_TOOLS_USE_BUNDLED_LIBUSB "Use bundled libusb library instead of system provided one" OFF)
option(ANDROID_TOOLS_ADB_ENABLE_MDNS "Enable ADB mDNS support" OFF)
option(ANDROID_TOOLS_LIBUSB_ENABLE_UDEV "Enable udev for device enumeration and hotplug support" OFF)

# Install bash/zsh completion files.
Expand Down Expand Up @@ -47,6 +49,7 @@ set(CPACK_SOURCE_GENERATOR "TXZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${ANDROID_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/patches/" "/build/" "/.git/" "/.github/" "/tests/"
"/test/" "/testdata/" "/extras/simpleperf/scripts/" "/extras/simpleperf/demo/"
"/adb/client/adbmdns/.cargo" "/adb/client/adbmdns/vendor"
"aes_128_gcm.txt" "aes_256_gcm.txt"
"/fuzz/"
"/wycheproof_testvectors/"
Expand All @@ -56,6 +59,7 @@ set(CPACK_SOURCE_IGNORE_FILES "/patches/" "/build/" "/.git/" "/.github/" "/tests
"\\\\.data$"
"\\\\.git$"
"\\\\.html$"
"\\\\.lock$"
"\\\\.orig$"
"\\\\.pdf$"
"\\\\.pem$"
Expand All @@ -68,3 +72,17 @@ set(CPACK_SOURCE_IGNORE_FILES "/patches/" "/build/" "/.git/" "/.github/" "/tests
"\\\\.zip$"
)
include(CPack)

# Create a custom target to for vendor source tarball.
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/${ANDROID_VENDOR}-${ANDROID_VERSION}-vendor.tar.xz
COMMAND ${CMAKE_COMMAND} -E tar
cJf ${CMAKE_BINARY_DIR}/${ANDROID_VENDOR}-${ANDROID_VERSION}-vendor.tar.xz
vendor/adb/client/adbmdns/.cargo
vendor/adb/client/adbmdns/vendor
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_target(vendor_source
DEPENDS ${CMAKE_BINARY_DIR}/${ANDROID_VENDOR}-${ANDROID_VERSION}-vendor.tar.xz
)
23 changes: 12 additions & 11 deletions patches/adb/0002-adb-disable-mdns-transport-support.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
From 419a5885e90871647e4bca76f528e6bd3c0d7ada Mon Sep 17 00:00:00 2001
From 704721ad0f2b9730f49e985c318576f90903b048 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]>
Date: Sun, 1 Sep 2019 15:04:18 +0000
Subject: [PATCH] adb: disable mdns transport support

Would require patching the MDNS code as well.
---
client/main.cpp | 4 ----
1 file changed, 4 deletions(-)
client/main.cpp | 2 ++
1 file changed, 2 insertions(+)

diff --git a/client/main.cpp b/client/main.cpp
index d8186c3..50a53b0 100644
index d8186c3..efde06c 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -133,10 +133,6 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, const char* o
@@ -133,9 +133,11 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, const char* o

init_reconnect_handler();

- if (mdns::is_enabled()) {
- init_mdns_transport_discovery();
- }
-
+#if ADB_MDNS
if (mdns::is_enabled()) {
init_mdns_transport_discovery();
}
+#endif

if (is_usb_enabled()) {
if (is_libusb_enabled()) {
libusb::usb_init();
--
2.54.0
2.55.0

19 changes: 16 additions & 3 deletions patches/adb/0003-adb-include-missing-headers.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
From c37bd188a394b36ecb5aa5eeac9469fc5ef4473a Mon Sep 17 00:00:00 2001
From edcfea31a3381decc13f4550e412e5d84b8e968b Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Thu, 1 Feb 2024 19:39:48 +0530
Subject: [PATCH] adb include missing headers

---
adb_mdns.cpp | 1 +
sysdeps/uio.h | 1 +
1 file changed, 1 insertion(+)
2 files changed, 2 insertions(+)

diff --git a/adb_mdns.cpp b/adb_mdns.cpp
index dde08d7..312ea3c 100644
--- a/adb_mdns.cpp
+++ b/adb_mdns.cpp
@@ -19,6 +19,7 @@
#include "adb_mdns.h"

#include <algorithm>
+#include <atomic>
#include <set>

#include <android-base/stringprintf.h>
diff --git a/sysdeps/uio.h b/sysdeps/uio.h
index f3ace64..266a20b 100644
--- a/sysdeps/uio.h
Expand All @@ -20,5 +33,5 @@ index f3ace64..266a20b 100644
using adb_iovec = struct iovec;
inline ssize_t adb_writev(borrowed_fd fd, const adb_iovec* iov, int iovcnt) {
--
2.43.0
2.55.0

Loading
Loading