Skip to content

Commit 6323deb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents 6b29d52 + 0b17828 commit 6323deb

File tree

9 files changed

+50
-18
lines changed

9 files changed

+50
-18
lines changed

build.gradle

+17-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ if (JavaVersion.current().isJava8Compatible()) {
3131
}
3232
}
3333

34+
def String deriveOSGIVersion(String prjVersion) {
35+
if (prjVersion.contains("-SNAPSHOT")) {
36+
// Snapshots always extend to fourth level and terminate with time in seconds since epoch.
37+
prjVersion = prjVersion.replace("-SNAPSHOT", "");
38+
while (prjVersion.count(".") < 2) {
39+
prjVersion = prjVersion + ".0";
40+
}
41+
prjVersion = prjVersion + "." + System.currentTimeMillis().intdiv(1000L).intdiv(60).intdiv(60).intdiv(24);
42+
}
43+
return prjVersion
44+
}
45+
46+
ext {
47+
bundle_version = deriveOSGIVersion(version.toString());
48+
}
49+
3450

3551
// this needs to go here, otherwise it can't find config
3652
apply plugin: 'io.spring.nohttp'
@@ -46,7 +62,6 @@ allprojects {
4662
mavenCentral()
4763
}
4864

49-
5065
dependencies {
5166
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
5267
}
@@ -171,6 +186,7 @@ ext {
171186

172187

173188

189+
174190
subprojects {
175191
apply plugin: 'eclipse'
176192

jmail/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ jar {
7979
into('META-INF/versions/9') {
8080
from sourceSets.java9.output
8181
}
82+
String v = "${rootProject.extensions.ext.bundle_version}"
8283
manifest.attributes('Multi-Release': 'true')
8384
manifest.attributes('Bundle-Name': 'bcjmail')
8485
manifest.attributes('Bundle-SymbolicName': 'bcjmail')
8586
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
86-
manifest.attributes('Export-Package': 'org.bouncycastle.mail.*')
87-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,jakarta.*;resolution:=optional,!org.bouncycastle.mail.*,org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
87+
manifest.attributes('Export-Package': "org.bouncycastle.mail.*;version=${v}")
88+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,jakarta.*;resolution:=optional,!org.bouncycastle.mail.*,org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
89+
manifest.attributes('Bundle-Version': "${v}")
8890
}
8991

9092
task sourcesJar(type: Jar) {

mail/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ jar {
5959
into('META-INF/versions/9') {
6060
from sourceSets.java9.output
6161
}
62+
String v = "${rootProject.extensions.ext.bundle_version}"
6263
manifest.attributes('Multi-Release': 'true')
6364
manifest.attributes('Bundle-Name': 'bcmail')
6465
manifest.attributes('Bundle-SymbolicName': 'bcmail')
6566
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
66-
manifest.attributes('Export-Package': 'org.bouncycastle.mail.*')
67-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.mail.*,org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
67+
manifest.attributes('Export-Package': "org.bouncycastle.mail.*;version=${v}")
68+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.mail.*,org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
69+
manifest.attributes('Bundle-Version': "${v}")
6870
}
6971

7072
task sourcesJar(type: Jar) {

mls/build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ jar {
155155
}
156156

157157
String packages = 'org.bouncycastle.mls.*'
158-
158+
String v = "${rootProject.extensions.ext.bundle_version}"
159159
manifest.attributes('Multi-Release': 'true')
160160
manifest.attributes('Bundle-Name': 'bcmls')
161161
manifest.attributes('Bundle-SymbolicName': 'bcmls')
162162
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
163-
manifest.attributes('Export-Package': "${packages}")
164-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
163+
manifest.attributes('Export-Package': "${packages};version=${v}")
164+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
165+
manifest.attributes('Bundle-Version': "${v}")
165166
}
166167

167168
task sourcesJar(type: Jar) {

pg/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ jar {
6767
into('META-INF/versions/9') {
6868
from sourceSets.java9.output
6969
}
70+
String v = "${rootProject.extensions.ext.bundle_version}"
7071
manifest.attributes('Multi-Release': 'true')
7172
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
7273
manifest.attributes('Bundle-Name': 'bcpg')
7374
manifest.attributes('Bundle-SymbolicName': 'bcpg')
74-
manifest.attributes('Export-Package': 'org.bouncycastle.{apache|bcpg|gpg|openpgp}.*')
75-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.{apache|bcpg|gpg|openpgp|}.*,org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
75+
manifest.attributes('Export-Package': "org.bouncycastle.{apache|bcpg|gpg|openpgp}.*;version=${v}")
76+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.{apache|bcpg|gpg|openpgp|}.*,org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
77+
manifest.attributes('Bundle-Version': "${v}")
7678
}
7779

7880

pkix/build.gradle

+5-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ jar {
6969

7070
String packages = 'org.bouncycastle.{cert|cmc|cms|dvcs|eac|est|its|mime|mozilla|voms|operator|pkix|openssl|pkcs|tsp}.*'
7171

72+
String v = "${rootProject.extensions.ext.bundle_version}"
73+
7274
manifest.attributes('Multi-Release': 'true')
7375
manifest.attributes('Bundle-Name': 'bcpkix')
7476
manifest.attributes('Bundle-SymbolicName': 'bcpkix')
7577
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
76-
manifest.attributes('Export-Package': "${packages}")
77-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
78+
manifest.attributes('Export-Package': "${packages};version=${v}")
79+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
80+
manifest.attributes('Bundle-Version': "${v}")
7881
}
7982

8083

prov/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ jar {
144144
into('META-INF/versions/21') {
145145
from sourceSets.java21.output
146146
}
147+
String v = "${rootProject.extensions.ext.bundle_version}"
147148
manifest.attributes('Multi-Release': 'true')
148149
manifest.attributes('Bundle-Name': 'bcprov')
149150
manifest.attributes('Bundle-SymbolicName': 'bcprov')
150151
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
151-
manifest.attributes('Export-Package': '!org.bouncycastle.internal.*,org.bouncycastle.*')
152+
manifest.attributes('Export-Package': "!org.bouncycastle.internal.*,org.bouncycastle.*;version=${v}")
152153
manifest.attributes('Import-Package': 'java.*;resolution:=optional,javax.*;resolution:=optional')
154+
manifest.attributes('Bundle-Version': "${v}")
155+
153156
}
154157

155158

tls/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,14 @@ jar {
145145
into('META-INF/versions/9') {
146146
from sourceSets.java9.output
147147
}
148+
String v = "${rootProject.extensions.ext.bundle_version}"
148149
manifest.attributes('Multi-Release': 'true')
149150
manifest.attributes('Bundle-Name': 'bctls')
150151
manifest.attributes('Bundle-SymbolicName': 'bctls')
151152
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
152-
manifest.attributes('Export-Package': 'org.bouncycastle.{jsse|tls}.*')
153-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.{jsse|tls}.*,org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
153+
manifest.attributes('Export-Package': "org.bouncycastle.{jsse|tls}.*;version=${v}")
154+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!org.bouncycastle.{jsse|tls}.*,org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
155+
manifest.attributes('Bundle-Version': "${v}")
154156
}
155157

156158

util/build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ jar {
6464
from sourceSets.java9.output
6565
}
6666
String packages = 'org.bouncycastle.asn1.{bsi|cmc|cmp|cms|crmf|cryptlib|dvcs|eac|edec|esf|ess|est|gnu|iana|icao|isara|isismtt|iso|kisa|microsoft|misc|mozilla|nsri|ntt|oiw|rosstandart|smime|tsp}.*'
67-
67+
String v = "${rootProject.extensions.ext.bundle_version}"
6868
manifest.attributes('Multi-Release': 'true')
6969
manifest.attributes('Bundle-Name': 'bcutil')
7070
manifest.attributes('Bundle-SymbolicName': 'bcutil')
7171
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
72-
manifest.attributes('Export-Package': "${packages},org.bouncycastle.oer.*")
73-
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},!org.bouncycastle.oer.*,org.bouncycastle.*;version=\"[${version},${maxVersion})\"")
72+
manifest.attributes('Export-Package': "${packages};version=${v},org.bouncycastle.oer.*;version=${v}")
73+
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},!org.bouncycastle.oer.*,org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
74+
manifest.attributes('Bundle-Version': "${v}")
7475
}
7576

7677

0 commit comments

Comments
 (0)