init package

This commit is contained in:
gu-gu-gu 2020-02-20 09:53:38 +08:00
commit e8e2862ada
9 changed files with 463 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,20 @@
--- sisu-inject/org.eclipse.sisu.inject/META-INF/MANIFEST.MF~ 2014-04-21 16:32:25.000000000 +0200
+++ sisu-inject/org.eclipse.sisu.inject/META-INF/MANIFEST.MF 2014-04-23 10:53:22.538142253 +0200
@@ -16,6 +16,7 @@
com.google.inject.matcher;version="1.3",
com.google.inject.name;version="1.3",
com.google.inject.spi;version="1.3",
+ com.google.common.base,
org.osgi.framework;version="1.5",
org.osgi.util.tracker;version="1.4",
org.slf4j;resolution:=optional,
--- sisu-inject/org.eclipse.sisu.inject/build.properties~ 2015-02-25 14:46:42.392037463 +0100
+++ sisu-inject/org.eclipse.sisu.inject/build.properties 2015-02-25 14:44:56.626803789 +0100
@@ -17,5 +17,5 @@
.
# build with JSR250 v1.2 and workaround indirect Guava dependency via Guice 4
-extra.. = platform:/plugin/javax.annotation,platform:/plugin/com.google.guava
-additional.bundles = javax.annotation,com.google.guava
+extra.. = platform:/plugin/javax.annotation-api,platform:/plugin/com.google.guava
+additional.bundles = javax.annotation-api,com.google.guava

205
sisu-ignored-tests.patch Normal file
View File

@ -0,0 +1,205 @@
--- sisu-inject/org.eclipse.sisu.inject.tests/src/org/eclipse/sisu/inject/LocatedBeansTest.java~ 2014-09-12 08:32:32.899725268 +0200
+++ sisu-inject/org.eclipse.sisu.inject.tests/src/org/eclipse/sisu/inject/LocatedBeansTest.java 2014-09-12 08:37:45.656099710 +0200
@@ -128,30 +128,6 @@
assertSame( a, itr2.next().getValue() );
}
- public void testUnrestrictedSearch()
- {
- final LocatedBeans<Annotation, Bean> beans = locate( Key.get( Bean.class ) );
- final Iterator<BeanEntry<Annotation, Bean>> itr = beans.iterator();
-
- assertTrue( itr.hasNext() );
- assertEquals( QualifyingStrategy.DEFAULT_QUALIFIER, itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( QualifyingStrategy.BLANK_QUALIFIER, itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( Names.named( "Named1" ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( Names.named( "Named2" ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( QualifyingStrategy.BLANK_QUALIFIER, itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( MarkedBeanImpl1.class.getAnnotation( Marked.class ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( Names.named( "Marked2" ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( Names.named( "Marked3" ), itr.next().getKey() );
- assertFalse( itr.hasNext() );
- }
-
public void testNamedSearch()
{
final LocatedBeans<Named, Bean> beans = locate( Key.get( Bean.class, Named.class ) );
@@ -181,20 +156,6 @@
assertFalse( itr.hasNext() );
}
- public void testMarkedSearch()
- {
- final LocatedBeans<Marked, Bean> beans = locate( Key.get( Bean.class, Marked.class ) );
- final Iterator<BeanEntry<Marked, Bean>> itr = beans.iterator();
-
- assertTrue( itr.hasNext() );
- assertEquals( MarkedBeanImpl1.class.getAnnotation( Marked.class ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( MarkedBeanImpl2.class.getAnnotation( Marked.class ), itr.next().getKey() );
- assertTrue( itr.hasNext() );
- assertEquals( MarkedBeanProvider.class.getAnnotation( Marked.class ), itr.next().getKey() );
- assertFalse( itr.hasNext() );
- }
-
public void testMarkedWithAttributesSearch()
{
final LocatedBeans<Marked, Bean> beans =
--- sisu-plexus/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusXmlScannerTest.java~ 2014-08-24 01:48:47.000000000 +0200
+++ sisu-plexus/org.eclipse.sisu.plexus.tests/src/org/eclipse/sisu/plexus/PlexusXmlScannerTest.java 2015-02-04 07:06:49.696531924 +0100
@@ -159,83 +159,6 @@
new PlexusXmlScanner( null, plexusXml, null ).scan( space, true );
}
- @SuppressWarnings( "deprecation" )
- public void testComponents()
- {
- final ClassSpace space = new URLClassSpace( PlexusXmlScannerTest.class.getClassLoader() );
-
- final Map<String, PlexusBeanMetadata> metadata = new HashMap<String, PlexusBeanMetadata>();
- final PlexusXmlScanner scanner = new PlexusXmlScanner( null, null, metadata );
-
- final Map<Component, DeferredClass<?>> componentMap = scanner.scan( space, true );
-
- assertEquals( 6, componentMap.size() );
-
- final Component component1 =
- new ComponentImpl( DefaultBean.class, Hints.DEFAULT_HINT, Strategies.PER_LOOKUP, "" );
- assertEquals( DefaultBean.class, componentMap.get( component1 ).load() );
-
- final Component component2 = new ComponentImpl( Bean.class, "debug", Strategies.SINGLETON, "For debugging" );
- assertEquals( DebugBean.class, componentMap.get( component2 ).load() );
-
- final Component component3 = new ComponentImpl( Bean.class, Hints.DEFAULT_HINT, Strategies.SINGLETON, "" );
- assertEquals( AnotherBean.class, componentMap.get( component3 ).load() );
-
- final Component component4 = new ComponentImpl( Bean.class, "clone", Strategies.SINGLETON, "" );
- assertEquals( DefaultBean.class, componentMap.get( component4 ).load().getSuperclass() );
- final Class<?> proxy = CustomTestClassLoader.proxy( componentMap.get( component4 ).load() );
-
- try
- {
- assertNotNull( proxy.getMethod( "TestMe" ) );
- }
- catch ( final NoSuchMethodException e )
- {
- fail( "Proxied class is missing 'TestMe' method" );
- }
-
- final PlexusBeanMetadata metadata1 = metadata.get( DefaultBean.class.getName() );
-
- assertFalse( metadata1.isEmpty() );
-
- assertEquals( new ConfigurationImpl( "someFieldName", "<some-field-name><item>PRIMARY</item></some-field-name>" ),
- metadata1.getConfiguration( new NamedProperty( "someFieldName" ) ) );
-
- assertEquals( new ConfigurationImpl( "simple", "value" ),
- metadata1.getConfiguration( new NamedProperty( "simple" ) ) );
-
- assertEquals( new ConfigurationImpl( "value", "<value with=\"attribute\"></value>" ),
- metadata1.getConfiguration( new NamedProperty( "value" ) ) );
-
- assertEquals( new ConfigurationImpl( "emptyValue1", "<empty-value1 with=\"attribute\" />" ),
- metadata1.getConfiguration( new NamedProperty( "emptyValue1" ) ) );
-
- assertEquals( new ConfigurationImpl( "emptyValue2", "" ),
- metadata1.getConfiguration( new NamedProperty( "emptyValue2" ) ) );
-
- assertFalse( metadata1.isEmpty() );
-
- assertEquals( new RequirementImpl( Bean.class, true, "debug" ),
- metadata1.getRequirement( new NamedProperty( "bean", TypeLiteral.get( Bean.class ) ) ) );
-
- assertFalse( metadata1.isEmpty() );
-
- metadata1.getConfiguration( new NamedProperty( "foo" ) );
-
- assertEquals( new RequirementImpl( Bean.class, false, Hints.DEFAULT_HINT, "debug" ),
- metadata1.getRequirement( new NamedProperty( "beanMap" ) ) );
-
- assertFalse( metadata1.isEmpty() );
-
- assertEquals( new RequirementImpl( Bean.class, false ),
- metadata1.getRequirement( new NamedProperty( "beanField" ) ) );
-
- assertTrue( metadata1.isEmpty() );
-
- assertNotNull( metadata.get( AnotherBean.class.getName() ) );
- assertNull( metadata.get( DebugBean.class.getName() ) );
- }
-
static class FixedClassSpace
implements ClassSpace
{
@@ -392,64 +315,4 @@
}
}
- static final class CustomTestClassLoader
- extends ClassLoader
- {
- private static final String PROXY_MARKER = "$proxy";
-
- CustomTestClassLoader( final ClassLoader parent )
- {
- super( parent );
- }
-
- static Class<?> proxy( final Class<?> clazz )
- {
- try
- {
- return new CustomTestClassLoader( clazz.getClassLoader() ).loadClass( clazz.getName() + PROXY_MARKER );
- }
- catch ( final ClassNotFoundException e )
- {
- throw new TypeNotPresentException( clazz.getName(), e );
- }
- }
-
- @Override
- protected synchronized Class<?> loadClass( final String name, final boolean resolve )
- throws ClassNotFoundException
- {
- return super.loadClass( name, resolve );
- }
-
- @Override
- protected Class<?> findClass( final String name )
- throws ClassNotFoundException
- {
- final String proxyName = name.replace( '.', '/' );
- final String superName = proxyName.substring( 0, proxyName.length() - PROXY_MARKER.length() );
-
- final ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
- cw.visit( Opcodes.V1_5, Modifier.PUBLIC | Modifier.FINAL, proxyName, null, superName, null );
- MethodVisitor mv = cw.visitMethod( Modifier.PUBLIC, "<init>", "()V", null, null );
-
- mv.visitCode();
- mv.visitVarInsn( Opcodes.ALOAD, 0 );
- mv.visitMethodInsn( Opcodes.INVOKESPECIAL, superName, "<init>", "()V", false );
- mv.visitInsn( Opcodes.RETURN );
- mv.visitMaxs( 0, 0 );
- mv.visitEnd();
-
- mv = cw.visitMethod( Modifier.PUBLIC, "TestMe", "()V", null, null );
-
- mv.visitCode();
- mv.visitInsn( Opcodes.RETURN );
- mv.visitMaxs( 0, 0 );
- mv.visitEnd();
- cw.visitEnd();
-
- final byte[] buf = cw.toByteArray();
-
- return defineClass( name, buf, 0, buf.length );
- }
- }
}

72
sisu-inject.pom Normal file
View File

@ -0,0 +1,72 @@
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>@VERSION@</version>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<classifier>no_aop</classifier>
<version>4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>org.eclipse.sisu.inject/src</sourceDirectory>
</build>
</project>

11
sisu-osgi-api.patch Normal file
View File

@ -0,0 +1,11 @@
--- sisu-plexus/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusBundlePlan.java~ 2015-09-13 20:15:37.000000000 +0200
+++ sisu-plexus/org.eclipse.sisu.plexus/src/org/eclipse/sisu/plexus/PlexusBundlePlan.java 2017-01-29 19:56:51.608151337 +0100
@@ -80,7 +80,7 @@
protected static boolean hasPlexusAnnotations( final Bundle bundle )
{
- final String imports = bundle.getHeaders().get( Constants.IMPORT_PACKAGE );
+ final String imports = bundle.getHeaders().get( Constants.IMPORT_PACKAGE ).toString();
return null != imports && imports.contains( "org.codehaus.plexus.component.annotations" );
}

12
sisu-parent.pom Normal file
View File

@ -0,0 +1,12 @@
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openEuler.maven</groupId>
<artifactId>aggregator-project</artifactId>
<version>@VERSION@</version>
<packaging>pom</packaging>
<modules>
<module>sisu-inject</module>
<module>sisu-plexus</module>
</modules>
</project>

67
sisu-plexus.pom Normal file
View File

@ -0,0 +1,67 @@
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>@VERSION@</version>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.22</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<classifier>no_aop</classifier>
<version>4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>org.eclipse.sisu.plexus/src</sourceDirectory>
<resources>
<resource>
<targetPath>META-INF/plexus</targetPath>
<filtering>false</filtering>
<directory>${basedir}/org.eclipse.sisu.plexus/META-INF/plexus</directory>
<includes>
<include>components.xml</include>
</includes>
</resource>
</resources>
</build>
</project>

76
sisu.spec Normal file
View File

@ -0,0 +1,76 @@
Name: sisu
Epoch: 1
Version: 0.3.3
Release: 5
Summary: Eclipse dependency injection framework
License: EPL
URL: https://eclipse.org/sisu
Source0: http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/snapshot/releases/%{version}.tar.gz#/org.eclipse.sisu.inject-%{version}.tar.gz
Source1: http://git.eclipse.org/c/sisu/org.eclipse.sisu.plexus.git/snapshot/releases/%{version}.tar.gz#/org.eclipse.sisu.plexus-%{version}.tar.gz
Source2: sisu-parent.pom
Source3: sisu-plexus.pom
Source4: sisu-inject.pom
Patch001: sisu-OSGi-import-guava.patch
Patch002: sisu-ignored-tests.patch
Patch003: sisu-osgi-api.patch
BuildArch: noarch
BuildRequires: maven-local guice-servlet google-guice glassfish-annotation-api testng
BuildRequires: cdi-api atinject glassfish-servlet-api junit plexus-classworlds slf4j
BuildRequires: plexus-containers-component-annotations plexus-utils osgi-core
%description
Sisu is a modular JSR330-based container that supports classpath scanning,
auto-binding, and dynamic auto-wiring. Sisu uses Google-Guice to perform
dependency injection and provide the core JSR330 support, but removes the
need to write explicit bindings in Guice modules. Integration with other
containers via the Eclipse Extension Registry and the OSGi Service
Registry is a goal of this project.
%package inject
Summary: inject package for sisu
Provides: %{name}-plexus = %{epoch}:%{version}-%{release}
Obsoletes: %{name}-plexus < %{epoch}:%{version}-%{release} %{name}-tests < 1:0.3.2-5
Provides: %{name}-javadoc = %{epoch}:%{version}-%{release}
Obsoletes: %{name}-javadoc < %{epoch}:%{version}-%{release}
%description inject
inject package for sisu
%prep
%setup -q -c -T
tar -zxf %{SOURCE0} && mv releases/* sisu-inject && rmdir releases
cp %{SOURCE4} sisu-inject/pom.xml
tar -zxf %{SOURCE1} && mv releases/* sisu-plexus && rmdir releases
cp %{SOURCE3} sisu-plexus/pom.xml
cp %{SOURCE2} pom.xml
%patch001
%patch002
%patch003
%{_bindir}/python3 %{_datadir}/java-utils/pom_editor.py pom_xpath_set -r /pom:project/pom:version %{version}
%{_bindir}/python3 %{_datadir}/java-utils/mvn_file.py ':{*}' @1
%{_bindir}/python3 %{_datadir}/java-utils/mvn_package.py ':*{inject,plexus}' @1
%{_bindir}/python3 %{_datadir}/java-utils/mvn_package.py : __noinstall
%{_bindir}/python3 %{_datadir}/java-utils/mvn_alias.py :org.eclipse.sisu.plexus org.sonatype.sisu:sisu-inject-plexus
%build
%mvn_build
%install
%mvn_install
%files inject
%defattr(-,root,root)
%license sisu-inject/LICENSE.txt
%{_datadir}/java/*
%{_datadir}/javadoc/*
%{_datadir}/maven-poms/*
%{_datadir}/maven-metadata/*
%changelog
* Thu Dec 5 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:0.3.3-5
- Package init