├── .github ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── codeql.yml │ ├── maven.yml │ └── release-drafter.yml ├── .gitignore ├── README.md ├── plexus-compiler-api ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ ├── AbstractCompiler.java │ │ ├── Compiler.java │ │ ├── CompilerConfiguration.java │ │ ├── CompilerException.java │ │ ├── CompilerMessage.java │ │ ├── CompilerNotImplementedException.java │ │ ├── CompilerOutputStyle.java │ │ ├── CompilerResult.java │ │ ├── PlexusLoggerWrapper.java │ │ └── util │ │ ├── StreamPumper.java │ │ └── scan │ │ ├── AbstractSourceInclusionScanner.java │ │ ├── InclusionScanException.java │ │ ├── SimpleSourceInclusionScanner.java │ │ ├── SourceInclusionScanner.java │ │ ├── StaleSourceScanner.java │ │ └── mapping │ │ ├── SingleTargetSourceMapping.java │ │ ├── SourceMapping.java │ │ └── SuffixMapping.java │ ├── site │ └── site.xml │ └── test │ ├── java │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ ├── AbstractCompilerTest.java │ │ ├── CompilerConfigurationTest.java │ │ └── util │ │ └── scan │ │ ├── AbstractSourceInclusionScannerTest.java │ │ ├── SimpleSourceInclusionScannerTest.java │ │ ├── StaleSourceScannerTest.java │ │ └── mapping │ │ └── SuffixMappingTest.java │ └── resources │ └── org │ └── codehaus │ └── plexus │ └── compiler │ └── util │ └── scan │ └── SourceInclusionScanner-testMarker.txt ├── plexus-compiler-its ├── pom.xml └── src │ └── main │ └── it │ ├── MCOMPILER-346-mre │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── jenkinsci │ │ │ └── test │ │ │ └── acceptance │ │ │ └── server │ │ │ └── PooledJenkinsController.java │ └── verify.groovy │ ├── aspectj-compiler │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── acme │ │ │ │ ├── Application.java │ │ │ │ ├── MyAnnotationDrivenAspect.aj │ │ │ │ ├── MyNativeAspect.aj │ │ │ │ └── do-not-try-to-compile.txt │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── acme │ │ │ ├── ApplicationTest.java │ │ │ └── TestAspect.java │ └── verify.groovy │ ├── eclipse-compiler-mapstruct │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ ├── Car.java │ │ │ ├── CarDto.java │ │ │ ├── CarMapper.java │ │ │ └── Dummy.java │ └── verify.groovy │ ├── eclipse-compiler-procpath │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ ├── Car.java │ │ │ ├── CarDto.java │ │ │ └── CarMapper.java │ └── verify.groovy │ ├── error-prone-compiler │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── MyClass.java │ │ └── test │ │ │ └── java │ │ │ └── MyTest.java │ └── verify.groovy │ ├── missing-warnings │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ ├── com │ │ │ └── company │ │ │ │ └── SomeClass.java │ │ │ └── module-info.java │ └── verify.groovy │ ├── settings.xml │ ├── simple-eclipse-compiler-fail │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── MyClass.java │ │ └── test │ │ └── java │ │ └── MyTest.java │ ├── simple-eclipse-compiler │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── MyClass.java │ │ └── test │ │ │ └── java │ │ │ └── MyTest.java │ └── verify.groovy │ ├── simple-javac-fork │ ├── invoker.properties │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── MyClass.java │ │ └── test │ │ │ └── java │ │ │ └── MyTest.java │ └── verify.groovy │ └── simple-javac │ ├── invoker.properties │ ├── pom.xml │ ├── src │ ├── main │ │ └── java │ │ │ └── MyClass.java │ └── test │ │ └── java │ │ └── MyTest.java │ └── verify.groovy ├── plexus-compiler-manager ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── manager │ │ ├── CompilerManager.java │ │ ├── DefaultCompilerManager.java │ │ └── NoSuchCompilerException.java │ ├── site │ └── site.xml │ └── test │ └── java │ └── org │ └── codehaus │ └── plexus │ └── compiler │ └── manager │ └── CompilerManagerTest.java ├── plexus-compiler-test ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ ├── AbstractCompilerTckTest.java │ │ └── AbstractCompilerTest.java │ └── site │ └── site.xml ├── plexus-compilers ├── plexus-compiler-aspectj │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── ajc │ │ │ ├── AspectJCompiler.java │ │ │ └── AspectJCompilerConfiguration.java │ │ ├── site │ │ ├── markdown │ │ │ └── index.md │ │ └── site.xml │ │ ├── test-input │ │ └── src │ │ │ └── main │ │ │ └── org │ │ │ └── codehaus │ │ │ └── foo │ │ │ ├── Bad.class │ │ │ ├── Bad.java │ │ │ ├── ExternalDeps.class │ │ │ ├── ExternalDeps.java │ │ │ ├── Person.class │ │ │ └── Person.java │ │ └── test │ │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── ajc │ │ └── AspectJCompilerTest.java ├── plexus-compiler-csharp │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── csharp │ │ │ ├── CSharpCompiler.java │ │ │ ├── DefaultCSharpCompilerParser.java │ │ │ └── JarUtil.java │ │ ├── site │ │ ├── markdown │ │ │ └── index.md │ │ └── site.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── csharp │ │ └── CSharpCompilerTest.java ├── plexus-compiler-eclipse │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── eclipse │ │ │ ├── EcjFailureException.java │ │ │ ├── EcjResponseParser.java │ │ │ ├── EclipseJavaCompiler.java │ │ │ └── SourceCodeLocator.java │ │ ├── site │ │ ├── markdown │ │ │ └── index.md │ │ └── site.xml │ │ ├── test-input │ │ └── src │ │ │ └── main │ │ │ └── org │ │ │ └── codehaus │ │ │ └── foo │ │ │ ├── Bad.java │ │ │ ├── Deprecation.java │ │ │ ├── ExternalDeps.java │ │ │ ├── Person.java │ │ │ ├── ReservedWord.java │ │ │ ├── UnknownSymbol.java │ │ │ └── WrongClassname.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── eclipse │ │ │ ├── EclipseCompilerConfigurationTest.java │ │ │ ├── EclipseCompilerDashedArgumentsTest.java │ │ │ ├── EclipseCompilerErrorsAsWarningsTest.java │ │ │ ├── EclipseCompilerFailOnWarningsTest.java │ │ │ ├── EclipseCompilerTckTest.java │ │ │ ├── EclipseCompilerTest.java │ │ │ └── EclipseJavaCompilerTest.java │ │ └── resources │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── eclipse │ │ └── EclipseCompilerConfigurationTest-test.properties ├── plexus-compiler-javac-errorprone │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── javac │ │ │ └── errorprone │ │ │ └── JavacCompilerWithErrorProne.java │ │ ├── site │ │ ├── markdown │ │ │ └── index.md │ │ └── site.xml │ │ ├── test-input │ │ └── src │ │ │ └── main │ │ │ └── ShortSet.java │ │ └── test │ │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── javac │ │ └── JavacErrorProneCompilerTest.java ├── plexus-compiler-javac │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── codehaus │ │ │ └── plexus │ │ │ └── compiler │ │ │ └── javac │ │ │ ├── InProcessCompiler.java │ │ │ ├── IsolatedClassLoader.java │ │ │ ├── JavacCompiler.java │ │ │ └── JavaxToolsCompiler.java │ │ ├── site │ │ ├── markdown │ │ │ └── index.md │ │ └── site.xml │ │ ├── test-input │ │ └── src │ │ │ └── main │ │ │ └── org │ │ │ └── codehaus │ │ │ └── foo │ │ │ ├── Bad.java │ │ │ ├── Deprecation.java │ │ │ ├── ExternalDeps.java │ │ │ ├── Person.java │ │ │ ├── ReservedWord.java │ │ │ ├── UnknownSymbol.java │ │ │ └── WrongClassname.java │ │ └── test │ │ └── java │ │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── compiler │ │ └── javac │ │ ├── AbstractJavacCompilerTest.java │ │ ├── ErrorMessageParserTest.java │ │ ├── JavacCompilerTest.java │ │ └── JavaxToolsCompilerTest.java └── pom.xml ├── pom.xml └── src └── site ├── apt └── index.apt └── site.xml /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | - package-ecosystem: "github-actions" 8 | directory: "/" 9 | schedule: 10 | interval: "daily" 11 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | _extends: .github 2 | tag-template: plexus-compiler-$NEXT_MINOR_VERSION 3 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 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}}" 94 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: GitHub CI 19 | 20 | on: [push, pull_request] 21 | 22 | jobs: 23 | build: 24 | name: Build it 25 | uses: codehaus-plexus/.github/.github/workflows/maven.yml@master 26 | with: 27 | matrix-exclude: '[ {"jdk": "8"}, {"jdk": "11"}, {"jdk": "24", distribution: "microsoft" } ]' 28 | jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica", "corretto"]' 29 | maven_args: 'verify javadoc:javadoc -e -B -V -fae' 30 | 31 | deploy: 32 | name: Deploy 33 | needs: build 34 | uses: codehaus-plexus/.github/.github/workflows/maven-deploy.yml@master 35 | secrets: inherit 36 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | update_release_draft: 8 | uses: codehaus-plexus/.github/.github/workflows/release-drafter.yml@master 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .project 3 | .classpath 4 | .settings/ 5 | bin 6 | .idea 7 | *.iml 8 | .java-version 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Plexus-Compiler 2 | =============== 3 | 4 | [![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/) 5 | [![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) 6 | [![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) 8 | 9 | This component is an Compilation API used by Apache Maven Compiler plugin on the top of different Compiler Engines: Javac, Eclipse Compiler, etc.. 10 | 11 | ### Error Prone usage 12 | 13 | Please refer to [documentation](https://errorprone.info/docs/installation#maven) 14 | 15 | Or the project [it test](plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml) 16 | -------------------------------------------------------------------------------- /plexus-compiler-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compiler 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-api 12 | 13 | Plexus Compiler Api 14 | Plexus Compilers component's API to manipulate compilers. 15 | 16 | 17 | 18 | org.codehaus.plexus 19 | plexus-utils 20 | 21 | 22 | org.eclipse.sisu 23 | org.eclipse.sisu.plexus 24 | provided 25 | 26 | 27 | org.slf4j 28 | slf4j-api 29 | 1.7.36 30 | 31 | 32 | org.junit.jupiter 33 | junit-jupiter-api 34 | test 35 | 36 | 37 | org.hamcrest 38 | hamcrest 39 | test 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/Compiler.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | /** 28 | * The interface of an compiling language processor (aka compiler). 29 | * 30 | * @author Jason van Zyl 31 | * @author Trygve Laugstøl 32 | * @author Matthew Pocock 33 | */ 34 | public interface Compiler { 35 | String ROLE = Compiler.class.getName(); 36 | 37 | CompilerOutputStyle getCompilerOutputStyle(); 38 | 39 | String getInputFileEnding(CompilerConfiguration configuration) throws CompilerException; 40 | 41 | String getOutputFileEnding(CompilerConfiguration configuration) throws CompilerException; 42 | 43 | String getOutputFile(CompilerConfiguration configuration) throws CompilerException; 44 | 45 | boolean canUpdateTarget(CompilerConfiguration configuration) throws CompilerException; 46 | 47 | /** 48 | * Performs the compilation of the project. Clients must implement this 49 | * method. 50 | * 51 | * @param configuration the configuration description of the compilation 52 | * to perform 53 | * @return the result of the compilation returned by the language processor 54 | * @throws CompilerException 55 | */ 56 | CompilerResult performCompile(CompilerConfiguration configuration) throws CompilerException; 57 | 58 | /** 59 | * Create the command line that would be executed using this configuration. 60 | * If this particular compiler has no concept of a command line then returns 61 | * null. 62 | * 63 | * @param config the CompilerConfiguration describing the compilation 64 | * @return an array of Strings that make up the command line, or null if 65 | * this compiler has no concept of command line 66 | * @throws CompilerException if there was an error generating the command 67 | * line 68 | */ 69 | String[] createCommandLine(CompilerConfiguration config) throws CompilerException; 70 | 71 | /** 72 | * Based on this flag the caller can decide the strategy how to compile. E.g. is incrementCompilation is not supported, 73 | * it could decide to clear to outputDirectory to enforce a complete recompilation. 74 | * 75 | * @return {@code true} if incrementalCompilation is supported, otherwise {@code false} 76 | */ 77 | default boolean supportsIncrementalCompilation() { 78 | return false; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | /** 28 | * @author Trygve Laugstøl 29 | */ 30 | public class CompilerException extends Exception { 31 | public CompilerException(String message) { 32 | super(message); 33 | } 34 | 35 | public CompilerException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerNotImplementedException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | /** 28 | * @author Andrew Eisenberg 29 | */ 30 | public class CompilerNotImplementedException extends CompilerException { 31 | public CompilerNotImplementedException(String message) { 32 | super(message); 33 | } 34 | 35 | public CompilerNotImplementedException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerOutputStyle.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2004, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | /** 28 | * @author Trygve Laugstøl 29 | */ 30 | public final class CompilerOutputStyle { 31 | public static final CompilerOutputStyle ONE_OUTPUT_FILE_PER_INPUT_FILE = 32 | new CompilerOutputStyle("one-output-file-per-input-file"); 33 | 34 | public static final CompilerOutputStyle ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES = 35 | new CompilerOutputStyle("one-output-file"); 36 | 37 | // ---------------------------------------------------------------------- 38 | // 39 | // ---------------------------------------------------------------------- 40 | 41 | private String id; 42 | 43 | private CompilerOutputStyle(String id) { 44 | this.id = id; 45 | } 46 | 47 | // ---------------------------------------------------------------------- 48 | // 49 | // ---------------------------------------------------------------------- 50 | 51 | public String toString() { 52 | return id; 53 | } 54 | 55 | public boolean equals(Object other) { 56 | if (!(other instanceof CompilerOutputStyle)) { 57 | return false; 58 | } 59 | 60 | return id.equals(((CompilerOutputStyle) other).id); 61 | } 62 | 63 | public int hashCode() { 64 | return id.hashCode(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerResult.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | /** 25 | * The result returned from a compiling language processor (aka compiler), possibly including 26 | * some messages. 27 | * 28 | * @author Olivier Lamy 29 | * @since 2.0 30 | */ 31 | public class CompilerResult { 32 | private boolean success; 33 | 34 | private List compilerMessages; 35 | 36 | /** 37 | * Constructs a successful compiler result with no messages. 38 | */ 39 | public CompilerResult() { 40 | this.success = true; 41 | } 42 | 43 | /** 44 | * Constructs a compiler result. 45 | * 46 | * @param success if the compiler process was successful or not 47 | * @param compilerMessages a list of messages from the compiler process 48 | */ 49 | public CompilerResult(boolean success, List compilerMessages) { 50 | this.success = success; 51 | this.compilerMessages = compilerMessages; 52 | } 53 | 54 | public boolean isSuccess() { 55 | return success; 56 | } 57 | 58 | public void setSuccess(boolean success) { 59 | this.success = success; 60 | } 61 | 62 | public CompilerResult success(boolean success) { 63 | this.setSuccess(success); 64 | return this; 65 | } 66 | 67 | public List getCompilerMessages() { 68 | if (compilerMessages == null) { 69 | this.compilerMessages = new ArrayList<>(); 70 | } 71 | return compilerMessages; 72 | } 73 | 74 | public void setCompilerMessages(List compilerMessages) { 75 | this.compilerMessages = compilerMessages; 76 | } 77 | 78 | public CompilerResult compilerMessages(List compilerMessages) { 79 | this.setCompilerMessages(compilerMessages); 80 | return this; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/PlexusLoggerWrapper.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | import org.slf4j.Logger; 4 | 5 | class PlexusLoggerWrapper implements org.codehaus.plexus.logging.Logger { 6 | 7 | private final Logger log; 8 | 9 | PlexusLoggerWrapper(Logger log) { 10 | this.log = log; 11 | } 12 | 13 | @Override 14 | public void debug(String message) { 15 | log.debug(message); 16 | } 17 | 18 | @Override 19 | public void debug(String message, Throwable throwable) { 20 | log.debug(message, throwable); 21 | } 22 | 23 | @Override 24 | public boolean isDebugEnabled() { 25 | return log.isDebugEnabled(); 26 | } 27 | 28 | @Override 29 | public void info(String message) { 30 | log.info(message); 31 | } 32 | 33 | @Override 34 | public void info(String message, Throwable throwable) { 35 | log.info(message, throwable); 36 | } 37 | 38 | @Override 39 | public boolean isInfoEnabled() { 40 | return log.isInfoEnabled(); 41 | } 42 | 43 | @Override 44 | public void warn(String message) { 45 | log.warn(message); 46 | } 47 | 48 | @Override 49 | public void warn(String message, Throwable throwable) { 50 | log.warn(message, throwable); 51 | } 52 | 53 | @Override 54 | public boolean isWarnEnabled() { 55 | return log.isWarnEnabled(); 56 | } 57 | 58 | @Override 59 | public void error(String message) { 60 | log.error(message); 61 | } 62 | 63 | @Override 64 | public void error(String message, Throwable throwable) { 65 | log.error(message, throwable); 66 | } 67 | 68 | @Override 69 | public boolean isErrorEnabled() { 70 | return log.isErrorEnabled(); 71 | } 72 | 73 | @Override 74 | public void fatalError(String message) { 75 | log.error(message); 76 | } 77 | 78 | @Override 79 | public void fatalError(String message, Throwable throwable) { 80 | log.error(message, throwable); 81 | } 82 | 83 | @Override 84 | public boolean isFatalErrorEnabled() { 85 | return log.isErrorEnabled(); 86 | } 87 | 88 | @Override 89 | public int getThreshold() { 90 | return 0; 91 | } 92 | 93 | @Override 94 | public void setThreshold(int threshold) { 95 | // not implemented 96 | } 97 | 98 | @Override 99 | public org.codehaus.plexus.logging.Logger getChildLogger(String name) { 100 | return null; 101 | } 102 | 103 | @Override 104 | public String getName() { 105 | return log.getName(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/StreamPumper.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.io.BufferedInputStream; 27 | import java.io.IOException; 28 | import java.io.OutputStream; 29 | 30 | /** 31 | * @author Jason van Zyl 32 | */ 33 | public class StreamPumper extends Thread { 34 | private static final int BUFFER_SIZE = 512; 35 | 36 | private final BufferedInputStream stream; 37 | 38 | private boolean endOfStream = false; 39 | 40 | private int SLEEP_TIME = 5; 41 | 42 | private final OutputStream out; 43 | 44 | public StreamPumper(BufferedInputStream is, OutputStream out) { 45 | this.stream = is; 46 | this.out = out; 47 | } 48 | 49 | public void pumpStream() throws IOException { 50 | byte[] buf = new byte[BUFFER_SIZE]; 51 | if (!endOfStream) { 52 | int bytesRead = stream.read(buf, 0, BUFFER_SIZE); 53 | 54 | if (bytesRead > 0) { 55 | out.write(buf, 0, bytesRead); 56 | } else if (bytesRead == -1) { 57 | endOfStream = true; 58 | } 59 | } 60 | } 61 | 62 | public void run() { 63 | try { 64 | while (!endOfStream) { 65 | pumpStream(); 66 | sleep(SLEEP_TIME); 67 | } 68 | } catch (Exception e) { 69 | // getLogger().warn("Jikes.run()", e); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScanner.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.ArrayList; 21 | import java.util.Collections; 22 | import java.util.List; 23 | import java.util.Set; 24 | 25 | import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping; 26 | import org.codehaus.plexus.util.DirectoryScanner; 27 | 28 | /** 29 | * @author jdcasey 30 | */ 31 | public abstract class AbstractSourceInclusionScanner implements SourceInclusionScanner { 32 | private final List sourceMappings = new ArrayList<>(); 33 | 34 | public final void addSourceMapping(SourceMapping sourceMapping) { 35 | sourceMappings.add(sourceMapping); 36 | } 37 | 38 | protected final List getSourceMappings() { 39 | return Collections.unmodifiableList(sourceMappings); 40 | } 41 | 42 | protected String[] scanForSources(File sourceDir, Set sourceIncludes, Set sourceExcludes) { 43 | DirectoryScanner ds = new DirectoryScanner(); 44 | ds.setFollowSymlinks(true); 45 | ds.setBasedir(sourceDir); 46 | 47 | String[] includes; 48 | if (sourceIncludes.isEmpty()) { 49 | includes = new String[0]; 50 | } else { 51 | includes = sourceIncludes.toArray(new String[0]); 52 | } 53 | 54 | ds.setIncludes(includes); 55 | 56 | String[] excludes; 57 | if (sourceExcludes.isEmpty()) { 58 | excludes = new String[0]; 59 | } else { 60 | excludes = sourceExcludes.toArray(new String[0]); 61 | } 62 | 63 | ds.setExcludes(excludes); 64 | ds.addDefaultExcludes(); 65 | 66 | ds.scan(); 67 | 68 | return ds.getIncludedFiles(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/InclusionScanException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @author jdcasey 21 | */ 22 | public class InclusionScanException extends Exception { 23 | public InclusionScanException(String message) { 24 | super(message); 25 | } 26 | 27 | public InclusionScanException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.io.File; 27 | import java.util.Collections; 28 | import java.util.HashSet; 29 | import java.util.List; 30 | import java.util.Set; 31 | 32 | import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping; 33 | 34 | /** 35 | * @author Trygve Laugstøl 36 | */ 37 | public class SimpleSourceInclusionScanner extends AbstractSourceInclusionScanner { 38 | private final Set sourceIncludes; 39 | 40 | private final Set sourceExcludes; 41 | 42 | public SimpleSourceInclusionScanner(Set sourceIncludes, Set sourceExcludes) { 43 | this.sourceIncludes = sourceIncludes; 44 | 45 | this.sourceExcludes = sourceExcludes; 46 | } 47 | 48 | public Set getIncludedSources(File sourceDir, File targetDir) throws InclusionScanException { 49 | List srcMappings = getSourceMappings(); 50 | 51 | if (srcMappings.isEmpty()) { 52 | return Collections.emptySet(); 53 | } 54 | 55 | String[] potentialSources = scanForSources(sourceDir, sourceIncludes, sourceExcludes); 56 | 57 | Set matchingSources = new HashSet<>(potentialSources != null ? potentialSources.length : 0); 58 | 59 | if (potentialSources != null) { 60 | for (String potentialSource : potentialSources) { 61 | matchingSources.add(new File(sourceDir, potentialSource)); 62 | } 63 | } 64 | 65 | return matchingSources; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SourceInclusionScanner.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed under the License 12 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 13 | * or implied. See the License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | 17 | import java.io.File; 18 | import java.util.Set; 19 | 20 | import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping; 21 | 22 | /** 23 | * @author jdcasey 24 | */ 25 | public interface SourceInclusionScanner { 26 | void addSourceMapping(SourceMapping sourceMapping); 27 | 28 | /** 29 | * @param sourceDir 30 | * @param targetDir 31 | * @return Set of File objects 32 | * @throws InclusionScanException 33 | */ 34 | Set getIncludedSources(File sourceDir, File targetDir) throws InclusionScanException; 35 | } 36 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.Collections; 21 | import java.util.HashSet; 22 | import java.util.List; 23 | import java.util.Set; 24 | 25 | import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping; 26 | 27 | /** 28 | * @author jdcasey 29 | */ 30 | public class StaleSourceScanner extends AbstractSourceInclusionScanner { 31 | private final long lastUpdatedWithinMsecs; 32 | 33 | private final Set sourceIncludes; 34 | 35 | private final Set sourceExcludes; 36 | 37 | // ---------------------------------------------------------------------- 38 | // 39 | // ---------------------------------------------------------------------- 40 | 41 | public StaleSourceScanner() { 42 | this(0, Collections.singleton("**/*"), Collections.emptySet()); 43 | } 44 | 45 | public StaleSourceScanner(long lastUpdatedWithinMsecs) { 46 | this(lastUpdatedWithinMsecs, Collections.singleton("**/*"), Collections.emptySet()); 47 | } 48 | 49 | public StaleSourceScanner(long lastUpdatedWithinMsecs, Set sourceIncludes, Set sourceExcludes) { 50 | this.lastUpdatedWithinMsecs = lastUpdatedWithinMsecs; 51 | 52 | this.sourceIncludes = sourceIncludes; 53 | 54 | this.sourceExcludes = sourceExcludes; 55 | } 56 | 57 | // ---------------------------------------------------------------------- 58 | // SourceInclusionScanner Implementation 59 | // ---------------------------------------------------------------------- 60 | 61 | public Set getIncludedSources(File sourceDir, File targetDir) throws InclusionScanException { 62 | List srcMappings = getSourceMappings(); 63 | 64 | if (srcMappings.isEmpty()) { 65 | return Collections.emptySet(); 66 | } 67 | 68 | String[] potentialIncludes = scanForSources(sourceDir, sourceIncludes, sourceExcludes); 69 | 70 | Set matchingSources = new HashSet<>(); 71 | 72 | for (String path : potentialIncludes) { 73 | File sourceFile = new File(sourceDir, path); 74 | 75 | staleSourceFileTesting: 76 | for (SourceMapping mapping : srcMappings) { 77 | Set targetFiles = mapping.getTargetFiles(targetDir, path); 78 | 79 | // never include files that don't have corresponding target mappings. 80 | // the targets don't have to exist on the filesystem, but the 81 | // mappers must tell us to look for them. 82 | for (File targetFile : targetFiles) { 83 | if (!targetFile.exists() 84 | || (targetFile.lastModified() + lastUpdatedWithinMsecs < sourceFile.lastModified())) { 85 | matchingSources.add(sourceFile); 86 | break staleSourceFileTesting; 87 | } 88 | } 89 | } 90 | } 91 | 92 | return matchingSources; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SingleTargetSourceMapping.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan.mapping; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.io.File; 27 | import java.util.Collections; 28 | import java.util.Set; 29 | 30 | import org.codehaus.plexus.compiler.util.scan.InclusionScanException; 31 | 32 | /** 33 | * Maps a set of input files to a single output file. 34 | * 35 | * @author Trygve Laugstøl 36 | */ 37 | public class SingleTargetSourceMapping implements SourceMapping { 38 | private final String sourceSuffix; 39 | 40 | private final String outputFile; 41 | 42 | public SingleTargetSourceMapping(String sourceSuffix, String outputFile) { 43 | this.sourceSuffix = sourceSuffix; 44 | 45 | this.outputFile = outputFile; 46 | } 47 | 48 | public Set getTargetFiles(File targetDir, String source) throws InclusionScanException { 49 | if (!source.endsWith(sourceSuffix)) { 50 | return Collections.emptySet(); 51 | } 52 | 53 | return Collections.singleton(new File(targetDir, outputFile)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SourceMapping.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan.mapping; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.Set; 21 | 22 | import org.codehaus.plexus.compiler.util.scan.InclusionScanException; 23 | 24 | /** 25 | * @author jdcasey 26 | */ 27 | public interface SourceMapping { 28 | Set getTargetFiles(File targetDir, String source) throws InclusionScanException; 29 | } 30 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMapping.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan.mapping; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.Collections; 21 | import java.util.HashSet; 22 | import java.util.Set; 23 | 24 | /** 25 | * @author jdcasey 26 | */ 27 | public final class SuffixMapping implements SourceMapping { 28 | private final String sourceSuffix; 29 | 30 | private final Set targetSuffixes; 31 | 32 | public SuffixMapping(String sourceSuffix, String targetSuffix) { 33 | this.sourceSuffix = sourceSuffix; 34 | 35 | this.targetSuffixes = Collections.singleton(targetSuffix); 36 | } 37 | 38 | public SuffixMapping(String sourceSuffix, Set targetSuffixes) { 39 | this.sourceSuffix = sourceSuffix; 40 | 41 | this.targetSuffixes = Collections.unmodifiableSet(targetSuffixes); 42 | } 43 | 44 | public Set getTargetFiles(File targetDir, String source) { 45 | Set targetFiles = new HashSet<>(); 46 | 47 | if (source.endsWith(sourceSuffix)) { 48 | String base = source.substring(0, source.length() - sourceSuffix.length()); 49 | 50 | for (String suffix : targetSuffixes) { 51 | targetFiles.add(new File(targetDir, base + suffix)); 52 | } 53 | } 54 | 55 | return targetFiles; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | import java.io.File; 4 | import java.util.Set; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertFalse; 9 | import static org.junit.jupiter.api.Assertions.assertTrue; 10 | 11 | class AbstractCompilerTest { 12 | 13 | @Test 14 | void getSourceFilesForSourceRootShouldReturnEmptyForNotExistingLocation() { 15 | 16 | CompilerConfiguration config = new CompilerConfiguration(); 17 | File fileLocation = new File("non/existing/location").getAbsoluteFile(); 18 | 19 | assertFalse(fileLocation.exists()); 20 | 21 | Set sourcesFile = AbstractCompiler.getSourceFilesForSourceRoot(config, fileLocation.getAbsolutePath()); 22 | 23 | assertTrue(sourcesFile.isEmpty()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/CompilerConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler; 2 | 3 | import java.util.Iterator; 4 | import java.util.Map; 5 | 6 | import org.junit.jupiter.api.BeforeEach; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.hamcrest.MatcherAssert.assertThat; 10 | import static org.hamcrest.Matchers.is; 11 | 12 | public class CompilerConfigurationTest { 13 | private CompilerConfiguration configuration; 14 | 15 | @BeforeEach 16 | protected void setUp() throws Exception { 17 | configuration = new CompilerConfiguration(); 18 | } 19 | 20 | @Test 21 | public void testCustomArguments() { 22 | configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package1=OTHER-MOD"); 23 | configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package2=OTHER-MOD"); 24 | 25 | assertThat(configuration.getCustomCompilerArgumentsAsMap().size(), is(1)); 26 | assertThat( 27 | configuration.getCustomCompilerArgumentsAsMap().get("--add-exports"), 28 | is("FROM-MOD/package2=OTHER-MOD")); 29 | 30 | assertThat(configuration.getCustomCompilerArgumentsEntries().size(), is(2)); 31 | Iterator> entries = 32 | configuration.getCustomCompilerArgumentsEntries().iterator(); 33 | Map.Entry entry; 34 | 35 | entry = entries.next(); 36 | assertThat(entry.getKey(), is("--add-exports")); 37 | assertThat(entry.getValue(), is("FROM-MOD/package1=OTHER-MOD")); 38 | entry = entries.next(); 39 | assertThat(entry.getKey(), is("--add-exports")); 40 | assertThat(entry.getValue(), is("FROM-MOD/package2=OTHER-MOD")); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2006 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.io.FileWriter; 21 | import java.io.IOException; 22 | import java.net.URISyntaxException; 23 | import java.net.URL; 24 | import java.util.Set; 25 | 26 | import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; 27 | import org.junit.jupiter.api.Test; 28 | 29 | import static org.hamcrest.MatcherAssert.assertThat; 30 | import static org.hamcrest.Matchers.empty; 31 | import static org.hamcrest.Matchers.not; 32 | import static org.hamcrest.io.FileMatchers.anExistingFile; 33 | 34 | /** 35 | * Tests for all the implementations of SourceInclusionScanner 36 | * 37 | * @author Carlos Sanchez 38 | */ 39 | public abstract class AbstractSourceInclusionScannerTest { 40 | 41 | private static final String TESTFILE_DEST_MARKER_FILE = 42 | SourceInclusionScanner.class.getName().replace('.', '/') + "-testMarker.txt"; 43 | 44 | protected SourceInclusionScanner scanner; 45 | 46 | @Test 47 | public void testGetIncludedSources() throws Exception { 48 | File base = new File(getTestBaseDir(), "testGetIncludedSources"); 49 | 50 | File sourceFile = new File(base, "file.java"); 51 | 52 | writeFile(sourceFile); 53 | 54 | sourceFile.setLastModified(System.currentTimeMillis()); 55 | 56 | SuffixMapping mapping = new SuffixMapping(".java", ".xml"); 57 | 58 | scanner.addSourceMapping(mapping); 59 | 60 | Set includedSources = scanner.getIncludedSources(base, base); 61 | 62 | assertThat("no sources were included", includedSources, not(empty())); 63 | 64 | for (File file : includedSources) { 65 | assertThat("file included does not exist", file, anExistingFile()); 66 | } 67 | } 68 | 69 | // ---------------------------------------------------------------------- 70 | // Utilities 71 | // ---------------------------------------------------------------------- 72 | 73 | protected File getTestBaseDir() throws URISyntaxException { 74 | ClassLoader cl = Thread.currentThread().getContextClassLoader(); 75 | URL markerResource = cl.getResource(TESTFILE_DEST_MARKER_FILE); 76 | 77 | File basedir; 78 | 79 | if (markerResource != null) { 80 | File marker = new File(markerResource.toURI()); 81 | 82 | basedir = marker.getParentFile().getAbsoluteFile(); 83 | } else { 84 | // punt. 85 | System.out.println("Cannot find marker file: \'" + TESTFILE_DEST_MARKER_FILE + "\' in classpath. " 86 | + "Using '.' for basedir."); 87 | 88 | basedir = new File(".").getAbsoluteFile(); 89 | } 90 | 91 | return basedir; 92 | } 93 | 94 | protected void writeFile(File file) throws IOException { 95 | 96 | File parent = file.getParentFile(); 97 | if (!parent.exists()) { 98 | parent.mkdirs(); 99 | } 100 | 101 | file.deleteOnExit(); 102 | 103 | try (FileWriter fWriter = new FileWriter(file)) { 104 | fWriter.write("This is just a test file."); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScannerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan; 2 | 3 | /* 4 | * Copyright 2006 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.Collections; 20 | import java.util.HashSet; 21 | import java.util.Set; 22 | 23 | import org.junit.jupiter.api.BeforeEach; 24 | 25 | /** 26 | * Test for 27 | * 28 | * @author Carlos Sanchez 29 | */ 30 | public class SimpleSourceInclusionScannerTest extends AbstractSourceInclusionScannerTest { 31 | 32 | private Set includes, excludes; 33 | 34 | @BeforeEach 35 | public void setUp() throws Exception { 36 | includes = Collections.singleton("*.java"); 37 | excludes = new HashSet<>(); 38 | scanner = new SimpleSourceInclusionScanner(includes, excludes); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMappingTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.util.scan.mapping; 2 | 3 | /* 4 | * Copyright 2001-2005 The Apache Software Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.HashSet; 21 | import java.util.Set; 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | import static org.hamcrest.Matchers.containsInAnyOrder; 27 | import static org.hamcrest.Matchers.empty; 28 | import static org.hamcrest.Matchers.is; 29 | 30 | /** 31 | * @author jdcasey 32 | */ 33 | public class SuffixMappingTest { 34 | 35 | @Test 36 | public void testShouldReturnSingleClassFileForSingleJavaFile() { 37 | String base = "path/to/file"; 38 | 39 | File basedir = new File("."); 40 | 41 | SuffixMapping mapping = new SuffixMapping(".java", ".class"); 42 | 43 | Set results = mapping.getTargetFiles(basedir, base + ".java"); 44 | 45 | assertThat("Returned wrong number of target files.", results.size(), is(1)); 46 | 47 | assertThat("Target file is wrong.", results.iterator().next(), is(new File(basedir, base + ".class"))); 48 | } 49 | 50 | @Test 51 | public void testShouldNotReturnClassFileWhenSourceFileHasWrongSuffix() { 52 | String base = "path/to/file"; 53 | 54 | File basedir = new File("."); 55 | 56 | SuffixMapping mapping = new SuffixMapping(".java", ".class"); 57 | 58 | Set results = mapping.getTargetFiles(basedir, base + ".xml"); 59 | 60 | assertThat("Returned wrong number of target files.", results, empty()); 61 | } 62 | 63 | @Test 64 | public void testShouldReturnOneClassFileAndOneXmlFileForSingleJavaFile() { 65 | String base = "path/to/file"; 66 | 67 | File basedir = new File("."); 68 | 69 | Set targets = new HashSet<>(); 70 | targets.add(".class"); 71 | targets.add(".xml"); 72 | 73 | SuffixMapping mapping = new SuffixMapping(".java", targets); 74 | 75 | Set results = mapping.getTargetFiles(basedir, base + ".java"); 76 | 77 | assertThat("Returned wrong number of target files.", results.size(), is(2)); 78 | 79 | assertThat( 80 | "Targets do not contain class target.", 81 | results, 82 | containsInAnyOrder(new File(basedir, base + ".class"), new File(basedir, base + ".xml"))); 83 | } 84 | 85 | @Test 86 | public void testShouldReturnNoTargetFilesWhenSourceFileHasWrongSuffix() { 87 | String base = "path/to/file"; 88 | 89 | File basedir = new File("."); 90 | 91 | Set targets = new HashSet<>(); 92 | targets.add(".class"); 93 | targets.add(".xml"); 94 | 95 | SuffixMapping mapping = new SuffixMapping(".java", targets); 96 | 97 | Set results = mapping.getTargetFiles(basedir, base + ".apt"); 98 | 99 | assertThat("Returned wrong number of target files.", results, empty()); 100 | } 101 | 102 | @Test 103 | public void testSingleTargetMapper() throws Exception { 104 | String base = "path/to/file"; 105 | 106 | File basedir = new File("target/"); 107 | 108 | SingleTargetSourceMapping mapping = new SingleTargetSourceMapping(".cs", "/foo"); 109 | 110 | Set results = mapping.getTargetFiles(basedir, base + ".apt"); 111 | 112 | assertThat(results, empty()); 113 | 114 | results = mapping.getTargetFiles(basedir, base + ".cs"); 115 | 116 | assertThat(results.size(), is(1)); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /plexus-compiler-api/src/test/resources/org/codehaus/plexus/compiler/util/scan/SourceInclusionScanner-testMarker.txt: -------------------------------------------------------------------------------- 1 | marker for finding this location on the classpath. -------------------------------------------------------------------------------- /plexus-compiler-its/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compiler 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-its 12 | pom 13 | 14 | Plexus Compiler It Tests 15 | 16 | 17 | 4.13.2 18 | 17 19 | true 20 | 21 | 22 | 23 | 24 | org.codehaus.plexus 25 | plexus-compiler-aspectj 26 | 27 | 28 | org.codehaus.plexus 29 | plexus-compiler-eclipse 30 | 31 | 32 | org.codehaus.plexus 33 | plexus-compiler-javac 34 | 35 | 36 | org.codehaus.plexus 37 | plexus-compiler-javac-errorprone 38 | 39 | 40 | org.codehaus.plexus 41 | plexus-compiler-manager 42 | 43 | 44 | 45 | 46 | 47 | org.apache.maven.plugins 48 | maven-invoker-plugin 49 | 3.9.0 50 | 51 | 52 | integration-tests 53 | 54 | install 55 | run 56 | verify 57 | 58 | verify 59 | 60 | false 61 | true 62 | src/main/it 63 | ${project.build.directory}/it 64 | verify 65 | ${project.build.directory}/local-repo 66 | src/main/it/settings.xml 67 | 68 | clean 69 | test-compile 70 | 71 | 72 | ${errorprone.version} 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/MCOMPILER-346-mre/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean compile 19 | invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/MCOMPILER-346-mre/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 4.0.0 24 | com.basilcrow 25 | MCOMPILER-346-mre 26 | 1.0 27 | jar 28 | MCOMPILER-346 Minimal Reproducible Example (MRE) 29 | https://github.com/basil/MCOMPILER-346-mre 30 | 31 | UTF-8 32 | @pom.version@ 33 | 34 | 35 | 36 | org.eclipse.sisu 37 | org.eclipse.sisu.plexus 38 | 0.2.0 39 | 40 | 41 | org.jenkins-ci.main 42 | remoting 43 | 3.2 44 | 45 | 46 | 47 | 48 | repo.jenkins-ci.org 49 | https://repo.jenkins-ci.org/public/ 50 | 51 | 52 | 53 | 54 | 55 | org.apache.maven.plugins 56 | maven-compiler-plugin 57 | 3.10.0 58 | 59 | 11 60 | 61 | 62 | 63 | org.codehaus.plexus 64 | plexus-compiler-api 65 | ${plexus.compiler.version} 66 | 67 | 68 | org.codehaus.plexus 69 | plexus-compiler-manager 70 | ${plexus.compiler.version} 71 | 72 | 73 | org.codehaus.plexus 74 | plexus-compiler-javac 75 | ${plexus.compiler.version} 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/MCOMPILER-346-mre/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | def logFile = new File( basedir, 'build.log' ) 21 | assert logFile.exists() 22 | content = logFile.text 23 | 24 | assert content.contains( 'package org.jenkinsci.test.acceptance.controller does not exist' ) 25 | assert content.contains( 'package org.jenkinsci.test.acceptance.log does not exist' ) 26 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.maven.version = 3.9.6+ 19 | invoker.goals = clean test 20 | #invoker.buildResult = failure 21 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 23 | 4.0.0 24 | 25 | org.apache.maven.plugins.compiler.it 26 | aspectj-compiler 27 | 1.0-SNAPSHOT 28 | 29 | 30 | UTF-8 31 | UTF-8 32 | 1.8 33 | 1.8 34 | @pom.version@ 35 | 36 | 37 | 38 | 39 | 40 | maven-compiler-plugin 41 | @maven.compiler.version@ 42 | 43 | aspectj 44 | 45 | 46 | 47 | org.codehaus.plexus 48 | plexus-compiler-api 49 | ${plexus.compiler.version} 50 | 51 | 52 | org.codehaus.plexus 53 | plexus-compiler-manager 54 | ${plexus.compiler.version} 55 | 56 | 57 | org.codehaus.plexus 58 | plexus-compiler-aspectj 59 | ${plexus.compiler.version} 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | junit 69 | junit 70 | @junit.version@ 71 | test 72 | 73 | 74 | org.aspectj 75 | aspectjrt 76 | @aspectj.version@ 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/main/java/org/acme/Application.java: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | public class Application { 4 | public static void main(String[] args) { 5 | System.out.println("Running application"); 6 | new Application().greet(args[0]); 7 | } 8 | 9 | public String greet(String name) { 10 | return "Hello " + name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/main/java/org/acme/MyAnnotationDrivenAspect.aj: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | import org.aspectj.lang.annotation.Aspect; 5 | import org.aspectj.lang.annotation.Before; 6 | 7 | @Aspect 8 | public class MyAnnotationDrivenAspect { 9 | @Before("execution(static * *(..)) && within(Application)") 10 | public void myAdvice(JoinPoint joinPoint) { 11 | System.out.println(joinPoint); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/main/java/org/acme/MyNativeAspect.aj: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | public aspect MyNativeAspect { 4 | before() : execution(!static * *(..)) && within(Application) { 5 | System.out.println(thisJoinPoint); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/main/java/org/acme/do-not-try-to-compile.txt: -------------------------------------------------------------------------------- 1 | The Apache Maven Compiler (MC) API only allows a single source file extension, such as '.java'. 2 | The AspectJ Compiler (AJC) should consider two default extensions, though: '.java' and '.aj'. 3 | In order to achieve that, the Plexus AJC component tells MC to give it all files, 4 | subsequently filtering for those two extensions. 5 | 6 | The purpose of this file is to make sure that even though MC finds it in the source folder, 7 | Plexus AJC filters it out and AJC does not try to compile it. 8 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/test/java/org/acme/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertTrue; 7 | 8 | public class ApplicationTest { 9 | @Test 10 | public void testGreet() { 11 | assertEquals("Hello Jane", new Application().greet("Jane")); 12 | } 13 | 14 | @Test 15 | public void testMain() { 16 | Application.main(new String[] { "Joe" }); 17 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/src/test/java/org/acme/TestAspect.java: -------------------------------------------------------------------------------- 1 | package org.acme; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | import org.aspectj.lang.annotation.Aspect; 5 | import org.aspectj.lang.annotation.Before; 6 | 7 | @Aspect 8 | public class TestAspect { 9 | @Before("call(* *(..)) && !within(TestAspect)") 10 | public void beforeCall(JoinPoint joinPoint) { 11 | System.out.println(joinPoint); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/aspectj-compiler/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def logFile = new File( basedir, 'build.log' ) 20 | assert logFile.exists() 21 | content = logFile.text.normalize() 22 | 23 | assert content.contains( "Tests run: 2, Failures: 0, Errors: 0, Skipped: 0" ) 24 | 25 | def junitLog = """Running org.acme.ApplicationTest 26 | call(String org.acme.Application.greet(String)) 27 | execution(String org.acme.Application.greet(String)) 28 | call(void org.junit.Assert.assertEquals(Object, Object)) 29 | call(void org.acme.Application.main(String[])) 30 | execution(void org.acme.Application.main(String[])) 31 | Running application 32 | execution(String org.acme.Application.greet(String)) 33 | call(void org.junit.Assert.assertTrue(boolean))""".normalize() 34 | 35 | assert content.contains( junitLog ) 36 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.maven.version = 3.9.6+ 19 | 20 | # without-dummy profile is used to have compiler plugin do actual compilation in the second run 21 | invoker.name.1 = Initial build 22 | invoker.goals.1 = clean compile -Pwithout-dummy 23 | invoker.buildResult.1 = success 24 | 25 | invoker.name.2 = Subsequent build without clean 26 | invoker.goals.2 = compile 27 | invoker.buildResult.2 = success 28 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | eclipse-compiler-mapstruct 28 | 1.0-SNAPSHOT 29 | 30 | 31 | UTF-8 32 | UTF-8 33 | 1.8 34 | 1.8 35 | @pom.version@ 36 | 1.5.5.Final 37 | 38 | 39 | 40 | 41 | org.mapstruct 42 | mapstruct 43 | ${org.mapstruct.version} 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-compiler-plugin 52 | @maven.compiler.version@ 53 | 54 | eclipse 55 | 56 | 57 | 58 | org.codehaus.plexus 59 | plexus-compiler-api 60 | ${plexus.compiler.version} 61 | 62 | 63 | org.codehaus.plexus 64 | plexus-compiler-manager 65 | ${plexus.compiler.version} 66 | 67 | 68 | org.codehaus.plexus 69 | plexus-compiler-eclipse 70 | ${plexus.compiler.version} 71 | 72 | 73 | org.mapstruct 74 | mapstruct-processor 75 | ${org.mapstruct.version} 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | without-dummy 85 | 86 | 87 | 88 | org.apache.maven.plugins 89 | maven-compiler-plugin 90 | 91 | 92 | **/Dummy.java 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Car 21 | { 22 | public String make; 23 | public int numberOfSeats; 24 | } 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class CarDto 21 | { 22 | public String make; 23 | public int seatCount; 24 | } 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import org.mapstruct.Mapper; 21 | import org.mapstruct.Mapping; 22 | import org.mapstruct.factory.Mappers; 23 | 24 | @Mapper 25 | public interface CarMapper 26 | { 27 | 28 | CarMapper INSTANCE = Mappers.getMapper( CarMapper.class ); 29 | 30 | @Mapping( source = "numberOfSeats", target = "seatCount" ) 31 | CarDto carToCarDto( Car car ); 32 | } 33 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Dummy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Dummy 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def mapperImplClass = new File( basedir, "target/classes/CarMapperImpl.class" ) 20 | assert mapperImplClass.exists() 21 | 22 | def dummyClass = new File( basedir, "target/classes/Dummy.class" ) 23 | assert dummyClass.exists() 24 | 25 | File buildLog = new File( basedir, 'build.log' ) 26 | assert buildLog.text.count( "Recompiling the module because of changed" ) == 2 27 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.maven.version = 3.9.6+ 19 | 20 | invoker.goals = clean compile 21 | invoker.buildResult = success 22 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | eclipse-compiler-procpath 28 | 1.0-SNAPSHOT 29 | 30 | 31 | UTF-8 32 | UTF-8 33 | 1.8 34 | 1.8 35 | @pom.version@ 36 | 1.5.5.Final 37 | 38 | 39 | 40 | 41 | org.mapstruct 42 | mapstruct 43 | ${org.mapstruct.version} 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-compiler-plugin 52 | @maven.compiler.version@ 53 | 54 | eclipse 55 | 56 | 57 | org.mapstruct 58 | mapstruct-processor 59 | ${org.mapstruct.version} 60 | 61 | 62 | 63 | 64 | 65 | org.codehaus.plexus 66 | plexus-compiler-api 67 | ${plexus.compiler.version} 68 | 69 | 70 | org.codehaus.plexus 71 | plexus-compiler-manager 72 | ${plexus.compiler.version} 73 | 74 | 75 | org.codehaus.plexus 76 | plexus-compiler-eclipse 77 | ${plexus.compiler.version} 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class Car 21 | { 22 | public String make; 23 | public int numberOfSeats; 24 | } 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class CarDto 21 | { 22 | public String make; 23 | public int seatCount; 24 | } 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import org.mapstruct.Mapper; 21 | import org.mapstruct.Mapping; 22 | import org.mapstruct.factory.Mappers; 23 | 24 | @Mapper 25 | public interface CarMapper 26 | { 27 | 28 | CarMapper INSTANCE = Mappers.getMapper( CarMapper.class ); 29 | 30 | @Mapping( source = "numberOfSeats", target = "seatCount" ) 31 | CarDto carToCarDto( Car car ); 32 | } 33 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/eclipse-compiler-procpath/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def mapperImplClass = new File( basedir, "target/classes/CarMapperImpl.class" ) 20 | assert mapperImplClass.exists() 21 | 22 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/error-prone-compiler/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean test-compile 19 | invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.apache.maven.plugins.compiler.it 27 | error-prone-compiler 28 | 1.0-SNAPSHOT 29 | 30 | Test for default configuration 31 | 32 | 33 | UTF-8 34 | 9+181-r4173-1 35 | @pom.version@ 36 | 37 | 38 | 39 | 40 | junit 41 | junit 42 | @junit.version@ 43 | test 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-compiler-plugin 52 | @maven.compiler.version@ 53 | 54 | 11 55 | 11 56 | 11 57 | UTF-8 58 | true 59 | 60 | -XDcompilePolicy=simple 61 | -Xplugin:ErrorProne 62 | --should-stop=ifError=FLOW 63 | -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED 64 | -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED 65 | -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED 66 | -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED 67 | -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED 68 | -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED 69 | -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 70 | -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 71 | -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED 72 | -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED 73 | 74 | 75 | 76 | com.google.errorprone 77 | error_prone_core 78 | @errorprone.version@ 79 | 80 | 81 | 82 | 83 | 84 | org.codehaus.plexus 85 | plexus-compiler-api 86 | ${plexus.compiler.version} 87 | 88 | 89 | org.codehaus.plexus 90 | plexus-compiler-manager 91 | ${plexus.compiler.version} 92 | 93 | 94 | org.codehaus.plexus 95 | plexus-compiler-javac-errorprone 96 | ${plexus.compiler.version} 97 | 98 | 99 | org.codehaus.plexus 100 | plexus-compiler-javac 101 | ${plexus.compiler.version} 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/error-prone-compiler/src/main/java/MyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class MyClass 21 | { 22 | 23 | public static void main(String[] args) { 24 | // error: dead exception 25 | // BUG: Diagnostic contains: throw new RuntimeException 26 | new RuntimeException("Not thrown, and reference lost"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/error-prone-compiler/src/test/java/MyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import junit.framework.TestCase; 21 | 22 | import java.util.*; 23 | 24 | public class MyTest 25 | extends TestCase 26 | { 27 | // InfiniteRecursion 28 | int oops() { 29 | return oops(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/error-prone-compiler/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def logFile = new File( basedir, 'build.log' ) 20 | assert logFile.exists() 21 | content = logFile.text 22 | 23 | assert content.contains( 'Compilation failure' ) 24 | assert content.contains( '[DeadException] Exception created but not thrown' ) 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/missing-warnings/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean compile 19 | #invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/missing-warnings/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.apache.maven.plugins.compiler.it 8 | missing-warnings 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | 14 | 15 | org.apache.maven.plugins 16 | maven-compiler-plugin 17 | @maven.compiler.version@ 18 | 19 | true 20 | true 21 | 22 | 23 | 24 | org.codehaus.plexus 25 | plexus-compiler-api 26 | ${plexus.compiler.version} 27 | 28 | 29 | org.codehaus.plexus 30 | plexus-compiler-manager 31 | ${plexus.compiler.version} 32 | 33 | 34 | org.codehaus.plexus 35 | plexus-compiler-javac 36 | ${plexus.compiler.version} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 11 46 | 11 47 | UTF-8 48 | @pom.version@ 49 | 50 | 51 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/missing-warnings/src/main/java/com/company/SomeClass.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | public class SomeClass 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/missing-warnings/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module testcase { 2 | exports com.company to someOtherModule; 3 | } -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/missing-warnings/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def logFile = new File( basedir, 'build.log' ) 20 | assert logFile.exists() 21 | content = logFile.text.normalize() 22 | 23 | assert content.contains( "module-info.java:[2,24] [module] module not found: someOtherModule") 24 | //assert content.contains( "exports com.company to someOtherModule;" ) 25 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | it-repo 26 | 27 | true 28 | 29 | 30 | 31 | local.central 32 | @localRepositoryUrl@ 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | local.central 44 | @localRepositoryUrl@ 45 | 46 | true 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean test-compile 19 | invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | simple-javac 28 | 1.0-SNAPSHOT 29 | 30 | Test for default configuration 31 | 32 | 33 | UTF-8 34 | UTF-8 35 | 1.8 36 | 1.8 37 | @pom.version@ 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | @junit.version@ 45 | test 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-compiler-plugin 54 | 3.9.0 55 | 56 | eclipse 57 | 58 | 59 | 60 | org.codehaus.plexus 61 | plexus-compiler-api 62 | ${plexus.compiler.version} 63 | 64 | 65 | org.codehaus.plexus 66 | plexus-compiler-manager 67 | ${plexus.compiler.version} 68 | 69 | 70 | org.codehaus.plexus 71 | plexus-compiler-eclipse 72 | ${plexus.compiler.version} 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/src/main/java/MyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class MyClass 21 | { 22 | 23 | foo 24 | 25 | } 26 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/src/test/java/MyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import junit.framework.TestCase; 21 | 22 | public class MyTest 23 | extends TestCase 24 | { 25 | 26 | bar 27 | 28 | } 29 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.maven.version = 3.9.6+ 19 | 20 | invoker.goals = clean test-compile 21 | #invoker.buildResult = failure 22 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | simple-javac 28 | 1.0-SNAPSHOT 29 | 30 | Test for default configuration 31 | 32 | 33 | UTF-8 34 | UTF-8 35 | 1.8 36 | 1.8 37 | @pom.version@ 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | @junit.version@ 45 | test 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-compiler-plugin 54 | 3.9.0 55 | 56 | eclipse 57 | 58 | 59 | 60 | org.codehaus.plexus 61 | plexus-compiler-api 62 | ${plexus.compiler.version} 63 | 64 | 65 | org.codehaus.plexus 66 | plexus-compiler-manager 67 | ${plexus.compiler.version} 68 | 69 | 70 | org.codehaus.plexus 71 | plexus-compiler-eclipse 72 | ${plexus.compiler.version} 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler/src/main/java/MyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class MyClass 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler/src/test/java/MyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import junit.framework.TestCase; 21 | 22 | public class MyTest 23 | extends TestCase 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-eclipse-compiler/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def mainClass = new File( basedir, "target/classes/MyClass.class" ) 20 | assert mainClass.exists() 21 | 22 | def testClass = new File( basedir, "target/test-classes/MyTest.class" ) 23 | assert testClass.exists() 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac-fork/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean test-compile 19 | #invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac-fork/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | simple-javac-forked 28 | 1.0-SNAPSHOT 29 | 30 | Test for default configuration with forked=true 31 | 32 | 33 | UTF-8 34 | UTF-8 35 | 11 36 | @project.version@ 37 | 38 | 39 | 40 | 41 | junit 42 | junit 43 | @junit.version@ 44 | test 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.apache.maven.plugins 52 | maven-compiler-plugin 53 | @maven.compiler.version@ 54 | 55 | true 56 | 57 | -Xlint:-path 58 | 59 | 60 | 61 | 62 | org.codehaus.plexus 63 | plexus-compiler-api 64 | ${plexus.compiler.version} 65 | 66 | 67 | org.codehaus.plexus 68 | plexus-compiler-manager 69 | ${plexus.compiler.version} 70 | 71 | 72 | org.codehaus.plexus 73 | plexus-compiler-javac 74 | ${plexus.compiler.version} 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac-fork/src/main/java/MyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class MyClass 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac-fork/src/test/java/MyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import junit.framework.TestCase; 21 | 22 | public class MyTest 23 | extends TestCase 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac-fork/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def mainClass = new File( basedir, "target/classes/MyClass.class" ) 20 | assert mainClass.exists() 21 | 22 | def testClass = new File( basedir, "target/test-classes/MyTest.class" ) 23 | assert testClass.exists() 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac/invoker.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | invoker.goals = clean test-compile 19 | #invoker.buildResult = failure 20 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 4.0.0 25 | 26 | org.codehaus.plexus.compiler.it 27 | simple-javac 28 | 1.0-SNAPSHOT 29 | 30 | Test for default configuration 31 | 32 | 33 | UTF-8 34 | UTF-8 35 | 1.8 36 | 1.8 37 | @pom.version@ 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | @junit.version@ 45 | test 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-compiler-plugin 54 | @maven.compiler.version@ 55 | 56 | 57 | -Xlint:-path 58 | 59 | 60 | 61 | 62 | org.codehaus.plexus 63 | plexus-compiler-api 64 | ${plexus.compiler.version} 65 | 66 | 67 | org.codehaus.plexus 68 | plexus-compiler-manager 69 | ${plexus.compiler.version} 70 | 71 | 72 | org.codehaus.plexus 73 | plexus-compiler-javac 74 | ${plexus.compiler.version} 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac/src/main/java/MyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | public class MyClass 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac/src/test/java/MyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import junit.framework.TestCase; 21 | 22 | public class MyTest 23 | extends TestCase 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /plexus-compiler-its/src/main/it/simple-javac/verify.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | def mainClass = new File( basedir, "target/classes/MyClass.class" ) 20 | assert mainClass.exists() 21 | 22 | def testClass = new File( basedir, "target/test-classes/MyTest.class" ) 23 | assert testClass.exists() 24 | -------------------------------------------------------------------------------- /plexus-compiler-manager/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compiler 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-manager 12 | 13 | Plexus Compiler Manager 14 | 15 | 16 | 17 | org.codehaus.plexus 18 | plexus-compiler-api 19 | 20 | 21 | javax.inject 22 | javax.inject 23 | 24 | 25 | org.slf4j 26 | slf4j-api 27 | 28 | 29 | org.codehaus.plexus 30 | plexus-xml 31 | 32 | 33 | org.junit.jupiter 34 | junit-jupiter-api 35 | test 36 | 37 | 38 | org.codehaus.plexus 39 | plexus-testing 40 | test 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/CompilerManager.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.manager; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import org.codehaus.plexus.compiler.Compiler; 27 | 28 | /** 29 | * @author Trygve Laugstøl 30 | */ 31 | public interface CompilerManager { 32 | String ROLE = CompilerManager.class.getName(); 33 | 34 | Compiler getCompiler(String compilerId) throws NoSuchCompilerException; 35 | } 36 | -------------------------------------------------------------------------------- /plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.manager; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import javax.inject.Inject; 27 | import javax.inject.Named; 28 | import javax.inject.Provider; 29 | 30 | import java.util.Map; 31 | 32 | import org.codehaus.plexus.compiler.Compiler; 33 | import org.slf4j.Logger; 34 | import org.slf4j.LoggerFactory; 35 | 36 | /** 37 | * @author Trygve Laugstøl 38 | */ 39 | @Named 40 | public class DefaultCompilerManager implements CompilerManager { 41 | private static final String ERROR_MESSAGE = "Compiler '{}' could not be instantiated or injected properly. " 42 | + "If you spelled the compiler ID correctly and all necessary dependencies are on the classpath, " 43 | + "then next you can try running the build with -Dsisu.debug, looking for exceptions."; 44 | private static final String ERROR_MESSAGE_DETAIL = "TypeNotPresentException caused by UnsupportedClassVersionError " 45 | + "might indicate, that the compiler needs a more recent Java runtime. " 46 | + "IllegalArgumentException in ClassReader. might mean, that you need to upgrade Maven."; 47 | 48 | @Inject 49 | private Map> compilers; 50 | 51 | private final Logger log = LoggerFactory.getLogger(getClass()); 52 | 53 | // ---------------------------------------------------------------------- 54 | // CompilerManager Implementation 55 | // ---------------------------------------------------------------------- 56 | 57 | public Compiler getCompiler(String compilerId) throws NoSuchCompilerException { 58 | // Provider is lazy -> presence of provider means compiler is present, but not yet constructed 59 | Provider compilerProvider = compilers.get(compilerId); 60 | 61 | if (compilerProvider == null) { 62 | // Compiler could not be injected for some reason 63 | log.error(ERROR_MESSAGE + " " + ERROR_MESSAGE_DETAIL, compilerId); 64 | throw new NoSuchCompilerException(compilerId); 65 | } 66 | 67 | // Provider exists, but compiler was not created yet 68 | try { 69 | return compilerProvider.get(); 70 | } catch (Exception e) { 71 | // DI could not construct compiler 72 | log.error(ERROR_MESSAGE, compilerId); 73 | throw new NoSuchCompilerException(compilerId, e); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/NoSuchCompilerException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.manager; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | 27 | /** 28 | * @author Trygve Laugstøl 29 | */ 30 | public class NoSuchCompilerException extends Exception { 31 | private final String compilerId; 32 | 33 | public NoSuchCompilerException(String compilerId) { 34 | this(compilerId, null); 35 | } 36 | 37 | public NoSuchCompilerException(String compilerId, Throwable cause) { 38 | super("No such compiler '" + compilerId + "'", cause); 39 | this.compilerId = compilerId; 40 | } 41 | 42 | public String getCompilerId() { 43 | return compilerId; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /plexus-compiler-manager/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compiler-manager/src/test/java/org/codehaus/plexus/compiler/manager/CompilerManagerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.manager; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import javax.inject.Inject; 27 | 28 | import org.codehaus.plexus.testing.PlexusTest; 29 | import org.junit.jupiter.api.Assertions; 30 | import org.junit.jupiter.api.Test; 31 | 32 | /** 33 | * @author Trygve Laugstøl 34 | */ 35 | @PlexusTest 36 | public class CompilerManagerTest { 37 | @Inject 38 | private CompilerManager compilerManager; 39 | 40 | @Test 41 | public void testBasic() throws Exception { 42 | Assertions.assertThrows(NoSuchCompilerException.class, () -> compilerManager.getCompiler("foo")); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /plexus-compiler-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compiler 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-test 12 | 13 | Plexus Compiler Test Harness 14 | 15 | 16 | 17 | javax.inject 18 | javax.inject 19 | 20 | 21 | org.codehaus.plexus 22 | plexus-compiler-api 23 | 24 | 25 | org.junit.jupiter 26 | junit-jupiter-api 27 | compile 28 | 29 | 30 | 31 | org.codehaus.plexus 32 | plexus-testing 33 | compile 34 | 35 | 36 | org.hamcrest 37 | hamcrest 38 | compile 39 | 40 | 41 | org.apache.maven 42 | maven-artifact 43 | ${mavenVersion} 44 | 45 | 46 | org.apache.maven 47 | maven-core 48 | ${mavenVersion} 49 | 50 | 51 | org.codehaus.plexus 52 | plexus-utils 53 | 54 | 55 | org.codehaus.plexus 56 | plexus-xml 57 | 58 | 59 | 60 | commons-lang 61 | commons-lang 62 | 2.0 63 | runtime 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /plexus-compiler-test/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compilers 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-aspectj 12 | 13 | Plexus AspectJ Compiler 14 | AspectJ Compiler support for Plexus Compiler component. 15 | 16 | 17 | 17 18 | 19 | 20 | 21 | 22 | javax.inject 23 | javax.inject 24 | 25 | 26 | org.aspectj 27 | aspectjrt 28 | ${aspectj.version} 29 | 30 | 31 | org.aspectj 32 | aspectjtools 33 | ${aspectj.version} 34 | 35 | 36 | org.codehaus.plexus 37 | plexus-utils 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | maven-surefire-plugin 47 | 48 | 49 | ${aspectj.version} 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* Created on Oct 4, 2004 */ 2 | package org.codehaus.plexus.compiler.ajc; 3 | 4 | import java.io.File; 5 | import java.util.Collections; 6 | import java.util.LinkedList; 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.TreeMap; 10 | 11 | import org.codehaus.plexus.compiler.CompilerConfiguration; 12 | 13 | /** 14 | * @author jdcasey 15 | */ 16 | public class AspectJCompilerConfiguration extends CompilerConfiguration { 17 | 18 | private List aspectPath = new LinkedList<>(); 19 | 20 | private List inJars = new LinkedList<>(); 21 | 22 | private List inPath = new LinkedList<>(); 23 | 24 | private String outputJar; 25 | 26 | private Map ajOptions = new TreeMap<>(); 27 | 28 | private Map sourcePathResources; 29 | 30 | public void setAspectPath(List aspectPath) { 31 | this.aspectPath = new LinkedList<>(aspectPath); 32 | } 33 | 34 | public void addAspectPath(String aspectPath) { 35 | this.aspectPath.add(aspectPath); 36 | } 37 | 38 | public List getAspectPath() { 39 | return Collections.unmodifiableList(aspectPath); 40 | } 41 | 42 | public void setInJars(List inJars) { 43 | this.inJars = new LinkedList<>(inJars); 44 | } 45 | 46 | public void addInJar(String inJar) { 47 | this.inJars.add(inJar); 48 | } 49 | 50 | public List getInJars() { 51 | return Collections.unmodifiableList(inJars); 52 | } 53 | 54 | public void setInPath(List inPath) { 55 | this.inPath = new LinkedList<>(inPath); 56 | } 57 | 58 | public void addInPath(String inPath) { 59 | this.inPath.add(inPath); 60 | } 61 | 62 | public List getInPath() { 63 | return Collections.unmodifiableList(inPath); 64 | } 65 | 66 | public void setOutputJar(String outputJar) { 67 | this.outputJar = outputJar; 68 | } 69 | 70 | public String getOutputJar() { 71 | return outputJar; 72 | } 73 | 74 | /** 75 | * Ignored, not supported yet 76 | */ 77 | public void setAJOptions(Map ajOptions) { 78 | // TODO 79 | // this.ajOptions = new TreeMap( ajOptions ); 80 | } 81 | 82 | public void setAJOption(String optionName, String optionValue) { 83 | this.ajOptions.put(optionName, optionValue); 84 | } 85 | 86 | /** 87 | * Ignored, not supported yet 88 | * @return empty Map 89 | */ 90 | public Map getAJOptions() { 91 | return Collections.unmodifiableMap(ajOptions); 92 | } 93 | 94 | public void setSourcePathResources(Map sourcePathResources) { 95 | this.sourcePathResources = new TreeMap<>(sourcePathResources); 96 | } 97 | 98 | public Map getSourcePathResources() { 99 | return sourcePathResources; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | Plexus AspectJ Compiler 2 | ----------------------- 3 | 4 | AspectJ Compiler support for Plexus Compiler component. 5 | 6 | **Requires** `JDK 17+` and `Maven 3.9.6+` 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Bad.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codehaus-plexus/plexus-compiler/0fc7a30c00486e9d622b97875dd8374f35957d06/plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Bad.class -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Bad.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Bad 4 | { 5 | // Intentionally misspelled modifier. 6 | pubic String name; 7 | } 8 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/ExternalDeps.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codehaus-plexus/plexus-compiler/0fc7a30c00486e9d622b97875dd8374f35957d06/plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/ExternalDeps.class -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/ExternalDeps.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | 7 | public class ExternalDeps 8 | { 9 | 10 | public void hello( String str ) 11 | { 12 | System.out.println( StringUtils.upperCase( str) ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codehaus-plexus/plexus-compiler/0fc7a30c00486e9d622b97875dd8374f35957d06/plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Person.class -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test-input/src/main/org/codehaus/foo/Person.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Person 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.ajc; 2 | 3 | import java.io.File; 4 | import java.util.Arrays; 5 | import java.util.Collection; 6 | import java.util.List; 7 | 8 | import org.codehaus.plexus.compiler.AbstractCompilerTest; 9 | 10 | /** 11 | * @author Jason van Zyl 12 | */ 13 | public class AspectJCompilerTest extends AbstractCompilerTest { 14 | public AspectJCompilerTest() { 15 | super(); 16 | } 17 | 18 | @Override 19 | protected String getRoleHint() { 20 | return "aspectj"; 21 | } 22 | 23 | @Override 24 | protected Collection expectedOutputFiles() { 25 | return Arrays.asList("org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class"); 26 | } 27 | 28 | @Override 29 | protected List getClasspath() throws Exception { 30 | List classpath = super.getClasspath(); 31 | String aspectjVersion = System.getProperty("aspectj.version"); 32 | File aspectjRuntime = getLocalArtifactPath("org.aspectj", "aspectjrt", aspectjVersion, "jar"); 33 | classpath.add(aspectjRuntime.getAbsolutePath()); 34 | return classpath; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-csharp/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compilers 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-csharp 12 | 13 | Plexus C# Compiler 14 | C# Compiler support for Plexus Compiler component. 15 | 16 | 17 | 18 | javax.inject 19 | javax.inject 20 | 21 | 22 | org.codehaus.plexus 23 | plexus-utils 24 | 25 | 26 | org.hamcrest 27 | hamcrest 28 | test 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/JarUtil.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.csharp; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | import java.nio.file.Files; 8 | import java.nio.file.Path; 9 | import java.util.Enumeration; 10 | import java.util.jar.JarEntry; 11 | import java.util.jar.JarFile; 12 | 13 | public class JarUtil { 14 | public static void extract(Path destDir, File jarFile) throws IOException { 15 | Path toPath = destDir.normalize(); 16 | try (JarFile jar = new JarFile(jarFile)) { 17 | Enumeration enumEntries = jar.entries(); 18 | while (enumEntries.hasMoreElements()) { 19 | JarEntry file = enumEntries.nextElement(); 20 | Path f = destDir.resolve(file.getName()); 21 | if (!f.startsWith(toPath)) { 22 | throw new IOException("Bad zip entry"); 23 | } 24 | if (file.isDirectory()) { 25 | Files.createDirectories(f); 26 | continue; 27 | } 28 | try (InputStream is = jar.getInputStream(file); 29 | OutputStream fos = Files.newOutputStream(f)) { 30 | while (is.available() > 0) { 31 | fos.write(is.read()); 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-csharp/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | Plexus C# Compiler 2 | ------------------ 3 | 4 | C# Compiler support for Plexus Compiler component. 5 | 6 | **Requires** `JDK 8+` 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-csharp/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compilers 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-eclipse 12 | 13 | Plexus Eclipse Compiler 14 | Eclipse Compiler support for Plexus Compiler component. 15 | 16 | 17 | 17 18 | 19 | 20 | 21 | 22 | org.codehaus.plexus 23 | plexus-utils 24 | 25 | 26 | org.eclipse.jdt 27 | ecj 28 | 3.41.0 29 | 30 | 31 | javax.inject 32 | javax.inject 33 | 34 | 35 | org.slf4j 36 | slf4j-api 37 | 38 | 39 | org.junit.jupiter 40 | junit-jupiter-params 41 | test 42 | 43 | 44 | org.hamcrest 45 | hamcrest 46 | test 47 | 48 | 49 | org.codehaus.plexus 50 | plexus-testing 51 | test 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EcjFailureException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | /** 4 | * @author Frits Jalvingh 5 | * Created on 22-4-18. 6 | */ 7 | public class EcjFailureException extends RuntimeException { 8 | private final String ecjOutput; 9 | 10 | public EcjFailureException(String ecjOutput) { 11 | super("Failed to run the ecj compiler: " + ecjOutput); 12 | this.ecjOutput = ecjOutput; 13 | } 14 | 15 | public String getEcjOutput() { 16 | return ecjOutput; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/SourceCodeLocator.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | /** 4 | * The MIT License 5 | *

6 | * Copyright (c) 2005, The Codehaus 7 | *

8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | *

15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | *

18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.io.File; 27 | import java.util.HashMap; 28 | import java.util.List; 29 | import java.util.Map; 30 | 31 | /** 32 | * @author Trygve Laugstøl 33 | */ 34 | public class SourceCodeLocator { 35 | private List sourceRoots; 36 | 37 | private Map cache; 38 | 39 | public SourceCodeLocator(List sourceRoots) { 40 | this.sourceRoots = sourceRoots; 41 | 42 | cache = new HashMap<>(); 43 | } 44 | 45 | public File findSourceCodeForClass(String className) { 46 | File f = cache.get(className); 47 | 48 | if (f != null) { 49 | return f; 50 | } 51 | 52 | String sourceName = 53 | className.replace('.', System.getProperty("file.separator").charAt(0)); 54 | 55 | sourceName += ".java"; 56 | 57 | f = findInRoots(sourceName); 58 | 59 | cache.put(className, f); 60 | 61 | return f; 62 | } 63 | 64 | private File findInRoots(String s) { 65 | for (String root : sourceRoots) { 66 | File f = new File(root, s); 67 | 68 | if (f.exists()) { 69 | return f; 70 | } 71 | } 72 | 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | Plexus Eclipse Compiler 2 | ----------------------- 3 | 4 | Eclipse Compiler support for Plexus Compiler component. 5 | 6 | **Requires** `JDK 17+` and `Maven 3.9.6+` 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/Bad.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Bad 4 | { 5 | // Intentionally misspelled modifier. 6 | pubic String name; 7 | } 8 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/Deprecation.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Deprecation 4 | { 5 | public Deprecation() 6 | { 7 | new java.util.Date("testDate"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/ExternalDeps.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | 7 | public class ExternalDeps 8 | { 9 | 10 | public void hello( String str ) 11 | { 12 | System.out.println( StringUtils.upperCase( str) ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/Person.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Person 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/ReservedWord.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class ReservedWord 4 | { 5 | String assert; 6 | } 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/UnknownSymbol.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class UnknownSymbol 4 | { 5 | public UnknownSymbol() 6 | { 7 | foo(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test-input/src/main/org/codehaus/foo/WrongClassname.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class RightClassname 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerDashedArgumentsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import javax.inject.Inject; 27 | import javax.inject.Named; 28 | 29 | import java.io.File; 30 | import java.util.Collections; 31 | import java.util.HashSet; 32 | import java.util.List; 33 | import java.util.Set; 34 | 35 | import org.codehaus.plexus.compiler.Compiler; 36 | import org.codehaus.plexus.compiler.CompilerConfiguration; 37 | import org.codehaus.plexus.testing.PlexusTest; 38 | import org.codehaus.plexus.util.FileUtils; 39 | import org.hamcrest.MatcherAssert; 40 | import org.hamcrest.Matchers; 41 | import org.junit.jupiter.api.Assertions; 42 | import org.junit.jupiter.api.Test; 43 | 44 | import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; 45 | 46 | /** 47 | * @author Frits Jalvingh 48 | * Created on 22-4-18. 49 | */ 50 | @PlexusTest 51 | public class EclipseCompilerDashedArgumentsTest { 52 | 53 | public static final String BAD_DOUBLEDASH_OPTION = "--grubbelparkplace"; 54 | 55 | @Inject 56 | @Named("eclipse") 57 | Compiler compiler; 58 | 59 | private CompilerConfiguration getConfig() throws Exception { 60 | String sourceDir = getBasedir() + "/src/test-input/src/main"; 61 | 62 | List filenames = FileUtils.getFileNames(new File(sourceDir), "**/*.java", null, false, true); 63 | Collections.sort(filenames); 64 | Set files = new HashSet<>(); 65 | for (String filename : filenames) { 66 | files.add(new File(filename)); 67 | } 68 | 69 | CompilerConfiguration compilerConfig = new CompilerConfiguration(); 70 | compilerConfig.setDebug(false); 71 | compilerConfig.setShowDeprecation(false); 72 | 73 | // compilerConfig.setClasspathEntries( getClasspath() ); 74 | compilerConfig.addSourceLocation(sourceDir); 75 | compilerConfig.setOutputLocation(getBasedir() + "/target/eclipse/classes"); 76 | FileUtils.deleteDirectory(compilerConfig.getOutputLocation()); 77 | // compilerConfig.addInclude( filename ); 78 | compilerConfig.setForceJavacCompilerUse(false); 79 | compilerConfig.setSourceFiles(files); 80 | 81 | compilerConfig.setTargetVersion("1.8"); 82 | compilerConfig.setSourceVersion("1.8"); 83 | return compilerConfig; 84 | } 85 | 86 | /** 87 | * Start the eclipse compiler with a bad option that has two dashes. It should abort, and the error 88 | * message should show the actual bad option with two dashes. This ensures that both dashes are passed 89 | * to the compiler proper. 90 | * 91 | * This also tests that con-compile errors are shown properly, as the error caused by 92 | * the invalid option is not part of the error output but part of the data sent to stdout/stderr. 93 | */ 94 | @Test 95 | public void testDoubleDashOptionsArePassedWithTwoDashes() throws Exception { 96 | CompilerConfiguration config = getConfig(); 97 | config.addCompilerCustomArgument(BAD_DOUBLEDASH_OPTION, "b0rk3d"); 98 | 99 | EcjFailureException x = 100 | Assertions.assertThrows(EcjFailureException.class, () -> compiler.performCompile(config)); 101 | 102 | MatcherAssert.assertThat(x.getEcjOutput(), Matchers.containsString(BAD_DOUBLEDASH_OPTION)); 103 | MatcherAssert.assertThat(x.getEcjOutput(), Matchers.not(Matchers.containsString("-" + BAD_DOUBLEDASH_OPTION))); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerErrorsAsWarningsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | 6 | import org.codehaus.plexus.compiler.AbstractCompilerTest; 7 | import org.codehaus.plexus.compiler.CompilerConfiguration; 8 | import org.junit.jupiter.api.BeforeEach; 9 | 10 | public class EclipseCompilerErrorsAsWarningsTest extends AbstractCompilerTest { 11 | 12 | protected void configureCompilerConfig(CompilerConfiguration compilerConfig) { 13 | compilerConfig.addCompilerCustomArgument("-errorsAsWarnings", "true"); 14 | } 15 | 16 | @BeforeEach 17 | public void setUp() throws Exception { 18 | setCompilerDebug(true); 19 | setCompilerDeprecationWarnings(true); 20 | } 21 | 22 | @Override 23 | protected String getRoleHint() { 24 | return "eclipse"; 25 | } 26 | 27 | @Override 28 | protected int expectedErrors() { 29 | return 0; 30 | } 31 | 32 | @Override 33 | protected int expectedWarnings() { 34 | return 6; 35 | } 36 | 37 | @Override 38 | protected Collection expectedOutputFiles() { 39 | String javaVersion = getJavaVersion(); 40 | if (javaVersion.contains("9.0") 41 | || javaVersion.contains("11") 42 | || javaVersion.contains("17") 43 | || javaVersion.contains("21") 44 | || javaVersion.contains("24")) { 45 | return Arrays.asList( 46 | "org/codehaus/foo/Deprecation.class", 47 | "org/codehaus/foo/ExternalDeps.class", 48 | "org/codehaus/foo/Person.class"); 49 | } 50 | return Arrays.asList( 51 | "org/codehaus/foo/Deprecation.class", 52 | "org/codehaus/foo/ExternalDeps.class", 53 | "org/codehaus/foo/Person.class", 54 | "org/codehaus/foo/ReservedWord.class"); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerFailOnWarningsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | 6 | import org.codehaus.plexus.compiler.AbstractCompilerTest; 7 | import org.codehaus.plexus.compiler.CompilerConfiguration; 8 | 9 | public class EclipseCompilerFailOnWarningsTest extends AbstractCompilerTest { 10 | 11 | protected void configureCompilerConfig(CompilerConfiguration compilerConfig) { 12 | compilerConfig.setFailOnWarning(true); 13 | } 14 | 15 | @Override 16 | protected String getRoleHint() { 17 | return "eclipse"; 18 | } 19 | 20 | @Override 21 | protected int expectedErrors() { 22 | return 5; 23 | } 24 | 25 | @Override 26 | protected int expectedWarnings() { 27 | return 0; 28 | } 29 | 30 | @Override 31 | protected Collection expectedOutputFiles() { 32 | String javaVersion = getJavaVersion(); 33 | if (javaVersion.contains("9.0") 34 | || javaVersion.contains("11") 35 | || javaVersion.contains("17") 36 | || javaVersion.contains("21") 37 | || javaVersion.contains("24")) { 38 | return Arrays.asList( 39 | "org/codehaus/foo/Deprecation.class", 40 | "org/codehaus/foo/ExternalDeps.class", 41 | "org/codehaus/foo/Person.class"); 42 | } 43 | return Arrays.asList( 44 | "org/codehaus/foo/Deprecation.class", 45 | "org/codehaus/foo/ExternalDeps.class", 46 | "org/codehaus/foo/Person.class", 47 | "org/codehaus/foo/ReservedWord.class"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTckTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import org.codehaus.plexus.compiler.AbstractCompilerTckTest; 27 | 28 | /** 29 | * @author Trygve Laugstøl 30 | */ 31 | public class EclipseCompilerTckTest extends AbstractCompilerTckTest { 32 | public EclipseCompilerTckTest() { 33 | this.roleHint = "eclipse"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.util.Arrays; 27 | import java.util.Collection; 28 | 29 | import org.codehaus.plexus.compiler.AbstractCompilerTest; 30 | import org.codehaus.plexus.compiler.CompilerConfiguration; 31 | import org.junit.jupiter.api.BeforeEach; 32 | import org.junit.jupiter.api.Test; 33 | 34 | import static org.hamcrest.MatcherAssert.assertThat; 35 | import static org.hamcrest.Matchers.startsWith; 36 | import static org.junit.jupiter.api.Assertions.assertThrows; 37 | 38 | /** 39 | * @author Jason van Zyl 40 | */ 41 | public class EclipseCompilerTest extends AbstractCompilerTest { 42 | 43 | @BeforeEach 44 | public void setUp() { 45 | setCompilerDebug(true); 46 | setCompilerDeprecationWarnings(true); 47 | } 48 | 49 | @Override 50 | protected String getRoleHint() { 51 | return "eclipse"; 52 | } 53 | 54 | @Override 55 | protected int expectedErrors() { 56 | return 5; 57 | } 58 | 59 | @Override 60 | protected int expectedWarnings() { 61 | return 1; 62 | } 63 | 64 | @Override 65 | protected Collection expectedOutputFiles() { 66 | String javaVersion = getJavaVersion(); 67 | if (javaVersion.contains("9.0") 68 | || javaVersion.contains("11") 69 | || javaVersion.contains("17") 70 | || javaVersion.contains("21") 71 | || javaVersion.contains("24")) { 72 | return Arrays.asList( 73 | "org/codehaus/foo/Deprecation.class", 74 | "org/codehaus/foo/ExternalDeps.class", 75 | "org/codehaus/foo/Person.class"); 76 | } 77 | return Arrays.asList( 78 | "org/codehaus/foo/Deprecation.class", 79 | "org/codehaus/foo/ExternalDeps.class", 80 | "org/codehaus/foo/Person.class", 81 | "org/codehaus/foo/ReservedWord.class"); 82 | } 83 | 84 | // The test is fairly meaningless as we can not validate anything 85 | @Test 86 | public void testCustomArgument() throws Exception { 87 | CompilerConfiguration compilerConfig = createMinimalCompilerConfig(); 88 | 89 | compilerConfig.addCompilerCustomArgument("-key", "value"); 90 | 91 | getCompiler().performCompile(compilerConfig); 92 | } 93 | 94 | @Test 95 | public void testInitializeWarningsForPropertiesArgument() { 96 | CompilerConfiguration compilerConfig = createMinimalCompilerConfig(); 97 | 98 | compilerConfig.addCompilerCustomArgument("-properties", "file_does_not_exist"); 99 | 100 | IllegalArgumentException e = 101 | assertThrows(IllegalArgumentException.class, () -> getCompiler().performCompile(compilerConfig)); 102 | assertThat("Message must start with 'Properties file'", e.getMessage(), startsWith("Properties file")); 103 | } 104 | 105 | private CompilerConfiguration createMinimalCompilerConfig() { 106 | CompilerConfiguration compilerConfig = new CompilerConfiguration(); 107 | compilerConfig.setOutputLocation("target/" + getRoleHint() + "/classes-CustomArgument"); 108 | return compilerConfig; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.eclipse; 2 | 3 | import java.util.List; 4 | import java.util.stream.Stream; 5 | 6 | import org.junit.jupiter.params.ParameterizedTest; 7 | import org.junit.jupiter.params.provider.Arguments; 8 | import org.junit.jupiter.params.provider.MethodSource; 9 | 10 | import static java.util.Arrays.asList; 11 | import static org.junit.jupiter.api.Assertions.assertEquals; 12 | 13 | class EclipseJavaCompilerTest { 14 | @ParameterizedTest 15 | @MethodSource("sources") 16 | void testReorderedSources(List expected, List inputSources) { 17 | List resorted = EclipseJavaCompiler.resortSourcesToPutModuleInfoFirst(inputSources); 18 | 19 | assertEquals(expected, resorted); 20 | } 21 | 22 | static Stream sources() { 23 | List expectedOrder = asList("module-info.java", "plexus/A.java", "plexus/B.java", "eclipse/A.java"); 24 | 25 | List moduleInfoAlreadyFirst = 26 | asList("module-info.java", "plexus/A.java", "plexus/B.java", "eclipse/A.java"); 27 | 28 | List moduleInfoSomewhereInTheMiddle = 29 | asList("plexus/A.java", "module-info.java", "plexus/B.java", "eclipse/A.java"); 30 | 31 | List moduleInfoAsLast = asList("plexus/A.java", "plexus/B.java", "eclipse/A.java", "module-info.java"); 32 | 33 | return Stream.of( 34 | Arguments.arguments(expectedOrder, moduleInfoAlreadyFirst), 35 | Arguments.arguments(expectedOrder, moduleInfoSomewhereInTheMiddle), 36 | Arguments.arguments(expectedOrder, moduleInfoAsLast)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-eclipse/src/test/resources/org/codehaus/plexus/compiler/eclipse/EclipseCompilerConfigurationTest-test.properties: -------------------------------------------------------------------------------- 1 | foo=bar 2 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac-errorprone/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compilers 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-javac-errorprone 12 | 13 | Plexus Javac+error-prone Component 14 | Javac Compiler support for Plexus Compiler component, 15 | with error-prone static analysis checks enabled. 16 | See https://errorprone.info 17 | 18 | 19 | 17 20 | 21 | 22 | 23 | 24 | org.codehaus.plexus 25 | plexus-compiler-javac 26 | ${project.version} 27 | 28 | 29 | com.google.errorprone 30 | error_prone_core 31 | ${errorprone.version} 32 | 33 | 34 | javax.inject 35 | javax.inject 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-surefire-plugin 44 | 45 | --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED 46 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED 47 | --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED 48 | --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED 49 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED 50 | --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED 51 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 52 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 53 | --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED 54 | --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac-errorprone/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | Plexus Javac+error-prone Component 2 | ---------------------------------- 3 | 4 | Javac Compiler support for Plexus Compiler component, 5 | with error-prone static analysis checks enabled. 6 | 7 | See https://errorprone.info 8 | 9 | **Requires** `JDK 17+` 10 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac-errorprone/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac-errorprone/src/test-input/src/main/ShortSet.java: -------------------------------------------------------------------------------- 1 | import java.util.Set; 2 | import java.util.HashSet; 3 | 4 | public class ShortSet { 5 | public static void main (String[] args) { 6 | Set s = new HashSet<>(); 7 | for (short i = 0; i < 100; i++) { 8 | s.add(i); 9 | s.remove(i - 1); 10 | } 11 | System.out.println(s.size()); 12 | } 13 | } -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac-errorprone/src/test/java/org/codehaus/plexus/compiler/javac/JavacErrorProneCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.javac; 2 | 3 | import org.codehaus.plexus.compiler.AbstractCompilerTest; 4 | 5 | /** 6 | * @author Jason van Zyl 7 | */ 8 | public class JavacErrorProneCompilerTest extends AbstractCompilerTest { 9 | 10 | @Override 11 | protected String getRoleHint() { 12 | return "javac-with-errorprone"; 13 | } 14 | 15 | @Override 16 | protected int expectedWarnings() { 17 | String javaVersion = getJavaVersion(); 18 | if (javaVersion.startsWith("1.8")) { 19 | return 1; 20 | } else if (javaVersion.contains("18") 21 | || javaVersion.contains("19") 22 | || javaVersion.contains("20") 23 | || javaVersion.contains("21") 24 | || javaVersion.contains("22") 25 | || javaVersion.contains("23") 26 | || javaVersion.contains("24")) { 27 | return 5; 28 | } 29 | return 2; 30 | } 31 | 32 | @Override 33 | protected int expectedErrors() { 34 | return 1; 35 | } 36 | 37 | @Override 38 | public String getSourceVersion() { 39 | return "1.8"; 40 | } 41 | 42 | @Override 43 | public String getTargetVersion() { 44 | return "1.8"; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compilers 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compiler-javac 12 | 13 | Plexus Javac Component 14 | Javac Compiler support for Plexus Compiler component. 15 | 16 | 17 | 18 | org.codehaus.plexus 19 | plexus-utils 20 | 21 | 22 | javax.inject 23 | javax.inject 24 | 25 | 26 | org.slf4j 27 | slf4j-api 28 | 29 | 30 | org.junit.jupiter 31 | junit-jupiter-params 32 | test 33 | 34 | 35 | org.hamcrest 36 | hamcrest 37 | test 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/InProcessCompiler.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.javac; 2 | 3 | import org.codehaus.plexus.compiler.CompilerConfiguration; 4 | import org.codehaus.plexus.compiler.CompilerException; 5 | import org.codehaus.plexus.compiler.CompilerResult; 6 | 7 | public interface InProcessCompiler { 8 | 9 | CompilerResult compileInProcess(String[] args, final CompilerConfiguration config, String[] sourceFiles) 10 | throws CompilerException; 11 | } 12 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/IsolatedClassLoader.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.javac; 2 | 3 | /** 4 | * The MIT License 5 | * 6 | * Copyright (c) 2005, The Codehaus 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is furnished to do 13 | * so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | */ 26 | import java.net.URL; 27 | import java.net.URLClassLoader; 28 | 29 | public class IsolatedClassLoader extends URLClassLoader { 30 | private ClassLoader parentClassLoader = ClassLoader.getSystemClassLoader(); 31 | 32 | public IsolatedClassLoader() { 33 | super(new URL[0], null); 34 | } 35 | 36 | public void addURL(URL url) { 37 | super.addURL(url); 38 | } 39 | 40 | public synchronized Class loadClass(String className) throws ClassNotFoundException { 41 | Class c = findLoadedClass(className); 42 | 43 | ClassNotFoundException ex = null; 44 | 45 | if (c == null) { 46 | try { 47 | c = findClass(className); 48 | } catch (ClassNotFoundException e) { 49 | ex = e; 50 | 51 | if (parentClassLoader != null) { 52 | c = parentClassLoader.loadClass(className); 53 | } 54 | } 55 | } 56 | 57 | if (c == null) { 58 | throw ex; 59 | } 60 | 61 | return c; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | Plexus Javac Component 2 | ---------------------- 3 | 4 | Javac Compiler support for Plexus Compiler component. 5 | 6 | **Requires** `JDK 8+` 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/Bad.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Bad 4 | { 5 | // Intentionally misspelled modifier. 6 | pubic String name; 7 | } 8 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/Deprecation.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Deprecation 4 | { 5 | public Deprecation() 6 | { 7 | new java.util.Date("testDate"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/ExternalDeps.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | 5 | public class ExternalDeps 6 | { 7 | public void hello( String str ) 8 | { 9 | System.out.println( StringUtils.upperCase( str) ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/Person.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class Person 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/ReservedWord.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class ReservedWord 4 | { 5 | String assert; 6 | } 7 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/UnknownSymbol.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class UnknownSymbol 4 | { 5 | public UnknownSymbol() 6 | { 7 | foo(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test-input/src/main/org/codehaus/foo/WrongClassname.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.foo; 2 | 3 | public class RightClassname 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompilerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.compiler.javac; 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | /** 22 | * @author Olivier Lamy 23 | */ 24 | public class JavaxToolsCompilerTest extends AbstractJavacCompilerTest { 25 | // no op default is to javax.tools if available 26 | 27 | @Override 28 | protected int expectedWarnings() { 29 | String javaVersion = getJavaVersion(); 30 | if (javaVersion.contains("21") || javaVersion.contains("24")) { 31 | return 1; 32 | } else { 33 | return super.expectedWarnings(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /plexus-compilers/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | org.codehaus.plexus 7 | plexus-compiler 8 | 2.15.1-SNAPSHOT 9 | 10 | 11 | plexus-compilers 12 | pom 13 | 14 | Plexus Compilers 15 | 16 | 17 | plexus-compiler-aspectj 18 | plexus-compiler-csharp 19 | plexus-compiler-eclipse 20 | plexus-compiler-javac 21 | plexus-compiler-javac-errorprone 22 | 23 | 24 | 25 | 26 | org.junit.jupiter 27 | junit-jupiter-api 28 | test 29 | 30 | 31 | org.codehaus.plexus 32 | plexus-compiler-api 33 | 34 | 35 | org.codehaus.plexus 36 | plexus-compiler-test 37 | test 38 | 39 | 40 | 41 | commons-lang 42 | commons-lang 43 | 2.0 44 | test 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/site/apt/index.apt: -------------------------------------------------------------------------------- 1 | ------ 2 | Plexus Compiler 3 | ------ 4 | Hervé Boutemy 5 | ------ 6 | 2012-05-08 7 | ------ 8 | 9 | ~~ Licensed to the Apache Software Foundation (ASF) under one 10 | ~~ or more contributor license agreements. See the NOTICE file 11 | ~~ distributed with this work for additional information 12 | ~~ regarding copyright ownership. The ASF licenses this file 13 | ~~ to you under the Apache License, Version 2.0 (the 14 | ~~ "License"); you may not use this file except in compliance 15 | ~~ with the License. You may obtain a copy of the License at 16 | ~~ 17 | ~~ http://www.apache.org/licenses/LICENSE-2.0 18 | ~~ 19 | ~~ Unless required by applicable law or agreed to in writing, 20 | ~~ software distributed under the License is distributed on an 21 | ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | ~~ KIND, either express or implied. See the License for the 23 | ~~ specific language governing permissions and limitations 24 | ~~ under the License. 25 | 26 | ~~ NOTE: For help with the syntax of this file, see: 27 | ~~ http://maven.apache.org/doxia/references/apt-format.html 28 | 29 | Plexus Compiler 30 | 31 | Plexus Compiler is a Plexus component to use different compilers through a uniform API. 32 | 33 | It is composed by: 34 | 35 | * {{{./plexus-compiler-api/}<<>>}}: the API to use compilers, 36 | 37 | * {{{./plexus-compiler-manager/}<<>>}}: a manager to choose a compiler, 38 | 39 | * {{{./plexus-compilers/}<<>>}}: different compilers 40 | 41 | * {{{./plexus-compilers/plexus-compiler-aspectj/}<<>>}}: AspectJ compiler, <> <<>> and <<>> 42 | 43 | * {{{./plexus-compilers/plexus-compiler-csharp/}<<>>}}: C#/Mono compiler, <> <<>> 44 | 45 | * {{{./plexus-compilers/plexus-compiler-eclipse/}<<>>}}: Eclipse compiler, <> <<>> and <<>> 46 | 47 | * {{{./plexus-compilers/plexus-compiler-javac/}<<>>}}: javac compiler, <> <<>> 48 | 49 | * {{{./plexus-compilers/plexus-compiler-javac-errorprone/}<<>>}}: javac compiler with {{{https://errorprone.info}error-prone}} static analysis checks enabled, <> <<>> 50 | 51 | [] 52 | 53 | * {{{./plexus-compiler-test/}<<>>}}: a test harness. 54 | 55 | [] 56 | -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | --------------------------------------------------------------------------------