Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADR 2: Extract game logic to a separate submodule #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions build.gradle.kts → app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.springframework.boot") version "2.5.6"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.5.31"
kotlin("plugin.spring") version "1.5.31"
kotlin("plugin.jpa") version "1.5.31"
id("org.springframework.boot")
id("io.spring.dependency-management")
kotlin("jvm")
kotlin("plugin.spring")
kotlin("plugin.jpa")
}

group = "org.davnokodery"
version = "0.0.2"
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand All @@ -26,7 +24,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

implementation("com.auth0:java-jwt:3.18.2")
implementation("com.auth0:java-jwt:3.19.0")

runtimeOnly("com.h2database:h2")

Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions docs/arch/adr-0002-extract-card-logic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ADR 2: Extract game logic to a separate submodule

## Status

Proposed

## Context

Game project consists of the application and game logic code.
The application code contains endpoints and services for communicating with the client application and managing the game session lifecycle.
That part of the project is expected to be settled and have only slight changes after the initial release.
The game logic part on the other side is where the all game mechanics and balance logic is located and therefore can change more often.
The biggest necessity to make it separate is not to share it as part of the main open source project and not to spoil the fun of exploring the game.
Game logic code can be published as open source with a delay, when the new set of game logic code is developed.
## Decision

We will keep game logic in a separate gradle module residing in a git submodule, added to the application during the build process.
To separate these modules a new interface module will be requried (`game-logic-interface`).

The suggested git tree:


app/
logic-interface/
logic/ (git submodule)
build.gradle


The compilation dependencies will look like this:

```mermaid
graph TB
app --> logic-interface
logic --> logic-interface
```

The `logic` dependency should be runtime only and optional (implemented via gradle `feature variant`)

The app project can contain some sample logic to have a technically functional application but not a full game.

## Consequences

The application project is split into separate modules, which can have different visibility and lifecycle.
Git submodules are used.
8 changes: 8 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# application properties
version=0.0.3
group=org.davnokodery

# dependencies / plugins
kotlinVersion=1.6.20
springBootVersion=2.5.6
springDependencyVersion=1.0.11.RELEASE
15 changes: 15 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
pluginManagement {
val kotlinVersion: String by settings
val springBootVersion: String by settings
val springDependencyVersion: String by settings

plugins {
id("org.springframework.boot") version springBootVersion
id("io.spring.dependency-management") version springDependencyVersion
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion
}
}
include(":app")
rootProject.name = "stournament"