Skip to content

Commit 15d3065

Browse files
laeubiHannesWell
authored andcommitted
Link the sources in build.properties instead of copying with ant-tasks
1 parent 8dc46be commit 15d3065

File tree

9 files changed

+192
-78
lines changed

9 files changed

+192
-78
lines changed

binaries/org.eclipse.swt.cocoa.macosx.aarch64/build.properties

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,31 @@
1313
custom = true
1414
bin.includes = .,*.jnilib,about_files/,about.html,fragment.properties
1515
bin.excludes = library/
16-
source.. = src/
16+
source.. = \
17+
../../bundles/org.eclipse.swt/Eclipse SWT/cocoa,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/expand,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cocoa,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Program/cocoa,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/cocoa,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common
1741
src.includes = about.html,about_files/
1842

1943
pom.model.property.os=macosx

binaries/org.eclipse.swt.cocoa.macosx.x86_64/build.properties

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,31 @@
1313
custom = true
1414
bin.includes = .,*.jnilib,about_files/,about.html,fragment.properties
1515
bin.excludes = library/
16-
source.. = src/
16+
source.. = \
17+
../../bundles/org.eclipse.swt/Eclipse SWT/cocoa,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/expand,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cocoa,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Program/cocoa,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/cocoa,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common
1741
src.includes = about.html,about_files/
1842

1943
pom.model.property.os=macosx

binaries/org.eclipse.swt.gtk.linux.aarch64/build.properties

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,33 @@
1212
custom = true
1313
bin.includes = .,*.so,about_files/,about.html,fragment.properties
1414
bin.excludes = library/
15-
source.. = src/
15+
source.. = \
16+
../../bundles/org.eclipse.swt/Eclipse SWT/gtk,\
17+
../../bundles/org.eclipse.swt/Eclipse SWT/cairo,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/taskbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT PI/gtk,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cairo,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/gtk,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/gtk,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Program/gtk,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/gtk,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common,\
41+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk
1642
src.includes = about.html,about_files/
1743

1844
pom.model.property.os=linux

binaries/org.eclipse.swt.gtk.linux.loongarch64/build.properties

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,33 @@
1212
custom = true
1313
bin.includes = .,*.so,about_files/,about.html,fragment.properties
1414
bin.excludes = library/
15-
source.. = src/
15+
source.. = \
16+
../../bundles/org.eclipse.swt/Eclipse SWT/gtk,\
17+
../../bundles/org.eclipse.swt/Eclipse SWT/cairo,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/taskbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT PI/gtk,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cairo,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/gtk,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/gtk,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Program/gtk,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/gtk,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common,\
41+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk
1642
src.includes = about.html,about_files/
1743

1844
pom.model.property.os=linux

binaries/org.eclipse.swt.gtk.linux.ppc64le/build.properties

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,33 @@
1212
custom = true
1313
bin.includes = .,*.so,about_files/,about.html,fragment.properties
1414
bin.excludes = library/
15-
source.. = src/
15+
source.. = \
16+
../../bundles/org.eclipse.swt/Eclipse SWT/gtk,\
17+
../../bundles/org.eclipse.swt/Eclipse SWT/cairo,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/taskbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT PI/gtk,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cairo,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/gtk,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/gtk,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Program/gtk,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/gtk,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common,\
41+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk
1642
src.includes = about.html,about_files/
1743

1844
pom.model.property.os=linux

binaries/org.eclipse.swt.gtk.linux.x86_64/build.properties

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,34 @@
1313
custom = true
1414
bin.includes = .,*.so,about_files/,about.html,fragment.properties
1515
bin.excludes = library/
16-
source.. = src/
16+
source.. = \
17+
../../bundles/org.eclipse.swt/Eclipse SWT/gtk,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/cairo,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/bidi,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT/emulated/taskbar,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT PI/gtk,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT PI/cairo,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/gtk,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/gtk,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Program/gtk,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
37+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
38+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/gtk,\
39+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk,\
40+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/glx,\
41+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common,\
42+
../../bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk
43+
1744
src.includes = about.html,about_files/
1845

1946
pom.model.property.os=linux

binaries/org.eclipse.swt.win32.win32.x86_64/build.properties

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,27 @@
1313
custom = true
1414
bin.includes = .,*.dll,about_files/,about.html,fragment.properties
1515
bin.excludes = library/
16-
source.. = src/
16+
source.. = \
17+
../../bundles/org.eclipse.swt/Eclipse SWT/win32,\
18+
../../bundles/org.eclipse.swt/Eclipse SWT/common,\
19+
../../bundles/org.eclipse.swt/Eclipse SWT PI/common,\
20+
../../bundles/org.eclipse.swt/Eclipse SWT PI/win32,\
21+
../../bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32,\
22+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32,\
23+
../../bundles/org.eclipse.swt/Eclipse SWT Accessibility/common,\
24+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/win32,\
25+
../../bundles/org.eclipse.swt/Eclipse SWT AWT/common,\
26+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32,\
27+
../../bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common,\
28+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/win32,\
29+
../../bundles/org.eclipse.swt/Eclipse SWT Printing/common,\
30+
../../bundles/org.eclipse.swt/Eclipse SWT Program/win32,\
31+
../../bundles/org.eclipse.swt/Eclipse SWT Program/common,\
32+
../../bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common,\
33+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/common,\
34+
../../bundles/org.eclipse.swt/Eclipse SWT Browser/win32,\
35+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32,\
36+
../../bundles/org.eclipse.swt/Eclipse SWT OpenGL/common
1737
src.includes = about.html,about_files/
1838

1939
pom.model.property.os=win32

binaries/pom.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,6 @@
112112
<exportAntProperties>true</exportAntProperties>
113113
</configuration>
114114
</execution>
115-
<execution>
116-
<id>collect-java-sources</id>
117-
<phase>generate-sources</phase>
118-
<goals>
119-
<goal>run</goal>
120-
</goals>
121-
<configuration>
122-
<target>
123-
<exec executable="${java.home}/bin/java" dir="${swtMainProject}" failonerror="true">
124-
<arg line="-Dws=${ws} -Darch=${arch} build-scripts/CollectSources.java -javaSources '${project.basedir}/src' "/>
125-
</exec>
126-
</target>
127-
</configuration>
128-
</execution>
129115
<execution>
130116
<id>build-native-binaries</id>
131117
<phase>process-resources</phase>

bundles/org.eclipse.swt/build-scripts/CollectSources.java

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
* Contributors:
1212
* Hannes Wellmann - initial API and implementation
1313
*******************************************************************************/
14-
import java.io.*;
15-
import java.nio.file.*;
16-
import java.util.*;
17-
import java.util.stream.*;
18-
19-
import javax.xml.parsers.*;
20-
21-
import org.w3c.dom.*;
22-
import org.w3c.dom.Node;
23-
import org.xml.sax.*;
14+
import java.io.IOException;
15+
import java.io.InputStream;
16+
import java.nio.file.Files;
17+
import java.nio.file.Path;
18+
import java.nio.file.StandardCopyOption;
19+
import java.util.Arrays;
20+
import java.util.Collection;
21+
import java.util.List;
22+
import java.util.Map;
23+
import java.util.Properties;
24+
import java.util.Set;
2425

2526
/**
2627
* Script to collect the SWT sources for the specified native fragment.
@@ -38,7 +39,7 @@ private static ScriptEnvironment read(String[] args) {
3839
}
3940
Path swtProjectRoot = Path.of("").toAbsolutePath();
4041
if (!swtProjectRoot.endsWith(Path.of("bundles/org.eclipse.swt"))) { // Consistency check
41-
throw new IllegalStateException("Sript must be excuted from org.eclipse.swt project");
42+
throw new IllegalStateException("Script must be executed from org.eclipse.swt project");
4243
}
4344
Path binariesRoot = swtProjectRoot.getParent().getParent().resolve("binaries").toAbsolutePath();
4445
Path targetDirectory = Path.of(args[1]);
@@ -53,9 +54,6 @@ public static void main(String[] args) throws Exception {
5354
case "-nativeSources":
5455
collectNativeSources(env);
5556
break;
56-
case "-javaSources":
57-
collectJavaSources(env);
58-
break;
5957
default:
6058
throw new IllegalArgumentException("Unexpected value: " + args[0]);
6159
}
@@ -81,49 +79,6 @@ private static Map<String, String> loadProperties(Path path) throws IOException
8179
}
8280
}
8381

84-
private static void collectJavaSources(ScriptEnvironment env) throws Exception {
85-
Path classpathFile = env.binariesRoot.resolve(".classpath_" + env.ws);
86-
Set<String> srcClassPaths = readNativeJavaSourcesFromClasspath(classpathFile);
87-
Set<String> excludedExtensions = Set.of("_properties", "extras", "bridgesupport");
88-
System.out.println("Copy " + srcClassPaths.size() + " java source folders for " + env.ws);
89-
copySubDirectories(env.swtProjectRoot, srcClassPaths, env.targetDirectory, excludedExtensions);
90-
}
91-
92-
private static Set<String> readNativeJavaSourcesFromClasspath(Path classpathFile)
93-
throws IOException, SAXException, ParserConfigurationException {
94-
Element root = parseXMLFile(classpathFile);
95-
Set<String> srcPaths = new HashSet<>();
96-
if ("classpath".equals(root.getTagName())) {
97-
for (Node child : children(root)) {
98-
if (child instanceof Element classpathentry && "classpathentry".equals(classpathentry.getTagName())
99-
&& getAttributeValue(classpathentry, "kind").equals("src")
100-
&& getAttributeValue(classpathentry, "output").isBlank()) {
101-
srcPaths.add(getAttributeValue(classpathentry, "path"));
102-
}
103-
}
104-
}
105-
return srcPaths;
106-
}
107-
108-
private static Element parseXMLFile(Path classpathFile)
109-
throws IOException, SAXException, ParserConfigurationException {
110-
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
111-
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
112-
try (InputStream in = Files.newInputStream(classpathFile)) {
113-
return factory.newDocumentBuilder().parse(in).getDocumentElement();
114-
}
115-
}
116-
117-
private static Iterable<Node> children(Node node) {
118-
NodeList children = node.getChildNodes();
119-
return () -> IntStream.range(0, children.getLength()).mapToObj(children::item).iterator();
120-
}
121-
122-
private static String getAttributeValue(Element classpathentry, String attributeName) {
123-
Attr attribute = classpathentry.getAttributeNode(attributeName);
124-
return attribute != null ? attribute.getValue() : "";
125-
}
126-
12782
private static void copySubDirectories(Path root, Collection<String> allSources, Path target,
12883
Set<String> excludedExtensions) throws IOException {
12984
System.out.println("from " + root + "\nto " + target);

0 commit comments

Comments
 (0)