ant-contrib
ant-contrib
diff --git a/bundles/org.eclipse.swt/.classpath_cocoa_aarch64 b/bundles/org.eclipse.swt/.classpath_cocoa_aarch64
index 7c7600d7a27..07440032859 100644
--- a/bundles/org.eclipse.swt/.classpath_cocoa_aarch64
+++ b/bundles/org.eclipse.swt/.classpath_cocoa_aarch64
@@ -29,5 +29,6 @@
+
diff --git a/bundles/org.eclipse.swt/.classpath_cocoa_x86_64 b/bundles/org.eclipse.swt/.classpath_cocoa_x86_64
index c8f0d514f52..b323077f02b 100644
--- a/bundles/org.eclipse.swt/.classpath_cocoa_x86_64
+++ b/bundles/org.eclipse.swt/.classpath_cocoa_x86_64
@@ -29,5 +29,6 @@
+
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk
index e03c73d099c..b83802978e0 100644
--- a/bundles/org.eclipse.swt/.classpath_gtk
+++ b/bundles/org.eclipse.swt/.classpath_gtk
@@ -31,5 +31,6 @@
+
diff --git a/bundles/org.eclipse.swt/.classpath_win32 b/bundles/org.eclipse.swt/.classpath_win32
index 2edde625d7f..4cf3f176dbc 100644
--- a/bundles/org.eclipse.swt/.classpath_win32
+++ b/bundles/org.eclipse.swt/.classpath_win32
@@ -25,5 +25,6 @@
+
diff --git a/bundles/org.eclipse.swt/.gitignore b/bundles/org.eclipse.swt/.gitignore
index 8623d47ef51..867253bf3c8 100644
--- a/bundles/org.eclipse.swt/.gitignore
+++ b/bundles/org.eclipse.swt/.gitignore
@@ -2,3 +2,4 @@
ws/
.build64/
.buildas/
+/bin_build/
diff --git a/bundles/org.eclipse.swt/build-scripts/CollectSources.java b/bundles/org.eclipse.swt/build-scripts/CollectSources.java
new file mode 100644
index 00000000000..33c78b5049d
--- /dev/null
+++ b/bundles/org.eclipse.swt/build-scripts/CollectSources.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2024, 2024 Hannes Wellmann and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Hannes Wellmann - initial API and implementation
+ *******************************************************************************/
+import java.io.*;
+import java.nio.file.*;
+import java.util.*;
+
+/**
+ * Script to collect the SWT native sources for the specified native fragment.
+ *
+ * In order to be able to launch this directly as source script only
+ * reference standard java classes!
+ *
+ */
+public class CollectSources {
+
+ private record ScriptEnvironment(Path swtProjectRoot, Path targetDirectory, String ws, String arch) {
+ private static ScriptEnvironment read(String[] args) {
+ if (args.length != 2) {
+ throw new IllegalArgumentException("task and target directory must be defined as only argument");
+ }
+ Path swtProjectRoot = Path.of("").toAbsolutePath();
+ if (!swtProjectRoot.endsWith(Path.of("bundles/org.eclipse.swt"))) { // Consistency check
+ throw new IllegalStateException("Sript must be excuted from org.eclipse.swt project");
+ }
+ Path targetDirectory = Path.of(args[1]);
+ String ws = System.getProperty("ws");
+ String arch = System.getProperty("arch");
+ return new ScriptEnvironment(swtProjectRoot, targetDirectory, ws, arch);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ ScriptEnvironment env = ScriptEnvironment.read(args);
+ switch (args[0]) {
+ case "-nativeSources":
+ collectNativeSources(env);
+ break;
+ default:
+ throw new IllegalArgumentException("Unexpected value: " + args[0]);
+ }
+ }
+
+ private static void collectNativeSources(ScriptEnvironment env) throws IOException {
+ Path props = env.swtProjectRoot.resolve("nativeSourceFolders.properties");
+ Map sources = loadProperty(props);
+
+ String commonSources = sources.get("src_common");
+ String nativeSources = sources.get("src_" + env.ws);
+ List allSources = Arrays.asList((commonSources + "," + nativeSources).split(","));
+ System.out.println("Copy " + allSources.size() + " java source folders for " + env.ws + "." + env.arch);
+ copySubDirectories(env.swtProjectRoot, allSources, env.targetDirectory);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private static Map loadProperty(Path path) throws IOException {
+ try (InputStream in = Files.newInputStream(path)) {
+ Properties props = new Properties();
+ props.load(in);
+ return (Map) props;
+ }
+ }
+
+ private static void copySubDirectories(Path root, Collection allSources, Path target) throws IOException {
+ System.out.println("from " + root + "\nto " + target);
+ for (String srcPath : allSources) {
+ Path srcFolder = root.resolve(srcPath);
+ try (var files = Files.walk(srcFolder).filter(Files::isRegularFile)) {
+ for (Path sourceFile : (Iterable) files::iterator) {
+ Path targetFile = target.resolve(srcFolder.relativize(sourceFile));
+ Files.createDirectories(targetFile.getParent());
+ Files.copy(sourceFile, targetFile, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.swt/buildSWT.xml b/bundles/org.eclipse.swt/buildSWT.xml
index 4042af73fdf..9ddced45955 100644
--- a/bundles/org.eclipse.swt/buildSWT.xml
+++ b/bundles/org.eclipse.swt/buildSWT.xml
@@ -25,8 +25,6 @@
revision in the swp.map.
for Example: ant -f buildSWT.xml increment_version -Dnatives_changed=true
- To build the libraries of a fragment, run
- ant -f /build.xml build_libraries
-->
@@ -213,25 +211,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -297,87 +276,6 @@
-
-
-
-
-
-
- refreshing ${fragment}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Compile SWT natives against headers and libraries from JDK: ${SWT_JAVA_HOME}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Compile SWT natives against headers and libraries from JDK: ${SWT_JAVA_HOME}
-
-
-
-
-
-
-
-
@@ -401,20 +299,5 @@
"Creating file ${fileName}"
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bundles/org.eclipse.swt/nativeSourceFolders.properties b/bundles/org.eclipse.swt/nativeSourceFolders.properties
new file mode 100644
index 00000000000..6a93bdb27bd
--- /dev/null
+++ b/bundles/org.eclipse.swt/nativeSourceFolders.properties
@@ -0,0 +1,4 @@
+src_common=Eclipse SWT/common/library,Eclipse SWT PI/common/library
+src_win32=Eclipse SWT PI/win32/library,Eclipse SWT AWT/win32/library,Eclipse SWT OpenGL/win32/library
+src_gtk=Eclipse SWT PI/gtk/library,Eclipse SWT AWT/gtk/library,Eclipse SWT OpenGL/glx/library,Eclipse SWT PI/cairo/library,Eclipse SWT WebKit/gtk/library
+src_cocoa=Eclipse SWT PI/cocoa/library,Eclipse SWT AWT/cocoa/library