Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cordova/android): use src/tun2socks, not precompiled third_party version #1816

Merged
merged 7 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android: $(BUILDDIR)/android/tun2socks.aar
$(BUILDDIR)/android/tun2socks.aar: $(GOMOBILE)
mkdir -p "$(BUILDDIR)/android"
$(ANDROID_BUILD_CMD) -o "$@" $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks
unzip "$@" 'jni/*' -d $(BUILDDIR)/android
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you uncompressing the aar file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, still exploring. Let me set this to draft.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required for the copy script, for some reason, and removing the copy script silently breaks the build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not in this PR, but I think we should use the aar directly in the future. Intra already referenced the aar directly, but I don't know whether Cordova allows you to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like a Cordova thing, yeah.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daniellacosse Can you check whether we need to unzip again?

Based on the new fixed build.gradle, it seems we refer to directly to the .aar file, not the extracted files.

daniellacosse marked this conversation as resolved.
Show resolved Hide resolved

# TODO(fortuna): -s strips symbols and is obsolete. Why are we using it?
$(BUILDDIR)/ios/Tun2socks.xcframework: $(GOMOBILE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
// To make this project editable directly in the source tree, we need to load
// tun2socks.aar from its original path in the third_party directory. We do
// this by relative path:
compileOnly fileTree(dir: '../../../../../third_party/outline-go-tun2socks/android',
compileOnly fileTree(dir: '../../../../../output/build/android',
include: ['tun2socks.aar'])
// Note: A flatDir repository might be preferable, but this is not compatible
// with a composite build (https://github.com/gradle/gradle/issues/911).
Expand Down
2 changes: 1 addition & 1 deletion src/cordova/plugin/android/scripts/copy_third_party.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fs = require('fs/promises');
const path = require('node:path');

const ANDROID_LIBS_FOLDER_PATH = path.join('plugins', 'cordova-plugin-outline', 'android', 'libs');
const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('third_party', 'outline-go-tun2socks', 'android');
const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('output', 'build', 'android');

module.exports = async function (context) {
console.log('Copying Android third party libraries...');
Expand Down
21 changes: 0 additions & 21 deletions third_party/outline-go-tun2socks/LICENSE

This file was deleted.

11 changes: 0 additions & 11 deletions third_party/outline-go-tun2socks/METADATA

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading