Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer buildscript tasks to another language #138

Open
Copetan opened this issue Sep 15, 2023 · 4 comments
Open

Transfer buildscript tasks to another language #138

Copetan opened this issue Sep 15, 2023 · 4 comments
Assignees
Labels
buildscript Issue related to the buildscript draft Tentative new feature enhancement New feature or request help wanted Extra attention is needed

Comments

@Copetan
Copy link
Member

Copetan commented Sep 15, 2023

Currently, the Feather buildscript uses Gradle to execute all of its tasks, from running the main feather task, mapping generation, and name propagation, to downloading necessary libraries and publishing the mappings to the Ornithe maven repository. This has mostly worked, but Gradle has a tendency to time out or reset its connection randomly for no discernable reason. This was previously a really significant issue when we would publish every version in the same task sequentially, but #134 has significantly improved that situation by running every publish task in parallel, publishing up to 20 versions at a time concurrently.

This solved the issue of having to restart the whole publish task for every version if one of the versions failed, but the second time the new publish workflow was run, many versions failed to publish because the publish tasks would try to upload an artifact version that was already on the repository, because the maven-metadata.xml file didn't have those versions listed in them. We believe the concurrent nature of the workflow is causing a race condition with reading and writing the maven-metadata.xml file, preventing it from getting accurately updated for every version.

When thinking of ways to resolve the first issue, I had the idea of transferring most, if not all, of Gradle's workload to Pure Java Code; I shelved this idea when @Kahzerx refactored the workflow, but this race condition issue is making me consider bringing up this ussie again.

There are a couple things to consider:

  • What are all the tasks that are part of the current Gradle buildscript that we would need to translate to Java? Are there tasks we can get rid of?
  • Is there any new functionality that would be nice to add to a potential Java buildscript that was unfeasible to have when we used Gradle?
    • This might be a way that we could publish all the versions without updating the maven-metadata.xml file, until the very end.
  • Where are we storing the cache for these tasks, like version jars and the like? Should we try to use the same cache folder that our current Gradle buildscript uses? Should we use a different location?
  • Related to the previous point, should we use Gradle as a sort of "bootstrap" to run the core Java code part of this potential buildscript? Or should we ship with a Pure Java Code bootstrap main class that we compile on the fly that runs the rest of the buildscript?

I'm getting to the point where I've written so much that I'm losing track of my thoughts, so I'll stop here, I might edit this more later. Please feel free to share your thoughts about this.

@Copetan Copetan added enhancement New feature or request help wanted Extra attention is needed draft Tentative new feature buildscript Issue related to the buildscript labels Sep 15, 2023
@Copetan Copetan self-assigned this Sep 15, 2023
@Copetan Copetan added this to To-do Sep 15, 2023
@Copetan
Copy link
Member Author

Copetan commented Oct 31, 2023

@zeichenreihe Also has brought up the idea of completely rewriting the buildscript in Rust, so that is another option that we can consider

@Copetan Copetan changed the title Transfer buildscript tasks to Java Transfer buildscript tasks to another language Oct 31, 2023
@zeichenreihe
Copy link
Contributor

I already have #143 that would simplify the gradle buildscript a bit, allowing easier rust building (as in less things done).

One thing we might want to consider is adding superclass information to the mappings files (that would remove needing to download mc jars for getting them for doing remapping or finding bridge methods).

Another thing would be to also let enigma store bridge method mappings in our mappings [graph], which would also remove needing to figure out what bridge methods exist (further simplifiying the build task).

I already have a working rust version of a mapping graph reader, as well as a way to apply diffs to that graph. My current goal was just to provide the "build" task, but I'm sure that can be extended to also support modifications and writes of that graph.

One thing to note about the current gradle way: you read/write the mappings file like 10 times, because every enigma ...Command reads the mappings and writes new ones, reading it once and writing it at the very end removes that overhead.

I'm also gonna say: I currently don't have much time to spend on this "let's build it in rust"... but in 5 weeks there should be more time again.

@Copetan
Copy link
Member Author

Copetan commented Oct 31, 2023

I'm also gonna say: I currently don't have much time to spend on this "let's build it in rust"... but in 5 weeks there should be more time again.

Yeah, I'm not expecting anything soon since I don't think very many of us have much time either 😅

@SpaceWalkerRS
Copy link
Member

The gen2 branch has moved most of the build script logic into a Gradle plugin (Keratin), and while it doesn't solve every issue, it does make the build logic a lot more manageable. I wonder what issues still need fixing, and what changes we still want to implement, and if we can replace some of the parts that are using Gradle internals with custom Java code or event by invoking native code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildscript Issue related to the buildscript draft Tentative new feature enhancement New feature or request help wanted Extra attention is needed
Projects
Status: No status
Development

No branches or pull requests

3 participants