Skip to content

Commit

Permalink
Merge branch '3.5.0' into maintenance/androidContext
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani authored Sep 7, 2023
2 parents 06a77e4 + 217e2cb commit 3aa0f8b
Show file tree
Hide file tree
Showing 310 changed files with 5,720 additions and 2,093 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.

**Koin project used and used version (please complete the following information):**
[e.g]: `koin-core version 0.9.2`
**Koin module and version:**
[e.g]: `koin-core:3.4.3`

**Additional moduleDefinition**
Add any other moduleDefinition about the problem here.
**Snippet or Sample project to help reproduce**
Add a snippet or even a small sample project to hel reproduce your case.
13 changes: 4 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: cd android && ./test.sh

build-compose:
runs-on: ubuntu-latest
runs-on: macos-latest
timeout-minutes: 30

steps:
Expand Down Expand Up @@ -110,14 +110,9 @@ jobs:
with:
distribution: 'zulu'
java-version: 11

- name: Cache build tooling
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.konan
key: ${{ runner.os }}-v1-${{ hashFiles('*.gradle.kts') }}

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

- name: Run Core
run: cd core && ../gradlew macosX64Test --no-daemon --stacktrace
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "CodeQL"

on:
push:
branches: [ 'main','3.5.0' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'main','3.5.0' ]
schedule:
- cron: '52 13 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

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

- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Build and install all
# working-directory: core
run: ./install_all.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
3 changes: 3 additions & 0 deletions .github/workflows/release-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
distribution: 'zulu'
java-version: 11

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

- name: Install Core
run: cd core && ./install.sh

Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release-bom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release Android

on:
push:
tags:
- 'bom*'

env:
IS_RELEASE: true
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

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

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

- name: Install Bom
run: cd bom && ./install.sh

- name: Release Bom
run: cd bom && ./release.sh


3 changes: 3 additions & 0 deletions .github/workflows/release-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
distribution: 'zulu'
java-version: 11

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

- name: Install Core
run: cd core && ./install.sh

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
distribution: 'zulu'
java-version: 11

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

- name: Install Core
run: cd core && ./install.sh

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-ktor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
distribution: 'zulu'
java-version: 11

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

- name: Install Core
run: cd core && ./install.sh

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
distribution: 'zulu'
java-version: 11

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

- name: Install Core
run: cd core && ./install.sh

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: Install Android
run: cd android && ./install.sh

- name: Install BOM
run: cd bom && ./install.sh

- name: Test Examples
run: cd examples && ./test.sh

Expand Down
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Badges: `[UPDATED]`, `[FIXED]`, `[NEW]`, `[DEPRECATED]`, `[REMOVED]`, `[BREAKIN

--

## 3.4.1
## 3.4.1 - 2023-05-31

## [android-3.4.1](https://github.com/InsertKoinIO/koin/milestone/50?closed=1) - 2023-05-31
## [android-3.4.1](https://github.com/InsertKoinIO/koin/milestone/50?closed=1)
* `[FIXED]` - Fix broken API `workerOf` and `worker` - #1582 #1554
* `[UPDATED]` - Remove borken imports in sample - PR #1577 - Thanks to @pedrofsn
* `[FIXED]` - Fix java static overload - #1579
Expand All @@ -57,20 +57,20 @@ Badges: `[UPDATED]`, `[FIXED]`, `[NEW]`, `[DEPRECATED]`, `[REMOVED]`, `[BREAKIN
* `[UPDATED]` - lib update `androidx.work:work-runtime-ktx:2.8.1`


## [core-coroutines-3.4.1](https://github.com/InsertKoinIO/koin/milestone/48?closed=1) - 2023-05-31
## [core-coroutines-3.4.1](https://github.com/InsertKoinIO/koin/milestone/48?closed=1)
* `[FIXED]` - Fix kotlin files duplication issues, when importing to an Android project
* `[UPDATED]` - coroutines update `1.7.1`


## [core-3.4.1](https://github.com/InsertKoinIO/koin/milestone/48?closed=1) - 2023-05-31
## [core-3.4.1](https://github.com/InsertKoinIO/koin/milestone/48?closed=1)
* `[UPDATED]` - PR for Documentation updates - #1558 #1587 #1591 #1575 #1555 #1553 #1528 #1520 #1514 #1524 - Thanks to @Pitel @GrzegorzBobryk @lammertw @zsmb13 @christxph @sezikim @enzosego @igorwojda @lalnuo @mecoFarid
* `[FIXED]` - Allow `getScopeId` & `getScopeName` to use reified type - Fix for #1536
* `[UPDATED]` - Better error message for `checkModules` - PR #1569 - Thanks @mreichelt
* `[UPDATED]` - Injected parameters are now consumed in order and Ctor DSL can now handle cascade parameetr injection - f92a4c43779280f7a6ca6ca04856468d1484da49 45c3b1229bd1c35d2b1af9e735db41a6b10f2403
* `[UPDATED]` - Kotlin `1.8.21`


## [compose-1.0.3](https://github.com/InsertKoinIO/koin/milestone/51?closed=1) - 2023-05-16
## [compose-1.0.3](https://github.com/InsertKoinIO/koin/milestone/51?closed=1)
* `[UPDATED]` - `koin-compose` 1.0.3
* `[UPDATED]` - `koin-androidx-compose` 3.4.5
* `[UPDATED]` - lib update `androidx.compose.runtime:runtime:1.4.3`
Expand Down
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ buildscript {
}
}

plugins {
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version "$validator_version"
}

wrapper {
distributionType = Wrapper.DistributionType.ALL
}
Expand Down
4 changes: 2 additions & 2 deletions android/gradle/versions.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ext {
// Koin Versions
koin_android_version = '3.4.3'
koin_android_version = '3.5.0'

// build Tools
android_min_version = 14
android_target_version = 33
android_target_version = 34
android_build_tools_version = '33.0.1'
android_gradle_version = '7.3.1'
}
48 changes: 48 additions & 0 deletions android/koin-android-compat/api/koin-android-compat.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
public final class org/koin/android/compat/BuildConfig {
public static final field BUILD_TYPE Ljava/lang/String;
public static final field DEBUG Z
public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String;
public fun <init> ()V
}

public final class org/koin/android/compat/GetViewModelCompatKt {
public static final fun resolveViewModelCompat (Ljava/lang/Class;Landroidx/lifecycle/ViewModelStore;Ljava/lang/String;Landroidx/lifecycle/viewmodel/CreationExtras;Lorg/koin/core/qualifier/Qualifier;Lorg/koin/core/scope/Scope;Lkotlin/jvm/functions/Function0;)Landroidx/lifecycle/ViewModel;
public static synthetic fun resolveViewModelCompat$default (Ljava/lang/Class;Landroidx/lifecycle/ViewModelStore;Ljava/lang/String;Landroidx/lifecycle/viewmodel/CreationExtras;Lorg/koin/core/qualifier/Qualifier;Lorg/koin/core/scope/Scope;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/lifecycle/ViewModel;
}

public final class org/koin/android/compat/ScopeCompat {
public static final field INSTANCE Lorg/koin/android/compat/ScopeCompat;
public static final fun getViewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
public static final fun getViewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Landroidx/lifecycle/ViewModel;
public static final fun getViewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Landroidx/lifecycle/ViewModel;
public static synthetic fun getViewModel$default (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/lifecycle/ViewModel;
public static final fun viewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;)Lkotlin/Lazy;
public static final fun viewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Lkotlin/Lazy;
public static final fun viewModel (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Lkotlin/Lazy;
public static synthetic fun viewModel$default (Lorg/koin/core/scope/Scope;Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/Lazy;
}

public final class org/koin/android/compat/SharedViewModelCompat {
public static final field INSTANCE Lorg/koin/android/compat/SharedViewModelCompat;
public static final fun getSharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
public static final fun getSharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Landroidx/lifecycle/ViewModel;
public static final fun getSharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Landroidx/lifecycle/ViewModel;
public static synthetic fun getSharedViewModel$default (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/lifecycle/ViewModel;
public static final fun sharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;)Lkotlin/Lazy;
public static final fun sharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Lkotlin/Lazy;
public static final fun sharedViewModel (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Lkotlin/Lazy;
public static synthetic fun sharedViewModel$default (Landroidx/fragment/app/Fragment;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/Lazy;
}

public final class org/koin/android/compat/ViewModelCompat {
public static final field INSTANCE Lorg/koin/android/compat/ViewModelCompat;
public static final fun getViewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;)Landroidx/lifecycle/ViewModel;
public static final fun getViewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Landroidx/lifecycle/ViewModel;
public static final fun getViewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Landroidx/lifecycle/ViewModel;
public static synthetic fun getViewModel$default (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/lifecycle/ViewModel;
public static final fun viewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;)Lkotlin/Lazy;
public static final fun viewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;)Lkotlin/Lazy;
public static final fun viewModel (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;)Lkotlin/Lazy;
public static synthetic fun viewModel$default (Landroidx/lifecycle/ViewModelStoreOwner;Ljava/lang/Class;Lorg/koin/core/qualifier/Qualifier;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/Lazy;
}

8 changes: 6 additions & 2 deletions android/koin-android-compat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ ext {
}

android {
compileSdkVersion android_target_version
compileSdk android_target_version
buildToolsVersion android_build_tools_version

defaultConfig {
minSdkVersion android_min_version
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildFeatures {
buildConfig false
}
}

dependencies {
// Koin
api project(":koin-android")
}

apply from: '../../gradle/publish-to-central.gradle'
apply from: '../../gradle/publish-to-central.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.koin.android.compat

import androidx.activity.ComponentActivity
import androidx.annotation.MainThread
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
Expand Down Expand Up @@ -48,10 +49,11 @@ object ViewModelCompat {
owner: ViewModelStoreOwner,
clazz: Class<T>,
qualifier: Qualifier? = null,
extrasProducer: (() -> CreationExtras)? = null,
parameters: ParametersDefinition? = null
): Lazy<T> {
return lazy(LazyThreadSafetyMode.NONE) {
getViewModel(owner, clazz, qualifier, parameters)
getViewModel(owner, clazz, qualifier, extrasProducer, parameters)
}
}

Expand All @@ -72,13 +74,17 @@ object ViewModelCompat {
owner: ViewModelStoreOwner,
clazz: Class<T>,
qualifier: Qualifier? = null,
extrasProducer: (() -> CreationExtras)? = null,
parameters: ParametersDefinition? = null
): T = resolveViewModelCompat(
clazz,
owner.viewModelStore,
extras = CreationExtras.Empty,
extras = extrasProducer?.invoke() ?: getDefaultViewModelCreationExtras(owner),
qualifier = qualifier,
parameters = parameters,
scope = GlobalContext.get().scopeRegistry.rootScope
)

private fun getDefaultViewModelCreationExtras(owner: ViewModelStoreOwner): CreationExtras =
if (owner is ComponentActivity) owner.defaultViewModelCreationExtras else CreationExtras.Empty
}
Loading

0 comments on commit 3aa0f8b

Please sign in to comment.