lib/buildr4osgi/osgi/library_extension.rb in buildr4osgi-0.9.2 vs lib/buildr4osgi/osgi/library_extension.rb in buildr4osgi-0.9.3
- old
+ new
@@ -101,10 +101,12 @@
# name: the name of the project to define
# version: the version of the project to define
#
def library_project(dependencies, group, name, version, options = {:exclude => ["META-INF/MANIFEST.MF"], :include => [], :manifest => {}})
options[:manifest] ||= {}
+ options[:include] ||= []
+ options[:exclude] ||= []
deps_as_str = []
# We create an object and we extend with the module so we can get access to the walk_libs method.
walker = Object.new
walker.extend Buildr4OSGi::BuildLibraries::LibraryProject
walker.walk_libs(dependencies) {|lib|
@@ -132,10 +134,21 @@
entries = []
names = []
walk_libs(#{deps_as_str}) {|lib|
names << lib.to_spec
lib.invoke # make sure the artifact is present.
- Zip::ZipFile.foreach(lib.to_s) {|entry| entries << entry.name.sub(/(.*)\\/.*.class$/, '\\1').gsub(/\\//, '.') if /.*\\.class$/.match(entry.name)}
+ Zip::ZipFile.foreach(lib.to_s) {|entry|
+ if /.*\\.class$/.match(entry.name)
+ add_to_entries = true
+ [#{options[:exclude].inspect}].flatten.each {|excluded|
+ add_to_entries &&= !entry.name.match(excluded)
+ }
+ [#{options[:include].inspect}].flatten.each {|included|
+ add_to_entries &&= included.match(entry.name)
+ }
+ entries << entry.name.sub(/(.*)\\/.*.class$/, '\\1').gsub(/\\//, '.') if add_to_entries
+ end
+ }
}
lib_manifest = {
"Bundle-Version" => "#{version}",
"Bundle-SymbolicName" => project.name,
"Bundle-Name" => names.join(", "),