Skip to content

Commit

Permalink
Fix build due to JCenter shutdown (fixes #1135) (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 authored Oct 21, 2024
1 parent 565d629 commit 8dd2d47
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 209 deletions.
2 changes: 1 addition & 1 deletion App_build_and_release.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cls
REM
REM Script Consts.
SET CLEANUP_BEFORE_BUILD=1
SET SKIP_RELEASE_BUILD=0
SET SKIP_RELEASE_BUILD=1
REM
REM Runtime Variables.
IF EXIST "%LocalAppData%\Android\Sdk" SET "ANDROID_SDK_ROOT=%LocalAppData%\Android\Sdk"
Expand Down
8 changes: 4 additions & 4 deletions SyncthingNative_update_and_build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ git fetch --quiet --all
SET RESULT=%ERRORLEVEL%
IF NOT "%RESULT%" == "0" echo [ERROR] git fetch FAILED. & goto :eos
REM
echo [INFO] Reading required SyncthingNative from versions.gradle ...
echo [INFO] Reading required SyncthingNative from build.gradle.kts ...
IF NOT DEFINED SYNCTHING_NATIVE_REQUIRED_VERSION call :getRequiredSynchtingNativeVersion
REM
echo [INFO] Checking out syncthing_%SYNCTHING_NATIVE_REQUIRED_VERSION% ...
Expand Down Expand Up @@ -103,17 +103,17 @@ goto :eof
REM
REM Get "versionMajor"
SET VERSION_MAJOR=
FOR /F "tokens=2 delims== " %%A IN ('type "%SCRIPT_PATH%app\versions.gradle" 2^>^&1 ^| findstr "versionMajor"') DO SET VERSION_MAJOR=%%A
FOR /F "tokens=2 delims==) " %%A IN ('type "%SCRIPT_PATH%build.gradle.kts" 2^>^&1 ^| findstr "versionMajor"') DO SET VERSION_MAJOR=%%A
SET VERSION_MAJOR=%VERSION_MAJOR:"=%
REM
REM Get "versionMinor"
SET VERSION_MINOR=
FOR /F "tokens=2 delims== " %%A IN ('type "%SCRIPT_PATH%app\versions.gradle" 2^>^&1 ^| findstr "versionMinor"') DO SET VERSION_MINOR=%%A
FOR /F "tokens=2 delims==) " %%A IN ('type "%SCRIPT_PATH%build.gradle.kts" 2^>^&1 ^| findstr "versionMinor"') DO SET VERSION_MINOR=%%A
SET VERSION_MINOR=%VERSION_MINOR:"=%
REM
REM Get "versionPatch"
SET VERSION_PATCH=
FOR /F "tokens=2 delims== " %%A IN ('type "%SCRIPT_PATH%app\versions.gradle" 2^>^&1 ^| findstr "versionPatch"') DO SET VERSION_PATCH=%%A
FOR /F "tokens=2 delims==) " %%A IN ('type "%SCRIPT_PATH%build.gradle.kts" 2^>^&1 ^| findstr "versionPatch"') DO SET VERSION_PATCH=%%A
SET VERSION_PATCH=%VERSION_PATCH:"=%
REM
SET "SYNCTHING_NATIVE_REQUIRED_VERSION=v%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%"
Expand Down
152 changes: 0 additions & 152 deletions app/build.gradle

This file was deleted.

148 changes: 148 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
plugins {
id("com.android.application")
id("com.github.ben-manes.versions")
id("com.github.triplet.play") version "3.7.0"
}

dependencies {
androidTestImplementation("androidx.annotation:annotation:1.2.0")
androidTestImplementation("androidx.test:rules:1.4.0")
annotationProcessor("com.google.dagger:dagger-compiler:2.38.1")
implementation("androidx.preference:preference:1.1.1")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("androidx.core:core:1.3.0")
implementation("androidx.documentfile:documentfile:1.0.1")
implementation("androidx.fragment:fragment:1.2.5")
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.0.0")
implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("com.android.volley:volley:1.2.1")
implementation("com.annimon:stream:1.2.2")
implementation("com.google.android.material:material:1.4.0")
implementation("com.google.code.gson:gson:2.8.8")
implementation("com.google.dagger:dagger:2.38.1")
implementation("com.google.guava:guava:30.1.1-android")
// Do not upgrade zxing:core beyond 3.3.0 to ensure Android 6.0 compatibility, see issue #761.
implementation("com.google.zxing:core:3.3.0")
implementation("com.journeyapps:zxing-android-embedded:4.2.0") { isTransitive = false }
implementation("eu.chainfire:libsuperuser:1.1.1")
implementation("org.mindrot:jbcrypt:0.4")

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
}

android {
val ndkVersionShared = rootProject.extra.get("ndkVersionShared")
val versionMajor: kotlin.Int by rootProject.extra
val versionMinor: kotlin.Int by rootProject.extra
val versionPatch: kotlin.Int by rootProject.extra
val versionWrapper: kotlin.Int by rootProject.extra

compileSdk = 35
buildToolsVersion = "35.0.0"
ndkVersion = "${ndkVersionShared}"

namespace = "com.nutomic.syncthingandroid"
buildFeatures.dataBinding = true

defaultConfig {
applicationId = "com.github.catfriend1.syncthingandroid"
minSdk = 21
targetSdk = 35
versionCode = versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionWrapper
versionName = "${versionMajor}.${versionMinor}.${versionPatch}.${versionWrapper}"
testApplicationId = "com.github.catfriend1.syncthingandroid.test"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
create("release") {
storeFile = System.getenv("SYNCTHING_RELEASE_STORE_FILE")?.let(::file)
storePassword = System.getenv("SIGNING_PASSWORD")
keyAlias = System.getenv("SYNCTHING_RELEASE_KEY_ALIAS")
keyPassword = System.getenv("SIGNING_PASSWORD")
}
}

buildTypes {
getByName("debug") {
applicationIdSuffix = ".debug"
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
}
getByName("release") {
signingConfig = signingConfigs.runCatching { getByName("release") }
.getOrNull()
.takeIf { it?.storeFile != null }
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

bundle {
language {
enableSplit = false
}
density {
enableSplit = true
}
abi {
enableSplit = true
}
}


packaging {
jniLibs {
useLegacyPackaging = true
}
}
lint {
abortOnError = true
disable += "UnsafeExperimentalUsageError"
disable += "UnsafeExperimentalUsageWarning"
disable += "ExpiringTargetSdkVersion"
disable += "ExpiredTargetSdkVersion"
}
}

play {
// Use ANDROID_PUBLISHER_CREDENTIALS environment variable to specify serviceAccountCredentials.
track = "beta"
resolutionStrategy = com.github.triplet.gradle.androidpublisher.ResolutionStrategy.IGNORE
defaultToAppBundles = true
}

/**
* Some languages are not supported by Google Play, so we ignore them.
*/
tasks.register<Delete>("deleteUnsupportedPlayTranslations") {
delete(
"src/main/play/listings/el-EL/",
"src/main/play/listings/en/",
"src/main/play/listings/eu/",
"src/main/play/listings/nb/",
"src/main/play/listings/nl_BE/",
"src/main/play/listings/nl-BE/",
"src/main/play/listings/nn/",
"src/main/play/listings/ta/",
)
}

task<Exec>("postBuildScript") {
commandLine("python", "-u" , "./postbuild.py")
}

project.afterEvaluate {
project.getTasks().getByName("mergeDebugJniLibFolders").dependsOn(":syncthing:buildNative")
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.nutomic.syncthingandroid.BuildConfig;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.activities.MainActivity;
import com.nutomic.syncthingandroid.activities.RecentChangesActivity;
Expand Down Expand Up @@ -135,7 +134,7 @@ private void updateUI() {
* Reason: SyncthingNative's Web UI is not approved by Google because
* it is lacking full DPAD navigation support. See issue #567.
*/
mDrawerActionWebGui.setVisibility((!mRunningOnTV || BuildConfig.DEBUG) ? View.VISIBLE : View.GONE);
mDrawerActionWebGui.setVisibility((!mRunningOnTV) ? View.VISIBLE : View.GONE);

// Enable buttons if syncthing is running.
mDrawerRecentChanges.setEnabled(syncthingRunning);
Expand Down
6 changes: 0 additions & 6 deletions app/versions.gradle

This file was deleted.

30 changes: 0 additions & 30 deletions build.gradle

This file was deleted.

Loading

0 comments on commit 8dd2d47

Please sign in to comment.