Skip to content

Commit

Permalink
Added OSGI scan check to "check" stage
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcw committed May 6, 2024
1 parent 3561b43 commit 4a10c27
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ci/check_java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ export BC_JDK21=`openjdk_21`
export JAVA_HOME=`openjdk_17`
export PATH=$JAVA_HOME/bin:$PATH

# Checkstyle
./gradlew check -x test;



# OSGI scanner only, no testing
./gradlew clean build -x test
./osgi_scan.sh

15 changes: 15 additions & 0 deletions osgi_scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

if ! command -v osgiscanner &> /dev/null
then
echo "osgiscanner not on path"
exit 1
fi

export script_loc=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
cd $script_loc

export BCHOME=`pwd`

osgiscanner -f osgi_scan.xml
63 changes: 63 additions & 0 deletions osgi_scan.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" ?>
<osgiscanner>


<prop load="gradle.properties"/>

<!-- Make bundle regular expression -->
<prop name="bundle_ver" value="${version}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
<prop name="bundle_ver" value="^${bundle_ver}" find="\." replace="\\."/>

<!-- Make import range expression -->
<prop name="import_low" value="${version}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
<prop name="import_low" value="${import_low}" find="\." replace="\\."/>
<prop name="import_max" value="${maxVersion}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
<prop name="import_max" value="${import_max}" find="\." replace="\\."/>
<prop name="import_range" value="^\[${import_low}\,${import_max}\)"/>

<jar file="${ENV.BCHOME}/libs/jakarta.activation-api-2.0.0.jar"/>
<jar file="${ENV.BCHOME}/libs/jakarta.mail-2.0.1.jar"/>
<jar file="${ENV.BCHOME}/core/build/libs/core-${version}.jar"/>
<jar file="${ENV.BCHOME}/core/build/libs/core-${version}.jar"/>
<jar file="${ENV.BCHOME}/jmail/build/libs/bcjmail-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/mls/build/libs/bcmls-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/pg/build/libs/bcpg-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/pkix/build/libs/bcpkix-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/prov/build/libs/bcprov-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/tls/build/libs/bctls-jdk18on-${version}.jar"/>
<jar file="${ENV.BCHOME}/util/build/libs/bcutil-jdk18on-${version}.jar"/>

<bundle matches="^bcprov" version="${bundle_ver}">
<ignore-package package="^mls_client"/>
<ignore-package package="^org\.bouncycastle\.mls\.client"/>

<header key="Bundle-Version" matches="${bundle_ver}"/>

<header key="Export-Package" matches=".*" on-undefined="fail">
<package matches="^org\.bouncycastle\.*" param="version" test="${bundle_ver}" on-match="pass"
on-undefined="fail"/>
</header>

</bundle>


<bundle matches="^bc(jmail|mls|pg|pkix|tls|util)" version="${bundle_ver}">
<ignore-package package="^mls_client"/>
<ignore-package package="^org\.bouncycastle\.mls\.client"/>

<header key="Bundle-Version" matches="${bundle_ver}"/>

<header key="Export-Package" matches=".*" on-undefined="fail">
<package matches="^org\.bouncycastle\.*" param="version" test="${bundle_ver}" on-match="pass"
on-undefined="fail"/>
</header>

<header key="Import-Package" matches=".*" on-undefined="fail">
<package matches="^org\.bouncycastle\.*" param="version" test="${import_range}" on-match="pass"
on-undefined="fail"/>
</header>


</bundle>

</osgiscanner>

0 comments on commit 4a10c27

Please sign in to comment.