AboutLibraries icon indicating copy to clipboard operation
AboutLibraries copied to clipboard

Feature Request - exportPath dynamic for each build variant.

Open apkelly opened this issue 3 years ago • 3 comments

About this issue

  • Briefly describe the issue I currently use a command like this to generate my aboutlicense.json file

./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=src/main/assets/ -PaboutLibraries.exportVariant=dimensionRelease

Where dimension is different components of my build variant. Different variants will possibly have different included libraries e.g. a "pro" version of my app might include an extra library.

When building the different versions of my app, free/pro etc, I'd like the output json file placed in the correct src/free/assets or src/pro/assets folders.

It'd be great if exportPath could use the configuration of exportVariant to know where to place the file, perhaps making the path relative to dimension. e.g. -PaboutLibraries.exportPath=/assets/ PaboutLibraries.exportVariant=proRelease would place the file in src/pro/assets

Details

  • [ ] Used library version - 10.5.1
  • [ ] Used support library version
  • [ ] Used gradle build tools version - 7.3.3
  • [ ] Used tooling / Android Studio version - Android Studio Flamingo, Canary 8
  • [ ] Other used libraries, potential conflicting libraries - Jetpack Compose 1.3

Checklist

apkelly avatar Nov 23 '22 03:11 apkelly

@apkelly thank you for describing your usecase.

I may need some more information to better understand the benefit.

As you describe, you are passing the exportPath and exportVariant already. E.g. you will probably have multiple such export steps for the different variants.

What would the major benefit of the exportPath internally identifying the variant specific folder? As I assume this is only gonna be defined ones and then most likely stay for the most part like that?


Theoretically the android integration would do something like this: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPluginAndroidExtension.kt#L43

But personally I also prefer the "manual" approach, with the file being checked in as it allows for much more control of what's getting changed.

mikepenz avatar Nov 23 '22 08:11 mikepenz

The app I work on is branded for different clients, and also runs on different vendor hardware (each with their own SDKs)....its not an app for mobile phones, so we have lots of different "release" build variants.

I like the idea of manually running the export command, but I wanted to see if there was a way to cut down on the configuration, so that exportPath could be defined in my aboutlibraries section of my gradle file, and then depending on the exportVariant being created, the json file would be deposited in the correct /src/xxx/assets folder.

apkelly avatar Nov 24 '22 13:11 apkelly

Oh I see. So it's not an Android project, as such the automatic registration for android build tasks won't work.

Not sure how much can be reproduced of that as part of the sample app. But it may be worth exploring to add some of these variants to the app-desktop sample we have, and then see if something similar like we do for Android (https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPluginAndroidExtension.kt) would be possible for those desktop builds. 🤔

One thing I am not sure on is, if Gradle will have the appropriate folder per variant. I'd prefer not to base the folder path definition on assumptions which may break for other people.

mikepenz avatar Nov 24 '22 13:11 mikepenz