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

Task/66 67 configure debug release variants and setup publish plugin #68

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/flaker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
java-version: '11'

- name: Inject Secrets
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
.cxx
local.properties
secrets.properties
flakerKeyStore.jks
site
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.org.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.androidTest) apply false
alias(libs.plugins.gradle.mavenpublish) apply false
}

allprojects {
Expand Down
12 changes: 9 additions & 3 deletions flaker-android-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.gradle.mavenpublish)
}

version = "0.1.0"

android {
namespace = "io.rotlabs.flakerandroidktor"
compileSdk = 33
Expand All @@ -19,17 +22,20 @@ android {
}

buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "11"
}
buildFeatures {
compose = true
Expand Down
3 changes: 3 additions & 0 deletions flaker-android-ktor/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-android-ktor
VERSION_NAME=0.1.0
12 changes: 9 additions & 3 deletions flaker-android-monitor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import java.io.FileInputStream
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.gradle.mavenpublish)
}

val secretsPropertiesFile = rootProject.file("secrets.properties")
val secretProperties = Properties()
secretProperties.load(FileInputStream(secretsPropertiesFile))

version = "0.1.0"

android {
namespace = "io.rotlabs.flakerandroidmonitor"
compileSdk = 34
Expand All @@ -28,17 +31,20 @@ android {
}

buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "11"
}
}

Expand Down
3 changes: 3 additions & 0 deletions flaker-android-monitor/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-android-monitor
VERSION_NAME=0.1.0
12 changes: 7 additions & 5 deletions flaker-android-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.gradle.mavenpublish)
}

version = "0.1.0"

android {
namespace = "io.rotlabs.flakerandroidokhttp"
compileSdk = 33
version = "0.1.0"

defaultConfig {
minSdk = 24
Expand All @@ -24,16 +26,16 @@ android {
isMinifyEnabled = false
}
release {
isMinifyEnabled = true
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "11"
}
buildFeatures {
compose = true
Expand Down
3 changes: 3 additions & 0 deletions flaker-android-okhttp/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-android-okhttp
VERSION_NAME=0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ class FlakerViewModel(
}

fun toggleFlaker(value: Boolean) {
viewModelScope.launch {
val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable ->
flakerMonitor.captureException(
throwable,
mapOf(TAG to "Error while toggling flaker: ${throwable.message}")
)
}
viewModelScope.launch(coroutineExceptionHandler) {
prefDataStore.savePrefs(prefDataStore.getPrefs().first().copy(shouldIntercept = value))
}
}
Expand All @@ -110,7 +116,13 @@ class FlakerViewModel(
}

fun updatePrefs(flakerPrefsUiDto: FlakerPrefsUiDto) {
viewModelScope.launch {
val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable ->
flakerMonitor.captureException(
throwable,
mapOf(TAG to "Error while saving prefs: ${throwable.message}")
)
}
viewModelScope.launch(coroutineExceptionHandler) {
prefDataStore.savePrefs(
FlakerPrefs(
shouldIntercept = true,
Expand Down
13 changes: 9 additions & 4 deletions flaker-android-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.gradle.mavenpublish)
}

version = "0.1.0"

android {
namespace = "io.rotlabs.flakerandroidui"
compileSdk = 33
version = "0.1.0"

defaultConfig {
minSdk = 24
Expand All @@ -20,17 +22,20 @@ android {
}

buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "11"
}
buildFeatures {
compose = true
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions flaker-android-ui/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-android-ui
VERSION_NAME=0.1.0
12 changes: 9 additions & 3 deletions flaker-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.gradle.mavenpublish)
}

version = "0.1.0"

android {
namespace = "io.rotlabs.flakerandroid"
compileSdk = 33
Expand All @@ -19,17 +22,20 @@ android {
}

buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "11"
}
buildFeatures {
compose = true
Expand Down
3 changes: 3 additions & 0 deletions flaker-android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-android
VERSION_NAME=0.1.0
22 changes: 20 additions & 2 deletions flaker-data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ plugins {
kotlin("native.cocoapods")
alias(libs.plugins.androidLibrary)
alias(libs.plugins.sqlDelight)
alias(libs.plugins.gradle.mavenpublish)
}

version = "0.1.0"

kotlin {

jvmToolchain(17)
android()
jvmToolchain(11)
android {
publishAllLibraryVariants()
}
val frameworkName = "FlakerDataModule"
val xcFramework = XCFramework(frameworkName)

Expand Down Expand Up @@ -110,8 +113,23 @@ android {
defaultConfig {
minSdk = 24
targetSdk = 33
consumerProguardFiles("consumer-rules.pro")
}
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

sqldelight {
Expand Down
1 change: 1 addition & 0 deletions flaker-data/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class androidx.datastore.*.** {*;}
3 changes: 3 additions & 0 deletions flaker-data/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GROUP=io.rotlabs
POM_ARTIFACT_ID=flaker-data
VERSION_NAME=0.1.0
21 changes: 21 additions & 0 deletions flaker-data/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.rotlabs.flakerprefs

import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences

internal actual fun testDataStore() : DataStore<Preferences> {
return createDataStore { DATASTORE_FILE_NAME }
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ class NetworkRequestRepoTest {
host = "https://jsonplaceholder.typicode.com",
path = "/todos/1",
method = "GET",
requestTime = now - (millisInOneDay * 7),
requestTime = now - (millisInOneDay * 8),
responseCode = 200,
responseTimeTaken = 100,
isFailedByFlaker = false,
createdAt = now - (millisInOneDay * 7)
createdAt = now - (millisInOneDay * 8)
)
networkRequestRepo.insert(networkRequest1)
assertEquals(2, networkRequestRepo.selectAll().size)
Expand All @@ -126,11 +126,11 @@ class NetworkRequestRepoTest {
host = "https://jsonplaceholder.typicode.com",
path = "/todos/1",
method = "GET",
requestTime = now - (millisInOneDay * 15),
requestTime = now - (millisInOneDay * 16),
responseCode = 200,
responseTimeTaken = 100,
isFailedByFlaker = false,
createdAt = now - (millisInOneDay * 15)
createdAt = now - (millisInOneDay * 16)
)
networkRequestRepo.insert(networkRequest2)
assertEquals(2, networkRequestRepo.selectAll().size)
Expand All @@ -142,11 +142,11 @@ class NetworkRequestRepoTest {
host = "https://jsonplaceholder.typicode.com",
path = "/todos/1",
method = "GET",
requestTime = now - (millisInOneDay * 30),
requestTime = now - (millisInOneDay * 31),
responseCode = 200,
responseTimeTaken = 100,
isFailedByFlaker = false,
createdAt = now - (millisInOneDay * 30)
createdAt = now - (millisInOneDay * 31)
)
networkRequestRepo.insert(networkRequest3)
assertEquals(2, networkRequestRepo.selectAll().size)
Expand Down
Loading