A simple Kotlin multi-platform abstraction around the javax.inject annotations.

Overview

Inject

A simple Kotlin multi-platform abstraction around the javax.inject annotations. This allows using the annotations in Kotlin common code so that platform specific annotation processors can register them.
GitHub tag (latest by date)

For more information about the library, refer to the blog post here which was featured in Android Weekly issue #396. Badge

The blog post was also featured in Kotlin Weekly issue #182.

Using the library

Simply use the provided annotations just as you would use the javax.inject annotations.

For example, using the Inject annotation on a constructor in Kotlin Common code:

class MyUseCase @Inject constructor() { ... }

Available annotations and interfaces

  • @Inject
  • @Named("name")
  • @Qualifier
  • @Scope
  • @Singleton
  • Provider<T>

Building the library

The library is provided through repsy.io. Checkout the releases package to get the latest version.
GitHub tag (latest by date)

Repository

repositories {
    maven { url = "https://repo.repsy.io/mvn/chrynan/public" }
}

Dependencies

implementation("com.chrynan.inject:inject:VERSION")

Documentation

More detailed documentation is available in the docs folder. The entry point to the documentation can be found here.

License

Copyright 2021 chRyNaN

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The javax.inject library is also licensed under the Apache License 2.0.

You might also like...
A Lightweight PDF Viewer Android library which only occupies around 125kb while most of the Pdf viewer occupies up to 16MB space.
A Lightweight PDF Viewer Android library which only occupies around 125kb while most of the Pdf viewer occupies up to 16MB space.

Pdf Viewer For Android A Simple PDF Viewer library which only occupies around 125kb while most of the Pdf viewer occupies upto 16MB space. How to inte

Small Kafka Playground to play around with Test Containers, and KotlinX Coroutines bindings while reading Kafka Definite Guide V2

KafkaPlayground Small playground where I'm playing around with Kafka in Kotlin and the Kafka SDK whilst reading the Kafka book Definite Guide from Con

Develop an API that moves a rover around on a grid

Mars Rover Kata Develop an API that moves a rover around on a grid. Rules: You are given the initial starting 2D point (x,y) of a rover and the direct

DocuBox is a cloud based file storing app where you can securely store and access your documents from anywhere around the world
DocuBox is a cloud based file storing app where you can securely store and access your documents from anywhere around the world

DocuBox is an android app πŸ“±in which you can securely upload your files on the cloud– from family pictures and audio recordings to spreadsheets, presentations and other confidential documents.

An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.
An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.

Simple Currency Converter Simple Currency Converter Android App by Isaev Semyon An example of a test task for creating a simple currency converter app

Android Spinner Dialog Library supported on both Java and Kotlin, Use for single or multi selection of choice
Android Spinner Dialog Library supported on both Java and Kotlin, Use for single or multi selection of choice

SpinnerDialog Android Spinner Dialog Library, Use for single or multi selection of choice Android UI Download To include SpinnerDialog in your project

A set of highly-opinionated, batteries-included gradle plugins to get you started building delicious multi-module Kotlin projects

Sourdough Gradle What is Sourdough Gradle? Sourdough is a set of highly opinionated gradle plugins that aim to act as the starter for your Kotlin proj

Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.
Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.

MoneyHeist-Chars Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Room

Built with Jetpack compose, multi modules MVVM clean architecture, coroutines + flow, dependency injection, jetpack navigation and other jetpack components

RickAndMortyCompose - Work in progress A simple app using Jetpack compose, clean architecture, multi modules, coroutines + flows, dependency injection

Comments
  • Unable to pull this library into project - Unauthorized

    Unable to pull this library into project - Unauthorized

    Describe the bug When integrating with my project (and a clean standalone project) - I get this error

    Could not GET 'https://maven.pkg.github.com/chrynan/inject/com/chrynan/inject/inject-jvm/0.7.0/inject-jvm-0.7.0.pom'. Received status code 401 from server: Unauthorized

    To Reproduce Steps to reproduce the behaviour:

    1. Add maven repo to top level build.gradle
    2. Add library dependency to app build.gradle
    3. Sync and rebuild
    4. See error: Could not GET 'https://maven.pkg.github.com/chrynan/inject/com/chrynan/inject/inject-jvm/0.7.0/inject-jvm-0.7.0.pom'. Received status code 401 from server: Unauthorized

    Expected behaviour Dep should be available in project

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: Mac OSX
    opened by ruairimcguigan 3
  • Support for ios_simulator_arm64

    Support for ios_simulator_arm64

    Problem description I was trying to create a multiplatform project supporting android and ios platforms. I am using your latest version of the library - 1.0.0. And it works as expected for these targets:

    kotlin {
        android()
        iosX64()
        iosArm64()
    
       ..
    

    But for application to run on an M1 ios simulator I need to add iosSimulatorArm64() which is now not supported. This is the build error I am getting:

    Unable to build Kotlin project configuration
    
    org.gradle.internal.resolve.ArtifactNotFoundException: Could not find inject-1.0.0-samplessources.jar (com.chrynan.inject:inject:1.0.0).
    Searched in the following locations:
        https://repo.repsy.io/mvn/chrynan/public/com/chrynan/inject/inject/1.0.0/inject-1.0.0-samplessources.jar
    	at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:28)
    	at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveArtifact(ExternalResourceResolver.java:500)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$ResolveAndCacheRepositoryAccess.resolveArtifact(CachingModuleComponentRepository.java:469)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$resolveArtifact$15(ErrorHandlingModuleComponentRepository.java:181)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:237)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.performOperationWithRetries(ErrorHandlingModuleComponentRepository.java:203)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveArtifact(ErrorHandlingModuleComponentRepository.java:179)
    	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainArtifactResolver.resolveArtifact(RepositoryChainArtifactResolver.java:102)
    	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSupplier.calculateValue(DefaultArtifactSet.java:284)
    	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSupplier.calculateValue(DefaultArtifactSet.java:255)
    	at org.gradle.internal.model.CalculatedValueContainer$CalculationState.lambda$attachValue$0(CalculatedValueContainer.java:218)
    	at org.gradle.internal.Try.ofFailable(Try.java:41)
    	at org.gradle.internal.model.CalculatedValueContainer$CalculationState.attachValue(CalculatedValueContainer.java:213)
    	at org.gradle.internal.model.CalculatedValueContainer.finalizeIfNotAlready(CalculatedValueContainer.java:186)
    	at org.gradle.internal.model.CalculatedValueContainer.finalizeIfNotAlready(CalculatedValueContainer.java:177)
    	at org.gradle.api.internal.artifacts.PreResolvedResolvableArtifact.getFile(PreResolvedResolvableArtifact.java:88)
    	at org.jetbrains.plugins.gradle.tooling.util.resolve.DependencyResolverImpl.resolveDependencies(DependencyResolverImpl.java:239)
    	at org.jetbrains.plugins.gradle.tooling.util.resolve.DependencyResolverImpl.resolveDependencies(DependencyResolverImpl.java:119)
    
    

    Solution Can you please add support for iosSimulatorArm64 target so I can build it on M1 ios simulator?

    opened by phamobic 2
Releases(1.1.0)
Owner
Christopher
Christopher
Kotlin-native webserver for simple image annotations

Kotlin-native webserver for simple image annotations

null 1 Feb 26, 2022
Android library that creates app shortcuts from annotations

Shortbread Android library that generates app shortcuts for activities and methods annotated with @Shortcut. No need to touch the manifest, create XML

Matthias Robbers 1.8k Dec 30, 2022
Koin Annotations - help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you

The goal of Koin Annotations project is to help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you. The goal is to help developer experience to scale and go fast ?? , thanks to Kotlin Compilers.

insert-koin.io 68 Jan 6, 2023
Repository of a multi-platform application running the same Compose source code on all platforms

Compose multiplatform demo demo.mov Using the same compose user interface (UI) from android on all principal platforms ?? ?? App Features This is a si

David Coronel 18 Dec 16, 2022
A simple Kotlin wrapper around Anvil.

AnvilKotlin A simple Kotlin wrapper around Anvil. The only purpose of this library is to provide type safety to Anvil through Kotlin. Nothing more, no

Andre Artus 15 Oct 3, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Practical Kotlin Multiplatform on the Web λ³Έ μ €μž₯μ†ŒλŠ” μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌ 기반 μ›Ή ν”„λ‘œκ·Έλž˜λ° μ›Œν¬μˆ(κ°•μ’Œ)을 μœ„ν•΄ μž‘μ„±λœ ν…œν”Œλ¦Ώ ν”„λ‘œμ νŠΈκ°€ μžˆλŠ” κ³³μž…λ‹ˆλ‹€. μ›Œν¬μˆ κ³Όμ •μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌμ„ 기반으둜 ν”„λ‘ νŠΈμ—”λ“œ(front-end)λŠ” Ko

SpringRunner 14 Nov 5, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Building a Full Stack Web App with Kotlin Multiplatform λ³Έ μ €μž₯μ†ŒλŠ” INFCON 2022μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌ 기반 μ›Ή ν”„λ‘œκ·Έλž˜λ° ν•Έμ¦ˆμ˜¨λž©μ„ μœ„ν•΄ μž‘μ„±λœ ν…œν”Œλ¦Ώ ν”„λ‘œμ νŠΈκ°€ μžˆλŠ” κ³³μž…λ‹ˆλ‹€. ν•Έμ¦ˆμ˜¨ κ³Όμ •μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌμ„

Arawn Park 19 Sep 8, 2022
A Kotlin DSL wrapper around the mikepenz/MaterialDrawer library.

MaterialDrawerKt Create navigation drawers in your Activities and Fragments without having to write any XML, in pure Kotlin code, with access to all t

MΓ‘rton Braun 517 Nov 19, 2022
A lightweight Kotlin friendly wrapper around Couchbase lite for Android.

CouchBaseKtx ?? Work In-Progress ?? A lightweight Kotlin friendly wrapper around Couchbase-lite for Android Read up a little bit of documentation abou

Jaya Surya Thotapalli 5 Feb 15, 2022
SavedStateFlow - A Kotlin StateFlow wrapper around SavedStateHandle

SavedStateFlow SavedStateFlow is a Kotlin StateFlow wrapper around SavedStateHan

Andrew Steinmetz 13 Aug 4, 2022