Skip to content

Commit

Permalink
build: Increase the compilation memory to avoid OutOfMemory when comp…
Browse files Browse the repository at this point in the history
…iling wasmJs
  • Loading branch information
panpf committed Jul 18, 2024
1 parent 9a8aade commit 4e1b736
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 48 deletions.
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand All @@ -22,6 +22,7 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
#
kotlin.daemon.jvmargs=-Xmx3g
kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
# Suppress: A compileOnly dependency is used in the Kotlin/Native target 'iosX64': org.jetbrains.kotlinx:atomicfu:0.24.0
kotlin.native.ignoreIncorrectDependencies=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.github.panpf.zoomimage.sample

import android.os.Build
import coil3.ImageLoader
import com.github.panpf.sketch.ComponentRegistry
import com.github.panpf.sketch.PlatformContext
import com.github.panpf.sketch.Sketch
import com.github.panpf.sketch.decode.supportAnimatedGif
Expand All @@ -12,11 +11,7 @@ import com.github.panpf.zoomimage.sample.util.CoilComposeResourceUriFetcher


actual fun Sketch.Builder.platformSketchInitial(context: PlatformContext) {

}

actual fun platformSketchComponents(context: PlatformContext): ComponentRegistry? {
return ComponentRegistry.Builder().apply {
addComponents {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
supportAnimatedGif()
} else {
Expand All @@ -25,7 +20,7 @@ actual fun platformSketchComponents(context: PlatformContext): ComponentRegistry
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
supportAnimatedWebp()
}
}.build()
}
}

actual fun ImageLoader.Builder.platformCoilInitial(context: coil3.PlatformContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fun GlideZoomAsyncImageSample(
private fun GlideZoomAsyncImageSamplePreview() {
val colorScheme = MaterialTheme.colorScheme
val photo = remember {
val sketchImageUri = newResourceUri(drawableResId = R.drawable.im_placeholder)
val sketchImageUri = newResourceUri(resId = R.drawable.im_placeholder)
Photo(sketchImageUri)
}
GlideZoomAsyncImageSample(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.github.panpf.zoomimage.sample

import coil3.ImageLoader
import coil3.util.DebugLogger
import com.github.panpf.sketch.ComponentRegistry
import com.github.panpf.sketch.PlatformContext
import com.github.panpf.sketch.Sketch
import com.github.panpf.sketch.decode.supportSvg
Expand All @@ -19,22 +18,6 @@ fun newSketch(context: PlatformContext): Sketch {
components {
supportSvg()
supportComposeResources()

// TODO new version use addComponents
platformSketchComponents(context)?.let { components ->
components.decodeInterceptorList.forEach {
addDecodeInterceptor(it)
}
components.requestInterceptorList.forEach {
addRequestInterceptor(it)
}
components.decoderFactoryList.forEach {
addDecoder(it)
}
components.fetcherFactoryList.forEach {
addFetcher(it)
}
}
}

// For print the Sketch initialization log
Expand All @@ -52,7 +35,6 @@ fun newSketch(context: PlatformContext): Sketch {
}

expect fun Sketch.Builder.platformSketchInitial(context: PlatformContext)
expect fun platformSketchComponents(context: PlatformContext): ComponentRegistry?

fun newCoil(context: coil3.PlatformContext): ImageLoader {
return ImageLoader.Builder(context).apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.github.panpf.zoomimage.sample

import coil3.ImageLoader
import com.github.panpf.sketch.ComponentRegistry
import com.github.panpf.sketch.PlatformContext
import com.github.panpf.sketch.Sketch
import com.github.panpf.sketch.decode.supportSkiaAnimatedWebp
Expand All @@ -11,17 +10,13 @@ import com.github.panpf.zoomimage.sample.util.CoilKotlinResourceUriFetcher
import com.github.panpf.zoomimage.sample.util.PexelsCompatibleRequestInterceptor

actual fun Sketch.Builder.platformSketchInitial(context: PlatformContext) {

}

actual fun platformSketchComponents(context: PlatformContext): ComponentRegistry? {
return ComponentRegistry.Builder().apply {
addComponents {
supportSkiaGif()
supportSkiaAnimatedWebp()
supportSkiaAnimatedWebp()

addRequestInterceptor(PexelsCompatibleRequestInterceptor())
}.build()
}
}

actual fun ImageLoader.Builder.platformCoilInitial(context: coil3.PlatformContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.github.panpf.zoomimage.sample

import coil3.ImageLoader
import com.github.panpf.sketch.ComponentRegistry
import com.github.panpf.sketch.PlatformContext
import com.github.panpf.sketch.Sketch
import com.github.panpf.sketch.decode.supportSkiaAnimatedWebp
Expand All @@ -10,15 +9,11 @@ import com.github.panpf.zoomimage.sample.util.CoilComposeResourceUriFetcher
import com.github.panpf.zoomimage.sample.util.CoilKotlinResourceUriFetcher

actual fun Sketch.Builder.platformSketchInitial(context: PlatformContext) {

}

actual fun platformSketchComponents(context: PlatformContext): ComponentRegistry? {
return ComponentRegistry.Builder().apply {
addComponents {
supportSkiaGif()
supportSkiaAnimatedWebp()
supportSkiaAnimatedWebp()
}.build()
}
}

actual fun ImageLoader.Builder.platformCoilInitial(context: coil3.PlatformContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package com.github.panpf.zoomimage.sample

import coil3.ImageLoader
import com.github.panpf.sketch.ComponentRegistry
import com.github.panpf.sketch.PlatformContext
import com.github.panpf.sketch.Sketch
import com.github.panpf.sketch.decode.supportSkiaAnimatedWebp
import com.github.panpf.sketch.decode.supportSkiaGif
import com.github.panpf.zoomimage.sample.util.CoilComposeResourceUriFetcher

actual fun Sketch.Builder.platformSketchInitial(context: PlatformContext) {

}

actual fun platformSketchComponents(context: PlatformContext): ComponentRegistry? {
return ComponentRegistry.Builder().apply {
addComponents {
supportSkiaGif()
supportSkiaAnimatedWebp()
supportSkiaAnimatedWebp()
}.build()
}
}

actual fun ImageLoader.Builder.platformCoilInitial(context: coil3.PlatformContext) {
Expand Down

0 comments on commit 4e1b736

Please sign in to comment.