Skip to content

Commit

Permalink
Merge pull request #266 from vivid-money/publish-elmslie-3.0
Browse files Browse the repository at this point in the history
Elmslie 3.0
  • Loading branch information
rcmkt authored Jun 20, 2024
2 parents 59432b2 + d68a845 commit 0e1aa01
Show file tree
Hide file tree
Showing 246 changed files with 3,092 additions and 5,619 deletions.
2 changes: 1 addition & 1 deletion .github/sh/validate_version_format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
VERSION=$1
EXPECTED='^([0-9]+){1,3}\.([0-9]+){1,9}\.([0-9]+){1,9}$'
EXPECTED='^([0-9]+){1,3}\.([0-9]+){1,9}\.([0-9]+){1,9}(-(alpha|beta|rc)[0-9]{2})?$'
if [[ ! $VERSION =~ $EXPECTED ]]; then
echo "::error ::Invalid version format: $VERSION"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run unit tests
run: ./gradlew test

Expand All @@ -22,6 +31,9 @@ jobs:
- name: Run android lint
run: ./gradlew lint

- name : Run api compatibility check
run: ./gradlew apiCheck

- name: Build project
run: ./gradlew assemble

63 changes: 0 additions & 63 deletions .github/workflows/release-plugin.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
with:
ref: ${{ env.GITHUB_REF }}

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Ensure main branch
run: ./.github/sh/validate_publishing_branch.sh

Expand All @@ -42,6 +48,12 @@ jobs:
with:
ref: ${{ env.GITHUB_REF }}

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Update library version
run: ./.github/sh/update_release_version.sh "libraryVersion" "$NEW_VERSION"

Expand All @@ -60,9 +72,16 @@ jobs:
failOnError: true
configuration: .github/changelogconfig/configuration.json

- name: Get current git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse HEAD)
echo "::set-output name=commit_sha::$calculatedSha"
- name: Create github release
uses: ncipollo/release-action@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ env.NEW_VERSION }}"
commit: "${{ steps.vars.outputs.commit_sha }}"
body: ${{ steps.github_release.outputs.changelog }}
25 changes: 0 additions & 25 deletions .github/workflows/update_dependencies.yml

This file was deleted.

37 changes: 11 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
![Elmslie](https://user-images.githubusercontent.com/16104123/104534649-b5defa80-5625-11eb-98b6-d761623f8964.jpeg)
[![](https://jitpack.io/v/diklimchuk/test.svg)](https://jitpack.io/#diklimchuk/test)

[![Jitpack badge](https://jitpack.io/v/vivid-money/elmslie.svg)](https://jitpack.io/#vivid-money/elmslie)
[![Code quality badge](https://github.com/vivid-money/elmslie/actions/workflows/codequality.yml/badge.svg?branch=main&event=push)](https://github.com/vivid-money/elmslie/actions/workflows/codequality.yml)
[![Maven Central Version](https://img.shields.io/maven-central/v/money.vivid.elmslie/elmslie-core)](https://central.sonatype.com/artifact/money.vivid.elmslie/elmslie-core)
[![License badge](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Elmslie is a minimalistic reactive implementation of TEA/ELM written in kotlin with java support.
Named after [George Grant Elmslie](https://en.wikipedia.org/wiki/George_Grant_Elmslie), a Scottish-born architect.

## Why?
- **Scalable and Reusable**: Built-in support for nesting components
- **Reactive**: Written with pure Kotlin, but has compatibility mode with RxJava2, RxJava3 and Coroutines
- **Multiplatform**: Written with pure Kotlin and Coroutines, supports KMP (Android, iOS, JS)
- **Single immutable state**: Simplify state management
- **UDF**: Say no to spaghetti code with Unidirectional Data Flow

Expand All @@ -25,44 +24,30 @@ This is a visual representation of the architecture:
For more info head to the [wiki](https://github.com/vivid-money/elmslie/wiki)

## Samples
Samples are available [here](https://github.com/vivid-money/elmslie/tree/main/elmslie-samples)
- Basic loader for android: [link](https://github.com/vivid-money/elmslie/tree/main/elmslie-samples/android-loader)
- Pure kotlin calculator: [link](https://github.com/vivid-money/elmslie/tree/main/elmslie-samples/kotlin-calculator)
- Pure java notes: [link](https://github.com/vivid-money/elmslie/tree/main/elmslie-samples/java-notes)
- Paging with compose: [link](https://github.com/vivid-money/elmslie/tree/main/elmslie-samples/compose-paging)

## Code generation plugin for Android Studio
Plugin is available at the [Jetbrains plugin repository](https://plugins.jetbrains.com/plugin/17176-elmslie-generator/versions/stable/125661)
More info in the [wiki article](https://github.com/vivid-money/elmslie/wiki)
Samples are available [here](https://github.com/vivid-money/elmslie/tree/publish-elmslie-3.0/samples)
- Basic loader for android: [link](https://github.com/vivid-money/elmslie/tree/publish-elmslie-3.0/samples/coroutines-loader)
- Pure kotlin calculator: [link](https://github.com/vivid-money/elmslie/tree/publish-elmslie-3.0/samples/kotlin-calculator)

## Download
Library is distributed through JitPack

#### Add repository in the root build.gradle
```
```kotlin
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
repositories {
mavenCentral()
}
}
```

#### Add required modules:
- Core - for pure kotlin ELM implementation

`implementation 'com.github.vivid-money.elmslie:elmslie-core:{latest-version}'`
`implementation 'money.vivid.elmslie:elmslie-core:{latest-version}'`

- Android - for android apps only, simplifies lifecycle handling

`implementation 'com.github.vivid-money.elmslie:elmslie-android:{latest-version}'`

- RxJava 2 - compatibility module (more info in the wiki [article](https://github.com/vivid-money/elmslie/wiki/RxJava-2-vs-3))

`implementation 'com.github.vivid-money.elmslie:elmslie-rxjava-2:{latest-version}'`

- Jetpack Compose - for android apps only, simplifies using jetpack compose (not required)

`implementation 'com.github.vivid-money.elmslie:elmslie-compose:{latest-version}'`
`implementation 'money.vivid.elmslie:elmslie-android:{latest-version}'`


## Related articles
Expand Down
13 changes: 13 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@file:Suppress("UnstableApiUsage")

plugins {
`kotlin-dsl`
}

dependencies {
implementation(libs.android.gradlePlugin)
implementation(libs.detekt.gradlePlugin)
implementation(libs.dokka.gradlePlugin)
implementation(libs.kotlin.gradlePlugin)
implementation(libs.mavenPublishPlugin)
}
20 changes: 20 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@file:Suppress("UnstableApiUsage")

pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
versionCatalogs.create("libs").from(files("../gradle/libs.versions.toml"))
}

rootProject.name = "build-logic"
3 changes: 3 additions & 0 deletions build-logic/src/main/kotlin/JvmTarget.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import org.gradle.api.JavaVersion

val JvmTarget = JavaVersion.VERSION_11
12 changes: 12 additions & 0 deletions build-logic/src/main/kotlin/PublishingExtension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
abstract class PublishingExtension {

internal lateinit var pom: Pom

fun pom(
block: Pom.() -> Unit,
) {
pom = Pom().apply(block)
}

data class Pom(var name: String = "", var description: String = "")
}
36 changes: 36 additions & 0 deletions build-logic/src/main/kotlin/elmslie.android-lib.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@file:Suppress("UnstableApiUsage")

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.dokka")
id("elmslie.base-lib")
id("elmslie.detekt")
id("elmslie.tests-convention")
}

android {
compileSdk = 33
buildToolsVersion = "31.0.0"

defaultConfig { minSdk = 21 }

lint {
checkReleaseBuilds = false
checkDependencies = true

ignoreTestSources = true
abortOnError = true
warningsAsErrors = true

htmlReport = true
xmlReport = false
}

compileOptions {
targetCompatibility = JvmTarget
sourceCompatibility = JvmTarget
}
}

val catalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
8 changes: 8 additions & 0 deletions build-logic/src/main/kotlin/elmslie.base-lib.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

tasks.withType<JavaCompile> {
targetCompatibility = JvmTarget.toString()
sourceCompatibility = JvmTarget.toString()
}

tasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = JvmTarget.toString() }
18 changes: 18 additions & 0 deletions build-logic/src/main/kotlin/elmslie.detekt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@file:Suppress("UnstableApiUsage")

import io.gitlab.arturbosch.detekt.Detekt

plugins { id("io.gitlab.arturbosch.detekt") }

detekt {
parallel = true
config.setFrom("$rootDir/detekt/detekt.yml")
}

tasks.withType<Detekt> {
reports {
html.required.set(true)
xml.required.set(false)
txt.required.set(false)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
kotlin("multiplatform")
id("elmslie.detekt")
}

kotlin {
applyDefaultHierarchyTemplate {
common {
group("commonWeb") {
withJs()
withWasm()
}
}
}

jvm {
compilations.all {
compilerOptions.configure {
jvmTarget.set(JvmTarget.JVM_11)
}
}
}

iosArm64()
iosSimulatorArm64()
iosX64()

js(IR) {
browser()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}
}
Loading

0 comments on commit 0e1aa01

Please sign in to comment.