Rearrange the project for better Android Studio support [2/2]

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2022-07-03 23:47:52 +05:30 committed by Jochen Sprickerhof
parent c75b4fe462
commit 7755b5021d
4 changed files with 131 additions and 113 deletions

105
app/build.gradle Normal file
View File

@ -0,0 +1,105 @@
editorconfig {
excludes = ['external/**', 'metadata/**', '**/*.webp']
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 32
versionName "1.0.30"
applicationId "ws.xsoh.etar"
}
sourceSets {
main.java.srcDirs += '../external/ex/common/java'
}
buildTypes {
release {
// TODO: could be enabled for ProGuard minimization
minifyEnabled false
resValue "string", "search_authority", defaultConfig.applicationId + '.CalendarRecentSuggestionsProvider'
}
debug {
minifyEnabled false
applicationIdSuffix ".debug"
resValue "string", "search_authority", defaultConfig.applicationId + '.debug.CalendarRecentSuggestionsProvider'
}
}
buildFeatures {
viewBinding true
}
/*
* To sign release build, create file gradle.properties in ~/.gradle/ with this content:
*
* signingStoreLocation=/home/key.store
* signingStorePassword=xxx
* signingKeyAlias=alias
* signingKeyPassword=xxx
*/
if (project.hasProperty('signingStoreLocation') &&
project.hasProperty('signingStorePassword') &&
project.hasProperty('signingKeyAlias') &&
project.hasProperty('signingKeyPassword')) {
println "Found sign properties in gradle.properties! Signing build…"
signingConfigs {
release {
storeFile file(signingStoreLocation)
storePassword signingStorePassword
keyAlias signingKeyAlias
keyPassword signingKeyPassword
}
}
buildTypes.release.signingConfig = signingConfigs.release
} else {
buildTypes.release.signingConfig = null
}
lint {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
// External
implementation project(':external:calendar')
implementation project(':external:colorpicker')
implementation project(':external:timezonepicker')
implementation project(':external:chips')
// Core
implementation 'androidx.core:core-ktx:1.8.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.material:material:1.5.0'
// Coroutines
def coroutines_version = "1.6.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
}

View File

@ -1,3 +1,25 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.android.calendar.selectcalendars.SelectCalendarsSyncFragment
-keep class com.android.calendar.OtherPreferences
-keep class com.android.calendar.AboutPreferences
@ -43,3 +65,4 @@
-keepclassmembers class * implements android.content.SharedPreferences$Editor {
public *** apply();
}

View File

@ -18,117 +18,6 @@ configure(external_projects) {
}
}
editorconfig {
excludes = ['external/**', 'metadata/**', '**/*.webp']
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 32
versionName "1.0.30"
applicationId "ws.xsoh.etar"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'external/ex/common/java']
// NOTE: this includes external/ex/common/java!
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
// TODO: could be enabled for ProGuard minimization
minifyEnabled false
resValue "string", "search_authority", defaultConfig.applicationId + '.CalendarRecentSuggestionsProvider'
}
debug {
minifyEnabled false
applicationIdSuffix ".debug"
resValue "string", "search_authority", defaultConfig.applicationId + '.debug.CalendarRecentSuggestionsProvider'
}
}
buildFeatures {
viewBinding true
}
/*
* To sign release build, create file gradle.properties in ~/.gradle/ with this content:
*
* signingStoreLocation=/home/key.store
* signingStorePassword=xxx
* signingKeyAlias=alias
* signingKeyPassword=xxx
*/
if (project.hasProperty('signingStoreLocation') &&
project.hasProperty('signingStorePassword') &&
project.hasProperty('signingKeyAlias') &&
project.hasProperty('signingKeyPassword')) {
println "Found sign properties in gradle.properties! Signing build…"
signingConfigs {
release {
storeFile file(signingStoreLocation)
storePassword signingStorePassword
keyAlias signingKeyAlias
keyPassword signingKeyPassword
}
}
buildTypes.release.signingConfig = signingConfigs.release
} else {
buildTypes.release.signingConfig = null
}
lint {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
// External
implementation project(':external:calendar')
implementation project(':external:colorpicker')
implementation project(':external:timezonepicker')
implementation project(':external:chips')
// Core
implementation 'androidx.core:core-ktx:1.8.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.material:material:1.5.0'
// Coroutines
def coroutines_version = "1.6.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -20,3 +20,4 @@ include ':external:calendar'
include ':external:colorpicker'
include ':external:timezonepicker'
include ':external:chips'
include ':app'