Hi Moritz,
Le 2025-03-16 11:10, Moritz a écrit :
I got interested in the problem of bootstrapping a modern versions of
Gradle, mainly due to the old version available in Debian. As far as I
can tell, efforts have been mostly focused on using older versions to
bootstrap an up-to-date version.
Most but not all. My own branch also uses the same version of Gradle to
rebuild itself.
I wanted to explore the feasibility and effort required to bootstrap
with Maven instead. I now have a working purely Maven-based build that
generates a distribution capable of building Gradle itself. The code is
available here
<https://github.com/MorMundHS-MA/gradle-maven-bootstrap>.
That's an interesting approach. Did you use a generator for the pom.xml
files, and if so how much manual adjustment was required afterwards?
On my side I've started to write a Makefile generator that uses Gradle
itself to generate the recipes. It's not finished (and not functional)
yet, but you can get an idea of what the result would look like there
[1]. The generator is the MakefileMaker class at the bottom of [2]. I'm
planning to add custom logic to generate the additional code and
properties at (re)build time. The idea is to have something reasonably
simple that could be used to bootstrap a future version with minimal or
no changes (ideally) to the generation logic.
While it was fun, I am not sure how much this actually helps as it
still requires a pre-build Kotlin compiler (at least 1.8 I think, even
though >2.0 is used). Additionally some of the other dependencies are
also built with Gradle and would have to be bootstrapped as well. But I
wanted to share my progress so far non the less.
They still use Kotlin 2.0.21 currently, setting the source compatibility
to 1.9 (or 1.8 maybe?) to force the use of the legacy K1 compiler, and
adding another legacy dependency as they use APIs that are now
deprecated and even removed for some. It's possible to compile the
Kotlin code using older compilers (with a few minor adjustments
eventually) but the Kotlin scripting integration (DSL) in Gradle is much
less likely to be buildable or work with older versions of Kotlin
compiler libraries without some extensive changes.
So far the only other dependencies I found that will need to be
bootstrapped in the same batch (with gradle and kotlin) are:
- kotlinx.serialization
- kotlinx-metadata-jvm 0.5.0 (Kotlin 1.8.10 is the last release with
that version).
Thank you for sharing this. I will add a link to your repository on my
own wip/README.
Cheers,
[1]:
https://salsa.debian.org/jpd/gradle/-/blob/478abafcd391cc28549f9b369d7b42a3febb3197/debian/gradle.Makefile
[2]:
https://salsa.debian.org/jpd/gradle/-/blob/478abafcd391cc28549f9b369d7b42a3febb3197/debian/init.d/gradlebuild/DebianGradleBuildPlugin.gradle#L638
--
Julien Plissonneau Duquène