Skip to content

Commit

Permalink
Merge pull request #2 from ZuperInc/refactoring/upstream_fetch
Browse files Browse the repository at this point in the history
Upstream fetched and resolved merge conflicts
  • Loading branch information
ranjith-zuper authored Feb 28, 2023
2 parents 7853f03 + 8f343a2 commit ccf719d
Show file tree
Hide file tree
Showing 48 changed files with 987 additions and 318 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,73 @@ jobs:

- name: Stop Gradle
run: ./gradlew --stop
ui-tests:
name: FTL UI Tests
needs: [unit-tests, detekt]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: cache-gradle-

- name: Setup Java 15
uses: actions/setup-java@v1
with:
java-version: '15'

- name: Build app and test APKs
run: ./gradlew :sample:assembleDebug && ./gradlew :sample:assembleDebugAndroidTest

- name: Login to Google Cloud
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCLOUD_AUTH_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0

- name: Use gcloud CLI
run: gcloud info

- name: Set current project
run: gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID }}

- name: Run Instrumentation Tests in Firebase Test Lab
run: gcloud firebase test android run --type instrumentation --app sample/build/outputs/apk/debug/sample-debug.apk --test sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk --device model=Pixel2,version=28,locale=en,orientation=portrait

- name: Stop Gradle
run: ./gradlew --stop
compatibility-check:
name: Compatibility Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: cache-gradle-

- name: Setup Java 15
uses: actions/setup-java@v1
with:
java-version: '15'

- name: Check API compatibility
run: ./gradlew apiCheck

- name: Stop Gradle
run: ./gradlew --stop
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: ./gradlew :library:publish --no-daemon --no-parallel --stacktrace
run: ./gradlew publish --no-daemon --no-parallel --stacktrace


- name: Stop Gradle
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SONATYPE_NEXUS_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SONATYPE_NEXUS_SIGNING_KEY_PASSWORD }}
run: ./gradlew :library:publish --no-daemon --no-parallel --stacktrace
run: ./gradlew publish --no-daemon --no-parallel --stacktrace

- name: Publish release
env:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2022 Bogusz Pawłowski

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,15 @@ Selection modes are represented by `SelectionMode` enum, with following values:
- `Single` - only single day is selectable - selection will contain one or zero days selected.
- `Multiple` - a list of dates can be selected.
- `Period` - selectable period - implemented by `start` and `end` dates. - selection will contain all dates between start and the end date.
This implementation of SelectionState also allows for handling side-effects and vetoing the state change via `confirmSelectionChange` callback.

## KotlinX DateTime
As the core of the library is built on `java.time` library, on Android it requires to use [core libary desugaring](https://developer.android.com/studio/write/java8-support) to be able to access it's API.
As a result it's features may be unavailable to some project built around different date-time libraries (e.g. kotlinx-datetime). Although the project wont be migrating from `java.time`, as it's the best suited for it, there is a separate `kotlinx-datetime` artifact for those who need to use the library from a codebase based on it. It doesn't consist of a separate version of `ComposeCalendar` features, but offers a small bunch of utilities, that will enable you to create your own wrapper, as briefly presented in `KotlinDateTimeSample`. If the provided functionality, doesn't match your use-case, please submit an issue.

## License

Copyright 2021 Bogusz Pawłowski
Copyright 2022 Bogusz Pawłowski

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file modified blob/screenshot_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allprojects {

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + listOf(
"-progressive",
"-Xopt-in=kotlin.RequiresOptIn",
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ gradlePlugin {
}

dependencies {
implementation("com.android.tools.build:gradle:7.1.2")
implementation(kotlin("gradle-plugin", "1.5.31"))
implementation("com.android.tools.build:gradle:7.2.1")
implementation(kotlin("gradle-plugin", "1.7.20"))
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/CommonAndroidPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CommonAndroidPlugin : Plugin<Project> {
buildFeatures.compose = true

composeOptions {
kotlinCompilerExtensionVersion = Compose.Version
kotlinCompilerExtensionVersion = Compose.CompilerVersion
}

// target.dependencies.add("coreLibraryDesugaring", Kotlin.DesugarJdkLibs)
Expand Down
34 changes: 17 additions & 17 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
@file:Suppress("ObjectPropertyNaming", "ClassNaming", "UnderscoresInNumericLiterals")
object AndroidSdk {
const val Min = 21
const val Compile = 31
const val Compile = 32
const val Target = Compile
}

object Kotlin {
const val Version = "1.5.31"
const val Version = "1.7.20"
const val CompatibilityPluginVersion = "0.11.0"

const val GradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$Version"
const val DokkaGradlePlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0"
const val DokkaGradlePlugin = "org.jetbrains.dokka:dokka-gradle-plugin:$Version"

const val StdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$Version"
const val Reflect = "org.jetbrains.kotlin:kotlin-reflect:$Version"
const val SafeArgsPlugin = "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.0"

const val AndroidPluginId = "android"
const val KaptPluginId = "kapt"
const val SafeArgsPluginId = "androidx.navigation.safeargs.kotlin"
const val JvmPluginId = "jvm"

const val CompatibilityPlugin = "org.jetbrains.kotlinx.binary-compatibility-validator"
const val CompatibilityPluginId = "binary-compatibility-validator"

const val DesugarJdkLibs = "com.android.tools:desugar_jdk_libs:1.1.5"
const val StdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$Version"
const val Reflect = "org.jetbrains.kotlin:kotlin-reflect:$Version"
const val DateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0"
}

object Android {
const val GradlePlugin = "com.android.tools.build:gradle:7.1.2"
const val GradlePlugin = "com.android.tools.build:gradle:7.2.1"

const val ApplicationPluginId = "com.android.application"
const val LibraryPluginId = "com.android.library"
Expand Down Expand Up @@ -63,26 +68,20 @@ object Shipkit {
}
}

object Coroutines {
const val Version = "1.4.3"

const val Core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$Version"
}

object AndroidX {
const val Version = "1.0.0"
const val LifecycleVersion = "2.2.0"

const val AppCompat = "androidx.appcompat:appcompat:1.4.1"
const val ComposeActivity = "androidx.activity:activity-compose:1.4.0"
const val ComposeActivity = "androidx.activity:activity-compose:1.5.1"
}

object Material {
const val Core = "com.google.android.material:material:1.5.0"
}

object DetektLib {
const val Version = "1.19.0"
const val Version = "1.21.0"

const val PluginId = "io.gitlab.arturbosch.detekt"
const val Plugin = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$Version"
Expand All @@ -97,11 +96,12 @@ object Timber {
}

object Compose {
const val Version = "1.0.4"
const val AccompanistVersion = "0.23.1"
const val Version = "1.2.1"
const val CompilerVersion = "1.3.2"
const val AccompanistVersion = "0.25.1"

const val Runtime = "androidx.compose.runtime:runtime:$Version"
const val Compiler = "androidx.compose.compiler:compiler:$Version"
const val Compiler = "androidx.compose.compiler:compiler:$CompilerVersion"
const val Foundation = "androidx.compose.foundation:foundation:$Version"
const val FoundationLayout = "androidx.compose.foundation:foundation-layout:$Version"
const val Material = "androidx.compose.material:material:$Version"
Expand Down
4 changes: 2 additions & 2 deletions detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ naming:
privatePropertyPattern: '^[A-Z][a-z]+(?:[A-Z][a-z]+)*$'
PackageNaming:
active: true
packagePattern: '^[a-z]+(\.[a-z][a-z]*)*$'
packagePattern: '^[a-z]+(\.[a-z][a-zA-Z]*)*$'
TopLevelPropertyNaming:
active: false
constantPattern: '^[a-z]+(?:[A-Z][a-z]+)*$'
Expand Down Expand Up @@ -244,7 +244,7 @@ style:
active: true
RedundantVisibilityModifierRule:
active: true
excludes: ['**/library/**']
excludes: ['**/library/**', '**/kotlinx-datetime/**']
SafeCast:
active: true
SerialVersionUIDInSerializableClass:
Expand Down
12 changes: 12 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official

POM_NAME=Compose Calendar
GROUP=io.github.boguszpawlowski.composecalendar
POM_URL=https://github.com/boguszpawlowski/ComposeCalendar
POM_SCM_URL=https://github.com/boguszpawlowski/ComposeCalendar
POM_SCM_CONNECTION=[email protected]:boguszpawlowski/ComposeCalendar.git
POM_SCM_DEV_CONNECTION=[email protected]:boguszpawlowski/ComposeCalendar.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=boguszp
POM_DEVELOPER_NAME=Bogusz Pawlowski
File renamed without changes.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
1 change: 1 addition & 0 deletions kotlinx-datetime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
37 changes: 37 additions & 0 deletions kotlinx-datetime/api/kotlinx-datetime.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
public final class io/github/boguszpawlowski/composecalendar/kotlinxDateTime/ConvertersKt {
public static final fun toJavaYearMonth (Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;)Ljava/time/YearMonth;
public static final fun toKotlinYearMonth (Ljava/time/YearMonth;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
}

public final class io/github/boguszpawlowski/composecalendar/kotlinxDateTime/DateTimeExtensionsKt {
public static final fun getFirstDayOfWeek (Ljava/util/Locale;)Ljava/time/DayOfWeek;
public static final fun now (Lkotlinx/datetime/LocalDate$Companion;)Lkotlinx/datetime/LocalDate;
}

public final class io/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth {
public static final field Companion Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth$Companion;
public synthetic fun <init> (ILjava/time/Month;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()I
public final fun component2 ()Ljava/time/Month;
public final fun copy (ILjava/time/Month;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public static synthetic fun copy$default (Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;ILjava/time/Month;ILjava/lang/Object;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun dec ()Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public fun equals (Ljava/lang/Object;)Z
public final fun getMonth ()Ljava/time/Month;
public final fun getYear ()I
public fun hashCode ()I
public final fun inc ()Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun minus (ILkotlinx/datetime/DateTimeUnit$MonthBased;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun minus (JLkotlinx/datetime/DateTimeUnit$MonthBased;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun plus (ILkotlinx/datetime/DateTimeUnit$MonthBased;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun plus (JLkotlinx/datetime/DateTimeUnit$MonthBased;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public fun toString ()Ljava/lang/String;
}

public final class io/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth$Companion {
public final fun now ()Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun of (II)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun of (ILjava/time/Month;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
public final fun parse (Ljava/lang/String;)Lio/github/boguszpawlowski/composecalendar/kotlinxDateTime/YearMonth;
}

26 changes: 26 additions & 0 deletions kotlinx-datetime/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
kotlin(Kotlin.JvmPluginId)
id(MavenPublish.PluginId)
}

kotlin {
explicitApi()
}

dependencies {
api(Kotlin.DateTime)
implementation(Kotlin.StdLib)

testImplementation(Kotest.Assertions)
testImplementation(Kotest.RunnerJunit5)
testImplementation(Kotlin.Reflect)
}

plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
sonatypeHost = SonatypeHost.S01
releaseSigningEnabled = true
}
}
Loading

0 comments on commit ccf719d

Please sign in to comment.