mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 08:38:13 -07:00
Initial work for the OSGI plug-in.
This commit is contained in:
parent
7b068bb111
commit
9d2d536fe6
2 changed files with 26 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.beust.kobalt.plugin.packaging
|
||||
|
||||
import aQute.bnd.osgi.Analyzer
|
||||
import com.beust.kobalt.*
|
||||
import com.beust.kobalt.api.*
|
||||
import com.beust.kobalt.api.annotation.Directive
|
||||
|
@ -107,6 +108,27 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
|||
packages.add(p)
|
||||
}
|
||||
|
||||
// @Task(name = "generateOsgiManifest", alwaysRunAfter = arrayOf(TASK_ASSEMBLE))
|
||||
fun generateManifest(project: Project): TaskResult {
|
||||
val analyzer = Analyzer().apply {
|
||||
jar = aQute.bnd.osgi.Jar(project.projectProperties.get(Archives.JAR_NAME) as String)
|
||||
val dependencies = project.compileDependencies + project.compileRuntimeDependencies
|
||||
val dependentProjects = project.dependentProjects
|
||||
dependencyManager.calculateDependencies(project, context, dependentProjects, dependencies).forEach {
|
||||
addClasspath(it.jarFile.get())
|
||||
}
|
||||
setProperty(Analyzer.BUNDLE_VERSION, project.version)
|
||||
setProperty(Analyzer.BUNDLE_NAME, project.group)
|
||||
setProperty(Analyzer.BUNDLE_DESCRIPTION, project.description)
|
||||
setProperty(Analyzer.IMPORT_PACKAGE, "*")
|
||||
setProperty(Analyzer.EXPORT_PACKAGE, "*;-noimport:=false;version=" + project.version)
|
||||
}
|
||||
|
||||
val manifest = analyzer.calcManifest()
|
||||
manifest.write(System.out)
|
||||
return TaskResult()
|
||||
}
|
||||
|
||||
|
||||
@Task(name = PackagingPlugin.TASK_INSTALL, description = "Install the artifacts",
|
||||
runAfter = arrayOf(PackagingPlugin.TASK_ASSEMBLE))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue