From 44a138a58f960c49c322ddd87e0e4f9fbee18dbb Mon Sep 17 00:00:00 2001 From: John Rodriguez Date: Mon, 29 Jan 2024 00:32:20 -0500 Subject: [PATCH] Restrict Paparazzi's public API --- build.gradle | 7 + gradle/libs.versions.toml | 1 + .../api/paparazzi-annotations.api | 3 + .../api/paparazzi-gradle-plugin.api | 27 ++ .../paparazzi/gradle/PrepareResourcesTask.kt | 2 +- .../cash/paparazzi/gradle/utils/FileUtils.kt | 4 +- .../api/paparazzi-preview-processor.api | 11 + paparazzi/api/paparazzi.api | 259 ++++++++++++++++++ .../java/app/cash/paparazzi/DeviceConfig.kt | 1 + .../java/app/cash/paparazzi/Environment.kt | 2 +- .../paparazzi/agent/InterceptorRegistrar.kt | 2 +- .../paparazzi/internal/ComposeViewAdapter.kt | 2 +- .../ChoreographerDelegateInterceptor.kt | 2 +- .../interceptors/EditModeInterceptor.kt | 2 +- .../IInputMethodManagerInterceptor.kt | 2 +- .../MatrixMatrixMultiplicationInterceptor.kt | 2 +- .../MatrixVectorMultiplicationInterceptor.kt | 2 +- .../interceptors/ResourcesInterceptor.kt | 2 +- .../interceptors/ServiceManagerInterceptor.kt | 2 +- .../internal/parsers/AaptAttrParser.kt | 2 +- .../internal/parsers/AaptAttrSnapshot.kt | 2 +- .../internal/parsers/AttributeSnapshot.kt | 2 +- .../internal/parsers/InMemoryParser.kt | 2 +- .../internal/parsers/ResourceParser.kt | 2 +- .../paparazzi/internal/parsers/TagSnapshot.kt | 4 +- .../resources/AarSourceResourceRepository.kt | 2 +- .../AbstractAarResourceRepository.kt | 2 +- .../resources/CommentTrackingXmlPullParser.kt | 2 +- .../resources/FrameworkResourceRepository.kt | 2 +- .../resources/LoadableResourceRepository.kt | 2 +- .../resources/LocalResourceRepository.kt | 2 +- .../internal/resources/NamespaceResolver.kt | 2 +- .../internal/resources/Pseudolocalizer.kt | 10 +- .../resources/RepositoryConfiguration.kt | 2 +- .../internal/resources/RepositoryLoader.kt | 2 +- .../internal/resources/ResourceFile.kt | 2 +- .../resources/ResourceFolderRepository.kt | 2 +- .../internal/resources/ResourceNamespacing.kt | 2 +- .../resources/ResourceSerializationUtil.kt | 2 +- .../internal/resources/ResourceSourceFile.kt | 2 +- .../resources/ResourceSourceFileImpl.kt | 2 +- .../internal/resources/ResourceUrlParser.kt | 2 +- .../resources/base/BasicArrayResourceItem.kt | 2 +- .../resources/base/BasicAttrReference.kt | 2 +- .../resources/base/BasicAttrResourceItem.kt | 2 +- .../base/BasicDensityBasedFileResourceItem.kt | 2 +- .../resources/base/BasicFileResourceItem.kt | 2 +- .../base/BasicForeignAttrResourceItem.kt | 2 +- .../base/BasicPluralsResourceItem.kt | 2 +- .../resources/base/BasicResourceItem.kt | 2 +- .../resources/base/BasicStyleResourceItem.kt | 2 +- .../base/BasicStyleableResourceItem.kt | 2 +- .../base/BasicTextValueResourceItem.kt | 2 +- .../resources/base/BasicValueResourceItem.kt | 2 +- .../base/BasicValueResourceItemBase.kt | 2 +- .../internal/parsers/InMemoryParserTest.kt | 2 +- 56 files changed, 364 insertions(+), 55 deletions(-) create mode 100644 paparazzi-annotations/api/paparazzi-annotations.api create mode 100644 paparazzi-gradle-plugin/api/paparazzi-gradle-plugin.api create mode 100644 paparazzi-preview-processor/api/paparazzi-preview-processor.api create mode 100644 paparazzi/api/paparazzi.api diff --git a/build.gradle b/build.gradle index da1ef269bf..3d1454ffdd 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ buildscript { dependencies { classpath libs.plugin.kotlin + classpath libs.plugin.kotlinApiDump classpath libs.plugin.android classpath libs.plugin.mavenPublish classpath libs.plugin.dokka @@ -25,6 +26,12 @@ buildscript { } } +apply plugin: 'binary-compatibility-validator' + +apiValidation { + ignoredProjects += ['libs', 'sample'] +} + subprojects { version = property("VERSION_NAME") as String diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c0345e23b9..840814889a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -74,6 +74,7 @@ plugin-android = { module = "com.android.tools.build:gradle", version.ref = "agp plugin-buildConfig = { module = "com.github.gmazzo.buildconfig:plugin", version = "5.3.5" } plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.10" } plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +plugin-kotlinApiDump = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version = '0.13.2' } plugin-ksp = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } plugin-mavenPublish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.27.0" } plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" } diff --git a/paparazzi-annotations/api/paparazzi-annotations.api b/paparazzi-annotations/api/paparazzi-annotations.api new file mode 100644 index 0000000000..a21472ea68 --- /dev/null +++ b/paparazzi-annotations/api/paparazzi-annotations.api @@ -0,0 +1,3 @@ +public abstract interface annotation class app/cash/paparazzi/annotations/Paparazzi : java/lang/annotation/Annotation { +} + diff --git a/paparazzi-gradle-plugin/api/paparazzi-gradle-plugin.api b/paparazzi-gradle-plugin/api/paparazzi-gradle-plugin.api new file mode 100644 index 0000000000..9cc9562223 --- /dev/null +++ b/paparazzi-gradle-plugin/api/paparazzi-gradle-plugin.api @@ -0,0 +1,27 @@ +public final class app/cash/paparazzi/gradle/PaparazziPlugin : org/gradle/api/Plugin { + public fun ()V + public synthetic fun apply (Ljava/lang/Object;)V + public fun apply (Lorg/gradle/api/Project;)V +} + +public class app/cash/paparazzi/gradle/PaparazziPlugin$PaparazziTask : org/gradle/api/DefaultTask { + public fun ()V + public fun setTestNameIncludePatterns (Ljava/util/List;)Lapp/cash/paparazzi/gradle/PaparazziPlugin$PaparazziTask; +} + +public abstract class app/cash/paparazzi/gradle/PrepareResourcesTask : org/gradle/api/DefaultTask { + public fun ()V + public abstract fun getAarAssetDirs ()Lorg/gradle/api/file/ConfigurableFileCollection; + public abstract fun getAarExplodedDirs ()Lorg/gradle/api/file/ConfigurableFileCollection; + public abstract fun getArtifactFiles ()Lorg/gradle/api/file/ConfigurableFileCollection; + public abstract fun getCompileSdkVersion ()Lorg/gradle/api/provider/Property; + public abstract fun getModuleResourceDirs ()Lorg/gradle/api/provider/ListProperty; + public abstract fun getNonTransitiveRClassEnabled ()Lorg/gradle/api/provider/Property; + public abstract fun getPackageName ()Lorg/gradle/api/provider/Property; + public abstract fun getPaparazziResources ()Lorg/gradle/api/file/RegularFileProperty; + public abstract fun getProjectAssetDirs ()Lorg/gradle/api/provider/ListProperty; + public abstract fun getProjectResourceDirs ()Lorg/gradle/api/provider/ListProperty; + public abstract fun getTargetSdkVersion ()Lorg/gradle/api/provider/Property; + public final fun writeResourcesFile ()V +} + diff --git a/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt b/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt index 65dda4e4ce..a350701dff 100644 --- a/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt +++ b/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt @@ -108,7 +108,7 @@ abstract class PrepareResourcesTask : DefaultTask() { } @JsonClass(generateAdapter = true) - data class Config( + internal data class Config( val mainPackage: String, val targetSdkVersion: String, val platformDir: String, diff --git a/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/utils/FileUtils.kt b/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/utils/FileUtils.kt index 29ff8b33b8..a78374464d 100644 --- a/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/utils/FileUtils.kt +++ b/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/utils/FileUtils.kt @@ -19,8 +19,8 @@ import org.gradle.api.file.Directory import org.gradle.api.file.FileCollection import java.io.File -fun FileCollection.relativize(directory: Directory) = files.map(directory::relativize) +internal fun FileCollection.relativize(directory: Directory) = files.map(directory::relativize) -fun Directory.relativize(child: File): String { +internal fun Directory.relativize(child: File): String { return asFile.toPath().relativize(child.toPath()).toFile().invariantSeparatorsPath } diff --git a/paparazzi-preview-processor/api/paparazzi-preview-processor.api b/paparazzi-preview-processor/api/paparazzi-preview-processor.api new file mode 100644 index 0000000000..4c9c65ac6a --- /dev/null +++ b/paparazzi-preview-processor/api/paparazzi-preview-processor.api @@ -0,0 +1,11 @@ +public final class app/cash/paparazzi/preview/processor/PreviewProcessor : com/google/devtools/ksp/processing/SymbolProcessor { + public fun (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)V + public fun process (Lcom/google/devtools/ksp/processing/Resolver;)Ljava/util/List; +} + +public final class app/cash/paparazzi/preview/processor/PreviewProcessorProvider : com/google/devtools/ksp/processing/SymbolProcessorProvider { + public fun ()V + public fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lapp/cash/paparazzi/preview/processor/PreviewProcessor; + public synthetic fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lcom/google/devtools/ksp/processing/SymbolProcessor; +} + diff --git a/paparazzi/api/paparazzi.api b/paparazzi/api/paparazzi.api new file mode 100644 index 0000000000..0f80816153 --- /dev/null +++ b/paparazzi/api/paparazzi.api @@ -0,0 +1,259 @@ +public final class app/cash/paparazzi/DeviceConfig { + public static final field $stable I + public static final field Companion Lapp/cash/paparazzi/DeviceConfig$Companion; + public static final field GALAXY_WATCH4_CLASSIC_LARGE Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_10 Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_4 Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_5 Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_5_LAND Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_7 Lapp/cash/paparazzi/DeviceConfig; + public static final field NEXUS_7_2012 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_2 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_2_XL Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_3 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_3A Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_3A_XL Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_3_XL Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_4 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_4A Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_4_XL Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_5 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_6 Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_6_PRO Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_C Lapp/cash/paparazzi/DeviceConfig; + public static final field PIXEL_XL Lapp/cash/paparazzi/DeviceConfig; + public static final field WEAR_OS_SMALL_ROUND Lapp/cash/paparazzi/DeviceConfig; + public static final field WEAR_OS_SQUARE Lapp/cash/paparazzi/DeviceConfig; + public fun ()V + public fun (IIIILcom/android/resources/ScreenOrientation;Lcom/android/resources/UiMode;Lcom/android/resources/NightMode;Lcom/android/resources/Density;FLcom/android/resources/LayoutDirection;Ljava/lang/String;Lcom/android/resources/ScreenRatio;Lcom/android/resources/ScreenSize;Lcom/android/resources/Keyboard;Lcom/android/resources/TouchScreen;Lcom/android/resources/KeyboardState;ZLcom/android/resources/Navigation;Lcom/android/resources/ScreenRound;Ljava/lang/String;)V + public synthetic fun (IIIILcom/android/resources/ScreenOrientation;Lcom/android/resources/UiMode;Lcom/android/resources/NightMode;Lcom/android/resources/Density;FLcom/android/resources/LayoutDirection;Ljava/lang/String;Lcom/android/resources/ScreenRatio;Lcom/android/resources/ScreenSize;Lcom/android/resources/Keyboard;Lcom/android/resources/TouchScreen;Lcom/android/resources/KeyboardState;ZLcom/android/resources/Navigation;Lcom/android/resources/ScreenRound;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()I + public final fun component10 ()Lcom/android/resources/LayoutDirection; + public final fun component11 ()Ljava/lang/String; + public final fun component12 ()Lcom/android/resources/ScreenRatio; + public final fun component13 ()Lcom/android/resources/ScreenSize; + public final fun component14 ()Lcom/android/resources/Keyboard; + public final fun component15 ()Lcom/android/resources/TouchScreen; + public final fun component16 ()Lcom/android/resources/KeyboardState; + public final fun component17 ()Z + public final fun component18 ()Lcom/android/resources/Navigation; + public final fun component19 ()Lcom/android/resources/ScreenRound; + public final fun component2 ()I + public final fun component20 ()Ljava/lang/String; + public final fun component3 ()I + public final fun component4 ()I + public final fun component5 ()Lcom/android/resources/ScreenOrientation; + public final fun component6 ()Lcom/android/resources/UiMode; + public final fun component7 ()Lcom/android/resources/NightMode; + public final fun component8 ()Lcom/android/resources/Density; + public final fun component9 ()F + public final fun copy (IIIILcom/android/resources/ScreenOrientation;Lcom/android/resources/UiMode;Lcom/android/resources/NightMode;Lcom/android/resources/Density;FLcom/android/resources/LayoutDirection;Ljava/lang/String;Lcom/android/resources/ScreenRatio;Lcom/android/resources/ScreenSize;Lcom/android/resources/Keyboard;Lcom/android/resources/TouchScreen;Lcom/android/resources/KeyboardState;ZLcom/android/resources/Navigation;Lcom/android/resources/ScreenRound;Ljava/lang/String;)Lapp/cash/paparazzi/DeviceConfig; + public static synthetic fun copy$default (Lapp/cash/paparazzi/DeviceConfig;IIIILcom/android/resources/ScreenOrientation;Lcom/android/resources/UiMode;Lcom/android/resources/NightMode;Lcom/android/resources/Density;FLcom/android/resources/LayoutDirection;Ljava/lang/String;Lcom/android/resources/ScreenRatio;Lcom/android/resources/ScreenSize;Lcom/android/resources/Keyboard;Lcom/android/resources/TouchScreen;Lcom/android/resources/KeyboardState;ZLcom/android/resources/Navigation;Lcom/android/resources/ScreenRound;Ljava/lang/String;ILjava/lang/Object;)Lapp/cash/paparazzi/DeviceConfig; + public fun equals (Ljava/lang/Object;)Z + public final fun getDensity ()Lcom/android/resources/Density; + public final fun getFolderConfiguration ()Lcom/android/ide/common/resources/configuration/FolderConfiguration; + public final fun getFontScale ()F + public final fun getHardwareConfig ()Lcom/android/ide/common/rendering/api/HardwareConfig; + public final fun getKeyboard ()Lcom/android/resources/Keyboard; + public final fun getKeyboardState ()Lcom/android/resources/KeyboardState; + public final fun getLayoutDirection ()Lcom/android/resources/LayoutDirection; + public final fun getLocale ()Ljava/lang/String; + public final fun getNavigation ()Lcom/android/resources/Navigation; + public final fun getNightMode ()Lcom/android/resources/NightMode; + public final fun getOrientation ()Lcom/android/resources/ScreenOrientation; + public final fun getRatio ()Lcom/android/resources/ScreenRatio; + public final fun getReleased ()Ljava/lang/String; + public final fun getScreenHeight ()I + public final fun getScreenRound ()Lcom/android/resources/ScreenRound; + public final fun getScreenWidth ()I + public final fun getSize ()Lcom/android/resources/ScreenSize; + public final fun getSoftButtons ()Z + public final fun getTouchScreen ()Lcom/android/resources/TouchScreen; + public final fun getUiMode ()Lcom/android/resources/UiMode; + public final fun getUiModeMask ()I + public final fun getXdpi ()I + public final fun getYdpi ()I + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/cash/paparazzi/DeviceConfig$Companion { + public final fun getEnumMap (Ljava/io/File;)Ljava/util/Map; + public final fun loadProperties (Ljava/io/File;)Ljava/util/Map; +} + +public final class app/cash/paparazzi/Environment { + public static final field $stable I + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;)V + public final fun component1 ()Ljava/lang/String; + public final fun component10 ()Ljava/util/List; + public final fun component2 ()Ljava/lang/String; + public final fun component3 ()Ljava/lang/String; + public final fun component4 ()I + public final fun component5 ()Ljava/util/List; + public final fun component6 ()Ljava/util/List; + public final fun component7 ()Ljava/util/List; + public final fun component8 ()Ljava/util/List; + public final fun component9 ()Ljava/util/List; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lapp/cash/paparazzi/Environment; + public static synthetic fun copy$default (Lapp/cash/paparazzi/Environment;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;ILjava/lang/Object;)Lapp/cash/paparazzi/Environment; + public fun equals (Ljava/lang/Object;)Z + public final fun getAllModuleAssetDirs ()Ljava/util/List; + public final fun getAppTestDir ()Ljava/lang/String; + public final fun getCompileSdkVersion ()I + public final fun getLibraryAssetDirs ()Ljava/util/List; + public final fun getLibraryResourceDirs ()Ljava/util/List; + public final fun getLocalResourceDirs ()Ljava/util/List; + public final fun getModuleResourceDirs ()Ljava/util/List; + public final fun getPackageName ()Ljava/lang/String; + public final fun getPlatformDir ()Ljava/lang/String; + public final fun getResourcePackageNames ()Ljava/util/List; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/cash/paparazzi/EnvironmentKt { + public static final fun androidHome ()Ljava/lang/String; + public static final fun detectEnvironment ()Lapp/cash/paparazzi/Environment; +} + +public final class app/cash/paparazzi/Flags { + public static final field $stable I + public static final field DEBUG_LINKED_OBJECTS Ljava/lang/String; + public static final field INSTANCE Lapp/cash/paparazzi/Flags; +} + +public final class app/cash/paparazzi/HtmlReportWriter : app/cash/paparazzi/SnapshotHandler { + public static final field $stable I + public fun ()V + public fun (Ljava/lang/String;)V + public fun (Ljava/lang/String;Ljava/io/File;)V + public fun (Ljava/lang/String;Ljava/io/File;Ljava/io/File;)V + public synthetic fun (Ljava/lang/String;Ljava/io/File;Ljava/io/File;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun close ()V + public fun newFrameHandler (Lapp/cash/paparazzi/Snapshot;II)Lapp/cash/paparazzi/SnapshotHandler$FrameHandler; +} + +public final class app/cash/paparazzi/InstantAnimationsRule : org/junit/rules/TestRule { + public static final field $stable I + public fun ()V + public fun apply (Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;)Lorg/junit/runners/model/Statement; +} + +public final class app/cash/paparazzi/Paparazzi : org/junit/rules/TestRule { + public static final field $stable I + public static final field Companion Lapp/cash/paparazzi/Paparazzi$Companion; + public fun ()V + public fun (Lapp/cash/paparazzi/Environment;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;Z)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZD)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;Ljava/util/Set;)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;Ljava/util/Set;Z)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;Ljava/util/Set;ZZ)V + public fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;Ljava/util/Set;ZZZ)V + public synthetic fun (Lapp/cash/paparazzi/Environment;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ZDLapp/cash/paparazzi/SnapshotHandler;Ljava/util/Set;ZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun apply (Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;)Lorg/junit/runners/model/Statement; + public final fun close ()V + public final fun getContext ()Landroid/content/Context; + public final fun getLayoutInflater ()Landroid/view/LayoutInflater; + public final fun getResources ()Landroid/content/res/Resources; + public final fun gif (Landroid/view/View;)V + public final fun gif (Landroid/view/View;Ljava/lang/String;)V + public final fun gif (Landroid/view/View;Ljava/lang/String;J)V + public final fun gif (Landroid/view/View;Ljava/lang/String;JJ)V + public final fun gif (Landroid/view/View;Ljava/lang/String;JJI)V + public static synthetic fun gif$default (Lapp/cash/paparazzi/Paparazzi;Landroid/view/View;Ljava/lang/String;JJIILjava/lang/Object;)V + public final fun inflate (I)Landroid/view/View; + public final fun prepare (Lorg/junit/runner/Description;)V + public final fun snapshot (Landroid/view/View;)V + public final fun snapshot (Landroid/view/View;Ljava/lang/String;)V + public final fun snapshot (Landroid/view/View;Ljava/lang/String;J)V + public final fun snapshot (Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V + public static synthetic fun snapshot$default (Lapp/cash/paparazzi/Paparazzi;Landroid/view/View;Ljava/lang/String;JILjava/lang/Object;)V + public static synthetic fun snapshot$default (Lapp/cash/paparazzi/Paparazzi;Ljava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)V + public final fun unsafeUpdateConfig (Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;)V + public static synthetic fun unsafeUpdateConfig$default (Lapp/cash/paparazzi/Paparazzi;Lapp/cash/paparazzi/DeviceConfig;Ljava/lang/String;Lcom/android/ide/common/rendering/api/SessionParams$RenderingMode;ILjava/lang/Object;)V +} + +public final class app/cash/paparazzi/Paparazzi$Companion { +} + +public abstract interface class app/cash/paparazzi/RenderExtension { + public abstract fun renderView (Landroid/view/View;)Landroid/view/View; +} + +public final class app/cash/paparazzi/Snapshot { + public static final field $stable I + public fun (Ljava/lang/String;Lapp/cash/paparazzi/TestName;Ljava/util/Date;Ljava/util/List;Ljava/lang/String;)V + public synthetic fun (Ljava/lang/String;Lapp/cash/paparazzi/TestName;Ljava/util/Date;Ljava/util/List;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Lapp/cash/paparazzi/TestName; + public final fun component3 ()Ljava/util/Date; + public final fun component4 ()Ljava/util/List; + public final fun component5 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;Lapp/cash/paparazzi/TestName;Ljava/util/Date;Ljava/util/List;Ljava/lang/String;)Lapp/cash/paparazzi/Snapshot; + public static synthetic fun copy$default (Lapp/cash/paparazzi/Snapshot;Ljava/lang/String;Lapp/cash/paparazzi/TestName;Ljava/util/Date;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Lapp/cash/paparazzi/Snapshot; + public fun equals (Ljava/lang/Object;)Z + public final fun getFile ()Ljava/lang/String; + public final fun getName ()Ljava/lang/String; + public final fun getTags ()Ljava/util/List; + public final fun getTestName ()Lapp/cash/paparazzi/TestName; + public final fun getTimestamp ()Ljava/util/Date; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public abstract interface class app/cash/paparazzi/SnapshotHandler : java/io/Closeable { + public abstract fun newFrameHandler (Lapp/cash/paparazzi/Snapshot;II)Lapp/cash/paparazzi/SnapshotHandler$FrameHandler; +} + +public abstract interface class app/cash/paparazzi/SnapshotHandler$FrameHandler : java/io/Closeable { + public abstract fun handle (Ljava/awt/image/BufferedImage;)V +} + +public final class app/cash/paparazzi/SnapshotJsonAdapter : com/squareup/moshi/JsonAdapter { + public static final field $stable I + public fun (Lcom/squareup/moshi/Moshi;)V + public fun fromJson (Lcom/squareup/moshi/JsonReader;)Lapp/cash/paparazzi/Snapshot; + public synthetic fun fromJson (Lcom/squareup/moshi/JsonReader;)Ljava/lang/Object; + public fun toJson (Lcom/squareup/moshi/JsonWriter;Lapp/cash/paparazzi/Snapshot;)V + public synthetic fun toJson (Lcom/squareup/moshi/JsonWriter;Ljava/lang/Object;)V + public fun toString ()Ljava/lang/String; +} + +public final class app/cash/paparazzi/SnapshotVerifier : app/cash/paparazzi/SnapshotHandler { + public static final field $stable I + public fun (D)V + public fun (DLjava/io/File;)V + public synthetic fun (DLjava/io/File;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun close ()V + public fun newFrameHandler (Lapp/cash/paparazzi/Snapshot;II)Lapp/cash/paparazzi/SnapshotHandler$FrameHandler; +} + +public final class app/cash/paparazzi/TestName { + public static final field $stable I + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Ljava/lang/String; + public final fun component3 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lapp/cash/paparazzi/TestName; + public static synthetic fun copy$default (Lapp/cash/paparazzi/TestName;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lapp/cash/paparazzi/TestName; + public fun equals (Ljava/lang/Object;)Z + public final fun getClassName ()Ljava/lang/String; + public final fun getMethodName ()Ljava/lang/String; + public final fun getPackageName ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/cash/paparazzi/accessibility/AccessibilityRenderExtension : app/cash/paparazzi/RenderExtension { + public static final field $stable I + public fun ()V + public fun renderView (Landroid/view/View;)Landroid/view/View; +} + diff --git a/paparazzi/src/main/java/app/cash/paparazzi/DeviceConfig.kt b/paparazzi/src/main/java/app/cash/paparazzi/DeviceConfig.kt index 3c6faeeb3f..0f3267ad66 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/DeviceConfig.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/DeviceConfig.kt @@ -529,6 +529,7 @@ data class DeviceConfig( ) // https://www.techidence.com/galaxy-watch4-features-reviews-and-price/ + @JvmField val GALAXY_WATCH4_CLASSIC_LARGE: DeviceConfig = DeviceConfig( screenHeight = 454, screenWidth = 454, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/Environment.kt b/paparazzi/src/main/java/app/cash/paparazzi/Environment.kt index 0d8eb98379..9cfd34eaec 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/Environment.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/Environment.kt @@ -82,7 +82,7 @@ fun detectEnvironment(): Environment { } @JsonClass(generateAdapter = true) -data class Config( +internal data class Config( val mainPackage: String, val targetSdkVersion: String, val platformDir: String, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/agent/InterceptorRegistrar.kt b/paparazzi/src/main/java/app/cash/paparazzi/agent/InterceptorRegistrar.kt index 252c36eb5c..0987360868 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/agent/InterceptorRegistrar.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/agent/InterceptorRegistrar.kt @@ -7,7 +7,7 @@ import net.bytebuddy.implementation.MethodDelegation import net.bytebuddy.matcher.ElementMatchers import net.bytebuddy.pool.TypePool -object InterceptorRegistrar { +internal object InterceptorRegistrar { private val byteBuddy = ByteBuddy() private val systemClassFileLocator = ClassFileLocator.ForClassLoader.ofSystemLoader() private val systemTypePool = TypePool.Default.ofSystemLoader() diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/ComposeViewAdapter.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/ComposeViewAdapter.kt index 4c90f35262..98de889c56 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/ComposeViewAdapter.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/ComposeViewAdapter.kt @@ -10,7 +10,7 @@ import android.widget.FrameLayout * A wrapper layout for compose-based layouts which allows [android.view.WindowManagerImpl] to find * a composable root */ -class ComposeViewAdapter( +internal class ComposeViewAdapter( context: Context, attrs: AttributeSet ) : FrameLayout(context, attrs) diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ChoreographerDelegateInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ChoreographerDelegateInterceptor.kt index f37835c066..5bf39f9bdc 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ChoreographerDelegateInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ChoreographerDelegateInterceptor.kt @@ -3,7 +3,7 @@ package app.cash.paparazzi.internal.interceptors import android.view.Choreographer import com.android.internal.lang.System_Delegate -object ChoreographerDelegateInterceptor { +internal object ChoreographerDelegateInterceptor { @Suppress("unused") @JvmStatic fun intercept( diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/EditModeInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/EditModeInterceptor.kt index d744ba47f5..85509d6a59 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/EditModeInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/EditModeInterceptor.kt @@ -1,6 +1,6 @@ package app.cash.paparazzi.internal.interceptors -object EditModeInterceptor { +internal object EditModeInterceptor { @JvmStatic fun intercept(): Boolean = false } diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/IInputMethodManagerInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/IInputMethodManagerInterceptor.kt index 3b90e0eb86..fa25a5bc14 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/IInputMethodManagerInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/IInputMethodManagerInterceptor.kt @@ -8,7 +8,7 @@ import com.android.internal.view.IInputMethodManager * in [com.android.internal.view.IInputMethodManager.Stub.asInterface] to return the default * implementation of [IInputMethodManager]. */ -object IInputMethodManagerInterceptor { +internal object IInputMethodManagerInterceptor { @Suppress("unused") @JvmStatic fun interceptAsInterface(@Suppress("UNUSED_PARAMETER") obj: IBinder?): IInputMethodManager = diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixMatrixMultiplicationInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixMatrixMultiplicationInterceptor.kt index 91777fa76e..90e2a2fb9c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixMatrixMultiplicationInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixMatrixMultiplicationInterceptor.kt @@ -1,7 +1,7 @@ package app.cash.paparazzi.internal.interceptors // Sampled from https://cs.android.com/android/platform/superproject/+/master:external/robolectric-shadows/shadows/framework/src/main/java/org/robolectric/shadows/ShadowOpenGLMatrix.java;l=10-67 -object MatrixMatrixMultiplicationInterceptor { +internal object MatrixMatrixMultiplicationInterceptor { @Suppress("unused", "ktlint:standard:property-naming") @JvmStatic fun intercept( diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixVectorMultiplicationInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixVectorMultiplicationInterceptor.kt index d26b214c4e..765c413f26 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixVectorMultiplicationInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/MatrixVectorMultiplicationInterceptor.kt @@ -1,7 +1,7 @@ package app.cash.paparazzi.internal.interceptors // Sampled from https://cs.android.com/android/platform/superproject/+/master:external/robolectric-shadows/shadows/framework/src/main/java/org/robolectric/shadows/ShadowOpenGLMatrix.java;l=69-121 -object MatrixVectorMultiplicationInterceptor { +internal object MatrixVectorMultiplicationInterceptor { @Suppress("unused", "ktlint:standard:property-naming") @JvmStatic fun intercept( diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ResourcesInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ResourcesInterceptor.kt index a3c65a3c19..d4dcf5e09b 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ResourcesInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ResourcesInterceptor.kt @@ -3,7 +3,7 @@ package app.cash.paparazzi.internal.interceptors import android.content.Context import android.graphics.Typeface -object ResourcesInterceptor { +internal object ResourcesInterceptor { @JvmStatic fun intercept( context: Context, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ServiceManagerInterceptor.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ServiceManagerInterceptor.kt index 108c471756..3e9e59ea65 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ServiceManagerInterceptor.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/interceptors/ServiceManagerInterceptor.kt @@ -10,7 +10,7 @@ import android.os.IBinder * * This interceptor overrides ServiceManager.getServiceOrThrow to simply return null instead. */ -object ServiceManagerInterceptor { +internal object ServiceManagerInterceptor { @Suppress("unused") @JvmStatic fun interceptGetServiceOrThrow(@Suppress("UNUSED_PARAMETER") name: String): IBinder? = null diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrParser.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrParser.kt index 3c62aa8595..50d121103c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrParser.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrParser.kt @@ -20,7 +20,7 @@ package app.cash.paparazzi.internal.parsers * * Interface for parsers that support declaration of inlined {@code aapt:attr} attributes */ -interface AaptAttrParser { +internal interface AaptAttrParser { /** * Returns a [Map] that contains all the `aapt:attr` elements declared in this or any * children parsers. This list can be used to resolve `@aapt/_aapt` references into this parser. diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrSnapshot.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrSnapshot.kt index 4105eeed99..4659f106b8 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrSnapshot.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AaptAttrSnapshot.kt @@ -25,7 +25,7 @@ import com.android.SdkConstants.AAPT_PREFIX * of the reference. This snapshot will generate a dynamic reference that will be used by the * resource resolution to be able to retrieve the inlined value. */ -class AaptAttrSnapshot( +internal class AaptAttrSnapshot( override val namespace: String, override val prefix: String, override val name: String, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AttributeSnapshot.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AttributeSnapshot.kt index 50b658c15d..5b6dfca54d 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AttributeSnapshot.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/AttributeSnapshot.kt @@ -21,7 +21,7 @@ package app.cash.paparazzi.internal.parsers * A snapshot of an attribute value pulled from an XML resource. * Used in conjunction with [TagSnapshot]. */ -open class AttributeSnapshot( +internal open class AttributeSnapshot( open val namespace: String, open val prefix: String?, open val name: String, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/InMemoryParser.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/InMemoryParser.kt index 749154ca7f..5dda83cb9f 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/InMemoryParser.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/InMemoryParser.kt @@ -23,7 +23,7 @@ import org.xmlpull.v1.XmlPullParserException * * A parser implementation that walks an in-memory XML DOM tree. */ -abstract class InMemoryParser : KXmlParser() { +internal abstract class InMemoryParser : KXmlParser() { abstract fun rootTag(): TagSnapshot private val nodeStack = mutableListOf() diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/ResourceParser.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/ResourceParser.kt index 386997be3c..4605895982 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/ResourceParser.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/ResourceParser.kt @@ -23,7 +23,7 @@ import java.io.InputStream /** * An XML resource parser that creates a tree of [TagSnapshot]s */ -class ResourceParser(inputStream: InputStream) : KXmlParser() { +internal class ResourceParser(inputStream: InputStream) : KXmlParser() { init { setFeature(FEATURE_PROCESS_NAMESPACES, true) setInput(inputStream, null) diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/TagSnapshot.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/TagSnapshot.kt index 19cab20056..60899c781d 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/TagSnapshot.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/parsers/TagSnapshot.kt @@ -26,7 +26,7 @@ package app.cash.paparazzi.internal.parsers * of properties as they were at the time of rendering, not as they are at the current * instant. */ -data class TagSnapshot( +internal data class TagSnapshot( val name: String, val namespace: String, val prefix: String?, @@ -42,7 +42,7 @@ data class TagSnapshot( val output = """ |$name: |${pad(indent + 1)}attributes: ${print(attributes)} - |${pad(indent + 1)}children: ${print(children)} + |${pad(indent + 1)}children: ${print(children)} """.trimMargin() indent-- return output diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AarSourceResourceRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AarSourceResourceRepository.kt index f2974eb2e6..de55f39cec 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AarSourceResourceRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AarSourceResourceRepository.kt @@ -32,7 +32,7 @@ import java.util.stream.Collectors * obtained from R.txt instead, when it is available. This means that * [ResourceItem.getOriginalSource] method may return null for such ID resources. */ -open class AarSourceResourceRepository( +internal open class AarSourceResourceRepository( loader: RepositoryLoader, libraryName: String? ) : AbstractAarResourceRepository(loader.namespace, libraryName) { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AbstractAarResourceRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AbstractAarResourceRepository.kt index d36b9d2110..d810c780ac 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AbstractAarResourceRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/AbstractAarResourceRepository.kt @@ -33,7 +33,7 @@ import java.util.EnumMap /** * Ported from: [AbstractAarResourceRepository.java](https://cs.android.com/android-studio/platform/tools/base/+/47d204001bf0cb6273d8b135c7eece3a982cf0e0:resource-repository/main/java/com/android/resources/aar/AbstractAarResourceRepository.java) */ -abstract class AbstractAarResourceRepository internal constructor( +internal abstract class AbstractAarResourceRepository internal constructor( private val namespace: ResourceNamespace, override val libraryName: String? ) : AbstractResourceRepository(), LoadableResourceRepository { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/CommentTrackingXmlPullParser.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/CommentTrackingXmlPullParser.kt index 53a3520622..eb232969e7 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/CommentTrackingXmlPullParser.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/CommentTrackingXmlPullParser.kt @@ -36,7 +36,7 @@ import java.io.Reader * <eat-comment/> * */ -open class CommentTrackingXmlPullParser : KXmlParser() { +internal open class CommentTrackingXmlPullParser : KXmlParser() { /** * Returns the last encountered comment that is not an ASCII art. */ diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/FrameworkResourceRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/FrameworkResourceRepository.kt index 8d1350e605..e37a1eff52 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/FrameworkResourceRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/FrameworkResourceRepository.kt @@ -35,7 +35,7 @@ import java.util.zip.ZipFile * * @see FrameworkResJarCreator */ -class FrameworkResourceRepository private constructor( +internal class FrameworkResourceRepository private constructor( loader: RepositoryLoader, private val useCompiled9Patches: Boolean ) : AarSourceResourceRepository(loader, null) { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LoadableResourceRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LoadableResourceRepository.kt index bebbcc055c..f1a5942c06 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LoadableResourceRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LoadableResourceRepository.kt @@ -12,7 +12,7 @@ import java.nio.file.Path /** * Repository of resources loaded from a file or a directory on disk. */ -interface LoadableResourceRepository : SingleNamespaceResourceRepository { +internal interface LoadableResourceRepository : SingleNamespaceResourceRepository { /** * Returns the name of the library, or null if this is not an AAR resource repository. */ diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LocalResourceRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LocalResourceRepository.kt index 679e894908..de23c8262c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LocalResourceRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/LocalResourceRepository.kt @@ -11,7 +11,7 @@ import com.google.common.collect.ListMultimap * Repository for Android application resources, e.g. those that show up in {@code R}, * not {@code android.R} (which are referred to as framework resources.). */ -abstract class LocalResourceRepository protected constructor( +internal abstract class LocalResourceRepository protected constructor( val displayName: String ) : AbstractResourceRepository() { protected abstract fun getMap( diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/NamespaceResolver.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/NamespaceResolver.kt index 0945b863ea..8dd166b499 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/NamespaceResolver.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/NamespaceResolver.kt @@ -26,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser * Simple implementation of the [ResourceNamespace.Resolver] interface intended to be used * together with [XmlPullParser]. */ -class NamespaceResolver : ResourceNamespace.Resolver { +internal class NamespaceResolver : ResourceNamespace.Resolver { /** Interleaved prefixes and the corresponding URIs in order of descending priority. */ private val prefixesAndUris: Array diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/Pseudolocalizer.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/Pseudolocalizer.kt index 5d1e5a0836..fed1c09ca2 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/Pseudolocalizer.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/Pseudolocalizer.kt @@ -109,19 +109,19 @@ private fun Char.isPossiblePlaceHolderEnd() = when (this) { else -> false } -abstract class PseudoMethodImpl { +internal abstract class PseudoMethodImpl { open fun start() = "" open fun end() = "" abstract fun text(originalText: String): String abstract fun placeholder(originalText: String): String } -object PseudoMethodNone : PseudoMethodImpl() { +internal object PseudoMethodNone : PseudoMethodImpl() { override fun text(originalText: String) = originalText override fun placeholder(originalText: String) = originalText } -object PseudoMethodBidi : PseudoMethodImpl() { +internal object PseudoMethodBidi : PseudoMethodImpl() { private const val ESCAPE_CHAR = '\\' override fun text(originalText: String): String { @@ -165,7 +165,7 @@ object PseudoMethodBidi : PseudoMethodImpl() { RLM + RLO + originalText + PDF + RLM } -class PseudoMethodAccent : PseudoMethodImpl() { +internal class PseudoMethodAccent : PseudoMethodImpl() { var depth = 0 var wordCount = 0 var length = 0 @@ -353,7 +353,7 @@ class PseudoMethodAccent : PseudoMethodImpl() { "twelve thirteen fourteen fiveteen sixteen seventeen nineteen twenty" } -class Pseudolocalizer(method: Method) { +internal class Pseudolocalizer(method: Method) { private var implementation: PseudoMethodImpl var lastDepth = 0 private set diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryConfiguration.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryConfiguration.kt index 904b083773..86dba8837b 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryConfiguration.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryConfiguration.kt @@ -24,7 +24,7 @@ import com.android.utils.HashCodes * and [FolderConfiguration]. This indirection saves memory because the number of [RepositoryConfiguration] * instances is a tiny fraction of the number of [BasicResourceItem] instances. */ -class RepositoryConfiguration( +internal class RepositoryConfiguration( repository: LoadableResourceRepository, val folderConfiguration: FolderConfiguration ) { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryLoader.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryLoader.kt index 6ad98a773b..1a07174f2c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryLoader.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/RepositoryLoader.kt @@ -115,7 +115,7 @@ import java.util.zip.ZipFile /** * Ported from: [RepositoryLoader.java](https://cs.android.com/android-studio/platform/tools/base/+/876aaf229c1e3b8144736d3338c628ba43ccac45:resource-repository/main/java/com/android/resources/base/RepositoryLoader.java) */ -abstract class RepositoryLoader( +internal abstract class RepositoryLoader( val resourceDirectoryOrFile: Path, val resourceFilesAndFolders: Collection?, val namespace: ResourceNamespace diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFile.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFile.kt index dd51917184..3f44f841af 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFile.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFile.kt @@ -25,7 +25,7 @@ import java.io.File * Represents a resource file from which [com.android.ide.common.resources.ResourceItem]s are * created by [ResourceFolderRepository]. An [Iterable] of [BasicResourceItem]s. */ -class ResourceFile( +internal class ResourceFile( val file: File?, override val configuration: RepositoryConfiguration ) : ResourceSourceFile, Iterable { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFolderRepository.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFolderRepository.kt index 4b3c1bc889..2f54f058c8 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFolderRepository.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceFolderRepository.kt @@ -32,7 +32,7 @@ import kotlin.io.path.exists * Each [ResourceFolderRepository] contains the resources provided by a single res folder. */ @SuppressLint("NewApi") -class ResourceFolderRepository( +internal class ResourceFolderRepository( val resourceDir: File, private val namespace: ResourceNamespace ) : LocalResourceRepository(resourceDir.name), LoadableResourceRepository { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceNamespacing.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceNamespacing.kt index c2f489c2fb..6f87de283e 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceNamespacing.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceNamespacing.kt @@ -1,6 +1,6 @@ package app.cash.paparazzi.internal.resources -enum class ResourceNamespacing { +internal enum class ResourceNamespacing { /** * Resources are not namespaced. */ diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSerializationUtil.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSerializationUtil.kt index 659b4b9511..14c27d749b 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSerializationUtil.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSerializationUtil.kt @@ -26,7 +26,7 @@ import java.util.function.Function /** * Ported from: [ResourceSerializationUtil.java](https://cs.android.com/android-studio/platform/tools/base/+/18047faf69512736b8ddb1f6a6785f58d47c893f:resource-repository/main/java/com/android/resources/base/ResourceSerializationUtil.java) */ -object ResourceSerializationUtil { +internal object ResourceSerializationUtil { /** * Loads resources from the given input stream and passes them to the given consumer. */ diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFile.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFile.kt index 42ae82f748..419372a404 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFile.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFile.kt @@ -20,7 +20,7 @@ package app.cash.paparazzi.internal.resources * * Represents an XML file from which an Android resource was created. */ -interface ResourceSourceFile { +internal interface ResourceSourceFile { /** * The path of the file relative to the resource directory, or null if the source file * of the resource is not available. diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFileImpl.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFileImpl.kt index e2e2f5b42e..d58279eb69 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFileImpl.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceSourceFileImpl.kt @@ -26,7 +26,7 @@ import java.io.IOException * [relativePath] path of the file relative to the resource directory, or null if the source file of the resource is not available * [configuration] configuration the resource file is associated with */ -data class ResourceSourceFileImpl( +internal data class ResourceSourceFileImpl( override val relativePath: String?, override val configuration: RepositoryConfiguration ) : ResourceSourceFile { diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceUrlParser.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceUrlParser.kt index 73cb8ed0af..b191bbde4d 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceUrlParser.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/ResourceUrlParser.kt @@ -24,7 +24,7 @@ import com.android.SdkConstants.PREFIX_THEME_REF * Parser of resource URLs. Unlike [com.android.resources.ResourceUrl], this class is resilient to * URL syntax errors that doesn't create any GC overhead. */ -class ResourceUrlParser { +internal class ResourceUrlParser { private var resourceUrl = "" private var colonPos = 0 private var slashPos = 0 diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicArrayResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicArrayResourceItem.kt index 790cbe48af..3a548cac7b 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicArrayResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicArrayResourceItem.kt @@ -30,7 +30,7 @@ import java.util.Collections * * Resource item representing an array resource. */ -class BasicArrayResourceItem( +internal class BasicArrayResourceItem( name: String, sourceFile: ResourceSourceFile, visibility: ResourceVisibility, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrReference.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrReference.kt index 640b63ee66..3fbf4dfdb4 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrReference.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrReference.kt @@ -29,7 +29,7 @@ import com.android.utils.HashCodes * Resource value representing a reference to an attr resource, but potentially with its own description * and group name. Unlike [BasicAttrResourceItem], does not contain formats and enum or flag information. */ -class BasicAttrReference( +internal class BasicAttrReference( private val namespace: ResourceNamespace, name: String, sourceFile: ResourceSourceFile, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrResourceItem.kt index 54ed7c441e..eb7056ae1d 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicAttrResourceItem.kt @@ -32,7 +32,7 @@ import java.util.EnumSet * * Resource item representing an attr resource. */ -open class BasicAttrResourceItem( +internal open class BasicAttrResourceItem( name: String, sourceFile: ResourceSourceFile, visibility: ResourceVisibility, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicDensityBasedFileResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicDensityBasedFileResourceItem.kt index 496251f6a0..af2649da84 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicDensityBasedFileResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicDensityBasedFileResourceItem.kt @@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects * * Resource item representing a density-specific file resource inside an AAR, e.g. a drawable or a layout. */ -class BasicDensityBasedFileResourceItem( +internal class BasicDensityBasedFileResourceItem( type: ResourceType, name: String, configuration: RepositoryConfiguration, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicFileResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicFileResourceItem.kt index e9745e6e94..d707c86d0d 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicFileResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicFileResourceItem.kt @@ -32,7 +32,7 @@ import java.io.IOException * * Resource item representing a file resource, e.g. a drawable or a layout. */ -open class BasicFileResourceItem( +internal open class BasicFileResourceItem( type: ResourceType, name: String, override val repositoryConfiguration: RepositoryConfiguration, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicForeignAttrResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicForeignAttrResourceItem.kt index 72a5b34d5f..dc5ea60abf 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicForeignAttrResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicForeignAttrResourceItem.kt @@ -26,7 +26,7 @@ import com.android.resources.ResourceVisibility * Resource item representing an attr resource that is defined in a namespace different from the namespace * of the owning AAR. */ -class BasicForeignAttrResourceItem( +internal class BasicForeignAttrResourceItem( private val namespace: ResourceNamespace, name: String, sourceFile: ResourceSourceFile, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicPluralsResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicPluralsResourceItem.kt index 8cd053af1c..876b03bd53 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicPluralsResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicPluralsResourceItem.kt @@ -30,7 +30,7 @@ import java.io.IOException * * Resource item representing a plurals resource. */ -class BasicPluralsResourceItem private constructor( +internal class BasicPluralsResourceItem private constructor( name: String, sourceFile: ResourceSourceFile, visibility: ResourceVisibility, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicResourceItem.kt index ca5b6ad98e..d8695addbe 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicResourceItem.kt @@ -39,7 +39,7 @@ import java.io.IOException * * A merger of [BasicResourceItemBase] and [BasicResourceItem] from AOSP, to simplify. */ -abstract class BasicResourceItem( +internal abstract class BasicResourceItem( private val type: ResourceType, private val name: String, visibility: ResourceVisibility diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleResourceItem.kt index 44b3d33676..6468b70ffb 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleResourceItem.kt @@ -35,7 +35,7 @@ import java.util.logging.Logger * * Resource item representing a style resource. */ -class BasicStyleResourceItem( +internal class BasicStyleResourceItem( name: String, sourceFile: ResourceSourceFile, visibility: ResourceVisibility, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleableResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleableResourceItem.kt index 81f0d6370b..d6e35cd47c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleableResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicStyleableResourceItem.kt @@ -32,7 +32,7 @@ import java.io.IOException * * Resource item representing a styleable resource. */ -class BasicStyleableResourceItem( +internal class BasicStyleableResourceItem( name: String, sourceFile: ResourceSourceFile, visibility: ResourceVisibility, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicTextValueResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicTextValueResourceItem.kt index 2ee28112c5..77da372a0c 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicTextValueResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicTextValueResourceItem.kt @@ -26,7 +26,7 @@ import com.android.utils.HashCodes * * Resource item representing a value resource, e.g. a string or a color. */ -class BasicTextValueResourceItem( +internal class BasicTextValueResourceItem( type: ResourceType, name: String, sourceFile: ResourceSourceFile, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItem.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItem.kt index 79e5589086..00bea9d0f3 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItem.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItem.kt @@ -28,7 +28,7 @@ import java.io.IOException * * Resource item representing a value resource, e.g. a string or a color. */ -open class BasicValueResourceItem( +internal open class BasicValueResourceItem( type: ResourceType, name: String, sourceFile: ResourceSourceFile, diff --git a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItemBase.kt b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItemBase.kt index 8054e541c3..7e9715fc23 100644 --- a/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItemBase.kt +++ b/paparazzi/src/main/java/app/cash/paparazzi/internal/resources/base/BasicValueResourceItemBase.kt @@ -35,7 +35,7 @@ import java.io.IOException * * Base class for value resource items. */ -abstract class BasicValueResourceItemBase( +internal abstract class BasicValueResourceItemBase( type: ResourceType, name: String, val sourceFile: ResourceSourceFile, diff --git a/paparazzi/src/test/java/app/cash/paparazzi/internal/parsers/InMemoryParserTest.kt b/paparazzi/src/test/java/app/cash/paparazzi/internal/parsers/InMemoryParserTest.kt index 416ed08e41..b0bc2051fc 100644 --- a/paparazzi/src/test/java/app/cash/paparazzi/internal/parsers/InMemoryParserTest.kt +++ b/paparazzi/src/test/java/app/cash/paparazzi/internal/parsers/InMemoryParserTest.kt @@ -82,7 +82,7 @@ class InMemoryParserTest { return ResourceParser(resourceInputStream).createTagSnapshot() } - class RealInMemoryParser(private val root: TagSnapshot) : InMemoryParser() { + private class RealInMemoryParser(private val root: TagSnapshot) : InMemoryParser() { override fun rootTag(): TagSnapshot = root }