Skip to content

Commit c869426

Browse files
committed
Merge branch 'master' into debug-javac-output
2 parents 20152f3 + e39577b commit c869426

File tree

74 files changed

+1315
-1115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1315
-1115
lines changed

Diff for: .github/workflows/codeql.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
pull_request:
18+
branches: [ "master" ]
19+
schedule:
20+
- cron: '33 4 * * 1'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
32+
permissions:
33+
# required for all workflows
34+
security-events: write
35+
36+
# required to fetch internal or private CodeQL packs
37+
packages: read
38+
39+
# only required for workflows in private repositories
40+
actions: read
41+
contents: read
42+
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
include:
47+
- language: java-kotlin
48+
build-mode: none # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too.
49+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
50+
# Use `c-cpp` to analyze code written in C, C++ or both
51+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
52+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
53+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
54+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
55+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
56+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
61+
# Initializes the CodeQL tools for scanning.
62+
- name: Initialize CodeQL
63+
uses: github/codeql-action/init@v3
64+
with:
65+
languages: ${{ matrix.language }}
66+
build-mode: ${{ matrix.build-mode }}
67+
# If you wish to specify custom queries, you can do so here or in a config file.
68+
# By default, queries listed here will override any specified in a config file.
69+
# Prefix the list here with "+" to use these queries and those in the config file.
70+
71+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
72+
# queries: security-extended,security-and-quality
73+
74+
# If the analyze step fails for one of the languages you are analyzing with
75+
# "We were unable to automatically build your code", modify the matrix above
76+
# to set the build mode to "manual" for that language. Then modify this step
77+
# to build your code.
78+
# ℹ️ Command-line programs to run using the OS shell.
79+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
80+
- if: matrix.build-mode == 'manual'
81+
shell: bash
82+
run: |
83+
echo 'If you are using a "manual" build mode for one or more of the' \
84+
'languages you are analyzing, replace this with the commands to build' \
85+
'your code, for example:'
86+
echo ' make bootstrap'
87+
echo ' make release'
88+
exit 1
89+
90+
- name: Perform CodeQL Analysis
91+
uses: github/codeql-action/analyze@v3
92+
with:
93+
category: "/language:${{matrix.language}}"

Diff for: .github/workflows/maven.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616
# under the License.
1717

1818
name: GitHub CI
19-
on:
20-
push:
21-
pull_request:
2219

23-
jobs:
20+
on: [push, pull_request]
2421

22+
jobs:
2523
build:
2624
name: Build it
2725
uses: codehaus-plexus/.github/.github/workflows/maven.yml@master
2826
with:
29-
jdk-fast-fail-build: '21'
30-
jdk-matrix: '["11", "17", "21"]'
27+
matrix-exclude: '[ {"jdk": "8"}, {"jdk": "11"} ]'
3128
jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica", "corretto"]'
32-
os-matrix: '["ubuntu-latest","windows-latest", "macOS-latest"]'
33-
maven_args: 'install javadoc:javadoc -e -B -V -fae -Pno-tests-if-not-on-osx'
29+
maven_args: 'verify javadoc:javadoc -e -B -V -fae'
3430

31+
deploy:
32+
name: Deploy
33+
needs: build
34+
uses: codehaus-plexus/.github/.github/workflows/maven-deploy.yml@master
35+
secrets: inherit

Diff for: README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Plexus-Compiler
44
[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/codehaus-plexus/plexus-compiler.svg?label=License)](http://www.apache.org/licenses/)
55
[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-compiler.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-compiler)
66
[![CI](https://github.com/codehaus-plexus/plexus-compiler/actions/workflows/maven.yml/badge.svg)](https://github.com/codehaus-plexus/plexus-compiler/actions/workflows/maven.yml)
7+
[![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/org/codehaus/plexus/plexus-compiler/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/codehaus/plexus/plexus-compiler/README.md)
78

89
This component is an Compilation API used by Apache Maven Compiler plugin on the top of different Compiler Engines: Javac, Eclipse Compiler, etc..
910

@@ -12,7 +13,3 @@ This component is an Compilation API used by Apache Maven Compiler plugin on the
1213
Please refer to [documentation](https://errorprone.info/docs/installation#maven)
1314

1415
Or the project [it test](plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml)
15-
16-
### J2ObjC OSX
17-
18-
To compile this project on OSX, you need to have J2ObjC installed: [J2ObjC Requirements](https://developers.google.com/j2objc#requirements).

Diff for: plexus-compiler-api/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.codehaus.plexus</groupId>
77
<artifactId>plexus-compiler</artifactId>
8-
<version>2.13.1-SNAPSHOT</version>
8+
<version>2.15.1-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>plexus-compiler-api</artifactId>
@@ -18,6 +18,11 @@
1818
<groupId>org.codehaus.plexus</groupId>
1919
<artifactId>plexus-utils</artifactId>
2020
</dependency>
21+
<dependency>
22+
<groupId>org.eclipse.sisu</groupId>
23+
<artifactId>org.eclipse.sisu.plexus</artifactId>
24+
<scope>provided</scope>
25+
</dependency>
2126
<dependency>
2227
<groupId>org.slf4j</groupId>
2328
<artifactId>slf4j-api</artifactId>

Diff for: plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java

+57-12
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
*/
2626
import java.io.File;
2727
import java.io.IOException;
28-
import java.util.HashSet;
28+
import java.util.Collections;
2929
import java.util.List;
3030
import java.util.Set;
31+
import java.util.TreeSet;
3132

3233
import org.codehaus.plexus.util.DirectoryScanner;
3334
import org.slf4j.Logger;
@@ -39,7 +40,10 @@
3940
* @author <a href="mailto:[email protected]">Trygve Laugst&oslash;l</a>
4041
*/
4142
public abstract class AbstractCompiler implements Compiler {
42-
protected Logger log = LoggerFactory.getLogger(getClass());
43+
private final Logger log = LoggerFactory.getLogger(getClass());
44+
45+
private final org.codehaus.plexus.logging.Logger plexusLogger;
46+
4347
protected static final String EOL = System.lineSeparator();
4448

4549
protected static final String PS = System.getProperty("path.separator");
@@ -68,6 +72,25 @@ protected AbstractCompiler(
6872
this.outputFileEnding = outputFileEnding;
6973

7074
this.outputFile = outputFile;
75+
76+
this.plexusLogger = new PlexusLoggerWrapper(log);
77+
}
78+
79+
/**
80+
*
81+
* @return a Logger
82+
*/
83+
protected Logger getLog() {
84+
return log;
85+
}
86+
87+
/**
88+
* @return a plexus Logger
89+
* @deprecated please use {@link #getLog()}
90+
*/
91+
@Deprecated
92+
protected org.codehaus.plexus.logging.Logger getLogger() {
93+
return plexusLogger;
7194
}
7295

7396
// ----------------------------------------------------------------------
@@ -76,18 +99,22 @@ protected AbstractCompiler(
7699

77100
public abstract String getCompilerId();
78101

102+
@Override
79103
public CompilerResult performCompile(CompilerConfiguration configuration) throws CompilerException {
80104
throw new CompilerNotImplementedException("The performCompile method has not been implemented.");
81105
}
82106

107+
@Override
83108
public CompilerOutputStyle getCompilerOutputStyle() {
84109
return compilerOutputStyle;
85110
}
86111

112+
@Override
87113
public String getInputFileEnding(CompilerConfiguration configuration) throws CompilerException {
88114
return inputFileEnding;
89115
}
90116

117+
@Override
91118
public String getOutputFileEnding(CompilerConfiguration configuration) throws CompilerException {
92119
if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE) {
93120
throw new RuntimeException("This compiler implementation doesn't have one output file per input file.");
@@ -96,6 +123,7 @@ public String getOutputFileEnding(CompilerConfiguration configuration) throws Co
96123
return outputFileEnding;
97124
}
98125

126+
@Override
99127
public String getOutputFile(CompilerConfiguration configuration) throws CompilerException {
100128
if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) {
101129
throw new RuntimeException("This compiler implementation doesn't have one output file for all files.");
@@ -104,6 +132,7 @@ public String getOutputFile(CompilerConfiguration configuration) throws Compiler
104132
return outputFile;
105133
}
106134

135+
@Override
107136
public boolean canUpdateTarget(CompilerConfiguration configuration) throws CompilerException {
108137
return true;
109138
}
@@ -123,10 +152,14 @@ public static String getPathString(List<String> pathElements) {
123152
}
124153

125154
protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration config, String sourceLocation) {
126-
DirectoryScanner scanner = new DirectoryScanner();
127155

156+
DirectoryScanner scanner = new DirectoryScanner();
128157
scanner.setBasedir(sourceLocation);
129158

159+
if (!scanner.getBasedir().exists()) {
160+
return Collections.emptySet();
161+
}
162+
130163
Set<String> includes = config.getIncludes();
131164

132165
if (includes != null && !includes.isEmpty()) {
@@ -147,7 +180,7 @@ protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration c
147180

148181
String[] sourceDirectorySources = scanner.getIncludedFiles();
149182

150-
Set<String> sources = new HashSet<>();
183+
Set<String> sources = new TreeSet<>();
151184

152185
for (String sourceDirectorySource : sourceDirectorySources) {
153186
File f = new File(sourceLocation, sourceDirectorySource);
@@ -159,7 +192,7 @@ protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration c
159192
}
160193

161194
protected static String[] getSourceFiles(CompilerConfiguration config) {
162-
Set<String> sources = new HashSet<>();
195+
Set<String> sources = new TreeSet<>();
163196

164197
Set<File> sourceFiles = config.getSourceFiles();
165198

@@ -235,19 +268,31 @@ private static String getCanonicalPath(File origFile) throws CompilerException {
235268

236269
protected void logCompiling(String[] sourceFiles, CompilerConfiguration config) {
237270
if (log.isInfoEnabled()) {
238-
String to = (config.getWorkingDirectory() == null)
239-
? config.getOutputLocation()
240-
: config.getWorkingDirectory()
241-
.toPath()
242-
.relativize(new File(config.getOutputLocation()).toPath())
243-
.toString();
244271
log.info("Compiling "
245272
+ (sourceFiles == null
246273
? ""
247274
: (sourceFiles.length + " source file" + (sourceFiles.length == 1 ? " " : "s ")))
248275
+ "with "
249276
+ getCompilerId() + " [" + config.describe() + "]" + " to "
250-
+ to);
277+
+ getRelativeWorkingDirectory(config));
278+
}
279+
}
280+
281+
private static String getRelativeWorkingDirectory(CompilerConfiguration config) {
282+
String to;
283+
if (config.getWorkingDirectory() == null) {
284+
to = config.getOutputLocation();
285+
} else {
286+
try {
287+
to = config.getWorkingDirectory()
288+
.toPath()
289+
.relativize(new File(config.getOutputLocation()).toPath())
290+
.toString();
291+
} catch (IllegalArgumentException e) {
292+
// may happen on Windows if the working directory is on a different drive
293+
to = config.getOutputLocation();
294+
}
251295
}
296+
return to;
252297
}
253298
}

Diff for: plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,20 @@ public void setOptimize(boolean optimize) {
500500
this.optimize = optimize;
501501
}
502502

503+
/**
504+
* @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version
505+
* of the actually executed compiler binary
506+
*/
507+
@Deprecated
503508
public String getCompilerVersion() {
504509
return compilerVersion;
505510
}
506511

512+
/**
513+
* @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version
514+
* of the actually executed compiler binary
515+
*/
516+
@Deprecated
507517
public void setCompilerVersion(String compilerVersion) {
508518
this.compilerVersion = compilerVersion;
509519
}
@@ -688,15 +698,18 @@ public String describe() {
688698
params.add("debug");
689699
}
690700
}
691-
if (isOptimize()) {
692-
params.add("optimize");
693-
}
694701
if (isVerbose()) {
695702
params.add("verbose");
696703
}
697704
if (isShowDeprecation()) {
698705
params.add("deprecation");
699706
}
707+
if (isParameters()) {
708+
params.add("parameters");
709+
}
710+
if (isEnablePreview()) {
711+
params.add("preview");
712+
}
700713

701714
// target bytecode options: release or target, module-path
702715
if (!StringUtils.isEmpty(getReleaseVersion())) {

0 commit comments

Comments
 (0)