3 ms·
That's basically Gradle and if you think cmake is bad you haven't seen some of monstrosities that can be created when you open up a whole programming language.
by vvanders 8y ago
That's basically Gradle and if you think cmake is bad you haven't seen some of monstrosities that can be created when you open up a whole programming language.
From what I've seen cargo gets most of the parts right. You can have a programmatic pre-build script bit can't take over the whole building process.
- kuschku 8y agoYes, with gradle you can create true monstrosities — and even my own projects aren’t free of those, sadly, because sometimes there’s just no alternatives. Here’s a few examples: Dynamically using git describe to determine version and build number (which is actually just the # of commits that ever occured, to allow reproducable builds) versionCode = cmd("git", "rev-list", "--count", "HEAD")?.toIntOrNull() ?: 1 versionName = cmd("git", "describe", "--always", "--tags", "HEAD") ?: "1.0.0" Putting git infos into certain classes buildConfigField("String", "GIT_HEAD", "\"${cmd("git", "rev-parse", "HEAD") ?: ""}\"") buildConfigField("String", "FANCY_VERSION_NAME", "\"${fancyVersionName() ?: ""}\"") buildConfigField("long", "GIT_COMMIT_DATE", "${cmd("git", "show", "-s", "--format=%ct") ?: 0}L") Using string interpolation to change the output file to include the version setProperty("archivesBaseName", "Quasseldroid-$versionName") But the worst part is that often on StackOverflow you only find ugly hacks adding custom tasks, removing tasks, modifying them, etc with ugly hacks. And even worse, sometimes there’s just no good alternative at all. Which is why gradle took so long to clean up some parts of their API, or introduce parallel builds.