diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 591e03a..d534dd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,22 +3,50 @@ name: CI on: push: branches: [ "main" ] + tags: [ "v*" ] pull_request: branches: [ "main" ] - workflow_dispatch: jobs: build: + name: Build + runs-on: macos-26 + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build + run: ./gradlew build + + publish: + name: Publish + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: macos-26 environment: S - name: Build & Publish - runs-on: macos-13 steps: - - uses: actions/checkout@v3 - - name: Gradlew - Build & Publish + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Publish env: USERNAME: ${{ secrets.USERNAME }} API_KEY: ${{ secrets.API_KEY }} - run: | - ./gradlew build --no-daemon - ./gradlew publish --no-daemon + run: ./gradlew publish diff --git a/README.md b/README.md index 492650c..86c4b4a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ dependencyResolutionManagement { kotlin { sourceSets { commonMain.dependencies { - implementation("dev.onexeor.kdownloader:shared:0.0.6") + implementation("dev.onexeor.kdownloader:shared:0.1.0") } } } diff --git a/build.gradle.kts b/build.gradle.kts index 4a600e3..07a28a1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ plugins { - //trick: for the same plugin versions in all sub-modules + alias(libs.plugins.androidApplication).apply(false) alias(libs.plugins.androidLibrary).apply(false) alias(libs.plugins.kotlinMultiplatform).apply(false) - id("org.jetbrains.kotlin.android") version "1.9.21" apply false + alias(libs.plugins.kotlinAndroid).apply(false) + alias(libs.plugins.composeCompiler).apply(false) } diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..e510fa9 --- /dev/null +++ b/example/.gitignore @@ -0,0 +1,10 @@ +*.iml +.gradle +.idea +.DS_Store +build +captures +.externalNativeBuild +.cxx +local.properties +xcuserdata \ No newline at end of file diff --git a/example/androidApp/build.gradle.kts b/example/androidApp/build.gradle.kts new file mode 100644 index 0000000..c3d7978 --- /dev/null +++ b/example/androidApp/build.gradle.kts @@ -0,0 +1,50 @@ +plugins { + alias(libs.plugins.androidApplication) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.composeCompiler) +} + +android { + namespace = "dev.onexeor.example.android" + compileSdk = 35 + defaultConfig { + applicationId = "dev.onexeor.example.android" + minSdk = 24 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" + } + buildFeatures { + compose = true + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } +} + +kotlin { + compilerOptions { + jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + } +} + +dependencies { + implementation(projects.example.shared) + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) + implementation(libs.compose.ui.tooling.preview) + implementation(libs.compose.material3) + implementation(libs.androidx.activity.compose) + debugImplementation(libs.compose.ui.tooling) +} diff --git a/example/androidApp/src/main/AndroidManifest.xml b/example/androidApp/src/main/AndroidManifest.xml new file mode 100644 index 0000000..22d1fac --- /dev/null +++ b/example/androidApp/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt b/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt new file mode 100644 index 0000000..9a6deec --- /dev/null +++ b/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt @@ -0,0 +1,40 @@ +package dev.onexeor.example.android + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import dev.onexeor.example.Greeting + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + MyApplicationTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + GreetingView(Greeting().greet()) + } + } + } + } +} + +@Composable +fun GreetingView(text: String) { + Text(text = text) +} + +@Preview +@Composable +fun DefaultPreview() { + MyApplicationTheme { + GreetingView("Hello, Android!") + } +} diff --git a/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt b/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt new file mode 100644 index 0000000..5b524e6 --- /dev/null +++ b/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt @@ -0,0 +1,55 @@ +package dev.onexeor.example.android + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Shapes +import androidx.compose.material3.Typography +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp + +@Composable +fun MyApplicationTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + content: @Composable () -> Unit +) { + val colors = if (darkTheme) { + darkColorScheme( + primary = Color(0xFFBB86FC), + secondary = Color(0xFF03DAC5), + tertiary = Color(0xFF3700B3) + ) + } else { + lightColorScheme( + primary = Color(0xFF6200EE), + secondary = Color(0xFF03DAC5), + tertiary = Color(0xFF3700B3) + ) + } + val typography = Typography( + bodyMedium = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp + ) + ) + val shapes = Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(4.dp), + large = RoundedCornerShape(0.dp) + ) + + MaterialTheme( + colorScheme = colors, + typography = typography, + shapes = shapes, + content = content + ) +} diff --git a/example/androidApp/src/main/res/values/styles.xml b/example/androidApp/src/main/res/values/styles.xml new file mode 100644 index 0000000..6b4fa3d --- /dev/null +++ b/example/androidApp/src/main/res/values/styles.xml @@ -0,0 +1,3 @@ + +