Small OSGI cleanup.
diff --git a/build.gradle.kts b/build.gradle.kts
index 81bfcd6..6391c08 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -112,10 +112,12 @@
// This source set is only needed, because the OSGI plugin supports only a single sourceSet.
// We are deleting it, because otherwise it would fool IDEs that a source root has multiple owners.
+val otherSourceSetsRef = fmExt
+ .allConfiguredSourceSetNames
+ .map { names -> names.map { name -> sourceSets.named(name).get() } }
val osgiSourceSet = sourceSets
.create("osgi") {
- val otherSourceSets = fmExt.allConfiguredSourceSetNames.get().map { name -> sourceSets.named(name).get() }
-
+ val otherSourceSets = otherSourceSetsRef.get()
java.setSrcDirs(otherSourceSets.flatMap { s -> s.java.srcDirs })
resources.setSrcDirs(otherSourceSets.flatMap { s -> s.resources.srcDirs })
}
@@ -124,13 +126,25 @@
compileClasspath = osgiClasspath
runtimeClasspath = osgiClasspath
}
- .also { sourceSets.remove(it) }
+ .also {
+ sourceSets.remove(it)
+ tasks.named(it.classesTaskName).configure {
+ description = "Do not run this task! This task exists only as a work around for the OSGI plugin."
+ enabled = false
+ }
+ }
tasks.named<Jar>(JavaPlugin.JAR_TASK_NAME) {
configure<aQute.bnd.gradle.BundleTaskExtension> {
bndfile.set(file("osgi.bnd"))
setSourceSet(osgiSourceSet)
+ val otherSourceSets = otherSourceSetsRef
+ .get()
+ .flatMap { sourceSet -> sourceSet.output.files }
+ .toSet()
+
+ classpath(osgiSourceSet.compileClasspath.filter { file -> file !in otherSourceSets })
properties.putAll(fmExt.versionDef.versionProperties)
properties.put("moduleOrg", project.group.toString())
properties.put("moduleName", project.name)
diff --git a/osgi.bnd b/osgi.bnd
index f80220f..9cbe266 100644
--- a/osgi.bnd
+++ b/osgi.bnd
@@ -21,7 +21,6 @@
# imports by examining the class files, and generates the OSGi meta-info
# based on that and this file.
--classpath: build/classes
-failok: false
Bundle-SymbolicName: ${moduleOrg}.${moduleName}
@@ -29,8 +28,6 @@
Bundle-License: Apache License, Version 2.0; see: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Vendor: freemarker.org
-Include-Resource: META-INF=src/dist/jar/META-INF
-
Export-Package: !freemarker.test.*, freemarker.*;version="${versionForOSGi}"
# Important:
# Packages that don't match nor the Export-Package nor the