Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:

env:
ANDROIDX_FORKS: :swing-ui-foundation :swing-ui-animation
# The Static Analysis job runs exactly the tasks the verify jobs exclude. A task `check` reaches
# that is missing here still runs in verify.
STATIC_ANALYSIS: >-
lint detekt detektMain detektTest detektTestFixtures
ktlintKotlinScriptCheck ktlintMainSourceSetCheck ktlintTestSourceSetCheck ktlintTestFixturesSourceSetCheck
# The verify jobs exclude staticAnalysis and the Static Analysis job runs it. `check` reaches the
# static checks (ktlint, detekt, Android Lint) only through staticAnalysis, so excluding it drops all of them.
STATIC_ANALYSIS: staticAnalysis

jobs:
verify:
Expand Down
19 changes: 9 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,16 @@ See [`docs/PERFORMANCE.md`](docs/PERFORMANCE.md) for the fixtures and the suites

## Quality gates (all must pass)

`build` runs every module's `check` - compilation, ktlint, detekt, the Compose lint checks, tests,
the coverage gates and `checkKotlinAbi` - plus `assemble`. Which of those a module carries depends on
`build` runs every module's `check` - compilation, `staticAnalysis` (ktlint, detekt and the Compose
lint checks), tests, the coverage gates and `checkKotlinAbi` - plus `assemble`. Which of those a module carries depends on
the convention plugins it applies: the vendored engine package under `swing-ui-animation` is
exempt from ktlint, detekt and Compose lint checks; the hand-written animation APIs and containers
remain under those gates. `samples/docs`, which holds generated code, carries none beyond compilation.
Two gates sit outside `build`: `buildSrc` is an included build the root-level tasks do not reach,
and `check` runs only the plain `detekt` task, not the type-resolution variants. So the full gate is
two commands, and they are what to run locally before pushing:
One gate sits outside `build`: `buildSrc` is an included build the root-level tasks do not reach. So
the full gate is one command, and it is what to run locally before pushing:

```bash
./gradlew :buildSrc:ktlintCheck :buildSrc:detekt detektMain detektTest detektTestFixtures
./gradlew build
./gradlew :buildSrc:ktlintCheck :buildSrc:detekt build
```

CI runs the same gates, plus `dokkaGenerate` and `publishToMavenLocal`, which `build` does not
Expand All @@ -106,9 +104,10 @@ Piece by piece:
```
- **`detekt`** - static analysis (`config/detekt/detekt.yml`, on top of the default config). Rules
that need the compile classpath fire only in the type-resolution variants, `detektMain`,
`detektTest` and `detektTestFixtures`, which the full gate runs by name. When scoping a run to one
module while iterating, invoke `:module:detektMain` and `:module:detektTest` rather than the plain
`:module:detekt` task, which runs without type resolution and stays silent on those rules. This
`detektTest`, `detektTestFixtures` and `detektFixtures`, which `staticAnalysis` runs for every
source set; `check` reaches them only through it. When scoping a run to one module while iterating,
invoke `:module:detektMain` and `:module:detektTest` rather than the plain `:module:detekt` task,
which runs without type resolution, stays silent on those rules and is not part of `check`. This
does not apply to `buildSrc`, whose plain `detekt` task (below) is its own gate.
- **`checkKotlinAbi`** - the Kotlin Gradle plugin's built-in ABI validation, comparing the compiled
surface against the committed `.api` dumps. If you change the **public API**, regenerate them and
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmark-utils/src/main/resources/META-INF/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This module contains source code copied and adapted from the Android Open Source
Project's Jetpack Compose test utilities, redistributed under the Apache License,
Version 2.0.

Original: androidx compose/test-utils 1.12.0, ComposeTestCase
(androidx commit 963bf914f78b389bdddef0da7f36bee19d897274)
Original: androidx compose/test-utils 1.13.0, ComposeTestCase
(androidx commit ac6d2ce3d991b07d9b981d616bddc6d3ab461eab)
Copyright The Android Open Source Project

Adaptations: the ComposeTestCase interface and the LayeredComposeTestCase class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks.withType<KotlinCompile>().matching { it.name == "compileFixturesKotlin" }.
}

dependencies {
add(fixtures.implementationConfigurationName, project)
add(fixtures.implementationConfigurationName, project(path))
}

(components["java"] as AdhocComponentWithVariants).run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
package buildsrc.convention

import dev.detekt.gradle.Detekt
import org.gradle.api.Task
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType

Expand Down Expand Up @@ -59,6 +61,33 @@ lint {
ignoreTestSources = true
}

private val staticAnalysis: TaskProvider<Task> =
tasks.register("staticAnalysis") {
group = "verification"
description = "Runs ktlint, Android Lint, and detekt with type resolution on every source set."
dependsOn("ktlintCheck", "lint")
dependsOn(
tasks.withType<Detekt>().matching { task ->
task.name != "detekt" && !task.name.endsWith("SourceSet")
},
)
}

// The ktlint, detekt and Android Lint plugins each wire their task into `check`. Rewiring them behind
// staticAnalysis lets `-x staticAnalysis` drop every static check from `check`.
private fun Task.isStaticCheck(): Boolean = name == "lint" || name == "detekt" || name.startsWith("ktlint")

afterEvaluate {
tasks.named("check") {
setDependsOn(
dependsOn.filterNot { dependency ->
dependency is TaskProvider<*> && dependency.get().isStaticCheck()
},
)
dependsOn(staticAnalysis)
}
}

dependencies {
// The Compose runtime publishes the checks for its own contracts as an artifact. They are the
// authors' checks, kept current with the runtime this project compiles against, so the runtime is
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ org.gradle.jvmargs=-Xmx4g \
-Dkotlin.daemon.jvm.options=-Xmx4g,-XX:MaxMetaspaceSize=1g \
-Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.tooling.parallel=true
org.gradle.welcome=never
org.gradle.caching=true
org.gradle.configuration-cache=true
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[versions]
androidLint = "9.3.2"
androidxAnnotation = "1.8.1"
androidxCollection = "1.5.0"
androidxLifecycle = "2.9.4"
androidxNavigation3 = "1.1.0"
androidLint = "9.5.0"
androidxAnnotation = "1.11.0"
androidxCollection = "1.7.0"
androidxLifecycle = "2.11.0"
androidxNavigation3 = "1.2.1"
androidxTracing = "2.0.0"
compose = "1.10.0"
composeRules = "0.6.6"
coroutines = "1.9.0"
compose = "1.12.0"
composeRules = "0.6.8"
coroutines = "1.11.0"
kotlinxBenchmark = "0.4.14"
detekt = "2.0.0-alpha.6"
dokka = "2.2.0"
jetbrainsAnnotations = "23.0.0"
jetbrainsAnnotations = "26.1.0"
knit = "0.5.1"
kotlin = "2.4.20"
ktlint = "1.8.0"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
52 changes: 41 additions & 11 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package org.jetbrains.compose.swing.samples.widgets
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
Expand Down Expand Up @@ -141,7 +142,7 @@ internal fun ShowcaseShell(alignmentGuidesShown: Boolean = true) {
val sectionsState = rememberListState(setOf(showcaseSections.indexOfFirst { it.title == current }))
// Driving the selection from the back stack does not push, so a pop moves the highlight without pushing the
// row it lands on: a selection naming the section already on top is not a new destination.
LaunchedEffect(current) {
SideEffect(current) {
sectionsState.selectedIndices = setOf(showcaseSections.indexOfFirst { it.title == current })
}
LaunchedEffect(sectionsState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package org.jetbrains.compose.swing.samples.widgets.animation

import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
Expand All @@ -13,8 +13,7 @@ import org.jetbrains.compose.swing.animation.DeferredAnimatedVisibility
import org.jetbrains.compose.swing.animation.MutableContentTransform
import org.jetbrains.compose.swing.animation.MutableTransform
import org.jetbrains.compose.swing.animation.core.DeferredTransitionState
import org.jetbrains.compose.swing.animation.core.ExperimentalDeferredTransitionApi
import org.jetbrains.compose.swing.animation.core.rememberTransition
import org.jetbrains.compose.swing.animation.core.rememberDeferredTransition
import org.jetbrains.compose.swing.animation.fadeIn
import org.jetbrains.compose.swing.animation.fadeOut
import org.jetbrains.compose.swing.animation.scaleIn
Expand All @@ -39,7 +38,6 @@ import java.awt.Dimension
import java.awt.Point
import javax.swing.SwingConstants

@OptIn(ExperimentalDeferredTransitionApi::class)
@Composable
internal fun ColumnScope.DeferredDismissCard() {
ExampleCard("DeferredAnimatedVisibility (experimental)") {
Expand All @@ -48,7 +46,7 @@ internal fun ColumnScope.DeferredDismissCard() {
// The slider goes back to zero once the phase is over, never in the handler that ends it: the
// phase is still standing there, so the transform would move the card first and the transition
// would take it over from that value instead of from where the gesture left it.
LaunchedEffect(state.pendingTargetState) {
SideEffect(state.pendingTargetState) {
if (state.pendingTargetState == null) dragged = 0
}
val transform = remember { MutableTransform() }
Expand All @@ -63,7 +61,7 @@ internal fun ColumnScope.DeferredDismissCard() {
"Preview a dismissal with the slider. Commit lets the exit continue from that position; Cancel " +
"returns the order. The slider stands in for a pointer drag.",
)
rememberTransition(state).DeferredAnimatedVisibility(
rememberDeferredTransition(state).DeferredAnimatedVisibility(
visible = { it },
enter = fadeIn() + scaleIn(initialScale = 0.8f),
exit = fadeOut() + scaleOut(targetScale = 0.6f) + slideOutHorizontally { it / 2 },
Expand Down Expand Up @@ -93,29 +91,28 @@ internal fun ColumnScope.DeferredDismissCard() {
}
}

@OptIn(ExperimentalDeferredTransitionApi::class)
@Composable
internal fun ColumnScope.DeferredPageSwipeCard() {
ExampleCard("DeferredAnimatedContent (experimental)") {
val pages = listOf("Inbox · 3 unread", "Drafts · 1 unsent", "Archive · 12 messages")
val state = remember { DeferredTransitionState(0) }
var swiped by remember { mutableIntStateOf(0) }
LaunchedEffect(state.pendingTargetState) {
SideEffect(state.pendingTargetState) {
if (state.pendingTargetState == null) swiped = 0
}

WrappedCaption(
"Preview a swipe between folders. Both pages follow the slider; Commit completes the " +
"swipe and Cancel restores the current folder.",
)
rememberTransition(state).DeferredAnimatedContent(
rememberDeferredTransition(state).DeferredAnimatedContent(
transitionSpec = {
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Left) togetherWith
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Left)
},
mutableTransformSpec = {
MutableContentTransform {
targetContentTransform { fullSize -> offset = Point(-fullSize.width * swiped / 100, 0) }
targetContentTransform { fullSize -> offset = Point(fullSize.width * (100 - swiped) / 100, 0) }
initialContentTransform { fullSize -> offset = Point(-fullSize.width * swiped / 100, 0) }
}
},
Expand Down
Loading
Loading