Skip to content

Commit 517a168

Browse files
committed
WIP: Add java8Jar Gradle task for -api and -bouncy
This worked locally (i.e. it successfully built the -java8 jars in the respective build output directories, but the changes added to maven-publish.gradle do not work and also partly duplicate the changes in the -api and -bouncy files.
1 parent 18f31fb commit 517a168

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44

55
// Projects to be published with maven-publish
66
ext.publishedProjects = ['secp-api', 'secp-ffm', 'secp-bouncy']
7+
ext.publishedJava8Projects = ['secp-api', 'secp-bouncy']
78

89
subprojects { sub ->
910
apply plugin: 'java'

gradle/maven-publish.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ subprojects { sub ->
77
publications {
88
jar(MavenPublication) {
99
from components.java
10+
if (sub.name in publishedJava8Projects) {
11+
tasks.register('java8Jar', Jar) {
12+
dependsOn tasks.jar
13+
archiveBaseName = "${sub.name}-java8"
14+
from zipTree(tasks.jar.archiveFile)
15+
exclude 'module-info.class'
16+
}
17+
artifacts {
18+
archives tasks.java8Jar
19+
}
20+
}
1021
}
11-
1222
}
1323
repositories {
1424
def secpJdkGitLabProjectId = "55956336"

secp-api/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ jar {
2727
'Implementation-Version': archiveVersion.get()
2828
}
2929
}
30+
31+
tasks.register('java8Jar', Jar) {
32+
dependsOn tasks.jar // Depend on the original Java 9 JAR
33+
archiveBaseName = "${project.name}-java8"
34+
from zipTree(tasks.jar.archiveFile) // Unpack the original JAR
35+
exclude 'module-info.class' // Remove the module-info.class file
36+
37+
// Copy the original manifest
38+
manifest {
39+
from tasks.jar.manifest
40+
}
41+
}

secp-bouncy/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ jar {
2828
'Implementation-Version': archiveVersion.get()
2929
}
3030
}
31+
32+
tasks.register('java8Jar', Jar) {
33+
dependsOn tasks.jar // Depend on the original Java 9 JAR
34+
archiveBaseName = "${project.name}-java8"
35+
from zipTree(tasks.jar.archiveFile) // Unpack the original JAR
36+
exclude 'module-info.class' // Remove the module-info.class file
37+
38+
// Copy the original manifest
39+
manifest {
40+
from tasks.jar.manifest
41+
}
42+
}

0 commit comments

Comments
 (0)