Skip to content

Commit 7f1fcf7

Browse files
committed
Show code tasks in compile logs of build website
and merge general and access warnings into a single warnings column. Also handle warnings without code-context (issued only directly on the file).
1 parent b7df278 commit 7f1fcf7

3 files changed

Lines changed: 53 additions & 65 deletions

File tree

scripts/releng/CompilerSummaryGenerator.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,31 @@ void parseCompileLog(Path file, Map<String, JSON.Object> compilerLog)
5151
throws IOException, SAXException, ParserConfigurationException {
5252
Document aDocument = XmlProcessorFactoryRelEng.parseDocumentIgnoringDOCTYPE(file);
5353
int warnings = 0;
54-
int accessWarnings = 0;
5554
int infos = 0;
55+
int tasks = 0;
5656
// Get summary of problems
5757
NodeList problemList = aDocument.getElementsByTagName("problem");
5858
for (Element problem : elements(problemList)) {
5959
String severity = problem.getAttribute("severity");
6060
switch (severity) {
61-
case "WARNING" -> {
62-
// this is a warning need to check the id
63-
String value = problem.getAttribute("id");
64-
switch (value) {
65-
case "ForbiddenReference", "DiscouragedReference" -> accessWarnings++;
66-
default -> warnings++;
67-
}
68-
}
61+
case "WARNING" -> warnings++;
6962
case "INFO" -> infos++; // this is an info warning
7063
}
7164
}
72-
if (warnings == 0 && accessWarnings == 0 && infos == 0) {
65+
NodeList tasksList = aDocument.getElementsByTagName("tasks");
66+
for (Element element : elements(tasksList)) {
67+
String count = element.getAttribute("tasks");
68+
tasks += Integer.parseInt(count);
69+
}
70+
71+
if (warnings == 0 && infos == 0 && tasks == 0) {
7372
return;
7473
}
7574
String path = compileLogsDirectory.relativize(file).toString().replace(File.separatorChar, '/');
7675
JSON.Object issues = JSON.Object.create();
7776
addIfNonZero(issues, "warnings", warnings);
78-
addIfNonZero(issues, "access", accessWarnings);
7977
addIfNonZero(issues, "infos", infos);
78+
addIfNonZero(issues, "tasks", tasks);
8079
if (compilerLog.putIfAbsent(path, issues) != null) {
8180
throw new IllegalStateException("Plugin already set: " + path + "\n" + compilerLog.get(path));
8281
}

sites/eclipse/build/reports.html

Lines changed: 42 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ <h3 id="tests">Unit Test Results</h3>
5454
<tbody id="test-results-summary"></tbody>
5555
</table>
5656

57-
<h3 id="compiler-issues">Plugins containing compile warnings or infos</h3>
57+
<h3 id="compiler-issues">Compile issues</h3>
5858
<p>
59-
The table below shows the plugins in which warnings were encountered.
59+
The table below shows the plugins in which warnings, infos or open tasks were encountered.
6060
Click on the jar file's row to view its detailed report.
6161
</p>
6262
<table class="styled-table">
6363
<thead>
6464
<tr>
6565
<th>Compile Logs (Jar Files)</th>
66-
<th style="text-align: center">General Warnings</th>
67-
<th style="text-align: center">Access Warnings</th>
68-
<th style="text-align: center">Infos</th>
66+
<th style="text-align: center;width: 20%;">Warnings</th>
67+
<th style="text-align: center;width: 20%;">Infos</th>
68+
<th style="text-align: center;width: 20%;">Tasks</th>
6969
</tr>
7070
</thead>
7171
<tbody id="compiler-issues-body"></tbody>
@@ -139,16 +139,16 @@ <h3 id="compiler-issues">Plugins containing compile warnings or infos</h3>
139139
row.classList.add('collapsible-table-main-row')
140140
insertLeanCell(row, false).innerHTML = shortName
141141
addLinkCell(row, `${shortName}--warnings`, issues.warnings)
142-
addLinkCell(row, `${shortName}--access_warnings`, issues.access)
143142
addLinkCell(row, `${shortName}--infos`, issues.infos)
143+
addLinkCell(row, `${shortName}--tasks`, issues.tasks)
144144
// Details row (collapsed by default)
145145
const detailsRow = compilerIssues.insertRow()
146146
detailsRow.classList.add('collapsible-table-details-row')
147147

148148
const content = ''
149-
+ (issues.warnings > 0 ? getDetailsContent(logFile, shortName, 'warnings') : '')
150-
+ (issues.access > 0 ? getDetailsContent(logFile, shortName, 'access_warnings') : '')
151-
+ (issues.infos > 0 ? getDetailsContent(logFile, shortName, 'infos') : '')
149+
+ (issues.warnings > 0 ? getDetailsContent(logFile, shortName, 'warning') : '')
150+
+ (issues.infos > 0 ? getDetailsContent(logFile, shortName, 'info') : '')
151+
+ (issues.tasks > 0 ? getDetailsContent(logFile, shortName, 'task') : '')
152152

153153
detailsRow.innerHTML = `<td colspan="${row.cells.length}">${content}</td>
154154
`
@@ -160,7 +160,7 @@ <h3 id="compiler-issues">Plugins containing compile warnings or infos</h3>
160160
}
161161

162162
function getDetailsContent(logFile, shortName, issueType) {
163-
return appendCopyLinkButton(`<h4 id="${shortName}--${issueType}"><b>${issueType.toUpperCase().replace('_', ' ')} in org.eclipse.${shortName}</b></h4>`) + `
163+
return appendCopyLinkButton(`<h4 id="${shortName}--${issueType}s"><b>${issueType.toUpperCase()}S in org.eclipse.${shortName}</b></h4>`) + `
164164
<div class="data-loader" data-supplier="parseCompileLogXML('${logFile}')" data-processor="generateCompileLog(arg,'${logFile}','${issueType}')"></div>
165165
`
166166
}
@@ -174,43 +174,42 @@ <h3 id="compiler-issues">Plugins containing compile warnings or infos</h3>
174174

175175
function generateCompileLog(compileLogXML, logFile, issueType) {
176176
let content = ''
177-
for (const fileProblems of compileLogXML.getElementsByTagName('problems')) {
178-
const source = fileProblems.parentNode
177+
const elementType = issueType == 'task' ? 'task' : 'problem'
178+
const expectedSeverity = issueType.toUpperCase()
179+
for (const fileIssues of compileLogXML.getElementsByTagName(`${elementType}s`)) {
180+
const source = fileIssues.parentNode
179181
const sourceFileName = computeRelativeFilePath(source, logFile)
180-
const warnings = parseInt(fileProblems.getAttribute('warnings'))
181-
const infos = parseInt(fileProblems.getAttribute('infos'))
182-
let counter = 0
183-
let elements = ''
184-
let severity;
185-
for (problem of fileProblems.getElementsByTagName('problem')) {
186-
severity = problem.getAttribute('severity')
187-
const problemID = problem.getAttribute('id')
188-
const line = parseInt(problem.getAttribute('line'))
189-
const message = escapeHTML(problem.querySelector('message').getAttribute('value'))
190-
const contextValue = problem.querySelector('source_context').getAttribute('value')
191-
const sourceStart = parseInt(problem.querySelector('source_context').getAttribute('sourceStart'))
192-
const sourceEnd = parseInt(problem.querySelector('source_context').getAttribute('sourceEnd')) + 1
193-
const sourceCodeBefore = escapeHTML(contextValue.substring(0, sourceStart))
194-
const sourceCode = escapeHTML(contextValue.substring(sourceStart, sourceEnd))
195-
const sourceCodeAfter = escapeHTML(contextValue.substring(sourceEnd, contextValue.length))
196-
if (isMatchingIssue(issueType, severity, problemID)) {
197-
elements += `
198-
<tr class="no-zebra-striping">
199-
<td style="padding-top:6px; padding-bottom:8px; padding-left:4px; padding-right:4px;">
200-
<b>${++counter}.</b> <i>${message}</i>
201-
${createCodeEditorBlock(line, `${sourceCodeBefore}${applyCodeMarker(severity.toLowerCase(), sourceCode)}${sourceCodeAfter}`)}
202-
</td>
203-
</tr>
204-
`
205-
}
206-
}
207-
if (counter > 0) {
182+
const itemCount = parseInt(fileIssues.getAttribute(`${issueType}s`))
183+
if (itemCount > 0) {
208184
content += `
209-
<h5><b><code>${sourceFileName}</code>: ${counter}&nbsp;${severity.toLowerCase()}${counter > 1 ? 's' : ''}</b></h5>
185+
<h5><b><code>${sourceFileName}</code>: ${itemCount}&nbsp;${issueType}${itemCount > 1 ? 's' : ''}</b></h5>
210186
<table><tbody>
211-
${elements}
212-
</tbody></table>
213187
`
188+
let counter = 0
189+
for (issue of fileIssues.getElementsByTagName(elementType)) {
190+
if (elementType != 'problem' || expectedSeverity == issue.getAttribute('severity')) {
191+
const message = escapeHTML(issue.querySelector('message').getAttribute('value'))
192+
content += `
193+
<tr class="no-zebra-striping">
194+
<td style="padding-top:6px; padding-bottom:8px; padding-left:4px; padding-right:4px;">
195+
<b>${++counter}.</b> <i>${message}</i>
196+
`
197+
const sourceContext = issue.querySelector('source_context')
198+
if (sourceContext) {
199+
const contextValue = sourceContext.getAttribute('value')
200+
const sourceStart = parseInt(sourceContext.getAttribute('sourceStart'))
201+
const sourceEnd = parseInt(sourceContext.getAttribute('sourceEnd')) + 1
202+
203+
const sourceCodeBefore = escapeHTML(contextValue.substring(0, sourceStart))
204+
const sourceCode = escapeHTML(contextValue.substring(sourceStart, sourceEnd))
205+
const sourceCodeAfter = escapeHTML(contextValue.substring(sourceEnd, contextValue.length))
206+
const line = parseInt(issue.getAttribute('line'))
207+
content += `${createCodeEditorBlock(line, `${sourceCodeBefore}${applyCodeMarker(issueType, sourceCode)}${sourceCodeAfter}`)}`
208+
}
209+
content += '</td> </tr>'
210+
}
211+
}
212+
content += '</tbody></table>'
214213
}
215214
}
216215
return content
@@ -242,17 +241,6 @@ <h5><b><code>${sourceFileName}</code>: ${counter}&nbsp;${severity.toLowerCase()}
242241
return filePath.substring(pluginNameIndex + pluginName.length + 1, filePath.length)
243242
}
244243

245-
const apiWarningIDs = new Set(['ForbiddenReference', 'DiscouragedReference'])
246-
247-
function isMatchingIssue(expectedType, severity, problemId) {
248-
switch (expectedType) {
249-
case "warnings": return severity == 'WARNING' && !apiWarningIDs.has(problemId)
250-
case "access_warnings": return severity == 'WARNING' && apiWarningIDs.has(problemId)
251-
case "infos": return severity == 'INFO'
252-
default: throw new Error(`Unexpected type: ${expectedType}`)
253-
}
254-
}
255-
256244
function insertLeanCell(row, center) {
257245
const cell = row.insertCell()
258246
cell.style = `padding-bottom:1px; padding-top:1px; ${center ? 'text-align:center' : ''}`

sites/eclipse/page.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--marker-error: red;
66
--marker-warning: orange;
77
--marker-info: dodgerblue;
8+
--marker-task: dodgerblue;
89
}
910

1011
.breadcrumbs-default-margin {

0 commit comments

Comments
 (0)