-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic tycho-build core extension
- Issue #556 add a tycho-core-extension including pomless - Issue #148 add a hint to the user to migrate to the generic extension - Update integration tests to use the new tycho-core-extension
- Loading branch information
Showing
10 changed files
with
163 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 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,50 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho</artifactId> | ||
<version>2.7.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>tycho-build</artifactId> | ||
|
||
<build> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.plexus</groupId> | ||
<artifactId>plexus-component-metadata</artifactId> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.plexus</groupId> | ||
<artifactId>plexus-utils</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.eclipse.tycho.extras</groupId> | ||
<artifactId>tycho-pomless</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-model</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-model-builder</artifactId> | ||
<version>${maven-version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains 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
4 changes: 2 additions & 2 deletions
4
tycho-extras/tycho-extras-its/src/test/resources/testpomless-flat/.mvn/extensions.xml
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho.extras</groupId> | ||
<artifactId>tycho-pomless</artifactId> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
4 changes: 2 additions & 2 deletions
4
tycho-extras/tycho-extras-its/src/test/resources/testpomless-structured/.mvn/extensions.xml
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho.extras</groupId> | ||
<artifactId>tycho-pomless</artifactId> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
4 changes: 2 additions & 2 deletions
4
tycho-extras/tycho-extras-its/src/test/resources/testpomless/.mvn/extensions.xml
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho.extras</groupId> | ||
<artifactId>tycho-pomless</artifactId> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
4 changes: 2 additions & 2 deletions
4
tycho-extras/tycho-extras-its/src/test/resources/testsetversionpomless/.mvn/extensions.xml
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho.extras</groupId> | ||
<artifactId>tycho-pomless</artifactId> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
This file contains 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
70 changes: 70 additions & 0 deletions
70
...cho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoPomlessLifecycleParticipant.java
This file contains 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,70 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
* | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.pomless; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
import org.apache.maven.AbstractMavenLifecycleParticipant; | ||
import org.apache.maven.MavenExecutionException; | ||
import org.apache.maven.cli.internal.extension.model.CoreExtension; | ||
import org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader; | ||
import org.apache.maven.execution.MavenSession; | ||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.codehaus.plexus.component.annotations.Requirement; | ||
import org.codehaus.plexus.logging.Logger; | ||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; | ||
|
||
@Component(role = AbstractMavenLifecycleParticipant.class, hint = "TychoPomlessLifecycleParticipant") | ||
public class TychoPomlessLifecycleParticipant extends AbstractMavenLifecycleParticipant { | ||
|
||
@Requirement | ||
protected Logger logger; | ||
|
||
@Override | ||
public void afterSessionStart(MavenSession session) throws MavenExecutionException { | ||
session.getUserProperties().setProperty("tycho.mode", "extension"); | ||
File moduleProjectDirectory = session.getRequest().getMultiModuleProjectDirectory(); | ||
if (moduleProjectDirectory != null) { | ||
File extensionsFile = new File(moduleProjectDirectory, ".mvn/extensions.xml"); | ||
CoreExtensionsXpp3Reader parser = new CoreExtensionsXpp3Reader(); | ||
try (InputStream is = new BufferedInputStream(new FileInputStream(extensionsFile))) { | ||
List<CoreExtension> extensions = parser.read(is).getExtensions(); | ||
for (CoreExtension coreExtension : extensions) { | ||
if ("org.eclipse.tycho.extras".equals(coreExtension.getGroupId()) | ||
&& "tycho-pomless".equals(coreExtension.getArtifactId())) { | ||
logger.warn( | ||
"org.eclipse.tycho.extras:tycho-pomless build extension will be replaced in a future version of Tycho by the new org.eclipse.tycho:tycho-build extension."); | ||
logger.warn( | ||
"You can simply change your .mvn/extensions.xml to reference the new extension right now:"); | ||
logger.warn("<extension>"); | ||
logger.warn(" <groupId>org.eclipse.tycho</groupId>"); | ||
logger.warn(" <artifactId>tycho-build</artifactId>"); | ||
logger.warn(" <version>" + coreExtension.getVersion() + "</version>"); | ||
logger.warn("</extension>"); | ||
break; | ||
} | ||
} | ||
|
||
} catch (IOException | XmlPullParserException e) { | ||
// //don't care, we just wan't to inform the user... | ||
} | ||
} | ||
} | ||
} |