Skip to content

Commit

Permalink
Cleanup before release
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed May 30, 2019
1 parent ddd6b46 commit 6ad5fcd
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 38 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## Version 1.0 (2019-05-30)

* Update dependency versions.
* Promote to stable release.

## Version 0.3 (2017-08-10)

* Support for transitive dependencies via `HasModules` interface and `transitive()` call on the root module.
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Minimalist dependency injection library for Kotlin.

**Note:** Kapsule is currently in pre-release stages of development. While every milestone build is well-tested and ready for use, breaking changes can be introduced without warning. Once version 1.0 is released, the changes will become more gradual.

Why create another dependency injection library? Here are the objectives pursued by Kapsule:

* Simple features that most projects will have use for
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
buildscript {
ext {
kotlin_min_version = '1.0.7'
kotlin_max_version = '1.2.71'
kotlin_version = '1.3.31'

junit_version = '4.12'
mockito_version = '2.7.19'
mockito_version = '2.28.2'
}

repositories {
jcenter()
}

dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.9.17'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.9.18'
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Feb 18 22:08:56 AEDT 2017
#Thu May 30 18:05:31 AEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
2 changes: 1 addition & 1 deletion kapsule-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = kotlin_max_version
ext.kotlin_version = kotlin_version

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import kotlin.reflect.KProperty
*/
class DelegateTest : TestCase() {

@Test fun testInitialize_required() {
@Test
fun testInitialize_required() {
val delegate = Delegate.Required<RequiredModule, String> { value }
assertEquals(null, delegate.value)

Expand All @@ -31,7 +32,8 @@ class DelegateTest : TestCase() {
}
}

@Test fun testInitialize_optional() {
@Test
fun testInitialize_optional() {
val delegate = Delegate.Optional<OptionalModule, String?> { value }
assertEquals(null, delegate.value)

Expand All @@ -42,7 +44,8 @@ class DelegateTest : TestCase() {
}
}

@Test fun testGetValue_required() {
@Test
fun testGetValue_required() {
val delegate = Delegate.Required<RequiredModule, String> { value }
val prop = Mockito.mock(KProperty::class.java)

Expand All @@ -58,7 +61,8 @@ class DelegateTest : TestCase() {
assertEquals(expected, delegate.getValue(null, prop))
}

@Test fun testGetValue_optional() {
@Test
fun testGetValue_optional() {
val delegate = Delegate.Optional<OptionalModule, String?> { value }
val prop = Mockito.mock(KProperty::class.java)

Expand All @@ -69,7 +73,8 @@ class DelegateTest : TestCase() {
assertEquals(expected, delegate.getValue(null, prop))
}

@Test fun testSetValue_required() {
@Test
fun testSetValue_required() {
val delegate = Delegate.Required<RequiredModule, String> { value }
val prop = Mockito.mock(KProperty::class.java)

Expand All @@ -79,7 +84,8 @@ class DelegateTest : TestCase() {
}
}

@Test fun testSetValue_optional() {
@Test
fun testSetValue_optional() {
val delegate = Delegate.Optional<OptionalModule, String?> { value }
val prop = Mockito.mock(KProperty::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ import kotlin.reflect.KProperty
*/
class KapsuleTest : TestCase() {

@Test fun testRequired() {
@Suppress("USELESS_IS_CHECK")
@Test
fun testRequired() {
val kap = Kapsule<MultiModule>()
assertTrue(kap.required { reqInt } is Delegate.Required)
assertTrue(kap<Int> { reqInt } is Delegate.Required)
assertTrue(kap { reqInt } is Delegate.Required)
assertTrue(kap.optional<Int?> { reqInt } is Delegate.Optional)
}

@Test fun testDelegates() {
@Test
fun testDelegates() {
val kap = Kapsule<MultiModule>()
for (i in 0..2) {
val initializer: (MultiModule.() -> Int) = { reqInt }
Expand All @@ -39,7 +42,8 @@ class KapsuleTest : TestCase() {
assertEquals(3, kap.delegates.count())
}

@Test fun testInject() {
@Test
fun testInject() {
val kap = Kapsule<MultiModule>()
val prop = Mockito.mock(KProperty::class.java)

Expand All @@ -54,7 +58,8 @@ class KapsuleTest : TestCase() {
}
}

@Test fun testTarget_pre() {
@Test
fun testTarget_pre() {
val target = Target()

assertEquals(null, target.optString)
Expand All @@ -67,7 +72,8 @@ class KapsuleTest : TestCase() {
}
}

@Test fun testTarget_multiple() {
@Test
fun testTarget_multiple() {
val target = Target()

listOf(MultiModule("test1", 3, "abc123"),
Expand All @@ -82,7 +88,7 @@ class KapsuleTest : TestCase() {

val kap = Kapsule<MultiModule>()
var optString by kap.optional<String?> { optString }
val reqInt by kap<Int> { reqInt }
val reqInt by kap { reqInt }

fun inject(module: MultiModule) {
kap.inject(module)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package space.traversal.kapsule

import junit.framework.TestCase
import org.junit.Test
import org.omg.CORBA.Object

/**
* Test case for [Kapsules].
Expand All @@ -21,14 +20,14 @@ class KapsulesTest : TestCase() {

@Test fun testFetch() {
Kapsules.instances.clear()
val caller = object : Injects<Object> {}
val caller = object : Injects<Any> {}
assertEquals(null, Kapsules.fetch(caller))
assertEquals(0, Kapsules.instances.size)
}

@Test fun testGet() {
Kapsules.instances.clear()
val caller = object : Injects<Object> {}
val caller = object : Injects<Any> {}
val kap = Kapsules.get(caller)
assertEquals(kap, Kapsules.get(caller))
assertEquals(1, Kapsules.instances.size)
Expand Down
23 changes: 12 additions & 11 deletions samples/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
buildscript {
ext.kotlin_version = kotlin_max_version
ext.kotlin_version = kotlin_version

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
Expand All @@ -18,12 +18,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
compileSdkVersion 28

defaultConfig {
applicationId "space.traversal.kapsule.demo"
minSdkVersion 21
targetSdkVersion 27
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -37,16 +37,17 @@ android {
}

repositories {
google()
jcenter()
}

dependencies {
compile project(':kapsule-core')
implementation project(':kapsule-core')

compile 'com.android.support:appcompat-v7:25.3.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.2.2'
testCompile 'org.mockito:mockito-core:1.10.19'
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.2.2'
testImplementation 'org.mockito:mockito-core:1.10.19'
}
2 changes: 1 addition & 1 deletion samples/simple/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = kotlin_max_version
ext.kotlin_version = kotlin_version

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down

0 comments on commit 6ad5fcd

Please sign in to comment.