Skip to content

Commit 000f909

Browse files
committed
Init project.
0 parents  commit 000f909

File tree

16 files changed

+675
-0
lines changed

16 files changed

+675
-0
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Build files and folders
2+
.gradle/
3+
build/
4+
5+
# Properties
6+
local.properties
7+
8+
# Idea
9+
.idea/
10+
**/*.iml
11+
12+
# Mac OS
13+
.DS_Store
14+
15+
# Xcode
16+
xcuserdata/
17+
project.xcworkspace/
18+
19+
# Web
20+
yarn.lock
21+
22+
# iOS
23+
Pods/
24+
*.podspec
25+
*.lock
26+
*.xcworkspace
27+
28+
# Sample
29+
pm_state.txt

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Compose Multiplatform Application
2+
3+
### Desktop
4+
Run the desktop application: `./gradlew :composeApp:run`
5+
6+
### Browser
7+
Run the browser application: `./gradlew :composeApp:jsBrowserDevelopmentRun`
8+

build.gradle.kts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
plugins {
26+
alias(libs.plugins.multiplatform).apply(false)
27+
alias(libs.plugins.compose).apply(false)
28+
alias(libs.plugins.kotlinx.serialization).apply(false)
29+
}

composeApp/build.gradle.kts

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
26+
27+
plugins {
28+
alias(libs.plugins.multiplatform)
29+
alias(libs.plugins.compose)
30+
alias(libs.plugins.kotlinx.serialization)
31+
}
32+
33+
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
34+
kotlin {
35+
targetHierarchy.default()
36+
jvm("desktop")
37+
38+
js {
39+
browser()
40+
binaries.executable()
41+
}
42+
43+
sourceSets {
44+
all {
45+
languageSettings {
46+
optIn("org.jetbrains.compose.resources.ExperimentalResourceApi")
47+
}
48+
}
49+
val commonMain by getting {
50+
dependencies {
51+
implementation(compose.runtime)
52+
implementation(compose.material3)
53+
implementation(compose.materialIconsExtended)
54+
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
55+
implementation(compose.components.resources)
56+
implementation(libs.kotlinx.coroutines.core)
57+
implementation(libs.kotlinx.serialization.json)
58+
implementation(libs.kotlinx.datetime)
59+
}
60+
}
61+
62+
val commonTest by getting {
63+
dependencies {
64+
implementation(kotlin("test"))
65+
}
66+
}
67+
68+
val desktopMain by getting {
69+
dependencies {
70+
implementation(compose.desktop.common)
71+
implementation(compose.desktop.currentOs)
72+
}
73+
}
74+
75+
val jsMain by getting {
76+
dependencies {
77+
implementation(compose.html.core)
78+
}
79+
}
80+
81+
}
82+
}
83+
84+
compose.desktop {
85+
application {
86+
mainClass = "MainKt"
87+
88+
nativeDistributions {
89+
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
90+
packageName = "me.dmdev.epicpredictor.desktopApp"
91+
packageVersion = "1.0.0"
92+
}
93+
}
94+
}
95+
96+
compose.experimental {
97+
web.application {}
98+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package me.dmdev.epicpredictor
26+
27+
import androidx.compose.runtime.Composable
28+
29+
@Composable
30+
internal fun App() {
31+
32+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
import androidx.compose.ui.unit.dp
26+
import androidx.compose.ui.window.Window
27+
import androidx.compose.ui.window.application
28+
import androidx.compose.ui.window.rememberWindowState
29+
import java.awt.Dimension
30+
import me.dmdev.epicpredictor.App
31+
32+
fun main() = application {
33+
Window(
34+
title = "Epic Predictor",
35+
state = rememberWindowState(width = 800.dp, height = 600.dp),
36+
onCloseRequest = ::exitApplication,
37+
) {
38+
window.minimumSize = Dimension(350, 600)
39+
App()
40+
}
41+
}

composeApp/src/jsMain/kotlin/main.kt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Dmitriy Gorbunov ([email protected])
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
import androidx.compose.ui.ExperimentalComposeUiApi
26+
import androidx.compose.ui.window.CanvasBasedWindow
27+
import me.dmdev.epicpredictor.App
28+
import org.jetbrains.skiko.wasm.onWasmReady
29+
30+
@OptIn(ExperimentalComposeUiApi::class)
31+
fun main() {
32+
onWasmReady {
33+
CanvasBasedWindow("Epic Predictor") {
34+
App()
35+
}
36+
}
37+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Epic Predictor</title>
6+
<script src="skiko.js"></script>
7+
</head>
8+
<body>
9+
<div>
10+
<canvas id="ComposeTarget" width="800" height="600"></canvas>
11+
</div>
12+
<script src="composeApp.js"></script>
13+
</body>
14+
</html>

gradle.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#Gradle
2+
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
3+
4+
#Kotlin
5+
kotlin.code.style=official
6+
kotlin.js.compiler=ir
7+
8+
#Compose
9+
org.jetbrains.compose.experimental.uikit.enabled=true
10+
org.jetbrains.compose.experimental.jscanvas.enabled=true
11+
12+
#Android
13+
android.useAndroidX=true
14+
android.nonTransitiveRClass=true

gradle/libs.versions.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[versions]
2+
3+
kotlin = "1.9.10"
4+
agp = "8.1.2"
5+
compose = "1.5.1"
6+
androidx-appcompat = "1.6.1"
7+
androidx-activityCompose = "1.7.2"
8+
compose-uitooling = "1.5.1"
9+
kotlinx-coroutines = "1.7.3"
10+
kotlinx-serialization = "1.6.0"
11+
kotlinx-datetime = "0.4.1"
12+
13+
[libraries]
14+
15+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
16+
androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
17+
compose-uitooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-uitooling" }
18+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
19+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
20+
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
21+
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
22+
23+
[plugins]
24+
25+
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
26+
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
27+
android-application = { id = "com.android.application", version.ref = "agp" }
28+
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

58.1 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)