Skip to content

Commit

Permalink
Migrate to Kotlin DSL & Misc. Improvements (#2373)
Browse files Browse the repository at this point in the history
* Enable Java language 11 features

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Migrate to Int only Sdk version properties

* Current ones are deprecated

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Merge libraries version into actual implementation

* We aren't multi-module project that requires us to specify the versions at project level

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Migrate to kotlin DSL

* Kotlin DSL is now the new default for Andorid projects
* https://developer.android.com/build/migrate-to-kotlin-dsl

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Set appropriate namespace in gradle file

* Setting packageName in AndroidManifest is deprecated in favour of namespace
* https://developer.android.com/build/configure-app-module#set-namespace

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Drop unused multidex support

* Only required to support apps targetting API lower than 21
* We currently require Android 6.0+
* https://developer.android.com/build/multidex
* 421462e

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

* Drop unused test instrumentation runner

* We don't have any tests, making this non-required

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>

---------

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
  • Loading branch information
theimpulson authored Oct 29, 2023
1 parent e2fe100 commit 7eb6cdd
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 167 deletions.
97 changes: 0 additions & 97 deletions app/build.gradle

This file was deleted.

107 changes: 107 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
plugins {
id("com.android.application")
}

apply(plugin = "realm-android")

val keystoreExists = System.getenv("KEYSTORE_FILE") != null

android {
namespace = "io.pslab"
compileSdk = 33

defaultConfig {
applicationId = "io.pslab"
minSdk = 21
targetSdk = 31
versionCode = 22
versionName = "2.1.0"
}

signingConfigs {
if (keystoreExists) {
register("release") {
storeFile = file(System.getenv("KEYSTORE_FILE"))
storePassword = System.getenv("STORE_PASS")
keyAlias = System.getenv("ALIAS")
keyPassword = System.getenv("KEY_PASS")
}
}
}

buildTypes {
debug {
versionNameSuffix = "Version: "
resValue("string", "version", "${versionNameSuffix}${defaultConfig.versionName}")
}
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
resValue("string", "version", "${defaultConfig.versionName}")
signingConfig = if (keystoreExists) signingConfigs.getByName("release") else null
}
}
lint {
abortOnError = false
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {

// Android stock libraries
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.recyclerview:recyclerview:1.3.0")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.preference:preference:1.2.0")
implementation("androidx.browser:browser:1.5.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

// Custom tools libraries
implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
implementation("com.github.bmelnychuk:atv:1.2.9")
implementation("de.hdodenhof:circleimageview:3.1.0")
implementation("com.github.devlight.navigationtabstrip:navigationtabstrip:1.0.4")
implementation("com.afollestad.material-dialogs:core:0.9.6.0")
implementation("com.github.medyo:android-about-page:1.3.1")
implementation("com.github.tiagohm.MarkdownView:library:0.19.0")
implementation("com.github.mirrajabi:search-dialog:1.2.4")
implementation("com.sdsmdg.harjot:croller:1.0.7")
implementation("com.github.BeppiMenozzi:Knob:1.9.0")
implementation("com.github.warkiz.widget:indicatorseekbar:2.1.2")
implementation("com.github.Vatican-Cameos:CarouselPicker:1.2")
implementation("com.github.anastr:speedviewlib:1.6.0")
implementation("com.github.GoodieBag:ProtractorView:v1.2")
implementation("com.github.Triggertrap:SeekArc:v1.1")

// Apache commons
implementation("org.apache.commons:commons-math3:3.6.1")
implementation("org.apache.commons:commons-lang3:3.12.0")

// Picasso
implementation("com.squareup.picasso:picasso:2.71828")

// OKHTTP
implementation("com.squareup.okhttp3:okhttp:4.9.3")

// ButterKnife
val butterKnifeVersion = "10.2.3"
annotationProcessor("com.jakewharton:butterknife-compiler:$butterKnifeVersion")
implementation("com.jakewharton:butterknife:$butterKnifeVersion")

// Map libraries
val osmDroidVersion = "6.1.11"
implementation("org.osmdroid:osmdroid-android:$osmDroidVersion")
implementation("org.osmdroid:osmdroid-mapsforge:$osmDroidVersion")
implementation("org.osmdroid:osmdroid-geopackage:$osmDroidVersion")

// Realm
implementation("io.realm:android-adapters:4.0.0")
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# By default, the flags in this file are appended to flags specified
# in /home/viveksb007/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# directive in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.pslab">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
Expand Down Expand Up @@ -130,4 +129,4 @@
<activity android:name=".sensors.SensorTSL2561" />
</application>

</manifest>
</manifest>
63 changes: 0 additions & 63 deletions build.gradle

This file was deleted.

13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("io.realm:realm-gradle-plugin:10.11.0")
}
}

plugins {
id("com.android.application") version "7.4.2" apply false
}
6 changes: 3 additions & 3 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://plugins.gradle.org/m2/" }
maven("https://jitpack.io")
maven("https://plugins.gradle.org/m2/")
}
}
rootProject.name = "PSLab"
include ':app'
include(":app")

0 comments on commit 7eb6cdd

Please sign in to comment.