Skip to content

Commit

Permalink
Baseline prof + release signing config (owlmail#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin2dehury authored Mar 21, 2023
1 parent 401ce6e commit f181f24
Show file tree
Hide file tree
Showing 41 changed files with 15,438 additions and 102 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/GenerateApk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
DATA: ${{ secrets.GOOGLE_SERVICES }}
run: echo $DATA > $PWD/app/google-services.json

- name: Generate Debug Apk
run: ./gradlew assembleDebug --scan
- name: Generate Release Apk
run: ./gradlew assembleRelease --scan

- uses: actions/upload-artifact@v3
with:
name: Debug Apk
path: app/build/outputs/apk/debug/app-debug.apk
name: Release Apk
path: app/build/outputs/apk/release/app-release.apk
13 changes: 9 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ android {

buildTypes {
release {
minifyEnabled false
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
Expand All @@ -48,8 +50,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down Expand Up @@ -100,7 +102,7 @@ dependencies {
kapt Dependencies.DaggerHiltCompiler

//Lint
lintChecks project(':lint-rules')
lintChecks project(Modules.LintRules)

//navigation
implementation Dependencies.FragmentKtx
Expand Down Expand Up @@ -128,6 +130,9 @@ dependencies {
implementation Dependencies.RoomKtx
kapt Dependencies.RoomCompiler

implementation "androidx.metrics:metrics-performance:1.0.0-alpha03"
implementation("androidx.profileinstaller:profileinstaller:1.2.2")

implementation(project(Modules.Auth))
implementation(project(Modules.Mail))
implementation(project(Modules.Contacts))
Expand Down
7 changes: 3 additions & 4 deletions app/lint-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
<issues name="AGP (7.3.0)" by="lint 7.3.0" client="gradle" dependencies="true" format="6"
type="baseline" variant="all" version="7.3.0">

<issue errorLine1=" app:startDestination=&quot;@id/auth_nav_graph&quot;>" errorLine2=" ~~~~~~~~~~~~~~~~~~"
id="InvalidNavigation"
<issue errorLine1=" app:startDestination=&quot;@id/auth_nav_graph&quot;>"
errorLine2=" ~~~~~~~~~~~~~~~~~~" id="InvalidNavigation"
message="Invalid start destination @id/auth_nav_graph">
<location column="27" file="src/main/res/navigation/nav_graph.xml" line="5" />
</issue>

<issue errorLine1=" app:showAsAction=&quot;always&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~"
id="AlwaysShowAction"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~" id="AlwaysShowAction"
message="Prefer &quot;`ifRoom`&quot; instead of &quot;`always`&quot;">
<location column="9" file="src/main/res/menu/search_menu_bar.xml" line="10" />
</issue>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="github.owlmail.app.androidx-startup"
tools:node="remove"></provider>
tools:node="remove" />
</application>

</manifest>
15,298 changes: 15,298 additions & 0 deletions app/src/main/baseline-prof.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions auth-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions auth/src/main/kotlin/github/owlmail/auth/AuthViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import github.owlmail.auth.api.AuthUseCase
import github.owlmail.core.DataStoreManager
import javax.inject.Inject
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class AuthViewModel @Inject constructor(
private val authUseCase: AuthUseCase,
private val dataStoreManager: DataStoreManager,
private val dataStoreManager: DataStoreManager
) : ViewModel() {

val loginState = authUseCase.get()
Expand Down
4 changes: 2 additions & 2 deletions benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

android {
namespace 'github.owlmail.benchmark'
compileSdk 32
compileSdk 33

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -22,7 +22,7 @@ android {

defaultConfig {
minSdk 23
targetSdk 32
targetSdk 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package github.owlmail.benchmark

import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalBaselineProfilesApi::class)
class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()

@Test
fun appStartupAndUserJourneys() {
baselineProfileRule.collectBaselineProfile(packageName = "github.owlmail.app") {
// App startup journey
startActivityAndWait()
}
}
}
4 changes: 2 additions & 2 deletions contacts-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions contacts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ import github.owlmail.contacts.model.ContactResponse

class ContactAdapter :
PagingDataAdapter<ContactResponse.Body.SearchGalResponse.Cn, RecyclerView.ViewHolder>(
diffCallback = ContactListDiffer(),
diffCallback = ContactListDiffer()
) {
class ContactListDiffer :
DiffUtil.ItemCallback<ContactResponse.Body.SearchGalResponse.Cn>() {
override fun areItemsTheSame(
oldItem: ContactResponse.Body.SearchGalResponse.Cn,
newItem: ContactResponse.Body.SearchGalResponse.Cn,
newItem: ContactResponse.Body.SearchGalResponse.Cn
): Boolean {
return oldItem == newItem
}

override fun areContentsTheSame(
oldItem: ContactResponse.Body.SearchGalResponse.Cn,
newItem: ContactResponse.Body.SearchGalResponse.Cn,
newItem: ContactResponse.Body.SearchGalResponse.Cn
): Boolean {
return oldItem == newItem
}
}

override fun onBindViewHolder(
holder: RecyclerView.ViewHolder,
position: Int,
position: Int
) {
val binding = ContactDetailBinding.bind(holder.itemView)
val item = getItem(position)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import github.owlmail.contacts.model.ContactResponse
interface
ContactDAO {
@Query(
"select * from contact where fileAsStr like '%' || :query || '%' order by fileAsStr asc limit :limit offset :offset",
"select * from contact where fileAsStr like '%' || :query || '%' order by fileAsStr asc limit :limit offset :offset"
)
suspend fun getAllContacts(
limit: Int,
offset: Int,
query: String,
query: String
): List<ContactResponse.Body.SearchGalResponse.Cn>

@Insert(onConflict = OnConflictStrategy.REPLACE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import github.owlmail.contacts.databinding.ContactListBinding
import javax.inject.Inject
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import javax.inject.Inject

@AndroidEntryPoint
class ContactListFragment : Fragment(), MenuProvider {
Expand All @@ -25,7 +25,7 @@ class ContactListFragment : Fragment(), MenuProvider {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
savedInstanceState: Bundle?
): View? {
binding = ContactListBinding.inflate(inflater)
return binding?.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContactPagingSource(
private val repository: ContactRepository,
private val searchContact: String,
private val contactDAO: ContactDAO,
private val networkState: NetworkState,
private val networkState: NetworkState
) :
PagingSource<Int, ContactResponse.Body.SearchGalResponse.Cn>() {

Expand All @@ -39,7 +39,7 @@ class ContactPagingSource(
null
} else {
offset + 1
},
}
)
}
val contactRequest = ContactRequest(
Expand All @@ -48,9 +48,9 @@ class ContactPagingSource(
jsns = "urn:zimbraAccount",
limit = loadSize,
offset = offset,
name = "$searchContact",
),
),
name = "$searchContact"
)
)
)
when (val response = repository.getContactList(contactRequest).mapToResponseState()) {
is ResponseState.Success -> {
Expand All @@ -64,7 +64,7 @@ class ContactPagingSource(
offset + 1
} else {
null
},
}
)
}
else -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class ContactRequest(
@Json(name = "Body")
val body: Body? = null,
val body: Body? = null
) {
@JsonClass(generateAdapter = true)
data class Body(
@Json(name = "SearchGalRequest")
val searchGalRequest: SearchGalRequest? = null,
val searchGalRequest: SearchGalRequest? = null
) {
@JsonClass(generateAdapter = true)
data class SearchGalRequest(
Expand All @@ -22,7 +22,7 @@ data class ContactRequest(
@Json(name = "name")
val name: String? = null,
@Json(name = "offset")
val offset: Int? = null,
val offset: Int? = null
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ data class ContactResponse(
@Json(name = "Header")
val header: Header? = null,
@Json(name = "_jsns")
val jsns: String? = null,
val jsns: String? = null
) {
@JsonClass(generateAdapter = true)
data class Body(
@Json(name = "SearchGalResponse")
val searchGalResponse: SearchGalResponse? = null,
val searchGalResponse: SearchGalResponse? = null
) {
@JsonClass(generateAdapter = true)
data class SearchGalResponse(
Expand All @@ -32,7 +32,7 @@ data class ContactResponse(
@Json(name = "paginationSupported")
val paginationSupported: Boolean? = null,
@Json(name = "sortBy")
val sortBy: String? = null,
val sortBy: String? = null
) {
@JsonClass(generateAdapter = true)
@Entity(tableName = "contact")
Expand All @@ -53,7 +53,7 @@ data class ContactResponse(
@Json(name = "rev")
val rev: Int? = null,
@Json(name = "sf")
val sf: String? = null,
val sf: String? = null
) {
@JsonClass(generateAdapter = true)
data class Attrs(
Expand All @@ -80,7 +80,7 @@ data class ContactResponse(
@Json(name = "zimbraId")
val zimbraId: String? = null,
@Json(name = "zimbraNotes")
val zimbraNotes: String? = null,
val zimbraNotes: String? = null
)
}
}
Expand All @@ -89,19 +89,19 @@ data class ContactResponse(
@JsonClass(generateAdapter = true)
data class Header(
@Json(name = "context")
val context: Context? = null,
val context: Context? = null
) {
@JsonClass(generateAdapter = true)
data class Context(
@Json(name = "change")
val change: Change? = null,
@Json(name = "_jsns")
val jsns: String? = null,
val jsns: String? = null
) {
@JsonClass(generateAdapter = true)
data class Change(
@Json(name = "token")
val token: Int? = null,
val token: Int? = null
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
}
}
compileOptions {
sourceCompatibility AppConfig.INSTANCE.JDKVersion
targetCompatibility AppConfig.INSTANCE.JDKVersion
sourceCompatibility AppConfig.JDKVersion
targetCompatibility AppConfig.JDKVersion
kotlinOptions.languageVersion = AppConfig.KotlinLanguageVersion
}
kotlinOptions {
Expand Down
Loading

0 comments on commit f181f24

Please sign in to comment.