Reduce Android AAR size with header-only Prefab (#4483)
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/gfx/context.hpp>
|
||||
#include <mbgl/style/layers/custom_layer_init_parameters.hpp>
|
||||
#include <mbgl/style/layers/custom_layer_render_parameters.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace gfx {
|
||||
class Context;
|
||||
} // namespace gfx
|
||||
|
||||
namespace style {
|
||||
|
||||
class CustomLayerHost {
|
||||
|
||||
@@ -204,7 +204,7 @@ android {
|
||||
prefab {
|
||||
create("maplibre") {
|
||||
headers = "../prefab-headers"
|
||||
libraryName = "libmaplibre"
|
||||
headerOnly = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +240,16 @@ tasks.configureEach {
|
||||
}
|
||||
}
|
||||
|
||||
// AGP 9.1.1 still adds the native build output to the AAR even when the Prefab module is
|
||||
// declared header-only. Keep the header-only metadata and omit that redundant unstripped copy.
|
||||
tasks.withType<org.gradle.api.tasks.bundling.Zip>().configureEach {
|
||||
if (name.startsWith("bundle") && name.endsWith("Aar")) {
|
||||
// The Prefab artifact is added under a `prefab/` destination by a nested copy spec,
|
||||
// so its paths are still relative to the Prefab root when exclusions are evaluated.
|
||||
exclude("modules/maplibre/libs/**")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
getByName("implementation") {
|
||||
exclude(group = "commons-logging", module = "commons-logging")
|
||||
|
||||
Reference in New Issue
Block a user