Skip to content

Commit

Permalink
Merge pull request #157 from elihart/eli-compose_update_1_9_10
Browse files Browse the repository at this point in the history
Support Compose 1.5
  • Loading branch information
rjrjr authored Nov 1, 2023
2 parents 4ff656a + a94ab3e commit 028511d
Show file tree
Hide file tree
Showing 31 changed files with 253 additions and 115 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build with Gradle
run: ./gradlew build

Expand All @@ -36,10 +36,10 @@ jobs:
- 30
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Change Log
==========

Version 3.0.0
-------------

_2023-10-30_

Compose 1.5 is now supported. Due to breaking API changes within the Compose runtime, this version
is not compatible with earlier versions of Compose. If you need to use an earlier version of Compose,
use a 2.x version of Radiography.

The ScannableView.ComposeView has a new property, `semanticsConfigurations`, which exposes SemanticsConfiguration objects
from both Modifiers and the new Semantics tree. In newer versions of Compose, SemanticsConfigurations cannot
be read from the Modifier list, and are present only in the Semantics tree,
so if you were previously using the `modifiers` property for this you should switch to
using `semanticsConfigurations` instead.

Version 2.4.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Contributing
============

If you would like to contribute code to Workflow you can do so through GitHub by
If you would like to contribute code to Radiography you can do so through GitHub by
forking the repository and sending a pull request.

When submitting code, please make every effort to follow existing conventions
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ subprojects {
repositories {
google()
mavenCentral()
jcenter()
}

apply(plugin = "org.jlleitschuh.gradle.ktlint")
Expand Down
4 changes: 0 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ plugins {
repositories {
mavenCentral()
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
}
20 changes: 10 additions & 10 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ object Versions {
* To change this in the IDE, use `systemProp.square.kotlinVersion=x.y.z` in your
* `~/.gradle/gradle.properties` file.
*/
val KotlinCompiler = System.getProperty("square.kotlinVersion") ?: "1.5.21"
val KotlinCompiler = System.getProperty("square.kotlinVersion") ?: "1.9.10"

const val AndroidXTest = "1.4.0"
const val Compose = "1.0.1"
const val AndroidXTest = "1.5.0"
const val Compose = "1.5.3"
}

object Dependencies {
object Build {
const val Android = "com.android.tools.build:gradle:7.0.0"
const val Android = "com.android.tools.build:gradle:8.1.2"
const val MavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.14.0"
val Kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KotlinCompiler}"
const val Ktlint = "org.jlleitschuh.gradle:ktlint-gradle:9.2.1"
const val Ktlint = "org.jlleitschuh.gradle:ktlint-gradle:11.6.1"
const val BinaryCompatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0"
const val Dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0"
const val Dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
}

const val AppCompat = "androidx.appcompat:appcompat:1.3.1"
const val ConstraintLayout = "androidx.constraintlayout:constraintlayout:2.1.0"
const val Curtains = "com.squareup.curtains:curtains:1.2.2"
const val JUnit = "junit:junit:4.13"
const val Mockito = "org.mockito:mockito-core:3.11.2"
const val Robolectric = "org.robolectric:robolectric:4.6.1"
const val Robolectric = "org.robolectric:robolectric:4.10.3"
const val Truth = "com.google.truth:truth:1.1.3"

class Compose(composeVersion: String = Versions.Compose) {
Expand All @@ -37,9 +37,9 @@ object Dependencies {

object InstrumentationTests {
const val Core = "androidx.test:core:${Versions.AndroidXTest}"
const val Espresso = "androidx.test.espresso:espresso-core:3.4.0"
const val JUnit = "androidx.test.ext:junit:1.1.3"
const val Orchestrator = "androidx.test:orchestrator:${Versions.AndroidXTest}"
const val Espresso = "androidx.test.espresso:espresso-core:3.5.1"
const val JUnit = "androidx.test.ext:junit:1.1.5"
const val Orchestrator = "androidx.test:orchestrator:1.4.2"
const val Rules = "androidx.test:rules:${Versions.AndroidXTest}"
const val Runner = "androidx.test:runner:${Versions.AndroidXTest}"
}
Expand Down
8 changes: 5 additions & 3 deletions compose-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

android {
compileSdk = 30
compileSdk = 34

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -15,7 +15,7 @@ android {

defaultConfig {
minSdk = 21
targetSdk = 30
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -28,12 +28,14 @@ android {
kotlinCompilerExtensionVersion = Versions.Compose
}

packagingOptions {
packaging {
resources.excludes += listOf(
"META-INF/AL2.0",
"META-INF/LGPL2.1",
)
}
namespace = "com.squareup.radiography.test.compose.empty"
testNamespace = "com.squareup.radiography.test.compose"
}

tasks.withType<KotlinCompile> {
Expand Down
3 changes: 1 addition & 2 deletions compose-tests/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.squareup.radiography.test.compose">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name="androidx.activity.ComponentActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,14 @@ class ComposeUiTest {
"""
|CompositionLocalProvider:
|${BLANK}CompositionLocalProvider { test-tag:"parent" }
|${BLANK}╰─LazyColumn { test-tag:"list", vertical-scroll-axis-range:"ScrollAxisRange(value=0.0, maxValue=Infinity)" }
|${BLANK}╰─LazyColumn { test-tag:"list", vertical-scroll-axis-range:"ScrollAxisRange(value=0.0, maxValue=0.0)" }
|${BLANK} ├─<subcomposition of LazyColumn>
|${BLANK} │ ╰─SaveableStateProvider { test-tag:"child:1" }
|${BLANK} │ ╰─SkippableItem { test-tag:"child:1" }
|${BLANK} ├─<subcomposition of LazyColumn>
|${BLANK} │ ├─SaveableStateProvider { test-tag:"child:2" }
|${BLANK} │ ╰─SaveableStateProvider { test-tag:"child:2 (even)" }
|${BLANK} │ ├─SkippableItem { test-tag:"child:2" }
|${BLANK} │ ╰─SkippableItem { test-tag:"child:2 (even)" }
|${BLANK} ╰─<subcomposition of LazyColumn>
|${BLANK} ╰─SaveableStateProvider { test-tag:"child:3" }
|${BLANK} ╰─SkippableItem { test-tag:"child:3" }
|
""".trimMargin()
)
Expand Down
2 changes: 1 addition & 1 deletion compose-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.squareup.radiography.test.compose.empty" />
<manifest />
15 changes: 8 additions & 7 deletions compose-unsupported-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ plugins {
* Allows using a different version of Compose to validate that we degrade gracefully on apps
* built with unsupported Compose versions.
*/
val oldComposeVersion = "1.0.1"
// Older version of Compose requires an older version of Kotlin.
val oldComposeCompiler = "1.5.21"
val oldComposeVersion = "1.3.0"

android {
compileSdk = 30
compileSdk = 34

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -23,7 +21,7 @@ android {

defaultConfig {
minSdk = 21
targetSdk = 30
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -33,15 +31,17 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = oldComposeVersion
kotlinCompilerExtensionVersion = Versions.Compose
}

packagingOptions {
packaging {
resources.excludes += listOf(
"META-INF/AL2.0",
"META-INF/LGPL2.1"
)
}
namespace = "com.squareup.radiography.test.compose.unsupported.empty"
testNamespace = "com.squareup.radiography.test.compose.unsupported"
}

tasks.withType<KotlinCompile> {
Expand All @@ -60,6 +60,7 @@ dependencies {
androidTestImplementation(Dependencies.Compose(oldComposeVersion).Material)
androidTestImplementation(Dependencies.Compose(oldComposeVersion).Testing)
androidTestImplementation(Dependencies.InstrumentationTests.Rules)
androidTestImplementation(Dependencies.InstrumentationTests.JUnit)
androidTestImplementation(Dependencies.InstrumentationTests.Runner)
androidTestImplementation(Dependencies.Truth)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.squareup.radiography.test.compose.unsupported">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name="androidx.activity.ComponentActivity" />
Expand Down
2 changes: 1 addition & 1 deletion compose-unsupported-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.squareup.radiography.test.compose.unsupported.empty" />
<manifest />
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
94 changes: 93 additions & 1 deletion radiography/api/radiography.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public abstract interface annotation class radiography/ExperimentalRadiographyCo

public final class radiography/Radiography {
public static final field INSTANCE Lradiography/Radiography;
public final synthetic fun renderScannableViewTree$radiography_release (Ljava/lang/StringBuilder;Lradiography/ScannableView;Ljava/util/List;Lradiography/ViewFilter;)V
public static final fun scan ()Ljava/lang/String;
public static final fun scan (Lradiography/ScanScope;)Ljava/lang/String;
public static final fun scan (Lradiography/ScanScope;Ljava/util/List;)Ljava/lang/String;
Expand All @@ -21,6 +22,7 @@ public abstract interface class radiography/ScanScope {

public final class radiography/ScanScopes {
public static final field AllWindowsScope Lradiography/ScanScope;
public static final field EmptyScope Lradiography/ScanScope;
public static final field FocusedWindowScope Lradiography/ScanScope;
public static final field INSTANCE Lradiography/ScanScopes;
public static final fun composeTestTagScope (Ljava/lang/String;)Lradiography/ScanScope;
Expand Down Expand Up @@ -49,15 +51,21 @@ public final class radiography/ScannableView$ChildRenderingError : radiography/S
}

public final class radiography/ScannableView$ComposeView : radiography/ScannableView {
public fun <init> (Ljava/lang/String;IILjava/util/List;Lkotlin/sequences/Sequence;)V
public fun <init> (Ljava/lang/String;IILjava/util/List;Ljava/util/List;Lkotlin/sequences/Sequence;)V
public fun getChildren ()Lkotlin/sequences/Sequence;
public fun getDisplayName ()Ljava/lang/String;
public final fun getHeight ()I
public final fun getModifiers ()Ljava/util/List;
public final fun getSemanticsConfigurations ()Ljava/util/List;
public final fun getSemanticsNodes ()Ljava/util/List;
public final fun getWidth ()I
public fun toString ()Ljava/lang/String;
}

public final class radiography/ScannableViewKt {
public static final fun toScannableView (Lradiography/internal/ComposeLayoutInfo;)Lradiography/ScannableView;
}

public abstract interface class radiography/ViewFilter {
public abstract fun matches (Lradiography/ScannableView;)Z
}
Expand All @@ -67,6 +75,7 @@ public final class radiography/ViewFilters {
public static final field NoFilter Lradiography/ViewFilter;
public static final fun and (Lradiography/ViewFilter;Lradiography/ViewFilter;)Lradiography/ViewFilter;
public static final fun androidViewFilterFor (Ljava/lang/Class;Lkotlin/jvm/functions/Function1;)Lradiography/ViewFilter;
public final synthetic fun androidViewFilterFor (Lkotlin/jvm/functions/Function1;)Lradiography/ViewFilter;
public static final fun skipComposeTestTagsFilter ([Ljava/lang/String;)Lradiography/ViewFilter;
public static final fun skipIdsViewFilter ([I)Lradiography/ViewFilter;
}
Expand All @@ -82,6 +91,10 @@ public final class radiography/ViewStateRenderers {
public static final field INSTANCE Lradiography/ViewStateRenderers;
public static final field ViewRenderer Lradiography/ViewStateRenderer;
public static final fun androidViewStateRendererFor (Ljava/lang/Class;Lkotlin/jvm/functions/Function2;)Lradiography/ViewStateRenderer;
public final synthetic fun androidViewStateRendererFor (Lkotlin/jvm/functions/Function2;)Lradiography/ViewStateRenderer;
public final fun appendTextValue$radiography_release (Lradiography/AttributeAppendable;Ljava/lang/String;Ljava/lang/CharSequence;ZI)V
public static final synthetic fun composeTextRenderer$radiography_release (ZI)Lradiography/ViewStateRenderer;
public static synthetic fun composeTextRenderer$radiography_release$default (ZIILjava/lang/Object;)Lradiography/ViewStateRenderer;
public static final fun textViewRenderer ()Lradiography/ViewStateRenderer;
public static final fun textViewRenderer (Z)Lradiography/ViewStateRenderer;
public static final fun textViewRenderer (ZI)Lradiography/ViewStateRenderer;
Expand All @@ -93,3 +106,82 @@ public final class radiography/ViewsKt {
public static synthetic fun scan$default (Landroid/view/View;Ljava/util/List;Lradiography/ViewFilter;ILjava/lang/Object;)Ljava/lang/String;
}

public abstract class radiography/internal/ComposeLayoutInfo {
}

public final class radiography/internal/ComposeLayoutInfo$AndroidViewInfo : radiography/internal/ComposeLayoutInfo {
public fun <init> (Landroid/view/View;)V
public final fun component1 ()Landroid/view/View;
public final fun copy (Landroid/view/View;)Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;Landroid/view/View;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$AndroidViewInfo;
public fun equals (Ljava/lang/Object;)Z
public final fun getView ()Landroid/view/View;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class radiography/internal/ComposeLayoutInfo$LayoutNodeInfo : radiography/internal/ComposeLayoutInfo {
public fun <init> (Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Landroidx/compose/ui/unit/IntRect;
public final fun component3 ()Ljava/util/List;
public final fun component4 ()Lkotlin/sequences/Sequence;
public final fun component5 ()Ljava/util/List;
public final fun copy (Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;)Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Ljava/util/List;Lkotlin/sequences/Sequence;Ljava/util/List;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$LayoutNodeInfo;
public fun equals (Ljava/lang/Object;)Z
public final fun getBounds ()Landroidx/compose/ui/unit/IntRect;
public final fun getChildren ()Lkotlin/sequences/Sequence;
public final fun getModifiers ()Ljava/util/List;
public final fun getName ()Ljava/lang/String;
public final fun getSemanticsNodes ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class radiography/internal/ComposeLayoutInfo$SubcompositionInfo : radiography/internal/ComposeLayoutInfo {
public fun <init> (Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Landroidx/compose/ui/unit/IntRect;
public final fun component3 ()Lkotlin/sequences/Sequence;
public final fun copy (Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;)Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;
public static synthetic fun copy$default (Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;Ljava/lang/String;Landroidx/compose/ui/unit/IntRect;Lkotlin/sequences/Sequence;ILjava/lang/Object;)Lradiography/internal/ComposeLayoutInfo$SubcompositionInfo;
public fun equals (Ljava/lang/Object;)Z
public final fun getBounds ()Landroidx/compose/ui/unit/IntRect;
public final fun getChildren ()Lkotlin/sequences/Sequence;
public final fun getName ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class radiography/internal/ComposeLayoutInfoKt {
public static final fun computeLayoutInfos (Landroidx/compose/ui/tooling/data/Group;Ljava/lang/String;Landroidx/compose/ui/semantics/SemanticsOwner;)Lkotlin/sequences/Sequence;
public static synthetic fun computeLayoutInfos$default (Landroidx/compose/ui/tooling/data/Group;Ljava/lang/String;Landroidx/compose/ui/semantics/SemanticsOwner;ILjava/lang/Object;)Lkotlin/sequences/Sequence;
}

public final class radiography/internal/ComposeViewsKt {
public static final field COMPOSE_UNSUPPORTED_MESSAGE Ljava/lang/String;
public static final fun composeRenderingError (Ljava/lang/LinkageError;)Lradiography/ScannableView;
public static final fun getComposeScannableViews (Landroid/view/View;)Lkotlin/Pair;
public static final fun getMightBeComposeView (Landroid/view/View;)Z
public static final fun isComposeAvailable ()Z
}

public final class radiography/internal/CompositionContextsKt {
public static final fun getCompositionContexts (Landroidx/compose/ui/tooling/data/Group;)Lkotlin/sequences/Sequence;
public static final fun tryGetComposers (Landroidx/compose/runtime/CompositionContext;)Ljava/lang/Iterable;
}

public final class radiography/internal/RenderTreeStringKt {
public static final fun renderTreeString (Ljava/lang/StringBuilder;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
}

public final class radiography/internal/SemanticsKt {
public static final fun findTestTags (Lradiography/ScannableView$ComposeView;)Lkotlin/sequences/Sequence;
}

public final class radiography/internal/StringsKt {
public static final fun ellipsize (Ljava/lang/CharSequence;I)Ljava/lang/CharSequence;
public static final fun formatPixelDimensions (II)Ljava/lang/String;
}

Loading

0 comments on commit 028511d

Please sign in to comment.