-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[MNG-6656] Introduce base for build/consumer process #286
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
Closed
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
65a5a1b
[MNG-6656] Introduce base for build/consumer pom
rfscholte dfb0c2c
[MNG-6656] Introduce base for build/consumer pom
rfscholte 79c4813
[MNG-6656] separate module for maven-xml, maven-model-builder doesn't…
rfscholte eeea0bb
[MNG-6720] MultiThreadedBuilder: wait for parallel running projects w…
oehme 144076c
[MNG-6725] Skip '.mavenrc' via MAVEN_SKIP_RC=1 and '-Dmaven.skip.rc=t…
Tibor17 b9c7c4a
IT archives
Tibor17 5822ea7
improved handlers documentation: artifact vs dependency attributes
hboutemy 0197248
[INFRA-18812] Revert unnecessary commits after fixing INFRA-18812
rfscholte 297a6b7
fixed ArtifactHandlerTest after commit d5b0f4ce
Tibor17 e6240d5
[MNG-6713] Fix ExclusionArtifactFilter to respect wildcard exclusions…
saturnism 6e624f0
Merge remote-tracking branch 'remotes/origin/master' into MNG-6656
rfscholte 5065aec
Move Filters to maven-xml filter, so it can be picked up by maven-mod…
rfscholte e12b732
Merge branch 'MNG-6656' of https://gitbox.apache.org/repos/asf/maven …
rfscholte 82d8693
Add missing classes
rfscholte a684370
[MNG-6656] Support versionless parent
rfscholte 712b95f
[MNG-6656] Support reactor managed versions
rfscholte 2f4d491
Merge branch 'master' into MNG-6656
rfscholte b46a4c7
[MNG-6656] Update project versions
rfscholte b19b05c
[MNG-6656] Applying review comments
rfscholte c52f383
[MNG-6656] Support LexicalHandler
rfscholte 24955e7
[MNG-6656] Introduce Features class
rfscholte 585cb56
Merge branch 'master' into MNG-6656
rfscholte 87601ec
[MNG-6656] Fix bug in AbstractEventXMLFilter (removed processed events)
rfscholte 91f8799
[MNG-6656] Enable maven.experimental.buildconsumer by default
rfscholte 3ef3fa1
[MNG-6656] Clean up code based on reviews
rfscholte 729c93c
[MNG-6656] Fix deadlock
rfscholte 1946d9c
Merge remote-tracking branch 'remotes/origin/master' into MNG-6656
rfscholte 61a3761
[MNG-6656] Move post-processing of file to rawmodel to proper method
rfscholte 2313114
Merge branch 'master' of https://gitbox.apache.org/repos/asf/maven in…
rfscholte a70db51
Merge remote-tracking branch 'remotes/origin/master' into MNG-6656
rfscholte 21be0b1
[MNG-6656] Don't post-process when model has errors
rfscholte ee8e8e2
Merge remote-tracking branch 'remotes/origin/master' into MNG-6656
rfscholte d373d3a
MNG-6656: Keep xml version + encoding after transformation
rfscholte d9cc0e4
[MNG-6656] Improve ModelValidator
rfscholte 9049d68
Merge branch 'master' into MNG-6656
rfscholte 630c22f
Merge branch 'master' into MNG-6656
rfscholte 3d453bf
[MNG-6656] Introduce custom ModelMerger to keep inputLocationTracker …
rfscholte a191af7
Merge branch 'master' into MNG-6656
rfscholte 3294a6b
[MNG-6656] Introduce ModelSourceTransformer
rfscholte 95b5b58
[MNG-6656] Refactor code, make sure it still works with non-xml poms
rfscholte 0a8d8e6
[MNG-6656] Fix checkstyle errors
rfscholte 1b0395e
Revert tests with unneeded changes
rfscholte 475fca2
[MNG-6656] Replace CacheManager with already existing ReactorModelPool
rfscholte 1218fe3
Merge branch 'master' into MNG-6656
rfscholte a94e2d1
Revert tests with unneeded changes
rfscholte 7ba7bef
[MNG-6656] Clean up code
rfscholte e0093d5
[MNG-6656] Changes based on review comments.
rfscholte 1381266
Merge branch 'master' into MNG-6656
rfscholte 447f33e
[MNG-6656] Process review comments
rfscholte f998d90
[MNG-6656] restore publishing valid consumer poms.
rfscholte cc5e28e
[MNG-6656] Align version in parent
rfscholte 1af5ee7
[MNG-6656] Move creation of TransformerContext to proper location
rfscholte 413fdb4
Merge branch 'master' into MNG-6656
rfscholte 51b74ad
Fix lineseparator in comments
rfscholte 2717ebc
Fix Jenkinsfile
rfscholte d0a3b92
Don't try to resolve ${project.artifactId}
rfscholte 3fda5cc
trying to escape $
rfscholte ee27a04
trying with triple double quotes
rfscholte 5101ea0
try as system property
rfscholte 9b42ab0
Merge branch 'master' into MNG-6656
rfscholte 82bc06d
Restore Jenkins file
rfscholte 8b3f47a
Pass sessionData
rfscholte be5d23d
Prevent NPE
rfscholte 020b503
Adjust apache-maven-wrapper pom for IT
rfscholte dc1d8c7
Merge branch 'master' into MNG-6656
rfscholte cc620d2
Adjust code based on review comments
rfscholte 1737d23
ReAdd DefaultModelSourceTransformer
rfscholte e082e6e
Adjust code based on review comments
rfscholte 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
110 changes: 110 additions & 0 deletions
110
...n-core/src/main/java/org/apache/maven/internal/aether/ConsumerModelSourceTransformer.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,110 @@ | ||
| package org.apache.maven.internal.aether; | ||
|
|
||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
|
|
||
| import javax.xml.parsers.ParserConfigurationException; | ||
| import javax.xml.stream.XMLInputFactory; | ||
| import javax.xml.stream.XMLStreamException; | ||
| import javax.xml.stream.XMLStreamReader; | ||
| import javax.xml.transform.OutputKeys; | ||
| import javax.xml.transform.Transformer; | ||
| import javax.xml.transform.TransformerConfigurationException; | ||
| import javax.xml.transform.sax.SAXTransformerFactory; | ||
| import javax.xml.transform.sax.TransformerHandler; | ||
|
|
||
| import org.apache.maven.model.building.AbstractModelSourceTransformer; | ||
| import org.apache.maven.model.building.DefaultBuildPomXMLFilterFactory; | ||
| import org.apache.maven.model.building.TransformerContext; | ||
| import org.apache.maven.xml.Factories; | ||
| import org.apache.maven.xml.internal.DefaultConsumerPomXMLFilterFactory; | ||
| import org.apache.maven.xml.sax.filter.AbstractSAXFilter; | ||
| import org.xml.sax.SAXException; | ||
|
|
||
| class ConsumerModelSourceTransformer extends AbstractModelSourceTransformer | ||
| { | ||
| @Override | ||
| protected AbstractSAXFilter getSAXFilter( Path pomFile, TransformerContext context ) | ||
| throws TransformerConfigurationException, SAXException, ParserConfigurationException | ||
| { | ||
| return new DefaultConsumerPomXMLFilterFactory( new DefaultBuildPomXMLFilterFactory( context ) ).get( pomFile ); | ||
| } | ||
|
|
||
| /** | ||
| * This transformer will ensure that encoding and version are kept. | ||
| * However, it cannot prevent: | ||
| * <ul> | ||
| * <li>attributes will be on one line</li> | ||
| * <li>Unnecessary whitespace before the rootelement will be removed</li> | ||
| * </ul> | ||
| */ | ||
| @Override | ||
| protected TransformerHandler getTransformerHandler( Path pomFile ) | ||
| throws IOException, org.apache.maven.model.building.TransformerException | ||
| { | ||
| final TransformerHandler transformerHandler; | ||
|
|
||
| final SAXTransformerFactory transformerFactory = | ||
| (SAXTransformerFactory) Factories.newTransformerFactory(); | ||
|
|
||
| // Keep same encoding+version | ||
| try ( InputStream input = Files.newInputStream( pomFile ) ) | ||
| { | ||
| XMLStreamReader streamReader = | ||
| XMLInputFactory.newFactory().createXMLStreamReader( input ); | ||
|
|
||
| transformerHandler = transformerFactory.newTransformerHandler(); | ||
|
|
||
| final String encoding = streamReader.getCharacterEncodingScheme(); | ||
| final String version = streamReader.getVersion(); | ||
|
|
||
| Transformer transformer = transformerHandler.getTransformer(); | ||
| transformer.setOutputProperty( OutputKeys.METHOD, "xml" ); | ||
| if ( encoding == null && version == null ) | ||
| { | ||
| transformer.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "yes" ); | ||
| } | ||
| else | ||
| { | ||
| transformer.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "no" ); | ||
|
|
||
| if ( encoding != null ) | ||
| { | ||
| transformer.setOutputProperty( OutputKeys.ENCODING, encoding ); | ||
| } | ||
| if ( version != null ) | ||
| { | ||
| transformer.setOutputProperty( OutputKeys.VERSION, version ); | ||
| } | ||
| } | ||
| } | ||
| catch ( XMLStreamException | TransformerConfigurationException e ) | ||
| { | ||
| throw new org.apache.maven.model.building.TransformerException( | ||
| "Failed to detect XML encoding and version", e ); | ||
| } | ||
| return transformerHandler; | ||
| } | ||
|
|
||
| } | ||
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.
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.