-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Thirdparty: Harmonize patches to document downstream changes #102242
Thirdparty: Harmonize patches to document downstream changes #102242
Conversation
All done, should be ready to review. |
This comment was marked as resolved.
This comment was marked as resolved.
e11ee8e
to
c44ad4c
Compare
c44ad4c
to
c51ae9c
Compare
@@ -1,5 +1,5 @@ | |||
/**************************************************************************/ | |||
/* godot.cpp */ | |||
/* enet_godot.cpp */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @Faless - I decided to rename our ENet Godot socket implementation to enet_godot.{cpp,h}
instead of just godot.{cpp,h}
to be more explicit.
#if 0 | ||
// WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical | ||
// threads from the browser or Node.js using JavaScript. | ||
nThreads = MAIN_THREAD_EM_ASM_INT({ | ||
const isBrowser = typeof window !== 'undefined'; | ||
const isNode = typeof process !== 'undefined' && process.versions != null && | ||
process.versions.node != null; | ||
if (isBrowser) { | ||
// Return 1 if the browser does not expose hardwareConcurrency. | ||
return window.navigator.hardwareConcurrency || 1; | ||
} else if (isNode) { | ||
return require('os').cpus().length; | ||
} else { | ||
return 1; | ||
} | ||
}); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just restored the original code with #if 0
, for documentation's sake and to reduce the risk of conflict.
+ Set<ScanLineEdge> edgeTree; | ||
+ RBSet<ScanLineEdge> edgeTree; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch was missing changes from Set
to RBSet
done by Juan a while ago.
c51ae9c
to
7cc583b
Compare
I reviewed each commit on GitHub and found a few issues in a couple patches, now fixed. This should finally be ready. Once approved, I'll squash the commits.
Edit 2: Now it's ready, I'm happy with the current state. |
7cc583b
to
7324a22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main requirement is that GitHub tests pass. My look-over by hand will be shallow. Approved.
Thanks for getting to this. It has been a problem that's now resolved.
I suggest finding a good place to put the description's instructions for patch creation. This may be enough for a first draft of patch creation documentation for third-party software in Godot Engine.
Edited:
I have created a godot engine documentation bug godotengine/godot-docs#10591
|
7324a22
to
8bce6b9
Compare
I squashed the commits, so this should be ready to merge. It's not exactly critical for 4.4 but it's just a documentation update for the most part, and since it will generate conflicts for cherry-picks, I'd prefer to have 4.4.stable and 4.5-dev share the same baseline so 4.5-dev thirdparty lib updates can easily be cherry-picked to 4.4.x. |
Needs a rebase |
8bce6b9
to
91907a8
Compare
Done. |
Thanks! |
Due to not having proper documentation on how to do this, various contributors have used slightly different approaches over the years, and we find it's difficult to convey what should be done in a consistent way.
I'll finally get to write such documentation, but first I'm harmonizing the way we do patches so that it can be better documented:
patches
subfolder, with a descriptive name in kebab case, with.patch
extension, starting with a four digit index to know in which order to apply them (e.g.0001-win7-8-dynamic-load.patch
).// -- GODOT start --
and// -- GODOT end --
comments around our changes. The patch files should be enough to document what changes we've done.git diff
, i.e. in Git compatible format and relative to the root of the Git repo. When using thepatch
command to apply them, that means usingpatch -p3 < path/to/patch
from the thirdparty library's folder, to skip the first 3 folders from the diff paths, e.g.a/thirdparty/embree
. Alternatively apply them withgit apply
from anywhere, orpatch -p1
from the root folder of the Godot repository.thirdparty/README.md
in a "Patches:" list of the patch filenames. We identify which PR added the patch in parenthesis, so that context can be found easily without having to write it in the README (which we very rarely did). For example:Patches should be generated with
git diff > patches/my-patch-name.patch
, and the generated patch file added to the same commit that's doing the change to thirdparty code. In other words, the process to generate a patch is:git diff > patches/000x-descriptive-name.patch
, stage both thirdparty code changes and the patch.thirdparty/README.md
where relevant, and with the PR number in parenthesis in the form(GH-xxxxx)
. If you haven't opened the PR yet, you can make an educated guess based on what's the latest issue/PR number, or amend it in after opening the PR.When updating a thirdparty library, the process is to remove all existing files (but the
patches
folder), copy the new files following thethirdparty/README.md
instructions, and stage that. Then start reapplying patches in order withgit apply patches/0001-some-patch.patch
orpatch -p3 < patches/0001-some-patch.patch
. If any patch fails or notifies about having to do fuzzy hunk matching, stop at that stage and rediff the patch before proceeding to the next step.