Browse Source

Move to 1.0.0-rc12 (#1518)

* Move build_from_cli

* Migrate to 1.0.0-rc12

* Comment about LWJGL

* Update Tutorials
pull/1523/head
Igor Demin 3 years ago committed by GitHub
parent
commit
21473b13f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      README.md
  2. 2
      ci/compose-uber-jar/gradle.properties
  3. 2
      components/gradle.properties
  4. 2
      examples/codeviewer/build.gradle.kts
  5. 2
      examples/falling-balls/build.gradle.kts
  6. 2
      examples/imageviewer/build.gradle.kts
  7. 2
      examples/intellij-plugin/build.gradle.kts
  8. 2
      examples/issues/build.gradle.kts
  9. 2
      examples/notepad/build.gradle.kts
  10. 2
      examples/todoapp-lite/build.gradle.kts
  11. 2
      examples/widgets-gallery/build.gradle.kts
  12. 3
      experimental/build_from_cli/build_and_run_from_cli_example.sh
  13. 31
      experimental/build_from_cli/src/main/kotlin/main.kt
  14. 2
      experimental/components/gradle.properties
  15. 3
      experimental/lwjgl-integration/README.md
  16. 2
      experimental/lwjgl-integration/build.gradle.kts
  17. 36
      experimental/lwjgl-integration/src/main/kotlin/GlfwEvents.kt
  18. 2
      experimental/lwjgl-integration/src/main/kotlin/main.kt
  19. 2
      gradle-plugins/gradle.properties
  20. 2
      templates/desktop-template/build.gradle.kts
  21. 2
      templates/multiplatform-template/build.gradle.kts
  22. 2
      templates/web-template/build.gradle.kts
  23. 6
      tutorials/Getting_Started/README.md
  24. 2
      tutorials/Web/Getting_Started/README.md

3
README.md

@ -28,7 +28,7 @@ Preview functionality (check your application UI without building/running it) fo
* [widgets gallery](examples/widgets-gallery) - Gallery of standard widgets
* [IDEA plugin](examples/intellij-plugin) - Plugin for IDEA using Compose for Desktop
* [gradle-plugins](gradle-plugins) - a plugin, simplifying usage of Compose Multiplatform with Gradle
* [templates](templates) - new application templates (see `desktop-template/build_and_run_from_cli_example.sh` for using without Gradle)
* [templates](templates) - new application templates
* [tutorials](tutorials) - tutorials on using Compose Multiplatform
* [Getting started](tutorials/Getting_Started)
* [Image and icon manipulations](tutorials/Image_And_Icons_Manipulations)
@ -49,6 +49,7 @@ Preview functionality (check your application UI without building/running it) fo
* [cef](experimental/cef) - CEF integration in Jetpack Compose (somewhat outdated)
* [Video Player](experimental/components/VideoPlayer)
* [LWJGL integration](experimental/lwjgl-integration) - An example showing how to integrate Compose with [LWJGL](https://www.lwjgl.org)
* [CLI example](build_from_cli) - An example showing how to build Compose without Gradle
## Getting latest version of Compose Multiplatform ##

2
ci/compose-uber-jar/gradle.properties

@ -1,3 +1,3 @@
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0-alpha1
compose.version=1.0.0-rc12
kotlin.code.style=official

2
components/gradle.properties

@ -4,4 +4,4 @@ android.enableJetifier=true
kotlin.code.style=official
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0-beta1
compose.version=1.0.0-rc12

2
examples/codeviewer/build.gradle.kts

@ -8,7 +8,7 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-beta5")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-rc12")
classpath("com.android.tools.build:gradle:4.2.2")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.31"))

2
examples/falling-balls/build.gradle.kts

@ -6,7 +6,7 @@ plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-beta5"
id("org.jetbrains.compose") version "1.0.0-rc12"
}
group = "me.user"

2
examples/imageviewer/build.gradle.kts

@ -7,7 +7,7 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-beta5")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-rc12")
classpath("com.android.tools.build:gradle:4.1.0")
classpath(kotlin("gradle-plugin", version = "1.5.31"))
}

2
examples/intellij-plugin/build.gradle.kts

@ -5,7 +5,7 @@ plugins {
java
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-beta1"
id("org.jetbrains.compose") version "1.0.0-rc12"
id("idea")
}

2
examples/issues/build.gradle.kts

@ -8,7 +8,7 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-beta5")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-rc12")
classpath("com.android.tools.build:gradle:4.1.3")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.31"))

2
examples/notepad/build.gradle.kts

@ -5,7 +5,7 @@ plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version ("1.0.0-beta5")
id("org.jetbrains.compose") version ("1.0.0-rc12")
}
repositories {

2
examples/todoapp-lite/build.gradle.kts

@ -7,7 +7,7 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-beta5")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-rc12")
classpath("com.android.tools.build:gradle:4.1.0")
classpath(kotlin("gradle-plugin", version = "1.5.31"))
}

2
examples/widgets-gallery/build.gradle.kts

@ -8,7 +8,7 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-beta5")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-rc12")
classpath("com.android.tools.build:gradle:4.2.0")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.31"))

3
templates/desktop-template/build_and_run_from_cli_example.sh → experimental/build_from_cli/build_and_run_from_cli_example.sh

@ -28,12 +28,11 @@ COROUTINES_VERSION=1.3.6
COLLECTIONS_VERSION=0.3
SPACE_REPO="https://public.jetbrains.space/p/compose/packages/maven/"
MAVEN_CENTRAL="https://repo1.maven.org/maven2"
BINTRAY_KOTLINX="https://dl.bintray.com/kotlin/kotlinx"
mavenDep "$SPACE_REPO" "org/jetbrains/skiko" "skiko-jvm-runtime-$PLATFORM" "$SKIKO_VERSION"
mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-full" "$COMPOSE_VERSION"
mavenDep "$SPACE_REPO" "org/jetbrains/compose" "compose-compiler-hosted" "$COMPOSE_VERSION"
mavenDep "$BINTRAY_KOTLINX" "org/jetbrains/kotlinx" "kotlinx-collections-immutable-jvm" "$COLLECTIONS_VERSION"
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-collections-immutable-jvm" "$COLLECTIONS_VERSION"
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlinx" "kotlinx-coroutines-core" "$COROUTINES_VERSION"
mavenDep "$MAVEN_CENTRAL" "org/jetbrains/kotlin" "kotlin-stdlib" "$KOTLIN_VERSION"
if [ ! -f "deps/kotlin-compiler-$KOTLIN_VERSION.zip" ]; then

31
experimental/build_from_cli/src/main/kotlin/main.kt

@ -0,0 +1,31 @@
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
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.window.Window
import androidx.compose.ui.window.application
@Composable
@Preview
fun App() {
var text by remember { mutableStateOf("Hello, World!") }
MaterialTheme {
Button(onClick = {
text = "Hello, Desktop!"
}) {
Text(text)
}
}
}
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
App()
}
}

2
experimental/components/gradle.properties

@ -4,4 +4,4 @@ android.enableJetifier=true
kotlin.code.style=official
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=0.0.0-sync-2010-10-01-build393
compose.version=1.0.0-rc12

3
experimental/lwjgl-integration/README.md

@ -4,4 +4,5 @@ Note that:
- the integration is very experimental and can be unstable
- not all features are implemented
- not all features are currently supported (Accessibility, Input Methods)
- to pass some event information it is needed to pass it via AWT events (java.awt.KeyEvent and java.awt.MouseEvent). In the future versions of Compose we plan to get rid of the need of AWT events.
- to pass some event information it is needed to pass it via AWT events (java.awt.KeyEvent and java.awt.MouseEvent). In the future versions of Compose we plan to get rid of the need of AWT events.
- it has bugs (it doesn't show cursor in TextField)

2
experimental/lwjgl-integration/build.gradle.kts

@ -5,7 +5,7 @@ plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-alpha4-build411")
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-rc12")
}
repositories {

36
experimental/lwjgl-integration/src/main/kotlin/GlfwEvents.kt

@ -2,15 +2,14 @@ import androidx.compose.ui.ComposeScene
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.NativeKeyEvent
import androidx.compose.ui.input.mouse.MouseScrollOrientation
import androidx.compose.ui.input.mouse.MouseScrollUnit
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.unit.Density
import org.lwjgl.glfw.GLFW.*
import java.awt.Component
import java.awt.event.InputEvent
import java.awt.event.MouseEvent
import java.awt.event.MouseWheelEvent
import java.awt.event.KeyEvent as AwtKeyEvent
@OptIn(ExperimentalComposeUiApi::class)
fun ComposeScene.subscribeToGLFWEvents(windowHandle: Long) {
@ -22,7 +21,7 @@ fun ComposeScene.subscribeToGLFWEvents(windowHandle: Long) {
GLFW_RELEASE -> PointerEventType.Release
else -> PointerEventType.Unknown
},
mouseEvent = MouseEvent(getAwtMods(windowHandle))
nativeEvent = MouseEvent(getAwtMods(windowHandle))
)
}
@ -30,7 +29,7 @@ fun ComposeScene.subscribeToGLFWEvents(windowHandle: Long) {
sendPointerEvent(
position = Offset(xpos.toFloat(), ypos.toFloat()),
eventType = PointerEventType.Move,
mouseEvent = MouseEvent(getAwtMods(windowHandle))
nativeEvent = MouseEvent(getAwtMods(windowHandle))
)
}
@ -38,25 +37,24 @@ fun ComposeScene.subscribeToGLFWEvents(windowHandle: Long) {
sendPointerEvent(
position = glfwGetCursorPos(windowHandle),
eventType = if (entered) PointerEventType.Enter else PointerEventType.Exit,
mouseEvent = MouseEvent(getAwtMods(windowHandle))
nativeEvent = MouseEvent(getAwtMods(windowHandle))
)
}
glfwSetScrollCallback(windowHandle) { _, xoffset, yoffset ->
sendPointerScrollEvent(
sendPointerEvent(
eventType = PointerEventType.Scroll,
position = glfwGetCursorPos(windowHandle),
delta = MouseScrollUnit.Line(
if (yoffset != 0.0) -3 * yoffset.toFloat() else -3 * xoffset.toFloat()
),
orientation = if (yoffset != 0.0) MouseScrollOrientation.Vertical else MouseScrollOrientation.Horizontal
scrollDelta = Offset(xoffset.toFloat(), -yoffset.toFloat()),
nativeEvent = MouseWheelEvent(getAwtMods(windowHandle))
)
}
glfwSetKeyCallback(windowHandle) { _, key, _, action, _ ->
val awtId = when (action) {
GLFW_PRESS -> NativeKeyEvent.KEY_PRESSED
GLFW_REPEAT -> NativeKeyEvent.KEY_PRESSED
GLFW_RELEASE -> NativeKeyEvent.KEY_RELEASED
GLFW_PRESS -> AwtKeyEvent.KEY_PRESSED
GLFW_REPEAT -> AwtKeyEvent.KEY_PRESSED
GLFW_RELEASE -> AwtKeyEvent.KEY_RELEASED
else -> error("Unknown type")
}
val awtKey = glfwToAwtKeyCode(key)
@ -64,13 +62,13 @@ fun ComposeScene.subscribeToGLFWEvents(windowHandle: Long) {
// Note that we don't distinguish between Left/Right Shift, Del from numpad or not, etc.
// To distinguish we should change `location` parameter
sendKeyEvent(KeyEvent(awtId, time, getAwtMods(windowHandle), awtKey, 0.toChar(), NativeKeyEvent.KEY_LOCATION_STANDARD))
sendKeyEvent(KeyEvent(awtId, time, getAwtMods(windowHandle), awtKey, 0.toChar(), AwtKeyEvent.KEY_LOCATION_STANDARD))
}
glfwSetCharCallback(windowHandle) { _, codepoint ->
for (char in Character.toChars(codepoint)) {
val time = System.nanoTime() / 1_000_000
sendKeyEvent(KeyEvent(NativeKeyEvent.KEY_TYPED, time, getAwtMods(windowHandle), 0, char, NativeKeyEvent.KEY_LOCATION_UNKNOWN))
sendKeyEvent(KeyEvent(AwtKeyEvent.KEY_TYPED, time, getAwtMods(windowHandle), 0, char, AwtKeyEvent.KEY_LOCATION_UNKNOWN))
}
}
@ -90,13 +88,17 @@ private fun glfwGetCursorPos(window: Long): Offset {
val awtComponent = object : Component() {}
private fun KeyEvent(awtId: Int, time: Long, awtMods: Int, key: Int, char: Char, location: Int) = KeyEvent(
NativeKeyEvent(awtComponent, awtId, time, awtMods, key, char, location)
AwtKeyEvent(awtComponent, awtId, time, awtMods, key, char, location)
)
private fun MouseEvent(awtMods: Int) = MouseEvent(
awtComponent, 0, 0, awtMods, 0, 0, 1, false
)
private fun MouseWheelEvent(awtMods: Int) = MouseWheelEvent(
awtComponent, 0, 0, awtMods, 0, 0, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 3, 1
)
private fun getAwtMods(windowHandle: Long): Int {
var awtMods = 0
if (glfwGetMouseButton(windowHandle, GLFW_MOUSE_BUTTON_1) == GLFW_PRESS)

2
experimental/lwjgl-integration/src/main/kotlin/main.kt

@ -65,7 +65,7 @@ fun main() {
glfwDispatcher.runLoop()
composeScene.dispose()
composeScene.close()
glfwDestroyWindow(windowHandle)
exitProcess(0)

2
gradle-plugins/gradle.properties

@ -6,7 +6,7 @@ kotlin.code.style=official
# unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var.
#
# __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0-beta1
compose.version=1.0.0-rc12
compose.with.web=false
# A version of Gradle plugin, that will be published,

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

@ -5,7 +5,7 @@ plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-beta5")
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-rc12")
}
repositories {

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

@ -1,6 +1,6 @@
buildscript {
// __LATEST_COMPOSE_RELEASE_VERSION__
val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-beta5"
val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-rc12"
repositories {
mavenCentral()

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

@ -6,7 +6,7 @@ plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("multiplatform") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version ("1.0.0-beta5")
id("org.jetbrains.compose") version ("1.0.0-rc12")
}
repositories {

6
tutorials/Getting_Started/README.md

@ -40,11 +40,11 @@ just search for "Compose Multiplatform".
### Update the wizard plugin
The Compose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. In this example the latest version of the plugin was 1.0.0-alpha4-build362 and a compatible version of kotlin was 1.5.31. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site.
The Compose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. In this example the latest version of the plugin was 1.0.0-rc12 and a compatible version of kotlin was 1.5.31. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site.
```
plugins {
kotlin("jvm") version "1.5.31"
id("org.jetbrains.compose") version "1.0.0-alpha4-build362"
id("org.jetbrains.compose") version "1.0.0-rc12"
}
```
@ -80,7 +80,7 @@ import org.jetbrains.compose.compose
plugins {
kotlin("jvm") version "1.5.31"
id("org.jetbrains.compose") version "1.0.0-alpha4-build362"
id("org.jetbrains.compose") version "1.0.0-rc12"
}
repositories {

2
tutorials/Web/Getting_Started/README.md

@ -43,7 +43,7 @@ pluginManagement {
// Add compose gradle plugin
plugins {
kotlin("multiplatform") version "1.5.31"
id("org.jetbrains.compose") version "1.0.0-alpha4-build362"
id("org.jetbrains.compose") version "1.0.0-rc12"
}
// Add maven repositories

Loading…
Cancel
Save