diff options
| author | Leo Ufimtsev | 2017-12-05 03:16:51 +0000 |
|---|---|---|
| committer | Leo Ufimtsev | 2017-12-05 03:16:51 +0000 |
| commit | 046cce2c7c22bc552489d4d7870b7b1919930c67 (patch) | |
| tree | dc04a82a35ca8163c27cf2550c6cf4d1d16c6f73 | |
| parent | 7eaf827af2dc3d5e192450bf89a96b1e117bd60d (diff) | |
| download | eclipse.platform.swt-046cce2c7c22bc552489d4d7870b7b1919930c67.tar.gz eclipse.platform.swt-046cce2c7c22bc552489d4d7870b7b1919930c67.tar.xz eclipse.platform.swt-046cce2c7c22bc552489d4d7870b7b1919930c67.zip | |
Bug 510905 (Webkit2FuncRetVal)
Adding relevant changes to:
- make webkitextension* folder have versions
- make_linux* delete old webkitextensions* folder and .so's
before creating/building new one.
- debug messages to be used to figure out how to make webextension
loading to work with OSGI. (to be removed later).
Change-Id: Ia979bca8764c19b389dff51b16dc54109f11faea
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
5 files changed, 47 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java index 38e60fe377..4b8d6c9aeb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java @@ -358,6 +358,10 @@ public static String getVersionString () { return version; } + +/** TEMP VAR to figure out how to package webkitextensions* folder into OSGI mechanism. To re removed upon completion of Bug 510905 */ +private static boolean SWT_WEBKIT_DEBUG_MSGS = System.getenv("SWT_WEBKIT_DEBUG_MSGS") != null ? true : false; + /** * Locates a resource located either in java library path, swt library path, or attempts to extract it from inside swt.jar file. * This function supports a single level subfolder, e.g SubFolder/resource. @@ -379,6 +383,7 @@ public static File findResource(String subDir, String resourceName, boolean mapR // This code commonly finds the resource if the swt project is a required project and the swt binary (for your platform) // project is open in your workplace (found in the JAVA_LIBRARY_PATH) or if you're explicitly specified SWT_LIBRARY_PATH. { + Function<String, File> lookForFileInPath = searchPath -> { String classpath = System.getProperty(searchPath); if (classpath != null){ @@ -386,6 +391,7 @@ public static File findResource(String subDir, String resourceName, boolean mapR for (String path : paths) { File file = new File(path + SEPARATOR + maybeSubDirPath + finalResourceName); if (file.exists()){ + if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource has found a file in search path: " + file.getPath()); // Temp, will be removed. Bug 510905 return file; } } @@ -400,6 +406,8 @@ public static File findResource(String subDir, String resourceName, boolean mapR } } + if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource didn't find file in paths. Will attempt to extract."); // Temp, will be removed. Bug 510905 + // 2) Need to try to pull the resource out of the swt.jar. // Look for the resource in the user's home directory, (if already extracted in the temp swt folder. (~/.swt/lib...) // Extract from the swt.jar if not there already. @@ -423,8 +431,10 @@ public static File findResource(String subDir, String resourceName, boolean mapR } StringBuffer message = new StringBuffer(""); + if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource Attempting to extract: " + maybeSubDirPath + finalResourceName); // Temp, will be removed. Bug 510905 if (extract(file.getPath(), maybeSubDirPath + finalResourceName, message)) { if (file.exists()) { + if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource extracted file sucessfully!"); // Temp, will be removed. Bug 510905 return file; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak index d5e316961f..c8a253fac6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak @@ -52,7 +52,8 @@ ALL_SWT_LIBS = $(SWT_LIB) $(AWT_LIB) $(SWTPI_LIB) $(CAIRO_LIB) $(ATK_LIB) $(GLX_ # Webkit extension lib has to be put into a separate folder and is treated differently from the other libraries. WEBKIT_EXTENSION_LIB = lib$(WEBKIT_EXTENSION_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so -WEBEXTENSION_DIR = webkitextensions +WEBEXTENSION_BASE_DIR = webkitextensions +WEBEXTENSION_DIR = $(WEBEXTENSION_BASE_DIR)$(maj_ver)$(min_ver) CAIROCFLAGS = `pkg-config --cflags cairo` CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo @@ -239,16 +240,25 @@ glx_stats.o: glx_stats.c glx_stats.h # # Install # -install: all - cp *.so $(OUTPUT_DIR) - - +# Note on syntax because below might be confusing even for bash-Gods: +# @ do not print command +# - do not stop if there is a fail.. => @- is combination of both. +# [ COND ] && CMD only run CMD if condition is true like 'if COND then CMD'. Single line to be makefile compatible. +# -d test if file exists and is a directory. +# $$(val) in makefile, you have to escape $(..) into $$(..) +# I hope there are no spaces in the path :-). install: all cp $(ALL_SWT_LIBS) $(OUTPUT_DIR) ifeq ($(GTK_VERSION), 3.0) # Copy webextension into it's own folder, but create folder first. - [ -d $(OUTPUT_DIR)/$(WEBEXTENSION_DIR) ] || mkdir $(OUTPUT_DIR)/$(WEBEXTENSION_DIR) # If folder not exist, make it. - cp $(WEBKIT_EXTENSION_LIB) $(OUTPUT_DIR)/$(WEBEXTENSION_DIR)/ + @# CAREFULLY delete '.so' files inside webextension*. Then carefully remove the directories. 'rm -rf' seemed too risky of an approach. + @-[ "$$(ls -d $(OUTPUT_DIR)/$(WEBEXTENSION_BASE_DIR)*/*.so)" ] && rm -v `ls -d $(OUTPUT_DIR)/$(WEBEXTENSION_BASE_DIR)*/*.so` + @-[ "$$(ls -d $(OUTPUT_DIR)/$(WEBEXTENSION_BASE_DIR)*)" ] && rmdir -v `ls -d $(OUTPUT_DIR)/$(WEBEXTENSION_BASE_DIR)*` + + # Copying webextension is not critical for build to succeed, thus we use '-'. SWT can still function without a webextension. + @-[ -d $(OUTPUT_DIR)/$(WEBEXTENSION_DIR) ] || mkdir -v $(OUTPUT_DIR)/$(WEBEXTENSION_DIR) # If folder does not exist, make it. + -cp $(WEBKIT_EXTENSION_LIB) $(OUTPUT_DIR)/$(WEBEXTENSION_DIR)/ endif + # # Clean # diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index 9618064134..755c797d71 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -384,6 +384,7 @@ class WebKit extends WebBrowser { */ @SuppressWarnings("unused") // Only called directly from C private static void initializeWebExtensions_callback (long /*int*/ WebKitWebContext, long /*int*/ user_data) { + if (WebKitGTK.SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: Initializing webextension"); // 1) GDBus: // Normally we'd first initialize gdbus channel. But gdbus makes Browser slower and isn't always needed. @@ -395,7 +396,8 @@ class WebKit extends WebBrowser { // 2) Load Webkit Extension: // Webkit extensions should be in their own directory. String swtVersion = Library.getVersionString(); - File extension = Library.findResource("webkitextensions","swt-webkit2extension", true); + if (WebKitGTK.SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: Webkit dir is:" + "webkitextensions" + swtVersion); + File extension = Library.findResource("webkitextensions" + swtVersion ,"swt-webkit2extension", true); if (extension == null){ System.err.println("SWT Webkit.java Error: Could not find webkit extension. BrowserFunction functionality will not be available. \n" + "(swt version: " + swtVersion + ")"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java index db3244ee1a..b219a1868c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java @@ -89,6 +89,7 @@ class WebkitGDBus { static void init(String uniqueId) { if (initialized) return; + if (WebKitGTK.SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: Webkit GDBus is being initialized with id: " + uniqueId); initialized = true; DBUS_SERVICE_NAME = "org.eclipse.swt" + uniqueId; int owner_id = WebKitGTK.g_bus_own_name(WebKitGTK.G_BUS_TYPE_SESSION, diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java index 6f96099383..a7bb1ad384 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java @@ -25,6 +25,21 @@ public class WebKitGTK extends C { public static final String Webkit1AssertMsg = "Webkit2 code reached by webkit1"; // $NON-NLS-1$ public static final String Webkit2AssertMsg = "Webkit1 code reached by webkit2"; // $NON-NLS-1$ + /** + * Internal version of "Webkit glue code", used mainly during webkit2 port. + * Used to make it easier to support users on bugzilla. Updated by hand. + */ + private static final String swtWebkitGlueCodeVersion = " SWT Glue code version: 50.0"; + private static final String swtWebkitGlueCodeVersionInfo = " info: +BrowserFunction/GDBus, +WebkitExtension Folder versioning, -setUrl(..postData..), -setCookie(), -getCookie"; + + + /** + * Temporary variable used during webkit2 port, to debug various problems for situations when it's time consuming to rebuild/debug. + * e.g debug issues in compiled eclipse builds, OSGI loading of the extension etc.. + * Should be removed once webkit2 (and it's enhancements) are completed, no need to keep these msgs around. + */ + public static boolean SWT_WEBKIT_DEBUG_MSGS = System.getenv("SWT_WEBKIT_DEBUG_MSGS") != null ? true : false; + static { try { Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$ @@ -48,11 +63,8 @@ public class WebKitGTK extends C { System.out.println("SWT_LIB Webkit1 Webkitgtk:"+ webkit_major_version() +"."+ webkit_minor_version() + "." + webkit_micro_version() + " (webkitgtk < 2.5 is Webkit1)"); } if (WEBKIT2) { - String featureInfo = " Implemented: BrowserFunction over GDBus, \n" - + " not finished: setUrl(..postData)\n"; System.out.println("SWT_LIB Webkit2 Webkitgtk:"+ webkit_get_major_version()+"."+ webkit_get_minor_version() + "." - + webkit_get_micro_version() + " (webkitgtk >=2.5 is Webkit2)\n" - + featureInfo); + + webkit_get_micro_version() + " (webkitgtk >=2.5 is Webkit2) " + swtWebkitGlueCodeVersion + swtWebkitGlueCodeVersionInfo); } } }; |
