mikepenz/AboutLibraries

Sort additional licenses under configPath

rocka opened this issue · 1 comments

rocka commented

About this issue

This issue counts for reproducible builds too (see #784 for more explanation). For what I'm working on (https://github.com/fcitx5-android/fcitx5-android to be exact), we have several native library dependencies so we use configPath property and put their licenses in app/licenses/libraries directory. The problem is, every time we run the build in a new environment, the order of licenses in generated json file varies.

After some investigation, I found that additional licenses are read by listFiles(), and there is no guarantee of string order:

fun readLicenses(configDir: File): List<License> {
val licensesDir = File(configDir, LICENSES_DIR)
return if (licensesDir.exists()) {
licensesDir.listFiles()?.mapNotNull {
readLicense(it.name, it.inputStream())

In my perspective, simply

licensesDir.listFiles()?.sortedBy { it.name }

would fix this issue. It would be nice if we can have this feature to further improve reproducibility, or at least have it as an option.

Details

  • Used library version 10.6.1
  • Used support library version
  • Used gradle build tools version 7.6
  • Used tooling / Android Studio version AGP 7.4.2 / Android Studio 2022.1.1
  • Other used libraries, potential conflicting libraries

@rocka that's a great suggestion, we probably should do that for the whole list of libraries prior to writing them out to the json.