Browse Source

Update all examples with Compose Application DSL

pull/45/head
Alexey Tsvetkov 4 years ago
parent
commit
314f5af47f
  1. 18
      examples/codeviewer/README.md
  2. 4
      examples/codeviewer/build.gradle.kts
  3. 20
      examples/codeviewer/desktop/build.gradle.kts
  4. 16
      examples/imageviewer/README.md
  5. 1
      examples/imageviewer/build.gradle.kts
  6. 13
      examples/issues/README.md
  7. 2
      examples/issues/build.gradle.kts
  8. 20
      examples/issues/desktop/build.gradle.kts
  9. 15
      examples/todoapp/README.md
  10. 4
      examples/todoapp/buildSrc/build.gradle.kts
  11. 20
      examples/todoapp/desktop/build.gradle.kts
  12. 3
      templates/desktop-template/README.md
  13. 13
      templates/desktop-template/build.gradle.kts
  14. 2
      templates/desktop-template/settings.gradle.kts
  15. 3
      templates/multiplatform-template/README.md
  16. 2
      templates/multiplatform-template/build.gradle.kts
  17. 14
      templates/multiplatform-template/desktop/build.gradle.kts

18
examples/codeviewer/README.md

@ -1,7 +1,17 @@
MPP Code Viewer example for desktop/android written in Multiplatform Compose library.
To run desktop application execute in a terminal:
`./gradlew desktop:run`
### Running desktop application
```
./gradlew :desktop:run
```
To install android application on device/emulator:
'./gradlew installDebug'
### Building native desktop distribution
```
./gradlew :desktop:package
# outputs are written to desktop/build/compose/binaries
```
### Installing Android application on device/emulator
```
./gradlew installDebug
```

4
examples/codeviewer/build.gradle.kts

@ -1,5 +1,7 @@
buildscript {
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
@ -16,6 +18,8 @@ buildscript {
allprojects {
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")

20
examples/codeviewer/desktop/build.gradle.kts

@ -1,10 +1,9 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
id("org.jetbrains.compose")
java
application
}
kotlin {
@ -22,6 +21,19 @@ kotlin {
}
}
application {
mainClassName = "org.jetbrains.codeviewer.MainKt"
compose.desktop {
application {
mainClass = "org.jetbrains.codeviewer.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ComoseCodeViewer"
windows {
menu = true
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
upgradeUuid = "AF792DA6-2EA3-495A-95E5-C3C6CBCB9948"
}
}
}
}

16
examples/imageviewer/README.md

@ -1,4 +1,16 @@
An example of image gallery for remote server image viewing, based on Jetpack Compose UI library (desktop and android).
To run desktop application execute in terminal: ./gradlew desktop:run
To run android application you will need to open project in Intellij IDEA or Android Studio and run "android" configuration
### Running desktop application
```
./gradlew :desktop:run
```
### Building native desktop distribution
```
./gradlew :desktop:package
# outputs are written to desktop/build/compose/binaries
```
### Running Android application
Open project in Intellij IDEA or Android Studio and run "android" configuration.

1
examples/imageviewer/build.gradle.kts

@ -1,5 +1,6 @@
buildscript {
repositories {
// TODO: remove after new build is published
mavenLocal().mavenContent {
includeModule("org.jetbrains.compose", "compose-gradle-plugin")
}

13
examples/issues/README.md

@ -1,4 +1,13 @@
Github Issues viewer example written in Jetpack Compose UI library.
To run desktop application execute in terminal:
`./gradlew run`
### Running desktop application
```
./gradlew :desktop:run
```
### Building native desktop distribution
```
./gradlew :desktop:package
# outputs are written to desktop/build/compose/binaries
```

2
examples/issues/build.gradle.kts

@ -1,5 +1,7 @@
buildscript {
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")

20
examples/issues/desktop/build.gradle.kts

@ -1,10 +1,9 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
id("org.jetbrains.compose")
java
application
}
kotlin {
@ -21,6 +20,19 @@ kotlin {
}
}
application {
mainClassName = "androidx.ui.examples.jetissues.MainKt"
compose.desktop {
application {
mainClass = "androidx.ui.examples.jetissues.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "IssuesViewer"
windows {
menu = true
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
upgradeUuid = "6565BEAD-713A-4DE7-A469-6B10FC4A6861"
}
}
}
}

15
examples/todoapp/README.md

@ -23,6 +23,17 @@ Features:
- View state is preserved when navigating between screens, Android configuration change, etc.
- Model-View-Intent (aka MVI) architectural pattern
To run the desktop application execute the following command: `./gradlew desktop:run`.
### Running desktop application
```
./gradlew :desktop:run
```
To run the Android application you will need to open the project in Intellij IDEA or Android Studio and run "android" configuration.
### Building native desktop distribution
```
./gradlew :desktop:package
# outputs are written to desktop/build/compose/binaries
```
### Running Android application
Open project in Intellij IDEA or Android Studio and run "android" configuration.

4
examples/todoapp/buildSrc/build.gradle.kts

@ -4,6 +4,8 @@ plugins {
}
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
@ -11,6 +13,8 @@ repositories {
buildscript {
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")

20
examples/todoapp/desktop/build.gradle.kts

@ -1,10 +1,9 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
id("org.jetbrains.compose")
java
application
}
kotlin {
@ -29,6 +28,19 @@ kotlin {
}
}
application {
mainClassName = "example.todo.desktop.MainKt"
compose.desktop {
application {
mainClass = "example.todo.desktop.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ComoseDesktopTodo"
windows {
menuGroup = "Compose Examples"
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
upgradeUuid = "BF9CDA6A-1391-46D5-9ED5-383D6E68CCEB"
}
}
}
}

3
templates/desktop-template/README.md

@ -1,5 +1,4 @@
Compose Desktop Application
- `./gradlew run` - run application
- `./gradlew install` - build application into `build/install`
- `./gradlew distZip` - build and create archive ready for distribution in `build/distributions/desktop.zip`
- `./gradlew package` - package native distribution into `build/compose/binaries`

13
templates/desktop-template/build.gradle.kts

@ -1,9 +1,9 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("jvm") version "1.4.0"
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.1.0-m1-build57")
application
}
repositories {
@ -15,6 +15,13 @@ dependencies {
implementation(compose.desktop.currentOs)
}
application {
mainClassName = "MainKt"
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "KotlinJvmComposeDesktopApplication"
}
}
}

2
templates/desktop-template/settings.gradle.kts

@ -1,5 +1,7 @@
pluginManagement {
repositories {
// TODO: remove after new build is published
mavenLocal()
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

3
templates/multiplatform-template/README.md

@ -2,8 +2,7 @@ Compose Multiplatform Application
**Desktop**
- `./gradlew run` - run application
- `./gradlew install` - build application into `desktop/build/install`
- `./gradlew distZip` - build and create archive ready for distribution in `desktop/build/distributions/desktop.zip`
- `./gradlew package` - package native distribution into `build/compose/binaries`
**Android**
- `./gradlew installDebug` - install Android application on an Android device (on a real device or on an emulator)

2
templates/multiplatform-template/build.gradle.kts

@ -2,6 +2,8 @@ buildscript {
val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.1.0-m1-build57"
repositories {
// TODO: remove after new build is published
mavenLocal()
google()
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")

14
templates/multiplatform-template/desktop/build.gradle.kts

@ -1,10 +1,9 @@
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
id("org.jetbrains.compose")
java
application
}
kotlin {
@ -21,6 +20,13 @@ kotlin {
}
}
application {
mainClassName = "MainKt"
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "KotlinMultiplatformComposeDesktopApplication"
}
}
}
Loading…
Cancel
Save