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

WIP: Revive for more recent android sdk versions #208

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ release.keystore
com_crashlytics_export_strings.xml
crashlytics-build.properties
crashlytics.properties
.kotlin/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "third_party/nfc-felica-lib"]
path = third_party/nfc-felica-lib
url = https://github.com/codebutler/nfc-felica-lib.git
url = https://github.com/jspaetzel/nfc-felica-lib.git
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ FareBot uses the following open-source libraries:
* [Guava](https://github.com/google/guava)
* [Kotlin](https://kotlinlang.org/)
* [Magellan](https://github.com/wealthfront/magellan/)
* [RxBroadcast](https://github.com/cantrowitz/RxBroadcast)
* [RxJava](https://github.com/ReactiveX/RxJava)
* [RxRelay](https://github.com/JakeWharton/RxRelay)

Expand Down
36 changes: 18 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
buildscript {
ext {
kotlin_version = '1.9.25'
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-alpha13'
classpath 'io.fabric.tools:gradle:1.28.1'
classpath 'com.squareup.sqldelight:gradle-plugin:1.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31"
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'app.cash.sqldelight:gradle-plugin:2.0.2'
}
}

plugins {
id 'com.github.ben-manes.versions' version '0.21.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id "org.jetbrains.kotlin.kapt" version "1.9.25"
}

allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
google()
}
}

Expand All @@ -39,7 +43,7 @@ subprojects {
afterEvaluate {project ->
if (project.name.contains('farebot')) {
check.dependsOn 'checkstyle'
task checkstyle(type: Checkstyle) {
tasks.register('checkstyle', Checkstyle) {
configFile file('config/checkstyle/checkstyle.xml')
source 'src'
include '**/*.java'
Expand All @@ -62,18 +66,14 @@ subprojects {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

lintOptions {
abortOnError true
disable 'InvalidPackage','MissingTranslation'
}

dexOptions {
dexInProcess = true
}
}
}
}
Expand All @@ -100,7 +100,7 @@ dependencies {
ktlint 'com.github.shyiko:ktlint:0.31.0'
}

task lintKotlin(type: JavaExec) {
tasks.register('lintKotlin', JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "*/src/**/*.kt"
Expand Down
33 changes: 15 additions & 18 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
ext {
vers = [
compileSdkVersion: 28,
targetSdkVersion: 28,
compileSdkVersion: 34,
targetSdkVersion: 34,
minSdkVersion: 21
]

def autoDisposeVersion = '0.8.0'
def autoValueGsonVersion = '0.8.0'
def autoValueVersion = '1.6.5'
def daggerVersion = '2.22.1'
def groupieVersion = '2.3.0'
def kotlinVersion = '1.3.31'
def autoValueVersion = '1.11.0'
def daggerVersion = '2.52'
def groupieVersion = '2.8.1'
def kotlinVersion = '1.9.25'
def magellanVersion = '1.1.0'
def roomVersion = '2.1.0-alpha07'
def roomVersion = '2.6.1'

libs = [
autoDispose: "com.uber.autodispose:autodispose:${autoDisposeVersion}",
Expand All @@ -21,27 +20,25 @@ ext {
autoDisposeKotlin: "com.uber.autodispose:autodispose-kotlin:${autoDisposeVersion}",
autoValue: "com.google.auto.value:auto-value:${autoValueVersion}",
autoValueAnnotations: "com.google.auto.value:auto-value-annotations:${autoValueVersion}",
autoValueGson: "com.ryanharter.auto.value:auto-value-gson:${autoValueGsonVersion}",
autoValueGsonAnnotations: "com.ryanharter.auto.value:auto-value-gson-annotations:${autoValueGsonVersion}",
autoValueGson: "com.ryanharter.auto.value:auto-value-gson:1.3.1",
autoValueGsonAnnotations: "com.ryanharter.auto.value:auto-value-gson-annotations:0.8.0",
checkstyle: 'com.puppycrawl.tools:checkstyle:8.20',
crashlytics: 'com.crashlytics.sdk.android:crashlytics:2.10.0',
dagger: "com.google.dagger:dagger:${daggerVersion}",
daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}",
groupie: "com.xwray:groupie:${groupieVersion}",
groupieDatabinding: "com.xwray:groupie-databinding:${groupieVersion}",
groupie: "com.github.lisawray.groupie:groupie:${groupieVersion}",
groupieDatabinding: "com.github.lisawray.groupie:groupie-databinding:${groupieVersion}",
gson: 'com.google.code.gson:gson:2.8.5',
guava: 'com.google.guava:guava:27.1-android',
kotlinStdlib: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}",
magellan: "com.wealthfront:magellan:${magellanVersion}",
playServicesMaps: 'com.google.android.gms:play-services-maps:16.1.0',
roomRuntime: "androidx.room:room-runtime:${roomVersion}",
roomCompiler: "androidx.room:room-compiler:${roomVersion}",
rxBroadcast: 'com.cantrowitz:rxbroadcast:2.0.0',
rxJava2: 'io.reactivex.rxjava2:rxjava:2.2.8',
rxRelay2: 'com.jakewharton.rxrelay2:rxrelay:2.1.0',
supportDesign: "com.google.android.material:material:1.0.0",
rxJava2: 'io.reactivex.rxjava2:rxjava:2.2.21',
rxRelay2: 'com.jakewharton.rxrelay2:rxrelay:2.1.1',
supportDesign: "com.google.android.material:material:1.12.0",
supportV4: "androidx.legacy:legacy-support-v4:1.0.0",
supportV7CardView: "androidx.cardview:cardview:1.0.0",
supportV7RecyclerView: "androidx.recyclerview:recyclerview:1.0.0"
supportV7RecyclerView: "androidx.recyclerview:recyclerview:1.3.2"
]
}
6 changes: 5 additions & 1 deletion farebot-app-persist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
plugins {
id "org.jetbrains.kotlin.kapt" version "1.9.25"
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

dependencies {
implementation libs.supportV4
Expand All @@ -15,6 +18,7 @@ dependencies {
}

android {
namespace "com.codebutler.farebot.persist"
defaultConfig {
kapt {
arguments {
Expand Down
3 changes: 1 addition & 2 deletions farebot-app-persist/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<manifest package="com.codebutler.farebot.app.persist">
</manifest>
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ abstract class FareBotDb : RoomDatabase() {
private fun buildDatabase(context: Context): FareBotDb =
Room.databaseBuilder(context, FareBotDb::class.java, DATABASE_NAME)
.addMigrations(object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
// Migration from Sqldelight to Room. Nothing to change.
}
})
.addMigrations(object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
// Re-create tables with new NOT NULL `id` column.
database.beginTransaction()
db.beginTransaction()
try {
database.execSQL("""
db.execSQL("""
CREATE TABLE `cards_new` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
`type` TEXT NOT NULL,
Expand All @@ -49,7 +49,7 @@ abstract class FareBotDb : RoomDatabase() {
);
""".trimIndent())

database.execSQL("""
db.execSQL("""
CREATE TABLE `keys_new` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
`card_id` TEXT NOT NULL,
Expand All @@ -59,25 +59,25 @@ abstract class FareBotDb : RoomDatabase() {
);
""".trimIndent())

database.execSQL("""
db.execSQL("""
INSERT INTO `cards_new` (type, serial, data, scanned_at)
SELECT type, serial, data, scanned_at FROM cards;
""".trimIndent())

database.execSQL("""
db.execSQL("""
INSERT INTO `keys_new` (card_id, card_type, key_data, created_at)
SELECT card_id, card_type, key_data, created_at FROM keys;
""".trimIndent())

database.execSQL("DROP TABLE `cards`;")
database.execSQL("DROP TABLE `keys`;")
db.execSQL("DROP TABLE `cards`;")
db.execSQL("DROP TABLE `keys`;")

database.execSQL("ALTER TABLE `cards_new` RENAME TO `cards`;")
database.execSQL("ALTER TABLE `keys_new` RENAME TO `keys`;")
db.execSQL("ALTER TABLE `cards_new` RENAME TO `cards`;")
db.execSQL("ALTER TABLE `keys_new` RENAME TO `keys`;")

database.setTransactionSuccessful()
db.setTransactionSuccessful()
} finally {
database.endTransaction()
db.endTransaction()
}
}
})
Expand Down
82 changes: 42 additions & 40 deletions farebot-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

plugins {
id "org.jetbrains.kotlin.kapt" version "1.9.25"
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

dependencies {
implementation project(':farebot-base')
Expand Down Expand Up @@ -64,57 +65,56 @@ dependencies {
implementation libs.kotlinStdlib
implementation libs.magellan
implementation libs.playServicesMaps
implementation libs.rxBroadcast
implementation libs.rxJava2
implementation libs.rxRelay2
implementation libs.supportDesign
implementation libs.supportV4
implementation libs.supportV7CardView
implementation libs.supportV7RecyclerView
//
// implementation(libs.crashlytics) {
// transitive = true
// }

implementation(libs.crashlytics) {
transitive = true
}

implementation libs.dagger
kapt libs.daggerCompiler
}

static def askPassword() {
return 'security -q find-generic-password -w -g -l farebot-release'.execute().text.trim()
}
implementation 'com.google.dagger:dagger:2.52'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.preference:preference-ktx:1.2.1'

gradle.taskGraph.whenReady { taskGraph ->
if(taskGraph.hasTask(':farebot-app:packageRelease')) {
def password = askPassword()
android.signingConfigs.release.storePassword = password
android.signingConfigs.release.keyPassword = password
}
kapt 'com.google.dagger:dagger-compiler:2.52'
}

kapt {
useBuildCache = true
mapDiagnosticLocations = true
}
// TODO: Fixme for release
//static def askPassword() {
// return 'security -q find-generic-password -w -g -l farebot-release'.execute().text.trim()
//}
//
//gradle.taskGraph.whenReady { taskGraph ->
// if(taskGraph.hasTask(':farebot-app:packageRelease')) {
// def password = askPassword()
// android.signingConfigs.release.storePassword = password
// android.signingConfigs.release.keyPassword = password
// }
//}

android {
namespace "com.codebutler.farebot.app"
defaultConfig {
versionCode 29
versionName '3.1.1'
multiDexEnabled true
}

signingConfigs {
debug {
storeFile file('../debug.keystore')
}
release {
storeFile file('../release.keystore')
keyAlias 'ericbutler'
storePassword ''
keyPassword ''
}
}
// signingConfigs {
// debug {
// storeFile file('../debug.keystore')
// }
// release {
// storeFile file('../release.keystore')
// keyAlias 'ericbutler'
// storePassword ''
// keyPassword ''
// }
// }

buildTypes {
debug {
Expand All @@ -124,12 +124,14 @@ android {
shrinkResources false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../config/proguard/proguard-rules.pro'
signingConfig signingConfigs.release
// signingConfig signingConfigs.release
}
}

packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
resources {
excludes += ['META-INF/LICENSE.txt', 'META-INF/NOTICE.txt']
}
}
compileSdk 34
buildToolsVersion '35.0.0'
}
Loading