[#734] Make the picocli jar OSGi friendly

* added the bnd plugin to the build
* defined a bnd.bnd file to handle the package export
(fixes #734)
This commit is contained in:
Radu Cotescu
2019-06-18 17:29:54 +02:00
committed by Remko Popma
parent 4e52ec5f10
commit f7be991277
2 changed files with 30 additions and 0 deletions

3
bnd.bnd Normal file
View File

@@ -0,0 +1,3 @@
Import-Package: !org.fusesource.jansi, *
Export-Package: picocli
-fixupmessages "^Classes found in the wrong directory: \\{META-INF/versions/9/module-info\\.class=module-info}$"

View File

@@ -1,5 +1,7 @@
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import aQute.bnd.gradle.Bundle
import aQute.bnd.gradle.Baseline
group 'info.picocli' group 'info.picocli'
description 'Java command line parser with both an annotations API and a programmatic API. Usage help with ANSI styles and colors. Autocomplete. Nested subcommands. Easily included as source to avoid adding a dependency.' description 'Java command line parser with both an annotations API and a programmatic API. Usage help with ANSI styles and colors. Autocomplete. Nested subcommands. Easily included as source to avoid adding a dependency.'
@@ -12,6 +14,7 @@ buildscript {
maven { maven {
url "https://plugins.gradle.org/m2/" url "https://plugins.gradle.org/m2/"
} }
mavenCentral()
} }
dependencies { dependencies {
@@ -19,6 +22,7 @@ buildscript {
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15' classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion" classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion"
classpath "gradle.plugin.org.beryx:badass-jar:1.1.3" classpath "gradle.plugin.org.beryx:badass-jar:1.1.3"
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
} }
} }
@@ -27,6 +31,7 @@ apply plugin: 'distribution'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray' apply plugin: 'com.jfrog.bintray'
apply plugin: "org.beryx.jar" apply plugin: "org.beryx.jar"
apply plugin: 'biz.aQute.bnd.builder'
allprojects { allprojects {
@@ -358,6 +363,28 @@ publishing {
} }
} }
} }
apply plugin: 'java'
configurations {
bundleCompile
baseline
}
dependencies {
baseline('group': group, 'name': jar.baseName, 'version': "(,${jar.version}[") {
force = true
transitive = false
}
}
sourceSets {
bundle
}
task bundle(type: Bundle) {
from sourceSets.bundle.output
bndfile = 'bnd.bnd'
sourceSet = sourceSets.bundle
}
/* /*
Release procedure: Release procedure:
1. edit version numbers: remove -SNAPSHOT classifier 1. edit version numbers: remove -SNAPSHOT classifier