-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[MNG-8395] Redirect the <sourceDirectory> element to <Source> #2061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
67dd58d
Include the list of <Source> elements in the path translation.
desruisseaux 82bb5cc
Add a `SourceRoot` interface for the properties declared in the POM's…
desruisseaux 77326a7
Deprecate POM elements that are replaced by <Source> elements.
desruisseaux 062e28b
Javadoc fixes.
desruisseaux 36bd9d6
Add @Deprecated annotation on model elements flagged as @deprecated i…
desruisseaux 7000a3c
Rename `getSourceRoots(scope, language)` as `getEnabledSourceRoot` an…
desruisseaux 9648557
Make the `getSourceRoots()` and `getEnabledSourceRoots(ProjectScope, …
desruisseaux 209e6d3
Update `ProjectManager` API using `SourceRoot`:
desruisseaux 4552207
Remove the methods that were deprecated in the previous commit.
desruisseaux 9af4ac9
Move the recently added `Project` methods into `ProjectManager`.
desruisseaux 3537d85
Remove unneeded static keyword
gnodet 713e751
Fix typo
gnodet b1e36a0
Specify nullability on parameters
gnodet dd1d376
Fix a checkstype error.
desruisseaux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.maven.api; | ||
|
|
||
| import java.nio.file.Path; | ||
| import java.nio.file.PathMatcher; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * A root directory of source files. | ||
| * The sources may be Java main classes, test classes, resources or anything else identified by the scope. | ||
| */ | ||
| public interface SourceRoot { | ||
| /** | ||
| * {@return the root directory where the sources are stored}. | ||
| * The path is relative to the <abbr>POM</abbr> file. | ||
| */ | ||
| Path directory(); | ||
|
|
||
| /** | ||
| * {@return the list of pattern matchers for the files to include}. | ||
| * The default implementation returns an empty list, which means to apply a language-dependent pattern. | ||
| * For example, for the Java language, the pattern includes all files with the {@code .java} suffix. | ||
| */ | ||
| default List<PathMatcher> includes() { | ||
| return List.of(); | ||
| } | ||
|
|
||
| /** | ||
| * {@return the list of pattern matchers for the files to exclude}. | ||
| * The exclusions are applied after the inclusions. | ||
| * The default implementation returns an empty list. | ||
| */ | ||
| default List<PathMatcher> excludes() { | ||
| return List.of(); | ||
| } | ||
|
|
||
| /** | ||
| * {@return in which context the source files will be used}. | ||
| * The default value is {@link ProjectScope#MAIN}. | ||
| */ | ||
| default ProjectScope scope() { | ||
| return ProjectScope.MAIN; | ||
| } | ||
|
|
||
| /** | ||
| * {@return the language of the source files}. | ||
| */ | ||
| Language language(); | ||
|
|
||
| /** | ||
| * {@return the name of the Java module (or other language-specific module) which is built by the sources}. | ||
| * The default value is empty. | ||
| */ | ||
| default Optional<String> module() { | ||
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * {@return the version of the platform where the code will be executed}. | ||
| * In a Java environment, this is the value of the {@code --release} compiler option. | ||
| * The default value is empty. | ||
| */ | ||
| default Optional<Version> targetVersion() { | ||
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * {@return an explicit target path, overriding the default value}. | ||
| * When a target path is explicitly specified, the values of the {@link #module()} and {@link #targetVersion()} | ||
| * elements are not used for inferring the path (they are still used as compiler options however). | ||
| * It means that for scripts and resources, the files below the path specified by {@link #directory()} | ||
| * are copied to the path specified by {@code targetPath()} with the exact same directory structure. | ||
| */ | ||
| default Optional<Path> targetPath() { | ||
| return Optional.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * {@return whether resources are filtered to replace tokens with parameterized values}. | ||
| * The default value is {@code false}. | ||
| */ | ||
| default boolean stringFiltering() { | ||
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * {@return whether the directory described by this source element should be included in the build}. | ||
| * The default value is {@code true}. | ||
| */ | ||
| default boolean enabled() { | ||
| return true; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.