Skip to content

Commit c46ba91

Browse files
committed
Fibonacci all the things
1 parent 4a68674 commit c46ba91

File tree

10 files changed

+24
-9
lines changed

10 files changed

+24
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ licensing, contribution guideline, code of conduct and others.
1414

1515
## How do I build it?
1616

17-
1. - [x] Clone this repository ot just [use it as template](https://github.com/Kotlin/multiplatform-library-template/generate)
17+
1. - [ ] Clone this repository or just [use it as template](https://github.com/Kotlin/multiplatform-library-template/generate) - you need to be logged into GitHub to create the repository from the template.
1818
1. - [ ] Edit library module name and include it in [`settings.gradle.kts`](settings.gradle.kts#L18)
1919
1. - [ ] Edit [`groupId` and `version`](convention-plugins/src/main/kotlin/module.publication.gradle.kts#L10-L11)
2020
1. If you need the Android support update namespace [there](library/build.gradle.kts#L38) too

convention-plugins/src/main/kotlin/module.publication.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ publishing {
1818

1919
// Provide artifacts information required by Maven Central
2020
pom {
21-
name.set("Kotlin Multiplatform library template")
22-
description.set("Dummy library to test deployment to Maven Central")
23-
url.set("https://github.com/Kotlin/multiplatform-library-template")
21+
name.set("Fibonacci")
22+
description.set("Fibonacci library to test deployment to Maven Central")
23+
url.set("https://github.com/pahill/fibonacci")
2424

2525
licenses {
2626
license {
@@ -37,7 +37,7 @@ publishing {
3737
}
3838
}
3939
scm {
40-
url.set("https://github.com/Kotlin/multiplatform-library-template")
40+
url.set("https://github.com/pahill/fibonacci")
4141
}
4242
}
4343
}

library/build.gradle.kts renamed to fibonacci/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
22
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33

4+
group = "io.github.pahill"
5+
version = "1.0.3"
6+
47
plugins {
58
alias(libs.plugins.kotlinMultiplatform)
69
alias(libs.plugins.androidLibrary)
@@ -36,7 +39,7 @@ kotlin {
3639
}
3740

3841
android {
39-
namespace = "org.jetbrains.kotlinx.multiplatform.library.template"
42+
namespace = "io.github.pahill.fibonacci"
4043
compileSdk = libs.versions.android.compileSdk.get().toInt()
4144
defaultConfig {
4245
minSdk = libs.versions.android.minSdk.get().toInt()
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package io.github.pahill.fibonacci
2+
13
actual val firstElement: Int = 1
24
actual val secondElement: Int = 2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
package io.github.pahill.fibonacci
2+
13
import kotlin.test.Test
24
import kotlin.test.assertEquals
35

46
class AndroidFibiTest {
57

68
@Test
79
fun `test 3rd element`() {
8-
assertEquals(3, fibi.take(3).last())
10+
assertEquals(3, generateFibi().take(3).last())
911
}
1012
}

library/src/commonMain/kotlin/CustomFibi.kt renamed to fibonacci/src/commonMain/kotlin/CustomFibi.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
val fibi = sequence {
1+
package io.github.pahill.fibonacci
2+
3+
fun generateFibi() = sequence {
24
var a = firstElement
35
yield(a)
46
var b = secondElement
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package io.github.pahill.fibonacci
2+
13
actual val firstElement: Int = 3
24
actual val secondElement: Int = 4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package io.github.pahill.fibonacci
2+
13
actual val firstElement: Int = 2
24
actual val secondElement: Int = 3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package io.github.pahill.fibonacci
2+
13
actual val firstElement: Int = 3
24
actual val secondElement: Int = 5

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ dependencyResolutionManagement {
1515
}
1616

1717
rootProject.name = "multiplatform-library-template"
18-
include(":library")
18+
include(":fibonacci")

0 commit comments

Comments
 (0)