Skip to content

Build Process Enhancement: Exclude redundant source files from dists directory #3258

@dogancankalinci

Description

@dogancankalinci

Problem Description

The current assemble_distribution method in the SDLGradleBootstrap (and other bootstraps) copies the entire temporary build directory into the final dists/<dist_name> directory.

This process works reliably, but it results in a dists directory that contains a large number of redundant files. Specifically, it includes the complete C/C++ source code for all the BootstrapNDKRecipe dependencies (like SDL2, SDL2_image, etc.) in the jni/ subfolder, as well as intermediate object files in obj/.

This is unnecessary because these source files have already been compiled by ndk-build into the final .so libraries located in the libs/ directory. The subsequent Gradle build step only uses these pre-compiled libraries and does not re-compile the C/C++ source.

This behavior has a few negative consequences:

  1. Increased Disk Usage: It significantly inflates the size of the distribution, which can be problematic in CI/CD environments or on systems with limited disk space.
  2. Slower Build Times: The file I/O for copying of unnecessary source code adds a small but noticeable delay to the build process.
  3. Confusing Project Structure: The presence of the jni/ sources in the final Gradle project can be misleading, suggesting that Gradle might be compiling them, which it is not. A cleaner project structure would be easier to debug and understand.

Note: This issue does not affect the final size of the APK, as the Android packaging tools correctly exclude the source code. This is purely an enhancement for the intermediate build process.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions