Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ abstract class MultiplatformResourcesPluginExtension {
abstract val resourcesVisibility: Property<MRVisibility>
abstract val iosMinimalDeploymentTarget: Property<String>
abstract val resourcesSourceSets: NamedDomainObjectContainer<SourceDirectorySet>
abstract val allowWebpImageFormat: Property<Boolean>

fun Project.configureCopyXCFrameworkResources(xcFrameworkName: String = name) {
NativeBuildType.values()
Expand All @@ -35,4 +36,5 @@ internal fun MultiplatformResourcesPluginExtension.setupConvention(project: Proj
iosBaseLocalizationRegion.convention("en")
resourcesVisibility.convention(MRVisibility.Public)
iosMinimalDeploymentTarget.convention("9.0")
allowWebpImageFormat.convention(false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal class ImageGeneratorFactory(
private val outputAssetsDir: File,
private val kotlinPlatformType: KotlinPlatformType,
private val kotlinKonanTarget: () -> KonanTarget,
private val allowWebpImageFormat: Boolean,
private val androidRClassPackage: () -> String,
private val logger: Logger
) {
Expand All @@ -44,7 +45,11 @@ internal class ImageGeneratorFactory(
generator = ImageResourceGenerator(),
platformResourceGenerator = createPlatformImageGenerator(),
filter = {
include("images/**/*.png", "images/**/*.jpg", "images/**/*.svg")
val formats = mutableListOf("images/**/*.png", "images/**/*.jpg", "images/**/*.svg")
if (allowWebpImageFormat) {
formats.add("images/**/*.webp")
}
Comment on lines +49 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it will be allowed - how it will works on platforms? sample should be added in resources-gallery and compose-resources-gallery samples

include(formats)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ abstract class GenerateMultiplatformResourcesTask : DefaultTask() {
@get:Input
abstract val strictLineBreaks: Property<Boolean>

@get:Optional
@get:Input
abstract val allowWebpImageFormat: Property<Boolean>

@get:Optional
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFiles
Expand Down Expand Up @@ -229,8 +233,9 @@ abstract class GenerateMultiplatformResourcesTask : DefaultTask() {
outputAssetsDir = outputAssetsDir.get().asFile,
kotlinPlatformType = kotlinPlatformType,
kotlinKonanTarget = ::kotlinKonanTarget,
allowWebpImageFormat = allowWebpImageFormat.get(),
androidRClassPackage = androidRClassPackage::get,
logger = logger
logger = logger,
).create(),
ColorGeneratorFactory(
resourcesVisibility = resourcesVisibility.get(),
Expand Down
Loading