Skip to content

Commit ff4c5ce

Browse files
committed
Update dependencies and build RClone in a go module.
This commit updates build tools, android gradle plugin and RClone to their latest version. Also, the RClone build recipe now creates a go module instead of git. his will make sure dependencies are pinned to the version expected by RClone.
1 parent ef1a368 commit ff4c5ce

7 files changed

Lines changed: 28 additions & 19 deletions

File tree

.github/workflows/android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
run: |
2828
BUILD_TOOLS_VERSION="$(grep -E "^io\.github\.x0b\.rcx\.buildToolsVersion=" gradle.properties | cut -d'=' -f2)"
2929
NDK_VERSION="$(grep -E "^io\.github\.x0b\.rcx\.ndkVersion=" gradle.properties | cut -d'=' -f2)"
30-
yes | sudo "${ANDROID_HOME}/tools/bin/sdkmanager" "build-tools;${BUILD_TOOLS_VERSION}" "ndk;${NDK_VERSION}"
30+
31+
yes | sudo "${ANDROID_HOME}/tools/bin/sdkmanager" --licenses
32+
sudo "${ANDROID_HOME}/tools/bin/sdkmanager" "build-tools;${BUILD_TOOLS_VERSION}" "ndk;${NDK_VERSION}"
3133
- name: Build app
3234
run: ./gradlew assembleOssDebug
3335
- name: Upload APK

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
*.apk
33
*.ap_
44

5+
# Built libraries
6+
*.so
7+
58
# Files for the ART/Dalvik VM
69
*.dex
710

app/src/main/java/ca/pkay/rcloneexplorer/RemoteConfig/DriveConfig.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
import android.annotation.SuppressLint;
44
import android.content.Context;
5-
import android.content.DialogInterface;
65
import android.content.Intent;
76
import android.content.SharedPreferences;
8-
import android.net.Uri;
97
import android.os.AsyncTask;
108
import android.os.Bundle;
119
import android.view.LayoutInflater;
@@ -18,7 +16,6 @@
1816
import androidx.annotation.NonNull;
1917
import androidx.annotation.Nullable;
2018
import androidx.appcompat.app.AlertDialog;
21-
import androidx.browser.customtabs.CustomTabsIntent;
2219
import androidx.fragment.app.Fragment;
2320
import androidx.preference.PreferenceManager;
2421
import ca.pkay.rcloneexplorer.MainActivity;

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88

99
dependencies {
10-
classpath 'com.android.tools.build:gradle:4.0.0'
10+
classpath 'com.android.tools.build:gradle:4.0.1'
1111

1212
for (String taskName : getGradle().getStartParameter().getTaskNames()) {
1313
if (taskName.endsWith('RcxDebug') || taskName.endsWith('RcxRelease')) {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android.useAndroidX=true
1414
# android.enableR8=true
1515
org.gradle.jvmargs=-Xmx1536m
1616

17-
io.github.x0b.rcx.rCloneVersion=1.51.0
18-
io.github.x0b.rcx.buildToolsVersion=30.0.1
17+
io.github.x0b.rcx.rCloneVersion=1.52.3
18+
io.github.x0b.rcx.buildToolsVersion=29.0.3
1919
io.github.x0b.rcx.ndkVersion=21.3.6528147
2020

2121
# When configured, Gradle will run in incubating parallel mode.

rclone/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/gopath
1+
/cache

rclone/build.gradle

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import java.nio.file.Paths
33
ext {
44
NDK_VERSION = project.properties['io.github.x0b.rcx.ndkVersion']
55
RCLONE_VERSION = project.properties['io.github.x0b.rcx.rCloneVersion']
6-
RCLONE_REPOSITORY = 'github.com/rclone/rclone'
7-
GO_PATH = Paths.get(projectDir.absolutePath, 'gopath').toAbsolutePath().toString()
6+
RCLONE_MODULE = 'github.com/rclone/rclone'
7+
CACHE_PATH = Paths.get(projectDir.absolutePath, 'cache').toAbsolutePath().toString()
8+
GOPATH = Paths.get(CACHE_PATH, "gopath").toString()
89
}
910

1011
def findSdkDir() {
@@ -83,29 +84,35 @@ def buildRclone(compiler, arch, abi, env = [:]) {
8384
return {
8485
doLast {
8586
exec {
86-
environment 'GOPATH', GO_PATH
87+
environment 'GOPATH', GOPATH
8788
def crossCompiler = getCrossCompiler(compiler)
8889
environment 'CC', crossCompiler
8990
environment 'CC_FOR_TARGET', crossCompiler
9091
environment 'GOOS', 'android'
9192
environment 'GOARCH', arch
9293
environment 'CGO_ENABLED', '1'
9394
env.each {entry -> environment "$entry.key", "$entry.value"}
94-
commandLine 'go', 'build', '-tags', 'linux', '-o', getLibrclone(abi), RCLONE_REPOSITORY
95+
workingDir CACHE_PATH
96+
commandLine 'go', 'build', '-tags', 'linux', '-o', getLibrclone(abi), RCLONE_MODULE
9597
}
9698
}
9799
}
98100
}
99101

100-
task fetchRclone(type: Exec) {
101-
mkdir GO_PATH
102-
environment 'GOPATH', GO_PATH
103-
commandLine 'go', 'get', '-d', RCLONE_REPOSITORY
102+
task createRcloneModule(type: Exec) {
103+
// We create a fake go module as it's the only way to checkout
104+
// a specific tag.
105+
onlyIf { !Paths.get(CACHE_PATH, 'go.mod').toFile().exists() }
106+
mkdir CACHE_PATH
107+
workingDir CACHE_PATH
108+
environment 'GOPATH', GOPATH
109+
commandLine 'go', 'mod', 'init', 'rclone'
104110
}
105111

106-
task checkoutRclone(type: Exec, dependsOn: fetchRclone) {
107-
workingDir Paths.get(GO_PATH, 'src', *RCLONE_REPOSITORY.split('/'))
108-
commandLine 'git', 'checkout', 'v' + RCLONE_VERSION
112+
task checkoutRclone(type: Exec, dependsOn: createRcloneModule) {
113+
workingDir CACHE_PATH
114+
environment 'GOPATH', GOPATH
115+
commandLine 'go', 'get', '-v', '-d', "${RCLONE_MODULE}@v${RCLONE_VERSION}"
109116
}
110117

111118
task cleanNative {

0 commit comments

Comments
 (0)