Skip to content

Commit

Permalink
Leverage OSGi-DS component-xml file generation of PDE-DS/Tycho
Browse files Browse the repository at this point in the history
Remove generated xml-files from equinox.ds.tests.
  • Loading branch information
HannesWell committed Sep 19, 2024
1 parent c7754d3 commit ddfd814
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 73 deletions.
1 change: 1 addition & 0 deletions bundles/org.eclipse.equinox.ds.tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/scr_test
OSGI-INF/org.eclipse.*.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
classpath=true
dsVersion=V1_3
eclipse.preferences.version=1
enabled=true
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions bundles/org.eclipse.equinox.ds.tests/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,3 @@ source.scr_test/tb26.jar = bundles_src/tb26/
manifest.scr_test/tb26.jar = META-INF/MANIFEST.MF
source.scr_test/tb27.jar = bundles_src/tb27/
manifest.scr_test/tb27.jar = META-INF/MANIFEST.MF

# Maven properties, see https://github.com/eclipse/tycho/wiki/Tycho-Pomless
pom.model.property.testClass = org.eclipse.equinox.ds.tests.AllTests
61 changes: 61 additions & 0 deletions bundles/org.eclipse.equinox.ds.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024, 2024 Hannes Wellmann and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/org/documents/edl-v10.php
Contributors:
Hannes Wellmann - initial implementation
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>parent</artifactId>
<version>4.34.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>org.eclipse.equinox.ds.tests</artifactId>
<version>1.7.200-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testClass>org.eclipse.equinox.ds.tests.AllTests</testClass>
</properties>
<build>
<testSourceDirectory>src</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<!-- The tycho-ds-plugin generates component-xml files into
target/classes/OSGI-INF, but when this Plugin is exected in a tycho-surefire
runtime, the bundle-root is this project's root directory and the
Service-Component-Runtime only searches for component-xml files only in
<bundle-root>/OSGI-INF and does not consider the classpath-->
<execution>
<id>copy-ds-component-xml</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<resources>
<resource>
<directory>${project.build.outputDirectory}/OSGI-INF</directory>
<include>*.xml</include>
</resource>
</resources>
<outputDirectory>${project.basedir}/OSGI-INF</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions bundles/org.eclipse.equinox.event/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/OSGI-INF/org.eclipse.*.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dsVersion=V1_3
eclipse.preferences.version=1
enabled=true
generateBundleActivationPolicyLazy=true
path=OSGI-INF
validationErrorLevel=error
validationErrorLevel.missingImplicitUnbindMethod=error
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Export-Package: org.eclipse.equinox.internal.event;x-internal:=true,
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-17
Service-Component: OSGI-INF/component.xml
Service-Component: OSGI-INF/org.eclipse.equinox.internal.event.EventComponent.xml
Bundle-ActivationPolicy: lazy
Provide-Capability:
osgi.service;
Expand Down
7 changes: 0 additions & 7 deletions bundles/org.eclipse.equinox.event/OSGI-INF/component.xml

This file was deleted.

3 changes: 1 addition & 2 deletions bundles/org.eclipse.equinox.event/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
# IBM Corporation - initial API and implementation
###############################################################################
bin.includes = META-INF/,\
plugin*.properties,\
plugin.properties,\
about.html,\
.,\
OSGI-INF/component.xml,\
OSGI-INF/
output.. = bin/
src.includes = about.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2018 IBM Corporation and others.
* Copyright (c) 2009, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -15,20 +15,24 @@

import org.eclipse.equinox.internal.event.mapper.EventRedeliverer;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.*;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;

@Component(service = EventAdmin.class)
public class EventComponent implements EventAdmin {
private EventRedeliverer eventRedeliverer;
private EventAdminImpl eventAdmin;

@Activate
void activate(BundleContext context) {
eventAdmin = new EventAdminImpl(context);
eventAdmin.start();
eventRedeliverer = new EventRedeliverer(context, eventAdmin);
eventRedeliverer.open();
}

@Deactivate
void deactivate(BundleContext context) {
eventRedeliverer.close();
eventAdmin.stop();
Expand Down

0 comments on commit ddfd814

Please sign in to comment.