buildr-ipojo 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -0
- data/LICENSE +177 -0
- data/README.rdoc +51 -0
- data/Rakefile +34 -0
- data/buildr-ipojo.gemspec +25 -0
- data/lib/buildr/ipojo/config.rb +20 -0
- data/lib/buildr/ipojo/core.rb +48 -0
- data/lib/buildr/ipojo/ipojo_cli.jar +0 -0
- data/lib/buildr/ipojo/project_extension.rb +53 -0
- data/lib/buildr/ipojo/version.rb +11 -0
- data/lib/buildr_ipojo.rb +5 -0
- data/spec/buildr/ipojo/ipojo_spec.rb +104 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +32 -0
- metadata +87 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
= iPojo support for buildr
|
|
2
|
+
|
|
3
|
+
iPojo is an OSGi component model (http://felix.apache.org/site/apache-felix-ipojo.html).
|
|
4
|
+
This extension processes OSGi bundles using iPojo's pojoizer to generate the required
|
|
5
|
+
metadata for the iPojo component model.
|
|
6
|
+
|
|
7
|
+
The extension will process all packages of type :jar and generate the required metadata
|
|
8
|
+
from annotations and an ipojo metadata file if present. The default location of the
|
|
9
|
+
metadata file is "src/main/config/ipojo.xml" but this can be changed by assigning the
|
|
10
|
+
"ipojo.metadata_filename" setting.
|
|
11
|
+
|
|
12
|
+
A typical project that uses the extension with the default metadata file location.
|
|
13
|
+
|
|
14
|
+
define 'myProject' do
|
|
15
|
+
...
|
|
16
|
+
project.ipojoize!
|
|
17
|
+
package :jar
|
|
18
|
+
...
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
An example of a project that specifies the metadata file location.
|
|
22
|
+
|
|
23
|
+
define 'myProject' do
|
|
24
|
+
...
|
|
25
|
+
# Note: no longer require project.pojoize!
|
|
26
|
+
project.ipojo.metadata_filename = _("src/ipojo.xml")
|
|
27
|
+
package :jar
|
|
28
|
+
...
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
== Installation
|
|
32
|
+
|
|
33
|
+
The extension is packaged as a gem named "buildr-ipojo", consult the ruby gems installation
|
|
34
|
+
steps but typically it is either
|
|
35
|
+
|
|
36
|
+
sudo gem install buildr-ipojo
|
|
37
|
+
|
|
38
|
+
for MRI ruby or
|
|
39
|
+
|
|
40
|
+
jgem install buildr-ipojo
|
|
41
|
+
|
|
42
|
+
for jruby.
|
|
43
|
+
|
|
44
|
+
The user then needs to add the following require into the build file:
|
|
45
|
+
|
|
46
|
+
require 'buildr_ipojo'
|
|
47
|
+
|
|
48
|
+
If the local maven repository does not contain the required ipojo jars they can be downloaded
|
|
49
|
+
but you will need to register the remote repository by adding the following to the build file:
|
|
50
|
+
|
|
51
|
+
repositories.remote << Buildr::Ipojo.remote_repository
|
data/Rakefile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/rdoctask'
|
|
3
|
+
require 'rake/gempackagetask'
|
|
4
|
+
require 'spec/rake/spectask'
|
|
5
|
+
require File.expand_path("lib/buildr/ipojo/version", File.dirname(__FILE__))
|
|
6
|
+
|
|
7
|
+
gem_spec = Gem::Specification.load(File.expand_path('buildr-ipojo.gemspec', File.dirname(__FILE__)))
|
|
8
|
+
|
|
9
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
10
|
+
spec.libs << 'lib' << 'spec'
|
|
11
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task :default => :spec
|
|
15
|
+
|
|
16
|
+
task :package => [:spec]
|
|
17
|
+
|
|
18
|
+
desc "Generate RDoc documentation in rdoc/"
|
|
19
|
+
Rake::RDocTask.new :rdoc do |rdoc|
|
|
20
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
21
|
+
rdoc.title = gem_spec.name
|
|
22
|
+
rdoc.options = gem_spec.rdoc_options.clone
|
|
23
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
24
|
+
rdoc.rdoc_files.include gem_spec.extra_rdoc_files
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Rake::GemPackageTask.new(gem_spec).define
|
|
28
|
+
|
|
29
|
+
namespace :deploy do
|
|
30
|
+
task :tag do
|
|
31
|
+
system("git tag -a #{Buildr::Ipojo::Version::STRING} -m 'Released #{Buildr::Ipojo::Version::STRING}'")
|
|
32
|
+
puts "Tagged locally. `git push --tags` if you're sure."
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/buildr/ipojo/version')
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = 'buildr-ipojo'
|
|
5
|
+
spec.version = Buildr::Ipojo::Version::STRING
|
|
6
|
+
spec.authors = ['Peter Donald']
|
|
7
|
+
spec.email = ["peter@realityforge.org"]
|
|
8
|
+
spec.homepage = "http://github.com/realityforge/buildr-ipojo"
|
|
9
|
+
spec.summary = "Buildr tasks to process OSGi bundles using IPojo"
|
|
10
|
+
spec.description = <<-TEXT
|
|
11
|
+
This is a buildr extension that processes OSGi bundles using the
|
|
12
|
+
iPojo "pojoization" tool that generates appropriate metadata from
|
|
13
|
+
annotations and a config file.
|
|
14
|
+
TEXT
|
|
15
|
+
|
|
16
|
+
spec.files = Dir['{lib,spec}/**/*', '*.gemspec'] +
|
|
17
|
+
['LICENSE', 'README.rdoc', 'CHANGELOG', 'Rakefile']
|
|
18
|
+
spec.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
spec.has_rdoc = true
|
|
21
|
+
spec.extra_rdoc_files = 'README.rdoc', 'LICENSE', 'CHANGELOG'
|
|
22
|
+
spec.rdoc_options = '--title', "#{spec.name} #{spec.version}", '--main', 'README.rdoc'
|
|
23
|
+
|
|
24
|
+
spec.post_install_message = "Thanks for installing the iPojo extension for Buildr"
|
|
25
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Buildr
|
|
2
|
+
module Ipojo
|
|
3
|
+
class Config
|
|
4
|
+
attr_writer :metadata_filename
|
|
5
|
+
|
|
6
|
+
attr_reader :project
|
|
7
|
+
|
|
8
|
+
def initialize(project)
|
|
9
|
+
@project= project
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def metadata_filename
|
|
13
|
+
return @metadata_filename unless @metadata_filename.nil?
|
|
14
|
+
filename = project._(:src, :main, :config, "ipojo.xml")
|
|
15
|
+
File.exist?(filename) ? filename : nil
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Buildr
|
|
2
|
+
module Ipojo
|
|
3
|
+
class << self
|
|
4
|
+
|
|
5
|
+
def ipojo_version
|
|
6
|
+
@ipojo_version ||= '1.6.2'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def ipojo_version=(ipojo_version)
|
|
10
|
+
@ipojo_version = ipojo_version
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def annotation_artifact
|
|
14
|
+
"org.apache.felix:org.apache.felix.ipojo.annotations:jar:#{self.ipojo_version}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The specs for requirements
|
|
18
|
+
def requires
|
|
19
|
+
[
|
|
20
|
+
self.annotation_artifact,
|
|
21
|
+
"org.apache.felix:org.apache.felix.ipojo.metadata:jar:1.4.0",
|
|
22
|
+
"org.apache.felix:org.apache.felix.ipojo.manipulator:jar:#{self.ipojo_version}",
|
|
23
|
+
'asm:asm-all:jar:3.0'
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Repositories containing the requirements
|
|
28
|
+
def remote_repository
|
|
29
|
+
'https://repository.apache.org/content/repositories/releases'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def pojoize(project, input_filename, output_filename, metadata_filename)
|
|
33
|
+
trace("Enhancing #{input_filename} with ipojo metadata")
|
|
34
|
+
cp = Buildr.artifacts(self.requires).each(&:invoke).map(&:to_s)
|
|
35
|
+
cp += [File.expand_path(File.dirname(__FILE__) + '/ipojo_cli.jar')]
|
|
36
|
+
args =
|
|
37
|
+
[
|
|
38
|
+
input_filename,
|
|
39
|
+
output_filename,
|
|
40
|
+
metadata_filename,
|
|
41
|
+
Buildr.application.options.trace ? "true" : "false",
|
|
42
|
+
{:classpath => cp}
|
|
43
|
+
]
|
|
44
|
+
Java::Commands.java 'buildr.ipojo.cli.Main', *(args)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Buildr
|
|
2
|
+
module Ipojo
|
|
3
|
+
module ProjectExtension
|
|
4
|
+
include Extension
|
|
5
|
+
|
|
6
|
+
def ipojo?
|
|
7
|
+
!@ipojo.nil?
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def ipojo
|
|
11
|
+
@ipojo ||= Buildr::Ipojo::Config.new(self)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def ipojoize!
|
|
15
|
+
self.ipojo
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
after_define do |project|
|
|
19
|
+
if project.ipojo?
|
|
20
|
+
project.packages.each do |pkg|
|
|
21
|
+
if pkg.respond_to?(:to_hash) && pkg.to_hash[:type] == :jar
|
|
22
|
+
pkg.enhance do
|
|
23
|
+
pkg.enhance do
|
|
24
|
+
begin
|
|
25
|
+
tmp_filename = pkg.to_s + ".out"
|
|
26
|
+
metadata_filename = project.ipojo.metadata_filename
|
|
27
|
+
if metadata_filename.nil?
|
|
28
|
+
metadata_filename = project._(:target, :generated, :config, "ipojo.xml")
|
|
29
|
+
mkdir_p File.dirname(metadata_filename)
|
|
30
|
+
File.open(metadata_filename, "w") do |f|
|
|
31
|
+
f << "<ipojo></ipojo>"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
info("Processing #{File.basename(pkg.to_s)} through iPojo pre-processor")
|
|
35
|
+
Buildr::Ipojo.pojoize(project, pkg.to_s, tmp_filename, metadata_filename)
|
|
36
|
+
FileUtils.mv tmp_filename, pkg.to_s
|
|
37
|
+
rescue => e
|
|
38
|
+
FileUtils.rm_rf pkg.to_s
|
|
39
|
+
raise e
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class Buildr::Project
|
|
52
|
+
include Buildr::Ipojo::ProjectExtension
|
|
53
|
+
end
|
data/lib/buildr_ipojo.rb
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
def open_zip_file(file = 'target/foo-2.1.3.jar')
|
|
4
|
+
jar_filename = @foo._(file)
|
|
5
|
+
File.should be_exist(jar_filename)
|
|
6
|
+
Zip::ZipFile.open(jar_filename) do |zip|
|
|
7
|
+
yield zip
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def open_main_manifest_section(file = 'target/foo-2.1.3.jar')
|
|
12
|
+
jar_filename = @foo._(file)
|
|
13
|
+
File.should be_exist(jar_filename)
|
|
14
|
+
yield Buildr::Packaging::Java::Manifest.from_zip(jar_filename).main
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def init_project(project)
|
|
18
|
+
project.version = "2.1.3"
|
|
19
|
+
project.group = "mygroup"
|
|
20
|
+
compile.with Buildr::Ipojo.annotation_artifact
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "ipojo" do
|
|
24
|
+
before do
|
|
25
|
+
write "src/main/java/com/biz/Foo.java", <<SRC
|
|
26
|
+
package com.biz;
|
|
27
|
+
@org.apache.felix.ipojo.annotations.Component
|
|
28
|
+
public class Foo {}
|
|
29
|
+
SRC
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe "with no metadata file and pojoized!" do
|
|
33
|
+
before do
|
|
34
|
+
@foo = define "foo" do
|
|
35
|
+
init_project(project)
|
|
36
|
+
project.ipojoize!
|
|
37
|
+
package :jar
|
|
38
|
+
end
|
|
39
|
+
task('package').invoke
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "produces a .jar in the correct location" do
|
|
43
|
+
File.should be_exist(@foo._("target/foo-2.1.3.jar"))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "produces a .jar containing expected manifest ipojo entries" do
|
|
47
|
+
open_main_manifest_section do |attribs|
|
|
48
|
+
attribs['iPOJO-Components'].should match(/\$name="com\.biz\.Foo"/)
|
|
49
|
+
attribs['iPOJO-Components'].should_not match(/instance \{ \$component="com\.biz\.Foo" \}/)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe "with default metadata file and pojoized!" do
|
|
55
|
+
before do
|
|
56
|
+
write "src/main/config/ipojo.xml", <<SRC
|
|
57
|
+
<ipojo><instance component="com.biz.Foo"/></ipojo>
|
|
58
|
+
SRC
|
|
59
|
+
@foo = define "foo" do
|
|
60
|
+
init_project(project)
|
|
61
|
+
project.ipojoize!
|
|
62
|
+
package :jar
|
|
63
|
+
end
|
|
64
|
+
task('package').invoke
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "produces a .jar in the correct location" do
|
|
68
|
+
File.should be_exist(@foo._("target/foo-2.1.3.jar"))
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "produces a .jar containing expected manifest ipojo entries" do
|
|
72
|
+
open_main_manifest_section do |attribs|
|
|
73
|
+
attribs['iPOJO-Components'].should match(/\$name="com\.biz\.Foo"/)
|
|
74
|
+
attribs['iPOJO-Components'].should match(/instance \{ \$component="com\.biz\.Foo" \}/)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe "with non-default metadata file and pojoized!" do
|
|
80
|
+
before do
|
|
81
|
+
write "src/main/config/non-default-ipojo.xml", <<SRC
|
|
82
|
+
<ipojo><instance component="com.biz.Foo"/></ipojo>
|
|
83
|
+
SRC
|
|
84
|
+
@foo = define "foo" do
|
|
85
|
+
init_project(project)
|
|
86
|
+
project.ipojoize!
|
|
87
|
+
project.ipojo.metadata_filename = project._("src/main/config/non-default-ipojo.xml")
|
|
88
|
+
package :jar
|
|
89
|
+
end
|
|
90
|
+
task('package').invoke
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "produces a .jar in the correct location" do
|
|
94
|
+
File.should be_exist(@foo._("target/foo-2.1.3.jar"))
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "produces a .jar containing expected manifest ipojo entries" do
|
|
98
|
+
open_main_manifest_section do |attribs|
|
|
99
|
+
attribs['iPOJO-Components'].should match(/\$name="com\.biz\.Foo"/)
|
|
100
|
+
attribs['iPOJO-Components'].should match(/instance \{ \$component="com\.biz\.Foo" \}/)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
data/spec/spec.opts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec'
|
|
2
|
+
|
|
3
|
+
DEFAULT_BUILDR_DIR=File.expand_path(File.dirname(__FILE__) + '/../../buildr')
|
|
4
|
+
BUILDR_DIR =
|
|
5
|
+
begin
|
|
6
|
+
if ENV['BUILDR_DIR']
|
|
7
|
+
ENV['BUILDR_DIR']
|
|
8
|
+
elsif File.exist?(File.expand_path('../buildr_dir', __FILE__))
|
|
9
|
+
File.read(File.expand_path('../buildr_dir', __FILE__)).strip
|
|
10
|
+
else
|
|
11
|
+
DEFAULT_BUILDR_DIR
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
unless File.exist?("#{BUILDR_DIR}/buildr.gemspec")
|
|
16
|
+
raise "Unable to find buildr.gemspec in #{BUILDR_DIR == DEFAULT_BUILDR_DIR ? 'guessed' : 'specified'} $BUILDR_DIR (#{BUILDR_DIR})"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# hook into buildr's spec_helpers load process
|
|
20
|
+
module SandboxHook
|
|
21
|
+
def SandboxHook.included(spec_helpers)
|
|
22
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
23
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
24
|
+
require 'buildr_ipojo'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
require "#{BUILDR_DIR}/spec/spec_helpers.rb"
|
|
29
|
+
|
|
30
|
+
# Download deps into real local dir
|
|
31
|
+
Buildr::repositories.remote << Buildr::Ipojo.remote_repository
|
|
32
|
+
Buildr::Ipojo.requires.each { |spec| artifact(spec).invoke }
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: buildr-ipojo
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 0
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.0.1
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- Peter Donald
|
|
13
|
+
autorequire:
|
|
14
|
+
bindir: bin
|
|
15
|
+
cert_chain: []
|
|
16
|
+
|
|
17
|
+
date: 2010-08-22 00:00:00 +10:00
|
|
18
|
+
default_executable:
|
|
19
|
+
dependencies: []
|
|
20
|
+
|
|
21
|
+
description: |
|
|
22
|
+
This is a buildr extension that processes OSGi bundles using the
|
|
23
|
+
iPojo "pojoization" tool that generates appropriate metadata from
|
|
24
|
+
annotations and a config file.
|
|
25
|
+
|
|
26
|
+
email:
|
|
27
|
+
- peter@realityforge.org
|
|
28
|
+
executables: []
|
|
29
|
+
|
|
30
|
+
extensions: []
|
|
31
|
+
|
|
32
|
+
extra_rdoc_files:
|
|
33
|
+
- README.rdoc
|
|
34
|
+
- LICENSE
|
|
35
|
+
- CHANGELOG
|
|
36
|
+
files:
|
|
37
|
+
- lib/buildr_ipojo.rb
|
|
38
|
+
- lib/buildr/ipojo/version.rb
|
|
39
|
+
- lib/buildr/ipojo/config.rb
|
|
40
|
+
- lib/buildr/ipojo/project_extension.rb
|
|
41
|
+
- lib/buildr/ipojo/ipojo_cli.jar
|
|
42
|
+
- lib/buildr/ipojo/core.rb
|
|
43
|
+
- spec/spec_helper.rb
|
|
44
|
+
- spec/spec.opts
|
|
45
|
+
- spec/buildr/ipojo/ipojo_spec.rb
|
|
46
|
+
- buildr-ipojo.gemspec
|
|
47
|
+
- LICENSE
|
|
48
|
+
- README.rdoc
|
|
49
|
+
- CHANGELOG
|
|
50
|
+
- Rakefile
|
|
51
|
+
has_rdoc: true
|
|
52
|
+
homepage: http://github.com/realityforge/buildr-ipojo
|
|
53
|
+
licenses: []
|
|
54
|
+
|
|
55
|
+
post_install_message: Thanks for installing the iPojo extension for Buildr
|
|
56
|
+
rdoc_options:
|
|
57
|
+
- --title
|
|
58
|
+
- buildr-ipojo 0.0.1
|
|
59
|
+
- --main
|
|
60
|
+
- README.rdoc
|
|
61
|
+
require_paths:
|
|
62
|
+
- lib
|
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
segments:
|
|
69
|
+
- 0
|
|
70
|
+
version: "0"
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
segments:
|
|
77
|
+
- 0
|
|
78
|
+
version: "0"
|
|
79
|
+
requirements: []
|
|
80
|
+
|
|
81
|
+
rubyforge_project:
|
|
82
|
+
rubygems_version: 1.3.7
|
|
83
|
+
signing_key:
|
|
84
|
+
specification_version: 3
|
|
85
|
+
summary: Buildr tasks to process OSGi bundles using IPojo
|
|
86
|
+
test_files: []
|
|
87
|
+
|