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

Remove all existing native libraries before copying new compiled #1100

Merged
merged 1 commit into from Mar 12, 2024

Conversation

iloveeclipse
Copy link
Member

If make_common.mak changes, code in 'Check if SWT-binaries build is needed' stage, that is supposed to delete native libraries, simply doesn't delete anything as it relies on getSWTVersions() that reads (changed) versions.

Instead, try to delete every library file stored in git before copying freshly compiled ones during 'Collect and sign binaries' stage.

Fixes #1095

@iloveeclipse
Copy link
Member Author

@HannesWell : I'm not sure why that was done in the way it was done, I guess we still don't build all native bits on SWT native build, which would be sad.

I guess some parts like webkit / edge support libraries might be deleted now and not rebuilt => therefore DRAFT PR.

Copy link
Contributor

github-actions bot commented Mar 11, 2024

Test Results

   299 files  ±0     299 suites  ±0   7m 12s ⏱️ -14s
 4 099 tests ±0   4 091 ✅ ±0   8 💤 ±0  0 ❌ ±0 
12 209 runs  ±0  12 134 ✅ ±0  75 💤 ±0  0 ❌ ±0 

Results for commit 8fcaabd. ± Comparison against base commit d2a5d7a.

♻️ This comment has been updated with latest results.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HannesWell : I'm not sure why that was done in the way it was done, I guess we still don't build all native bits on SWT native build, which would be sad.

I guess some parts like webkit / edge support libraries might be deleted now and not rebuilt => therefore DRAFT PR.

In general the structure was similar to the ant-task based build but I wanted to make deleting the natives more specific to not just delete all native files in the fragments. As you mentioned we cannot build all native binaries. The only one I see currently is the WebView2Loader.dll which is provided by Microsoft. I think this is a suitable reference:
https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#files-to-ship-with-the-app

Jenkinsfile Outdated
@@ -263,6 +263,7 @@ pipeline {
done
fi
fi
rm "${WORKSPACE}/eclipse.platform.swt/binaries/org.eclipse.swt.${PLATFORM}/*swt*.$binariesExtension"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The place where the deletion is supposed to happen is

rm -f binaries/org.eclipse.swt.gtk.*/lib*-${swt_version}.so
rm -f binaries/org.eclipse.swt.win32.*/*-${swt_version}.dll
rm -f binaries/org.eclipse.swt.cocoa.*/lib*-${swt_version}.jnilib

For the reasons you have described this does not delete the old binaries if the minor or major version is changed manually (i.e. before the pipeline starts).
But instead of deleting the binaries here the pattern in the linked rm calls should be adjusted to cover that scenario too.

So it could either be just changed to

rm -f binaries/org.eclipse.swt.gtk.*/libswt-*.so
rm -f binaries/org.eclipse.swt.win32.*/swt-*.dll
rm -f binaries/org.eclipse.swt.cocoa.*/libswt-*.jnilib

or more specific (not sure if this the right syntax I just searched it together) to expect a version like suffix in the end.
With regex I would write \d+r\d+

rm -f binaries/org.eclipse.swt.gtk.*/libswt-*-+([0-9])r+([0-9]).so
rm -f binaries/org.eclipse.swt.win32.*/swt-*-+([0-9])r+([0-9]).dll
rm -f binaries/org.eclipse.swt.cocoa.*/libswt-*-+([0-9])r+([0-9]).jnilib

@HannesWell HannesWell force-pushed the issue_1095 branch 3 times, most recently from eea222c to 744c816 Compare March 12, 2024 12:22
Jenkinsfile Outdated Show resolved Hide resolved
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iloveeclipse I have now applied the suggested changes and pushed it to your branch.
As I'm not a Linux pro, I cannot tell if there is a better way to express the suggested regex style pattern for bash. Please let me know if you do.

I have re-started the build of this PR enforcing native-lib build so we can see if this change works as expected. In my MSYS environment under Windows it worked as expected.
Once this is merged we have to enforce a native re-build on the master in order to delete the old natives or they are deleted manually as part of this PR.
I have no strong preference for either way. Deleting them manually would be more work, but would save us new revisions and thus one or two MB of LFS space.

@@ -150,9 +150,10 @@ pipeline {
'comma_ver='+swtVersions['comma_ver'], "new_comma_ver=${swtVersions['maj_ver']},${swtVersions['min_ver']},${swtVersions['new_rev']},0" ]) {
sh '''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+(pattern‐list) syntax is a bashism (extglob). This won't work in POSIX sh.

We need to switch to bash here and enable extglob:

-sh '''
+sh '''#!/bin/bash -ex
+      shopt -s extglob

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sratz : what about

swtNativeLibName='swt-.*-[0-9]+r[0-9]+'
ls -d binaries/org.eclipse.swt.gtk.*/*   | grep -E ${swtNativeLibName}.so     | xargs rm -vf
ls -d binaries/org.eclipse.swt.win32.*/* | grep -E ${swtNativeLibName}.dll    | xargs rm -vf
ls -d binaries/org.eclipse.swt.cocoa.*/* | grep -E ${swtNativeLibName}.jnilib | xargs rm -vf

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please don't. Never parse ls output. https://mywiki.wooledge.org/ParsingLs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for that hint! It's really not simple to understand all these shell scripts in detail 😅

With all this special setup I think it is best, to just go the simple way and use:

rm binaries/org.eclipse.swt.gtk.*/libswt-*.so
rm binaries/org.eclipse.swt.win32.*/swt-*.dll
rm binaries/org.eclipse.swt.cocoa.*/libswt-*.jnilib

With the current schema this deletes exactly the binaries we build in the SWT pipeline.
All native libraries in the fragments that should not be deleted at this point simply must not start with swt/libswt, which is the case for the only current candidate WebView2Loader.dll.

If 'make_common.mak' is changed manually (e.g. during new release-cycle
preparation), the code in 'Check if SWT-binaries build is needed' stage,
that is supposed to delete native libraries, doesn't delete anything as
it relies on getSWTVersions() that reads the (already changed) versions.

Adjust the file-pattern to delete every *swt* library file stored in git
instead, regardless of its exact version.

Fixes eclipse-platform#1095

Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
@HannesWell
Copy link
Member

The current list of changes looks good (see below).
@iloveeclipse and everyone interested as well, are you fine with the current approach?
I'm fine with it and after submission would run the master build with enforeced native complication to delete the outdated natives and ensure it works as expected.

 Changes to be committed:
   (use "git restore --staged <file>..." to unstage)
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4964r8.jnilib
 	deleted:    binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4965r2.jnilib
 	new file:   binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4965r3.jnilib
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4964r8.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4965r2.so
 	new file:   binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4965r2.so
 	renamed:    binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4964r8.so -> binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4965r3.so
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4964r8.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4965r2.dll
 	new file:   binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4965r3.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4964r8.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4965r2.dll
 	new file:   binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4965r3.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4964r8.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4965r2.dll
 	new file:   binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4965r3.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4964r8.dll
 	deleted:    binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4965r2.dll
 	new file:   binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4965r3.dll
 	modified:   bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
 	modified:   bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak

@iloveeclipse iloveeclipse marked this pull request as ready for review March 12, 2024 14:29
@iloveeclipse
Copy link
Member Author

I'm fine with that.

@HannesWell HannesWell merged commit c9a4f7d into eclipse-platform:master Mar 12, 2024
13 checks passed
@HannesWell
Copy link
Member

I'm fine with that.

Then lets apply this. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Older binaries are not deleted
3 participants