Skip to content

Commit

Permalink
Update dependencies, publish aar and fix testUI
Browse files Browse the repository at this point in the history
  • Loading branch information
desweemerl authored and Ludovic Desweemer committed Mar 6, 2024
1 parent b43e114 commit d435fda
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 52 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: "11"
java-version: "17"
distribution: "temurin"

- name: Change wrapper permissions
Expand All @@ -28,3 +28,9 @@ jobs:
with:
name: Reports
path: lib/build/reports

- name: Archive the package
uses: actions/upload-artifact@v2
with:
name: Package
path: lib/build/outputs/aar
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath 'com.android.tools.build:gradle:8.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22"
}
}

plugins {
id "java-library"
id "com.android.library" version '7.3.0' apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.library" version '8.2.1' apply false
id "org.jetbrains.kotlin.android" version "1.9.22" apply false
id "maven-publish"
}
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sat Mar 02 16:11:54 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
52 changes: 41 additions & 11 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
plugins {
id "com.android.library"
id "org.jetbrains.kotlin.android"
id ("org.jetbrains.kotlinx.kover") version "0.6.1"
id "maven-publish"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
}

android {
namespace "com.desweemerl.compose.form"
compileSdk 33

compileSdk 34

defaultConfig {
minSdk 21
targetSdk 32
minSdk 26
targetSdk 34
versionCode 1
versionName "0.1"
project.archivesBaseName = "form-compose"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -21,37 +26,62 @@ android {
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
composeOptions {
kotlinCompilerExtensionVersion "1.3.1"
}

kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
compose true
}

composeOptions {
kotlinCompilerExtensionVersion "1.5.9"
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

dependencies {
// Companion libs for Kotlin
def coroutines_version = "1.6.2"
def coroutines_version = '1.8.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"

// Serialization
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'

// Jetpack compose / Material3
implementation platform("androidx.compose:compose-bom:2022.12.00")
implementation platform("androidx.compose:compose-bom:2024.02.01")
implementation libs.compose.tooling.preview
debugImplementation libs.compose.tooling
implementation libs.bundles.material3

// Testing
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
}

afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
// You can then customize attributes of the publication as shown below.
groupId = "com.desweemerl"
artifactId = "form-compose"
version = "0.1"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.desweemerl.compose.form.ui
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
Expand All @@ -27,7 +26,6 @@ enum class FormTextFieldStyle {
}


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FormTextField(
state: FormFieldState<String>,
Expand Down
17 changes: 9 additions & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@ pluginManagement {
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}

versionCatalogs {
libs {
// Material3 bundle
version("material3", "1.0.1")
version("material3", "1.2.0")
library("material3-core", "androidx.compose.material3", "material3").versionRef("material3")
library("material3-wsc", "androidx.compose.material3", "material3-window-size-class").versionRef("material3")
bundle("material3", ["material3-core", "material3-wsc"])

// Jetpack Compose tooling
version("compose", "1.3.2")
version("compose", "1.6.2")
library("compose-tooling", "androidx.compose.ui", "ui-tooling").versionRef("compose")
library("compose-tooling-preview", "androidx.compose.ui", "ui-tooling-preview").versionRef("compose")
library("compose-test-junit", "androidx.compose.ui", "ui-test-junit4").versionRef("compose")
library("compose-test-manifest", "androidx.compose.ui", "ui-test-manifest").versionRef("compose")
}
}
}

rootProject.name = "formcompose"
include "lib"
include "testUI"
rootProject.name = "FormCompose"
include ":lib"
include ":testUI"
40 changes: 21 additions & 19 deletions testUI/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id "com.android.application"
id "org.jetbrains.kotlin.android"
}

android {
namespace 'com.desweemerl.compose.form.testui'
compileSdk 33
namespace "com.desweemerl.compose.form.testui"

compileSdk 34

defaultConfig {
minSdk 21
targetSdk 32
minSdk 26
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
composeOptions {
kotlinCompilerExtensionVersion "1.3.1"
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = "1.8"
}

buildFeatures {
compose true
}

composeOptions {
kotlinCompilerExtensionVersion "1.5.9"
}
}

dependencies {
// Android activity
def activity_version = "1.6.1"
def activity_version = "1.8.2"
implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.activity:activity-compose:$activity_version"

// Jetpack Compose / Material3 / FormCompose
implementation project(":lib")
implementation platform("androidx.compose:compose-bom:2022.12.00")
implementation platform("androidx.compose:compose-bom:2024.02.01")
implementation libs.bundles.material3
androidTestImplementation libs.compose.test.junit
debugImplementation libs.compose.test.manifest

// ViewModel lifecycle
def lifecycle_version = "2.5.1"
def lifecycle_version = "2.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"

testImplementation "org.jetbrains.kotlin:kotlin-test"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.desweemerl.compose.form.testui

import androidx.compose.ui.test.*
import androidx.compose.ui.test.assertTextContains
import androidx.compose.ui.test.junit4.createComposeRule
import com.desweemerl.compose.form.textControl
import com.desweemerl.compose.form.ui.FormTextField
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextClearance
import androidx.compose.ui.test.performTextInput
import com.desweemerl.compose.form.controls.textControl
import com.desweemerl.compose.form.ui.asTextField
import org.junit.Rule
import org.junit.Test

Expand All @@ -16,7 +20,7 @@ class FormTextFieldTest {
fun valueTest() {
val control = textControl("hello")
composeTestRule.setContent {
FormTextField(control = control, testTag = "field1")
control.asTextField(testTag = "field1")
}
val node = composeTestRule.onNodeWithTag("field1")
node.assertTextContains("hello")
Expand Down

0 comments on commit d435fda

Please # to comment.