Skip to content

Commit aeaefd4

Browse files
committed
[I/Y-Build] Move RelEng Build Tools ANT tasks into this repository
The following Java files are copied from https://github.com/eclipse-platform/eclipse.platform.releng.buildtools at commitId: af458820007ba53a290d47a76ec58bd4e9ceef9e respectively from https://github.com/eclipse-platform/eclipse.platform.releng.buildtools/tree/af458820007ba53a290d47a76ec58bd4e9ceef9e Add the generator classes: - org.eclipse.releng.generators.TestResultsGenerator as TestResultsGenerator - org.eclipse.releng.generators.ErrorTracker as ErrorTracker - org.eclipse.releng.generators.PlatformStatus as PlatformStatus Add org.eclipse.releng.build.tools.comparator.Extractor as ComparatorSummaryExtractor Add org.eclipse.releng.build.tools.convert.ant.Converter as CompileLogConverter Add relevant classes from package org.eclipse.releng.build.tools.convert.dom to package log.convert (with same name) In all copied source files spaces are replaced by tabs and all files are formated, but not changed further. They don't compile successfully in this state and are only adapted subsequently.
1 parent fe2e6ec commit aeaefd4

15 files changed

Lines changed: 3028 additions & 1 deletion

.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<type>30</type>
1616
<matcher>
1717
<id>org.eclipse.ui.ide.multiFilter</id>
18-
<arguments>1.0-projectRelativePath-matches-true-true-(eclipse.platform.releng.prereqs.sdk|eclipse.platform.releng.tychoeclipsebuilder|oomph|products|sites)/.*</arguments>
18+
<arguments>1.0-projectRelativePath-matches-true-true-(eclipse.platform.releng.prereqs.sdk|eclipse.platform.releng.tychoeclipsebuilder|oomph|products|scripts|sites)/.*</arguments>
1919
</matcher>
2020
</filter>
2121
</filteredResources>

scripts/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25"/>
4+
<classpathentry kind="src" path="releng"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

scripts/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>eclipse.platform.releng.scripts</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=25
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=25
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
10+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
11+
org.eclipse.jdt.core.compiler.release=enabled
12+
org.eclipse.jdt.core.compiler.source=25
Lines changed: 313 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
2+
/*******************************************************************************
3+
* Copyright (c) 2013, 2025 IBM Corporation and others.
4+
*
5+
* This program and the accompanying materials
6+
* are made available under the terms of the Eclipse Public License 2.0
7+
* which accompanies this distribution, and is available at
8+
* https://www.eclipse.org/legal/epl-2.0/
9+
*
10+
* SPDX-License-Identifier: EPL-2.0
11+
*
12+
* Contributors:
13+
* IBM Corporation - initial API and implementation
14+
*******************************************************************************/
15+
16+
import java.io.BufferedReader;
17+
import java.io.BufferedWriter;
18+
import java.io.File;
19+
import java.io.FileWriter;
20+
import java.io.IOException;
21+
import java.io.Writer;
22+
import java.nio.file.Files;
23+
import java.util.ArrayList;
24+
import java.util.List;
25+
import java.util.regex.Matcher;
26+
import java.util.regex.Pattern;
27+
28+
/**
29+
* This class is responsible for extracting the relevent "Debug" messages from
30+
* the huge maven debug log.
31+
*
32+
* @author davidw
33+
*/
34+
public class ComparatorSummaryExtractor {
35+
36+
public static final String BUILD_DIRECTORY_PROPERTY = "builddirectory";
37+
public static final String COMPARATOR_REPO_PROPERTY = "comparatorRepo";
38+
private static final String EOL = System.lineSeparator();
39+
40+
private record LogEntry(String name, List<String> reasons, List<String> info) {
41+
42+
static LogEntry create(String name) {
43+
return new LogEntry(name, new ArrayList<>(), new ArrayList<>());
44+
}
45+
46+
public void addInfo(final String infoline) {
47+
info.add(infoline);
48+
}
49+
50+
public void addReason(final String reason) {
51+
reasons.add(reason);
52+
}
53+
}
54+
55+
private static final String BUILD_LOGS_DIRECTORY = "buildlogs";
56+
private static final String COMPARATOR_LOGS_DIRECTORY = "comparatorlogs";
57+
private String comparatorRepo = "comparatorRepo";
58+
private String buildDirectory;
59+
private static final Pattern MAIN_PATTERN = Pattern.compile(
60+
"^\\[WARNING\\].*eclipse.platform.releng.aggregator/(.*): baseline and build artifacts have same version but different contents");
61+
private static final Pattern NO_CLASSIFIER_PATTERN = Pattern.compile("^.*no-classifier:.*$");
62+
private static final Pattern CLASSIFIER_SOURCES_PATTERN = Pattern.compile("^.*classifier-sources:.*$");
63+
private static final Pattern CLASSIFIER_SOURCES_FEATURE_PATTERN = Pattern
64+
.compile("^.*classifier-sources-feature:.*$");
65+
66+
private static final Pattern SIGN1_PATTERN = Pattern.compile("^.*META-INF/(ECLIPSE_|CODESIGN).RSA.*$");
67+
private static final Pattern SIGN2_PATTERN = Pattern.compile("^.*META-INF/(ECLIPSE_|CODESIGN).SF.*$");
68+
private static final Pattern DOC_NAME_PATTERN = Pattern.compile("^.*eclipse\\.platform\\.common.*\\.doc\\..*$");
69+
// jar pattern added for bug 416701
70+
private final Pattern JAR_PATTERN = Pattern.compile("^.*\\.jar.*$");
71+
private int count;
72+
private int countSign;
73+
private int countDoc;
74+
private int countOther;
75+
private int countSignPlusInnerJar;
76+
private int countJDTCore;
77+
78+
private boolean docItem(final LogEntry newEntry) {
79+
boolean result = false;
80+
final String name = newEntry.name();
81+
final Matcher matcher = DOC_NAME_PATTERN.matcher(name);
82+
if (matcher.matches()) {
83+
result = true;
84+
}
85+
return result;
86+
}
87+
88+
public String getBuildDirectory() {
89+
// if not set explicitly, see if its a system property
90+
if (buildDirectory == null) {
91+
buildDirectory = System.getProperty(BUILD_DIRECTORY_PROPERTY);
92+
}
93+
return buildDirectory;
94+
}
95+
96+
private String getInputFilename() {
97+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + "mb060_run-maven-build_output.txt";
98+
}
99+
100+
private String getOutputFilenameDoc() {
101+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
102+
+ "buildtimeComparatorDocBundle.log.txt";
103+
}
104+
105+
private String getOutputFilenameFull() {
106+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
107+
+ "buildtimeComparatorFull.log.txt";
108+
}
109+
110+
private String getOutputFilenameOther() {
111+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
112+
+ "buildtimeComparatorUnanticipated.log.txt";
113+
}
114+
115+
private String getOutputFilenameSign() {
116+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
117+
+ "buildtimeComparatorSignatureOnly.log.txt";
118+
}
119+
120+
private String getOutputFilenameSignWithInnerJar() {
121+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
122+
+ "buildtimeComparatorSignatureOnlyWithInnerJar.log.txt";
123+
}
124+
125+
private String getOutputFilenameJDTCore() {
126+
return getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY + "/" + COMPARATOR_LOGS_DIRECTORY + "/"
127+
+ "buildtimeComparatorJDTCore.log.txt";
128+
}
129+
130+
public void processBuildfile() throws IOException {
131+
132+
// Make sure directory exists
133+
File outputDir = new File(getBuildDirectory() + "/" + BUILD_LOGS_DIRECTORY, COMPARATOR_LOGS_DIRECTORY);
134+
if (!outputDir.exists()) {
135+
outputDir.mkdirs();
136+
}
137+
138+
final File infile = new File(getInputFilename());
139+
final File outfile = new File(getOutputFilenameFull());
140+
final File outfileSign = new File(getOutputFilenameSign());
141+
final File outfileDoc = new File(getOutputFilenameDoc());
142+
final File outfileOther = new File(getOutputFilenameOther());
143+
final File outfileSignWithInnerJar = new File(getOutputFilenameSignWithInnerJar());
144+
final File outfileJDTCore = new File(getOutputFilenameJDTCore());
145+
try (BufferedReader input = Files.newBufferedReader(infile.toPath());
146+
Writer out = new FileWriter(outfile);
147+
BufferedWriter output = new BufferedWriter(out);
148+
Writer outsign = new FileWriter(outfileSign);
149+
BufferedWriter outputSign = new BufferedWriter(outsign);
150+
Writer outdoc = new FileWriter(outfileDoc);
151+
BufferedWriter outputDoc = new BufferedWriter(outdoc);
152+
Writer outother = new FileWriter(outfileOther);
153+
BufferedWriter outputOther = new BufferedWriter(outother);
154+
Writer outsignWithJar = new FileWriter(outfileSignWithInnerJar);
155+
BufferedWriter outputSignWithJar = new BufferedWriter(outsignWithJar);
156+
Writer outJDTCore = new FileWriter(outfileJDTCore);
157+
BufferedWriter outputJDTCore = new BufferedWriter(outJDTCore);) {
158+
159+
writeHeader(output);
160+
writeHeader(outputSign);
161+
writeHeader(outputSignWithJar);
162+
writeHeader(outputDoc);
163+
writeHeader(outputOther);
164+
writeHeader(outputJDTCore);
165+
count = 0;
166+
countSign = 0;
167+
countSignPlusInnerJar = 0;
168+
countDoc = 0;
169+
countOther = 0;
170+
countJDTCore = 0;
171+
String inputLine = "";
172+
173+
while (inputLine != null) {
174+
inputLine = input.readLine();
175+
if (inputLine != null) {
176+
final Matcher matcher = MAIN_PATTERN.matcher(inputLine);
177+
if (matcher.matches()) {
178+
179+
final LogEntry newEntry = LogEntry.create(matcher.group(1));
180+
// read and write differences, until next blank line
181+
do {
182+
inputLine = input.readLine();
183+
if ((inputLine != null) && (inputLine.length() > 0)) {
184+
newEntry.addReason(inputLine);
185+
}
186+
} while ((inputLine != null) && (inputLine.length() > 0));
187+
// //output.write(EOL);
188+
// now, do one more, to get the "info" that says
189+
// what was copied, or not.
190+
do {
191+
inputLine = input.readLine();
192+
if ((inputLine != null) && (inputLine.length() > 0)) {
193+
// except leave out the first line, which is a
194+
// long [INFO] line repeating what we already
195+
// know.
196+
if (!inputLine.startsWith("[INFO]")) {
197+
newEntry.addInfo(inputLine);
198+
}
199+
}
200+
} while ((inputLine != null) && (inputLine.length() > 0));
201+
// Write full log, for sanity check, if nothing else
202+
writeEntry(++count, output, newEntry);
203+
if (jdtCore(newEntry)) {
204+
writeEntry(++countJDTCore, outputJDTCore, newEntry);
205+
} else if (docItem(newEntry)) {
206+
writeEntry(++countDoc, outputDoc, newEntry);
207+
} else if (pureSignature(newEntry)) {
208+
writeEntry(++countSign, outputSign, newEntry);
209+
} else if (pureSignaturePlusInnerJar(newEntry)) {
210+
writeEntry(++countSignPlusInnerJar, outputSignWithJar, newEntry);
211+
} else {
212+
writeEntry(++countOther, outputOther, newEntry);
213+
}
214+
}
215+
}
216+
}
217+
}
218+
}
219+
220+
private void writeHeader(final BufferedWriter output) throws IOException {
221+
output.write("Comparator differences from current build" + EOL);
222+
output.write("\t" + getBuildDirectory() + EOL);
223+
if (comparatorRepo != null) {
224+
output.write("compared to reference repo at " + EOL);
225+
output.write("\t" + getComparatorRepo() + EOL + EOL);
226+
}
227+
}
228+
229+
private boolean jdtCore(final LogEntry newEntry) {
230+
boolean result = false;
231+
final String name = newEntry.name();
232+
if (name.equals("eclipse.jdt.core/org.eclipse.jdt.core/pom.xml")) {
233+
result = true;
234+
}
235+
return result;
236+
}
237+
238+
private boolean pureSignature(final LogEntry newEntry) {
239+
// if all lines match one of these critical patterns,
240+
// then assume "signature only" difference. If even
241+
// one of them does not match, assume not.
242+
boolean result = true;
243+
final List<String> reasons = newEntry.reasons();
244+
for (final String reason : reasons) {
245+
final Matcher matcher1 = NO_CLASSIFIER_PATTERN.matcher(reason);
246+
final Matcher matcher2 = CLASSIFIER_SOURCES_PATTERN.matcher(reason);
247+
final Matcher matcher3 = CLASSIFIER_SOURCES_FEATURE_PATTERN.matcher(reason);
248+
final Matcher matcher4 = SIGN1_PATTERN.matcher(reason);
249+
final Matcher matcher5 = SIGN2_PATTERN.matcher(reason);
250+
251+
if (matcher1.matches() || matcher2.matches() || matcher3.matches() || matcher4.matches()
252+
|| matcher5.matches()) {
253+
} else {
254+
result = false;
255+
break;
256+
}
257+
}
258+
259+
return result;
260+
}
261+
262+
private boolean pureSignaturePlusInnerJar(final LogEntry newEntry) {
263+
// if all lines match one of these critical patterns,
264+
// then assume "signature only plus inner jar" difference. If even
265+
// one of them does not match, assume not.
266+
// TODO: refactor so less copy/paste of pureSignature method.
267+
boolean result = true;
268+
final List<String> reasons = newEntry.reasons();
269+
for (final String reason : reasons) {
270+
final Matcher matcher1 = NO_CLASSIFIER_PATTERN.matcher(reason);
271+
final Matcher matcher2 = CLASSIFIER_SOURCES_PATTERN.matcher(reason);
272+
final Matcher matcher3 = CLASSIFIER_SOURCES_FEATURE_PATTERN.matcher(reason);
273+
final Matcher matcher4 = SIGN1_PATTERN.matcher(reason);
274+
final Matcher matcher5 = SIGN2_PATTERN.matcher(reason);
275+
final Matcher matcher6 = JAR_PATTERN.matcher(reason);
276+
277+
if (matcher1.matches() || matcher2.matches() || matcher3.matches() || matcher4.matches()
278+
|| matcher5.matches() || matcher6.matches()) {
279+
} else {
280+
result = false;
281+
break;
282+
}
283+
}
284+
285+
return result;
286+
}
287+
288+
public void setBuildDirectory(final String buildDirectory) {
289+
this.buildDirectory = buildDirectory;
290+
}
291+
292+
private void writeEntry(int thistypeCount, final Writer output, final LogEntry newEntry) throws IOException {
293+
294+
output.write(thistypeCount + ". " + newEntry.name() + EOL);
295+
final List<String> reasons = newEntry.reasons();
296+
for (final String reason : reasons) {
297+
output.write(reason + EOL);
298+
}
299+
final List<String> infolist = newEntry.info();
300+
for (final String info : infolist) {
301+
output.write(info + EOL);
302+
}
303+
output.write(EOL);
304+
}
305+
306+
public String getComparatorRepo() {
307+
return comparatorRepo;
308+
}
309+
310+
public void setComparatorRepo(String comparatorRepo) {
311+
this.comparatorRepo = comparatorRepo;
312+
}
313+
}

0 commit comments

Comments
 (0)