Skip to content

Commit 2eabf4a

Browse files
committed
Merge branch 'main' into lan_access_fix
2 parents 91ecc5a + 63926a4 commit 2eabf4a

56 files changed

Lines changed: 1099 additions & 363 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/licenses.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The following open source dependencies are used to build the [Tailscale Android
1111
Client][]. See also the dependencies in the [Tailscale CLI][].
1212

1313
[Tailscale Android Client]: https://github.com/tailscale/tailscale-android
14+
[Tailscale CLI]: ./tailscale.md
1415

1516
## Go Packages
1617

.github/workflows/android.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ jobs:
3030
- name: Clean
3131
run: make clean
3232

33+
- name: Format check (ktfmt)
34+
run: make fmt-check
35+
36+
- name: Run Go tests
37+
run: make go-test
38+
3339
- name: Build APKs
3440
run: make tailscale-debug.apk
3541

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ libtailscale-sources.jar
4747
.DS_Store
4848

4949
tailscale.version
50+
/local.properties

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,12 @@ build-unstripped-aar: tailscale.version $(GOBIN)/gomobile
182182
rm -f $(ABS_UNSTRIPPED_AAR)
183183
# The -linkmode=external -extldflags=-Wl,-z,max-page-size=16384 is specific to NDK 23
184184
# to support 16kb page sizes. Your mileage may vary with other NDK versions.
185+
$(GOBIN)/gomobile version
186+
./tool/go version
185187
$(GOBIN)/gomobile bind -target android -androidapi 26 \
188+
-x \
186189
-tags "$$(./build-tags.sh)" \
190+
-gcflags="all=-N -l" \
187191
-ldflags "-linkmode=external -extldflags=-Wl,-z,max-page-size=16384 $$(./version-ldflags.sh)" \
188192
-o $(ABS_UNSTRIPPED_AAR) ./libtailscale || { echo "gomobile bind failed"; exit 1; }
189193
@if [ ! -f $(ABS_UNSTRIPPED_AAR) ]; then \
@@ -311,6 +315,10 @@ checkandroidsdk: ## Check that Android SDK is installed
311315
\tANDROID_SDK_ROOT=$(ANDROID_SDK_ROOT)\n\n\
312316
See README.md for instructions on how to install the prerequisites.\n"; exit 1)
313317

318+
.PHONY: go-test
319+
go-test: ## Run the Go tests (excludes packages requiring Android NDK)
320+
./tool/go test $$(./tool/go list ./... | grep -v '^github.com/tailscale/tailscale-android/libtailscale$$')
321+
314322
.PHONY: test
315323
test: gradle-dependencies ## Run the Android tests
316324
(cd android && ./gradlew test)

android/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ android {
3535
ndkVersion "23.1.7779620"
3636
compileSdkVersion 34
3737
defaultConfig {
38+
// Explicit applicationId so we can override it for debug builds below.
39+
applicationId "com.tailscale.ipn"
3840
minSdkVersion 26
3941
targetSdkVersion 35
4042
versionCode 468
@@ -86,6 +88,7 @@ android {
8688
}
8789
debug {
8890
manifestPlaceholders.leanbackRequired = false
91+
packaging.jniLibs.keepDebugSymbols.add("**/*.so")
8992
}
9093
release {
9194
manifestPlaceholders.leanbackRequired = false
@@ -105,6 +108,15 @@ android {
105108
}
106109

107110
testBuildType "applicationTest"
111+
112+
// Override the applicationId for the debug build variant so the installed
113+
// package id becomes debug.com.tailscale.ipn.debug instead of
114+
// com.tailscale.ipn, allowing for installing release and debug side by side
115+
applicationVariants.all { variant ->
116+
if (variant.buildType.name == 'debug') {
117+
variant.mergedFlavor.applicationId = 'com.tailscale.ipn.debug'
118+
}
119+
}
108120
}
109121

110122
dependencies {
@@ -150,7 +162,8 @@ dependencies {
150162
implementation("com.patrykandpatrick.vico:compose-m3:1.15.0")
151163

152164
// Tailscale dependencies.
153-
implementation ':libtailscale@aar'
165+
releaseImplementation ':libtailscale@aar'
166+
debugImplementation ':libtailscale_unstripped@aar'
154167

155168
// Integration Tests
156169
androidTestImplementation composeBom

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This file is symlinked in project's git root directory, so regardless of opening the whole project's git root dir or only
2+
# ./android subdir in Android Studio, it will make AS see the same properties, because they are read only from the opened project's root directory,
3+
# and can't be linked or imported from submodules (like app module which is defined as ./android folder in project's git root settings.gradle)
14
android.defaults.buildfeatures.buildconfig=true
25
android.nonFinalResIds=false
36
android.nonTransitiveRClass=true
16.8 KB
Loading
2.63 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:tools="http://schemas.android.com/tools"
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
tools:ignore="MonochromeLauncherIcon">
5+
<background android:drawable="@color/ic_launcher_background"/>
6+
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
7+
</adaptive-icon>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:tools="http://schemas.android.com/tools"
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
tools:ignore="MonochromeLauncherIcon">
5+
<background android:drawable="@color/ic_launcher_background"/>
6+
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
7+
</adaptive-icon>

0 commit comments

Comments
 (0)