Initial commit
This commit is contained in:
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@@ -0,0 +1,14 @@
|
||||
[*.{kt,kts}]
|
||||
ktlint_code_style = ktlint_official
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
ktlint_standard_filename = disabled
|
||||
ktlint_standard_max-line-length = 140
|
||||
ktlint_standard_multiline-expression-wrapping = disabled
|
||||
ktlint_standard_backing-property-naming = disabled
|
||||
ktlint_standard_function-naming = disabled
|
||||
ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 5
|
||||
|
||||
[**/build/**]
|
||||
generated_code = true
|
||||
ij_formatter_enabled = false
|
||||
ktlint = disabled
|
||||
@@ -5,3 +5,5 @@ plugins {
|
||||
alias(libs.plugins.composeCompiler) apply false
|
||||
alias(libs.plugins.kotlinMultiplatform) apply false
|
||||
}
|
||||
|
||||
apply("checks.gradle.kts")
|
||||
|
||||
43
checks.gradle.kts
Normal file
43
checks.gradle.kts
Normal file
@@ -0,0 +1,43 @@
|
||||
tasks.register("ensureChecksPreCommitHook") {
|
||||
group = "verification"
|
||||
description = "Ensures that the Git pre-commit hook for ktlint is properly set up"
|
||||
|
||||
doLast {
|
||||
val gitHooksDir = rootProject.file(".git/hooks")
|
||||
val preCommitHookFile = gitHooksDir.resolve("pre-commit")
|
||||
val requiredHookContent =
|
||||
"""
|
||||
#!/bin/sh
|
||||
|
||||
# https://github.com/pinterest/ktlint pre-commit hook
|
||||
|
||||
ktlint
|
||||
""".trimIndent()
|
||||
|
||||
if (!gitHooksDir.exists()) {
|
||||
logger.warn("Git hooks directory not found. Is this a Git repository?")
|
||||
return@doLast
|
||||
}
|
||||
|
||||
if (!preCommitHookFile.exists()) {
|
||||
logger.lifecycle("Creating ktlint pre-commit hook")
|
||||
preCommitHookFile.writeText(requiredHookContent)
|
||||
preCommitHookFile.setExecutable(true)
|
||||
} else {
|
||||
val currentContent = preCommitHookFile.readText()
|
||||
if (!currentContent.contains(requiredHookContent)) {
|
||||
logger.lifecycle("Updating pre-commit hook with ktlint check")
|
||||
preCommitHookFile.writeText(requiredHookContent)
|
||||
preCommitHookFile.setExecutable(true)
|
||||
} else {
|
||||
logger.lifecycle("ktlint pre-commit hook is already properly configured")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.matching { it.name != "ensureChecksPreCommitHook" }.configureEach {
|
||||
dependsOn("ensureChecksPreCommitHook")
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ kotlin {
|
||||
|
||||
listOf(
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach { iosTarget ->
|
||||
iosTarget.binaries.framework {
|
||||
baseName = "ComposeApp"
|
||||
@@ -48,12 +48,18 @@ kotlin {
|
||||
|
||||
android {
|
||||
namespace = "dev.carlosmartino.triplogic"
|
||||
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
||||
compileSdk = libs.versions.android.compileSdk
|
||||
.get()
|
||||
.toInt()
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "dev.carlosmartino.triplogic"
|
||||
minSdk = libs.versions.android.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||||
minSdk = libs.versions.android.minSdk
|
||||
.get()
|
||||
.toInt()
|
||||
targetSdk = libs.versions.android.targetSdk
|
||||
.get()
|
||||
.toInt()
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
}
|
||||
@@ -76,4 +82,3 @@ android {
|
||||
dependencies {
|
||||
debugImplementation(compose.uiTooling)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,16 @@ import androidx.compose.foundation.layout.safeContentPadding
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||
|
||||
import triplogic.composeapp.generated.resources.Res
|
||||
import triplogic.composeapp.generated.resources.compose_multiplatform
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun App() {
|
||||
@@ -40,7 +41,6 @@ fun App() {
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Image(painterResource(Res.drawable.compose_multiplatform), null)
|
||||
Text("Compose: $greeting")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,5 @@ package dev.carlosmartino.triplogic
|
||||
class Greeting {
|
||||
private val platform = getPlatform()
|
||||
|
||||
fun greet(): String {
|
||||
return "Hello, ${platform.name}!"
|
||||
}
|
||||
fun greet(): String = "Hello, ${platform.name}!"
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class ComposeAppCommonTest {
|
||||
|
||||
@Test
|
||||
fun example() {
|
||||
assertEquals(3, 1 + 2)
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.carlosmartino.triplogic
|
||||
|
||||
import platform.UIKit.UIDevice
|
||||
|
||||
class IOSPlatform: Platform {
|
||||
class IOSPlatform : Platform {
|
||||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#Kotlin
|
||||
kotlin.code.style=official
|
||||
kotlin.daemon.jvmargs=-Xmx3072M
|
||||
kotlin.daemon.jvmargs=-Xmx4096M
|
||||
kotlin.native.ignoreDisabledTargets=true
|
||||
kotlin.mpp.enableCInteropCommonization=true
|
||||
|
||||
#Gradle
|
||||
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
|
||||
|
||||
Reference in New Issue
Block a user