forked from com-lihaoyi/mill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hello world Kotlin Jetpack Compose Example; Fixes:com-lihaoyi#3550
- Loading branch information
1 parent
50eb241
commit 103b7b8
Showing
4 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
example/kotlinlib/android/2-jetpack-compose-hello-world/app/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.helloworld.app"> | ||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35"/> | ||
<application android:label="Hello World" android:debuggable="true"> | ||
<activity android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
21 changes: 21 additions & 0 deletions
21
...roid/2-jetpack-compose-hello-world/app/src/main/kotlin/com/helloworld/app/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.helloworld.app | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
Greeting("Hello, World!") | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Greeting(name: String) { | ||
Text(text = name) | ||
} |
45 changes: 45 additions & 0 deletions
45
example/kotlinlib/android/2-jetpack-compose-hello-world/build.mill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//// SNIPPET:BUILD | ||
package build | ||
|
||
import mill._ | ||
import kotlinlib._ | ||
import coursier.maven.MavenRepository | ||
import mill.kotlinlib.android.AndroidAppKotlinModule | ||
import mill.javalib.android.AndroidSdkModule | ||
|
||
val maven_google = Seq( | ||
MavenRepository("https://maven.google.com/"), | ||
MavenRepository("https://repo1.maven.org/maven2") | ||
) | ||
|
||
object androidSdkModule0 extends AndroidSdkModule { | ||
def buildToolsVersion = "35.0.0" | ||
} | ||
|
||
object app extends AndroidAppKotlinModule { | ||
def kotlinVersion = "2.0.20" | ||
def androidSdkModule = mill.define.ModuleRef(androidSdkModule0) | ||
|
||
override def mandatoryIvyDeps: T[Agg[Dep]] = Task { | ||
super.mandatoryIvyDeps() ++ Agg( | ||
// Jetpack Compose dependencies | ||
ivy"androidx.compose.compiler:compiler:1.5.15", | ||
ivy"androidx.activity:activity:1.8.2", | ||
ivy"androidx.activity:activity-compose:1.8.2", | ||
ivy"androidx.compose.runtime:runtime:1.3.1", | ||
ivy"androidx.compose.material3:material3:1.0.1" | ||
) | ||
} | ||
|
||
def repositoriesTask = T.task { super.repositoriesTask() ++ maven_google } | ||
|
||
} | ||
|
||
////SNIPPET:END | ||
|
||
/** Usage | ||
|
||
> ./mill show app.androidApk | ||
".../out/app/androidApk.dest/app.apk" | ||
|
||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters