Skip to content

Commit

Permalink
[#734] Make the picocli jar OSGi friendly
Browse files Browse the repository at this point in the history
* added the bnd plugin to the build
* defined a bnd.bnd file to handle the package export
(fixes #734)
  • Loading branch information
raducotescu authored and remkop committed Jun 18, 2019
1 parent 4e52ec5 commit f7be991
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bnd.bnd
@@ -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}$"
27 changes: 27 additions & 0 deletions build.gradle
@@ -1,5 +1,7 @@
import java.nio.file.Files
import java.nio.file.Paths
import aQute.bnd.gradle.Bundle
import aQute.bnd.gradle.Baseline

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.'
Expand All @@ -12,13 +14,15 @@ buildscript {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}

dependencies {
classpath "org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradlePluginVersion"
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion"
classpath "gradle.plugin.org.beryx:badass-jar:1.1.3"
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
}
}

Expand All @@ -27,6 +31,7 @@ apply plugin: 'distribution'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: "org.beryx.jar"
apply plugin: 'biz.aQute.bnd.builder'


allprojects {
Expand Down Expand Up @@ -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:
1. edit version numbers: remove -SNAPSHOT classifier
Expand Down

0 comments on commit f7be991

Please sign in to comment.