-
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.
Issue #551 - Provide tycho specific org.apache.maven.graph.GraphBuilder
for project dependency resolution Add a basic GraphBuilder prototype Signed-off-by: Christoph Läubrich <[email protected]>
- Loading branch information
Showing
5 changed files
with
728 additions
and
1 deletion.
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
83 changes: 83 additions & 0 deletions
83
tycho-build/src/main/java/org/eclipse/tycho/build/MavenLoggerAdapter.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,83 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2011, 2022 SAP AG 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: | ||
* SAP AG - initial API and implementation | ||
* Christoph Läubrich - #225 MavenLogger is missing error method that accepts an exception | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.build; | ||
|
||
import org.codehaus.plexus.logging.Logger; | ||
import org.eclipse.tycho.core.shared.MavenLogger; | ||
|
||
public class MavenLoggerAdapter implements MavenLogger { | ||
|
||
private final Logger logger; | ||
private final boolean extendedDebug; | ||
|
||
public MavenLoggerAdapter(Logger logger, boolean extendedDebug) { | ||
this.logger = logger; | ||
this.extendedDebug = extendedDebug; | ||
} | ||
|
||
@Override | ||
public void debug(String message) { | ||
if (logger.isDebugEnabled()) { | ||
logger.debug(message); | ||
} else if (isExtendedDebugEnabled()) { | ||
logger.info(message); | ||
} | ||
} | ||
|
||
@Override | ||
public void debug(String message, Throwable cause) { | ||
if (logger.isDebugEnabled()) { | ||
logger.debug(message, cause); | ||
} else if (isExtendedDebugEnabled()) { | ||
logger.info(message, cause); | ||
} | ||
} | ||
|
||
@Override | ||
public void info(String message) { | ||
logger.info(message); | ||
} | ||
|
||
@Override | ||
public void warn(String message) { | ||
warn(message, null); | ||
} | ||
|
||
@Override | ||
public void warn(String message, Throwable cause) { | ||
logger.warn(message, cause); | ||
} | ||
|
||
@Override | ||
public void error(String message, Throwable cause) { | ||
logger.error(message, cause); | ||
} | ||
|
||
@Override | ||
public void error(String message) { | ||
logger.error(message); | ||
} | ||
|
||
@Override | ||
public boolean isDebugEnabled() { | ||
return logger.isDebugEnabled() || isExtendedDebugEnabled(); | ||
} | ||
|
||
@Override | ||
public boolean isExtendedDebugEnabled() { | ||
return extendedDebug; | ||
} | ||
|
||
private boolean isEmpty(String message) { | ||
return message == null || message.isEmpty(); | ||
} | ||
} |
181 changes: 181 additions & 0 deletions
181
tycho-build/src/main/java/org/eclipse/tycho/build/PlexusBundleContext.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,181 @@ | ||
/******************************************************************************* | ||
* 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.build; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
import java.util.Collection; | ||
import java.util.Dictionary; | ||
|
||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.eclipse.osgi.internal.framework.FilterImpl; | ||
import org.osgi.framework.Bundle; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.BundleException; | ||
import org.osgi.framework.BundleListener; | ||
import org.osgi.framework.Filter; | ||
import org.osgi.framework.FrameworkListener; | ||
import org.osgi.framework.InvalidSyntaxException; | ||
import org.osgi.framework.ServiceFactory; | ||
import org.osgi.framework.ServiceListener; | ||
import org.osgi.framework.ServiceObjects; | ||
import org.osgi.framework.ServiceReference; | ||
import org.osgi.framework.ServiceRegistration; | ||
|
||
//FIXME this should not be necessary at all see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578387 | ||
@Component(role = BundleContext.class, hint = "plexus") | ||
public class PlexusBundleContext implements BundleContext { | ||
|
||
@Override | ||
public String getProperty(String key) { | ||
return System.getProperty(key); | ||
} | ||
|
||
@Override | ||
public Bundle getBundle() { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public Bundle installBundle(String location, InputStream input) throws BundleException { | ||
throw new BundleException("this context does not support installations"); | ||
} | ||
|
||
@Override | ||
public Bundle installBundle(String location) throws BundleException { | ||
throw new BundleException("this context does not support installations"); | ||
} | ||
|
||
@Override | ||
public Bundle getBundle(long id) { | ||
return getBundle(); | ||
} | ||
|
||
@Override | ||
public Bundle[] getBundles() { | ||
return new Bundle[0]; | ||
} | ||
|
||
@Override | ||
public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException { | ||
|
||
} | ||
|
||
@Override | ||
public void addServiceListener(ServiceListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public void removeServiceListener(ServiceListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public void addBundleListener(BundleListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public void removeBundleListener(BundleListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public void addFrameworkListener(FrameworkListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public void removeFrameworkListener(FrameworkListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public <S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, | ||
Dictionary<String, ?> properties) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public ServiceReference<?>[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public ServiceReference<?>[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public ServiceReference<?> getServiceReference(String clazz) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public <S> ServiceReference<S> getServiceReference(Class<S> clazz) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) | ||
throws InvalidSyntaxException { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public <S> S getService(ServiceReference<S> reference) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public boolean ungetService(ServiceReference<?> reference) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) { | ||
throw new IllegalStateException("this is not OSGi!"); | ||
} | ||
|
||
@Override | ||
public File getDataFile(String filename) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Filter createFilter(String filter) throws InvalidSyntaxException { | ||
return FilterImpl.newInstance(filter); | ||
} | ||
|
||
@Override | ||
public Bundle getBundle(String location) { | ||
return getBundle(); | ||
} | ||
|
||
} |
Oops, something went wrong.