My build.gradle file sets a BuildConfig variable from the result of running ‘git describe --dirty’ so that the app’s About dialog can show what git revision the code was built from. Because build processes for F-droid and Travis modify the build.gradle file, this always shows up with ‘dirty’ in it. For Travis builds I’ve worked around the problem by running git before the code is modified, capturing the result in a shell variable, and then passing it to gradlew via a -P. But F-droid’s build process is different, and I can’t figure out a workaround. This sort of thing doesn’t work:
- GITREV=$(git describe --tags --dirty)
Looking at other metadata files, it appears some use a “build” stanza and invoke gradlew directly. Presumably if I did that I could use -P and perhaps mimic what I do for Travis. But the easy mods to my .yml file don’t work, so it’ll take some time to explore this option. I hope instead there’s a way to keep the structure I have.
And yeah, for the short term I can just hard-code GITREV.