-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Delay the classpath computation - Add a ValidateClassPathMojo if earlier validation/computation is desired
- Loading branch information
Showing
7 changed files
with
141 additions
and
45 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
51 changes: 51 additions & 0 deletions
51
tycho-compiler-plugin/src/main/java/org/eclipse/tycho/compiler/ValidateClassPathMojo.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,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Christoph Läubrich and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.compiler; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.Component; | ||
import org.apache.maven.plugins.annotations.LifecyclePhase; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.plugins.annotations.ResolutionScope; | ||
import org.apache.maven.project.MavenProject; | ||
import org.eclipse.tycho.core.TychoProject; | ||
import org.eclipse.tycho.core.osgitools.DefaultReactorProject; | ||
import org.eclipse.tycho.core.osgitools.OsgiBundleProject; | ||
|
||
/** | ||
* This mojo could be added to a build if validation of the classpath is desired before the | ||
* compile-phase. | ||
*/ | ||
@Mojo(name = "validate-classpath", defaultPhase = LifecyclePhase.VALIDATE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true) | ||
public class ValidateClassPathMojo extends AbstractMojo { | ||
|
||
@Parameter(property = "project", readonly = true) | ||
private MavenProject project; | ||
|
||
@Component(role = TychoProject.class) | ||
private Map<String, TychoProject> projectTypes; | ||
|
||
@Override | ||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
|
||
TychoProject projectType = projectTypes.get(project.getPackaging()); | ||
if (projectType instanceof OsgiBundleProject) { | ||
OsgiBundleProject bundleProject = (OsgiBundleProject) projectType; | ||
bundleProject.getClasspath(DefaultReactorProject.adapt(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
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
44 changes: 44 additions & 0 deletions
44
tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/BundleClassPath.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,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Christoph Läubrich and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.core.osgitools; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.eclipse.tycho.classpath.ClasspathEntry; | ||
import org.eclipse.tycho.classpath.ClasspathEntry.AccessRule; | ||
|
||
public class BundleClassPath { | ||
|
||
private List<ClasspathEntry> classpath; | ||
private List<AccessRule> strictBootClasspathAccessRules; | ||
private List<AccessRule> bootClasspathExtraAccessRules; | ||
|
||
BundleClassPath(List<ClasspathEntry> classpath, List<AccessRule> strictBootClasspathAccessRules, | ||
List<AccessRule> bootClasspathExtraAccessRules) { | ||
this.classpath = Collections.unmodifiableList(classpath); | ||
this.strictBootClasspathAccessRules = Collections.unmodifiableList(strictBootClasspathAccessRules); | ||
this.bootClasspathExtraAccessRules = Collections.unmodifiableList(bootClasspathExtraAccessRules); | ||
} | ||
|
||
public List<ClasspathEntry> getClasspathEntries() { | ||
return classpath; | ||
} | ||
|
||
public List<AccessRule> getStrictBootClasspathAccessRules() { | ||
return strictBootClasspathAccessRules; | ||
} | ||
|
||
public List<AccessRule> getExtraBootClasspathAccessRules() { | ||
return bootClasspathExtraAccessRules; | ||
} | ||
|
||
} |
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