Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make jars to osgi compaible bundles #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added diozero-core/diozero-core-1.3.2_compare.jar
Binary file not shown.
55 changes: 48 additions & 7 deletions diozero-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,64 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>5.3.0</version>
<configuration><bnd><![CDATA[
Bundle-SymbolicName: ${groupId}.${artifactId}

# default ARM processor is armv7 but you could explicit specify your framework at start using
# -Dorg.osgi.framework.processor=armv6 or -Dorg.osgi.framework.processor=armv7
Bundle-NativeCode: lib/linux-aarch64/libdiozero-system-utils.so; osname=Linux; processor=aarch64,\
lib/linux-armv7/libdiozero-system-utils.so; osname=Linux; processor=ARM,\
lib/linux-armv6/libdiozero-system-utils.so; osname=Linux; processor=armv6,\
lib/linux-armv7/libdiozero-system-utils.so; osname=Linux; processor=armv7,\
lib/linux-x86_64/libdiozero-system-utils.so; osname=Linux; processor=x86_64,\
lib/macosx-x86_64/libdiozero-system-utils.dylib; osname=MacOSX; processor=x86_64
-jpms-module-info:

]]></bnd></configuration>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
<manifestEntries>
<Automatic-Module-Name>diozero.core</Automatic-Module-Name>
</manifestEntries>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<!-- <addMavenDescriptor>true</addMavenDescriptor> -->
<!-- <manifestEntries> -->
<!-- <Automatic-Module-Name>diozero.core</Automatic-Module-Name> -->
<!-- </manifestEntries> -->
<!-- <manifest> -->
<!-- <addDefaultImplementationEntries>true</addDefaultImplementationEntries> -->
<!-- </manifest> -->
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>5.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<reporting>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

3 changes: 3 additions & 0 deletions diozero-core/src/main/java/com/diozero/api/package-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
* Core APIs for interfacing with devices.
*/
@org.osgi.annotation.bundle.Export
@aQute.bnd.annotation.licenses.MIT
@org.osgi.annotation.bundle.Header(name = "Automatic-Module-Name",value = "diozero.core")
package com.diozero.api;

/*-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Classes representing actual devices such as LEDs, Buttons as well as GPIO,
* devices that are connected via I2C, SPI and Serial interfaces.
*/
@org.osgi.annotation.bundle.Export
package com.diozero.devices;

/*-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;

/**
* https://linux-sunxi.org/Xunlong_Orange_Pi_Zero_Plus
* https://linux-sunxi.org/GPIO
* https://github.com/friendlyarm/WiringNP/blob/master/wiringPi/boardtype_friendlyelec.c#L66
*/
@ServiceProvider(value = BoardInfoProvider.class)
public class AllwinnerH5BoardInfoProvider implements BoardInfoProvider {
// Not reliable
// public static final String ORANGEPI_ZEROPLUS_HARDWARE = "sun50iw1p1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;

/**
* https://linux-sunxi.org/Xunlong_Orange_Pi_One_Plus
* https://linux-sunxi.org/GPIO
*/
@ServiceProvider(value = BoardInfoProvider.class)
public class AllwinnerH6BoardInfoProvider implements BoardInfoProvider {
// Not reliable
// public static final String ORANGEPI_ONEPLUS_HARDWARE = "sun50iw1p1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
* THE SOFTWARE.
* #L%
*/

import com.diozero.internal.board.GenericLinuxArmBoardInfo;
import com.diozero.internal.spi.BoardInfoProvider;
import com.diozero.internal.spi.MmapGpioInterface;
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;
@ServiceProvider(value = BoardInfoProvider.class)
public class AllwinnerSun8iBoardInfoProvider implements BoardInfoProvider {
// E.g. CONFIG_ORANGEPI_H3, CONFIG_ORANGEPI_ZEROPLUS2_H3
public static final String MAKE = "Allwinner sun8i";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;

/*-
* https://github.com/derekmolloy/boneDeviceTree/raw/master/docs/BeagleboneBlackP8HeaderTable.pdf
* https://github.com/derekmolloy/boneDeviceTree/raw/master/docs/BeagleboneBlackP9HeaderTable.pdf
*/
@ServiceProvider(value = BoardInfoProvider.class)
public class BeagleBoneBoardInfoProvider implements BoardInfoProvider {
public static final String MAKE = "BeagleBone";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.provider.bbbiolib"})
package com.diozero.internal.provider.builtin;

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;
@ServiceProvider(value = BoardInfoProvider.class)
public class ChipBoardInfoProvider implements BoardInfoProvider {
public static final String MAKE = "Next Thing Company";
public static final String MODEL_CHIP = "CHIP";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;
@ServiceProvider(value = BoardInfoProvider.class)
public class OdroidBoardInfoProvider implements BoardInfoProvider {
public static final String MAKE = "Odroid";
public static final String C1_HARDWARE_ID = "ODROID-C1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;

/**
* See
* <a href="https://github.com/AndrewFromMelbourne/raspberry_pi_revision">this c
* library</a>. See also <a href="http://elinux.org/RPi_HardwareHistory">this
* table of revisions</a>.
*/
@ServiceProvider(value = BoardInfoProvider.class)
public class RaspberryPiBoardInfoProvider implements BoardInfoProvider {
public static final String MAKE = "Raspberry Pi";
private static final String BCM_HARDWARE_PREFIX = "BCM";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.provider.pigpio"})
package com.diozero.internal.provider.builtin;

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.sbc.LocalSystemInfo;

import aQute.bnd.annotation.spi.ServiceProvider;

@ServiceProvider(value = BoardInfoProvider.class)
public class TinkerBoardBoardInfoProvider implements BoardInfoProvider {
public static final String MAKE = "Asus";
private static final String TINKER_BOARD_HARDWARE_ID = "Rockchip (Device Tree)";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.sampleapps"})
package com.diozero.internal.provider.builtin;

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.provider.bbbiolib"})
package com.diozero.internal.provider.builtin;

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* The built-in default provider supporting GPIO, I2C, SPI and Serial device
* communication.
*/
@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.provider.bbbiolib", "com.diozero.provider.mmap", "com.diozero.provider.remote"})
package com.diozero.internal.provider.builtin;

/*-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@aQute.bnd.annotation.jpms.ExportTo({"com.diozero.provider.remote"})
package com.diozero.internal.provider.builtin;

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
import com.diozero.sbc.LocalSystemInfo;
import com.diozero.util.ServiceLoaderUtil;

import aQute.bnd.annotation.Resolution;
import aQute.bnd.annotation.spi.ServiceConsumer;

@ServiceConsumer(value = BoardInfoProvider.class,resolution = Resolution.OPTIONAL)
public interface BoardInfoProvider {
BoardInfo lookup(LocalSystemInfo sysInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
import com.diozero.sbc.BoardInfo;
import com.diozero.util.ServiceLoaderUtil;

import aQute.bnd.annotation.Resolution;
import aQute.bnd.annotation.spi.ServiceConsumer;

@ServiceConsumer(value = NativeDeviceFactoryInterface.class,resolution = Resolution.OPTIONAL)
public interface NativeDeviceFactoryInterface extends GpioDeviceFactoryInterface, SpiDeviceFactoryInterface,
I2CDeviceFactoryInterface, PwmOutputDeviceFactoryInterface, ServoDeviceFactoryInterface,
AnalogInputDeviceFactoryInterface, AnalogOutputDeviceFactoryInterface, SerialDeviceFactoryInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* APIs for interfacing with the host board.
*/
@org.osgi.annotation.bundle.Export
package com.diozero.sbc;

/*-
Expand Down
4 changes: 4 additions & 0 deletions diozero-core/src/main/java/com/diozero/util/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@org.osgi.annotation.bundle.Export
package com.diozero.animation;

This file was deleted.