Skip to content

Commit

Permalink
build(core): Move 'core' to 'core-domain'
Browse files Browse the repository at this point in the history
  • Loading branch information
CLOVIS-AI committed Jun 25, 2023
1 parent 89d41f5 commit 6b0aad2
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 16 deletions.
3 changes: 1 addition & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ kotlin {

api(projects.core.coreData)
api(projects.core.coreUsers)
api(projects.core.coreDomain)
}
}

Expand All @@ -48,8 +49,6 @@ kotlin {

tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
includes.from("${project.projectDir}/README.md")

sourceLink {
localDirectory.set(file("src"))
remoteUrl.set(URL("https://gitlab.com/opensavvy/formulaide/-/blob/main/core/src"))
Expand Down
6 changes: 2 additions & 4 deletions core/README.md → core/core-domain/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Module core
# Module core-domain

Core APIs for the Formulaide project.

Formulaide administrators can create web forms entirely online, and declare how the data submitted by users is shared between departments of the company to ensure each request is checked by the correct people.
Core functionality of the Formulaide project.

## Form structure

Expand Down
57 changes: 57 additions & 0 deletions core/core-domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import java.net.URL

plugins {
kotlin("multiplatform")
}

kotlin {
jvm {
jvmToolchain(17)
testRuns.named("test") {
executionTask.configure {
useJUnitPlatform()
}
}
}
js(IR) {
browser {
testTask {
useMocha {
timeout = "1 minute"
}
}
}
}

sourceSets {
val commonMain by getting {
dependencies {
api("opensavvy.pedestal:backbone:_")
api("opensavvy.pedestal:state-arrow:_")
api(KotlinX.datetime)

api(projects.core.coreData)
api(projects.core.coreUsers)
}
}

val commonTest by getting {
dependencies {
implementation(projects.test)
implementation(projects.fake)
}
}
}
}

tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
includes.from("${project.projectDir}/README.md")

sourceLink {
localDirectory.set(file("src"))
remoteUrl.set(URL("https://gitlab.com/opensavvy/formulaide/-/blob/main/core/core-domain/src"))
remoteLineSuffix.set("#L")
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,39 @@ class InputTest : TestExecutor() {
val files = FakeFiles(clock)
val bool = Input.Toggle

bool.parse("true", files).shouldSucceedAnd {
Input.Toggle.parse("true", files).shouldSucceedAnd {
assertEquals(true, it)
}

bool.parse("false", files).shouldSucceedAnd {
Input.Toggle.parse("false", files).shouldSucceedAnd {
assertEquals(false, it)
}

bool.parse("other", files) shouldFailWithType Input.Failures.Parsing::class
bool.parse("something", files) shouldFailWithType Input.Failures.Parsing::class
Input.Toggle.parse("other", files) shouldFailWithType Input.Failures.Parsing::class
Input.Toggle.parse("something", files) shouldFailWithType Input.Failures.Parsing::class
}

test("Email") {
val files = FakeFiles(clock)
val email = Input.Email

email.parse("[email protected]", files).shouldSucceedAnd {
Input.Email.parse("[email protected]", files).shouldSucceedAnd {
assertEquals(Email("[email protected]"), it)
}

email.parse("something", files) shouldFailWithType Input.Failures.Parsing::class
Input.Email.parse("something", files) shouldFailWithType Input.Failures.Parsing::class
}

test("Parse phone number") {
val files = FakeFiles(clock)
val phone = Input.Phone

phone.parse("+332345678", files).shouldSucceedAnd {
Input.Phone.parse("+332345678", files).shouldSucceedAnd {
assertEquals("+332345678", it)
}

phone.parse("thing", files) shouldFailWithType Input.Failures.Parsing::class
phone.parse("123456789123456789123456789", files) shouldFailWithType Input.Failures.Parsing::class
Input.Phone.parse("thing", files) shouldFailWithType Input.Failures.Parsing::class
Input.Phone.parse("123456789123456789123456789", files) shouldFailWithType Input.Failures.Parsing::class
}

test("Int range constructor") {
Expand Down
1 change: 0 additions & 1 deletion remote-common/src/commonMain/kotlin/dto/FieldDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package opensavvy.formulaide.remote.dto
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import opensavvy.formulaide.core.Field
import opensavvy.formulaide.core.Input
import opensavvy.formulaide.core.Template
import opensavvy.formulaide.remote.api
import opensavvy.formulaide.remote.dto.InputDto.Companion.toCore
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include(

"core:core-data",
"core:core-users",
"core:core-domain",

"remote-common",
"remote-client",
Expand Down

0 comments on commit 6b0aad2

Please sign in to comment.