GTNewHorizons / ExampleMod1.7.10

An example mod for Minecraft 1.7.10 with Forge focussed on a stable setup.
MIT License
87 stars 77 forks source link

Followup regarding git #278

Closed HenryLoenwind closed 4 months ago

HenryLoenwind commented 4 months ago

Why do you think your code knows better if something is a git repo than the actual git repo?

Should I open a ticket against git to tell them their command is having hallucinations about seeing a git repo that doesn't exist?

image

$ ./gradlew build

> Configure project :
Project is not a git repository, and no VERSION override was set. Either initialize a git repo, set a VERSION environment variable override, or disable the gitVersion module.

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\git\gravity_torch\1.7.10\build.gradle' line: 4

* What went wrong:
An exception occurred applying plugin request [id: 'com.gtnewhorizons.gtnhconvention']
> Failed to apply plugin 'com.gtnewhorizons.gtnhconvention'.
   > Not a git repo, and no VERSION set.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 14s
$ git describe --tags
v2.0.4-1-g4c5bc4c
$ git log
commit 4c5bc4c907cc7a9bc1059f428a41c560ed1d1eb8 (HEAD -> master, origin/master)
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue Jun 25 05:21:12 2024 +0200

    Fixed readme

commit 0ab5d93eee454d1641aed72f641df9905d979cda (tag: v2.0.4)
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue Jun 25 05:07:34 2024 +0200

    More cleanup

commit 08078f19cdf9d1fd21f364323b5719532e1800f3
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue Jun 25 04:58:58 2024 +0200

    Cleanup

commit 3b7385981c8fff8a83d539e8e5ac673ee6381a90
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue Jun 25 04:07:12 2024 +0200

    1.21 port, initial commit

commit 5e9fba1ca163559854e02a48fdd89be2eacd7284
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue Jun 25 04:03:21 2024 +0200

    Created version folder

commit c9b2699303175f18018a93a72b08627a59ec0ce2
Author: Henry Loenwind <henry@loenwind.info>
Date:   Thu May 30 09:54:18 2024 +0200

    Delete .github/workflows/release-tags.yml

    Don't trash my carefully crafted release notes, you dumb bot.

commit 37edfb4c4e78eb1274e815e353d33b7e6d247d1e (tag: v1.0.3)
Author: Henry Loenwind <henry@loenwind.info>
Date:   Thu May 30 09:45:50 2024 +0200

    Added compatibility with Angelica (threaded rendering)

    and optimized rendering top and bottom faces a tiny bit. RenderingContext needs an overhaul....

commit a071de12bcfc99362c5f4099b1783b9e176c14eb
Author: Henry Loenwind <henry@loenwind.info>
Date:   Wed May 29 18:46:19 2024 +0200

    Update README.md

commit 508a2eea89fe43aeada29da8d25ab47c515980dd (tag: v1.0.2)
Author: Henry Loenwind <henry@loenwind.info>
Date:   Wed May 29 03:12:17 2024 +0200

    Tweaked rendering to use a single Tessellator for better compatibility

    Also cleaned up colour code to be a bit nicer

commit d0a9fbcca3033b88e7e20cf1d6fb094c918678dd
Author: Henry Loenwind <henry@loenwind.info>
Date:   Wed May 29 03:06:56 2024 +0200

    Fixed config values not actually being set from the config file

commit f6f6e29bcabb7dc59c813cf1dc34bb44d8853c8b (tag: v1.0.1)
Author: Henry Loenwind <henry@loenwind.info>
Date:   Wed May 29 01:27:25 2024 +0200

    Added config to force Tessellator rendering

    Probably needed for compatibility with rendering overhaul mods.

commit bc014932d2eae8ca10f9b1209c8bd0a6936638f0
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue May 28 23:04:35 2024 +0200

    Removed debug option

commit 90e978c772b6199627a637c412ec4cbbb17dacbb
Author: Henry Loenwind <henry@loenwind.info>
Date:   Tue May 28 22:53:35 2024 +0200

    Fixed spelling mistakes

:

Also, I'm not even trying to build the project. For that I can override with the environment variable manually. I'm trying to open it in Eclipse. Just OPEN it to look at the code. And even Eclipse sees it as a git repo.

image

mitchej123 commented 4 months ago

HenryLoenwind commented 1 minute ago Why do you think your code knows better if something is a git repo than the actual git repo?

Keep up the attitude and see how much help that gets you. Try being polite instead of rude from the get go.

HenryLoenwind commented 4 months ago

PS: VERSION=42 ./gradlew build works fine. Just that I don't need a build, I want to open it in eclipse

mitchej123 commented 4 months ago

https://github.com/GTNewHorizons/GTNHGradle/blob/640a6c810c8cb602a17d80c055b19d006456b46b/src/main/java/com/gtnewhorizons/gtnhgradle/modules/GitVersionModule.java#L25

mitchej123 commented 4 months ago

final boolean isAGitRepo = Files.exists(projectDir.resolve(".git"));

Your version of git is clearly looking at something that isn't standard from what I've seen; every checkout I've had puts the files in .git.

You can set a VERSION env var in eclipse, setup a standard git repo, or submit a PR against gtnh gradle to identify new and/or non standard git setups

mitchej123 commented 4 months ago

Which version of git are you using

Dream-Master commented 4 months ago

Hey can we please act and argue as grown ups ? Thank you Maybe a discussion on Discord could be more helpful then just put here a wall of text ?

HenryLoenwind commented 4 months ago

Keep up the attitude and see how far that gets you.

I'd suggest you work on your attitude. Have a look at the original ticket:

I started it off with proof that the project is in git controlled by running a git command right after the build failure. I asked how to disable it, as the error message only says to disable it but doesn't give any hint on how---the build.gradle is rather empty and there's nothing in the gradle-properties. I even added that setting an environment variable is not an option as you cannot set one in Eclipse for the gradle process.

You closed the ticket with the very unhelpful comment of "that's no git repo".

I told you that git recognises it as a git repo.

You doubled down on "that's no repo".


So again, I'm not interested in how to get the gitVersion thing working. I'm not building the project---I built and published it weeks ago and so far it's been working without any issues. I simply wanted to open the thing because I wanted to compare a 1.7.10 Forge class with a 1.21 class. I shouldn't even need any kind of version for opening the project in Eclipse.

Also, Eclipse doesn't have the capability of setting environment variables for the automatic background "configure project" gradle run. It can do that for launch configurations and it may have some for manual gradle task runs. But not for the background stuff it uses to query the project setup from gradle.


But as you provided the code link, I went through it and found the error. It is using a very straightforward (and wrong) way of checking for a git repo. Instead of asking the GitVersionPlugin, it checks for the .git folder. While the GitVersionPlugin can get the tag version from any folder of a git repo, that .git folder only exists once for the whole repo—at the top level. So, creating a fake empty .git folder allows it to run.

However, there's something weird anyway. On the command line, all is well, and it correctly picks up the latest tag (and commit and changed files):

$ ./gradlew build

> Configure project :
You might want to check out './gradlew :faq' if your build fails.
Deprecated: Allowing insecure connections for repo 'maven' - add 'allowInsecureProtocol = true' to silence
This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`
For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle
Build script update from 1.0.21 to 1.0.23 available! Run ./gradlew updateBuildScript

> Task :compileJava
Jabel: initialized
Note: SpongePowered MIXIN Annotation Processor Version=0.8.5
Note: Supported obfuscation types: ObfuscationServiceMCP supports [searge,notch]
Note: Loading searge mappings from C:\Users\xxx\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1614-1.7.10\srgs\mcp-srg.srg
Note: Writing refmap to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.gravitytorch.refmap.json
Note: Writing refmap to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.gravitytorch.refmap.json
Note: Writing searge output SRGs to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.srg
Note: Writing refmap to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.gravitytorch.refmap.json
Note: Writing refmap to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.gravitytorch.refmap.json
Note: Writing searge output SRGs to D:\git\gravity_torch\1.7.10\build\tmp\mixins\mixins.srg

BUILD SUCCESSFUL in 21s

$ ls -ltr build/libs/
total 1008
...
-rwxrwx---+ 1 xxx None 43435 Jul  7 09:28 gravitytorch-v2.0.4-master.1+4c5bc4c907-dirty-dev.jar
-rwxrwx---+ 1 xxx None 43824 Jul  7 09:28 gravitytorch-v2.0.4-master.1+4c5bc4c907-dirty.jar
-rwxrwx---+ 1 xxx None 20354 Jul  7 09:28 gravitytorch-v2.0.4-master.1+4c5bc4c907-dirty-sources.jar

But in Eclipse it still is complaining (but at least not rejecting):

> Configure project :
This mod must be version controlled by Git AND the repository must provide at least one tag,
or the VERSION override must be set! (Do NOT download from GitHub using the ZIP option, instead
clone the repository, see https://gtnh.miraheze.org/wiki/Development for details.

Version override set to NO-GIT-TAG-SET!
You might want to check out './gradlew :faq' if your build fails.
Deprecated: Allowing insecure connections for repo 'maven' - add 'allowInsecureProtocol = true' to silence
This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`
For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle
Build script update from 1.0.21 to 1.0.23 available! Run ./gradlew updateBuildScript

> Task :nothing UP-TO-DATE

BUILD SUCCESSFUL in 7s

May I also state that I find it a very curious decision to throw for a missing version number on any gradle task other than build? Even ./gradlew tasks fails.

mitchej123 commented 4 months ago

An issue has been made here https://github.com/GTNewHorizons/GTNHGradle/issues/17

I again looked at the original ticket; last night I looked at it on mobile and since it was a screenshot instead of text it was easy to miss the part where you checked the git version.

I didn't double down on anything, just pointed out I wasn't assuming anything and was reading the screenshot provided.

99.5% of every other issue anyone else has had along these lines was because they downloaded the zip or didn't create a repo/commit -- Occam's Razor - that's generally the solution.

The ticket was closed because you were getting argumentative and saying I was assuming things, instead of moving it forward in a helpful manner of pointing out my oversight nicely and laying out the fact patterns, even on this ticket your first line was quite passive aggressive.