buildr4osgi 0.9.4 → 0.9.5
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/buildr4osgi.gemspec +1 -1
- data/lib/buildr4osgi/eclipse/p2.rb +8 -5
- data/lib/buildr4osgi/osgi/packaging.rb +3 -3
- data/lib/buildr4osgi/osgi/packaging_sources.rb +1 -1
- data/lib/buildr4osgi/osgi/project_extension.rb +1 -1
- data/lib/buildr4osgi.rb +0 -1
- data/spec/osgi/packaging_spec.rb +6 -6
- metadata +27 -15
- data/lib/buildr4osgi/compile/compiler.rb +0 -70
- data/lib/buildr4osgi/compile/ecj-3.4.1.jar +0 -0
- data/lib/buildr4osgi/compile/external.rb +0 -73
- data/lib/buildr4osgi/compile.rb +0 -17
- data/spec/compile/compiler_spec.rb +0 -62
- data/spec/compile/external_spec.rb +0 -41
data/buildr4osgi.gemspec
CHANGED
@@ -37,21 +37,24 @@ module Buildr4OSGi
|
|
37
37
|
super
|
38
38
|
|
39
39
|
enhance do |p2_task|
|
40
|
-
|
41
|
-
|
40
|
+
if @site.nil?
|
41
|
+
@site = project.package(:site)
|
42
|
+
end
|
43
|
+
fail "The p2 task needs to be associated with a site " if @site.nil?
|
44
|
+
p2_task.enhance [@site]
|
42
45
|
#add a prerequisite to the list of prerequisites, gives a chance
|
43
46
|
#for other prerequisites to be placed before this block is executed.
|
44
47
|
p2_task.enhance do
|
45
48
|
targetP2Repo = File.join(project.base_dir, "target", "p2repository")
|
46
49
|
mkpath targetP2Repo
|
47
|
-
Buildr::unzip(targetP2Repo
|
50
|
+
Buildr::unzip(targetP2Repo=>@site.to_s).extract
|
48
51
|
eclipseSDK = Buildr::artifact("org.eclipse:eclipse-SDK:zip:3.6M3-win32")
|
49
52
|
eclipseSDK.invoke
|
50
53
|
Buildr::unzip(File.dirname(eclipseSDK.to_s) => eclipseSDK.to_s).extract
|
51
54
|
|
52
55
|
launcherPlugin = Dir.glob("#{File.dirname(eclipseSDK.to_s)}/eclipse/plugins/org.eclipse.equinox.launcher_*")[0]
|
53
56
|
|
54
|
-
cmdline <<-CMD
|
57
|
+
cmdline = <<-CMD
|
55
58
|
java -jar #{launcherPlugin} -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
|
56
59
|
-metadataRepository file:#{targetP2Repo}
|
57
60
|
-artifactRepository file:#{targetP2Repo}
|
@@ -63,7 +66,7 @@ module Buildr4OSGi
|
|
63
66
|
-clean -consoleLog
|
64
67
|
CMD
|
65
68
|
info "Invoking P2's metadata generation: #{cmdline}"
|
66
|
-
system cmdline
|
69
|
+
system cmdline.gsub(/\n/, "").gsub(/\s+/, " ")
|
67
70
|
|
68
71
|
include targetP2Repo, :as => "."
|
69
72
|
end
|
@@ -127,7 +127,7 @@ module OSGi
|
|
127
127
|
unless @libs.nil? || @libs.empty?
|
128
128
|
artifacts = Buildr.artifacts(@libs)
|
129
129
|
path('lib').include artifacts
|
130
|
-
manifest["Bundle-
|
130
|
+
manifest["Bundle-ClassPath"] = [".", artifacts.collect {|a| "lib/#{File.basename(a.to_s)}"}].flatten.join(",")
|
131
131
|
|
132
132
|
end
|
133
133
|
end
|
@@ -275,8 +275,8 @@ module OSGi
|
|
275
275
|
manifest["Bundle-SymbolicName"] ||= self.name.split(":").last # if it was resetted to nil, we force the id to be added back.
|
276
276
|
|
277
277
|
plugin.with :manifest=> manifest, :meta_inf=>meta_inf
|
278
|
-
unless manifest["Bundle-
|
279
|
-
entry = manifest["Bundle-
|
278
|
+
unless manifest["Bundle-ClassPath"].nil? || compile.target.nil?
|
279
|
+
entry = manifest["Bundle-ClassPath"].split(",").first
|
280
280
|
plugin.path(entry).include compile.target, :as=>'.'
|
281
281
|
plugin.path(entry).include properties.target, :as=>'.' unless properties.target.nil?
|
282
282
|
plugin.with [resources.target, p_r.target].compact
|
@@ -28,7 +28,7 @@ module OSGi
|
|
28
28
|
sourcesManifest = ::Buildr::Packaging::Java::Manifest.new(nil)
|
29
29
|
sourcesManifest.main["Bundle-ManifestVersion"] = "2"
|
30
30
|
sourcesManifest.main["Eclipse-SourceBundle"] = "#{bundleSymName};version=\"#{bundleVersion}\";roots:=\".\""
|
31
|
-
sourcesManifest.main["Bundle-SymbolicName"] = bundleSymName + ".
|
31
|
+
sourcesManifest.main["Bundle-SymbolicName"] = bundleSymName + ".source"
|
32
32
|
sourcesManifest.main["Bundle-Name"] += " sources" if sourcesManifest.main["Bundle-Name"]
|
33
33
|
sourcesManifest.main["Bundle-Version"] = bundleVersion
|
34
34
|
sourcesManifest.main["Bundle-Vendor"] = pluginManifest["Bundle-Vendor"] unless pluginManifest["Bundle-Vendor"].nil?
|
@@ -185,7 +185,7 @@ module OSGi
|
|
185
185
|
if local
|
186
186
|
artifact = Buildr::artifact(bundle.to_s)
|
187
187
|
installed = Buildr.repositories.locate(artifact)
|
188
|
-
|
188
|
+
rm_rf installed
|
189
189
|
mkpath File.dirname(installed)
|
190
190
|
Buildr::artifact(bundle.to_s).from(bundle.file).install
|
191
191
|
info "Installed #{installed}"
|
data/lib/buildr4osgi.rb
CHANGED
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
require 'buildr4osgi/osgi'
|
17
17
|
require 'buildr4osgi/eclipse'
|
18
|
-
require 'buildr4osgi/compile'
|
19
18
|
|
20
19
|
# Methods defined in Buildr4OSGi are both instance methods (e.g. when included in Project)
|
21
20
|
# and class methods when invoked like Buildr4OSGi.project_library(SLF4J, "group", "foo", "1.0.0").
|
data/spec/osgi/packaging_spec.rb
CHANGED
@@ -302,7 +302,7 @@ describe OSGi::BundleTask, "with packaging libs" do
|
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
-
it "should add the libraries to the Bundle-
|
305
|
+
it "should add the libraries to the Bundle-ClassPath" do
|
306
306
|
foo = define("foo", :version => "1.0.0") do
|
307
307
|
compile.using :target=>'1.5'
|
308
308
|
package(:plugin).libs << SLF4J[0]
|
@@ -311,7 +311,7 @@ describe OSGi::BundleTask, "with packaging libs" do
|
|
311
311
|
foo.package(:plugin).invoke
|
312
312
|
Zip::ZipFile.open(foo.package(:plugin).to_s) do |zip|
|
313
313
|
zip.find_entry("META-INF/MANIFEST.MF").should_not be_nil
|
314
|
-
zip.read("META-INF/MANIFEST.MF").should match(/Bundle-
|
314
|
+
zip.read("META-INF/MANIFEST.MF").should match(/Bundle-ClassPath: \.,lib\/slf4j-api-1\.5\.8\.jar/)
|
315
315
|
end
|
316
316
|
end
|
317
317
|
|
@@ -369,8 +369,8 @@ describe OSGi::BundleTask, "with existing manifests" do
|
|
369
369
|
|
370
370
|
end
|
371
371
|
|
372
|
-
it "should use the Bundle-
|
373
|
-
Buildr::write "META-INF/MANIFEST.MF", "Bundle-SymbolicName: dev\nExport-Package: package1,\n package2\nBundle-Version: 1.0.0\nBundle-
|
372
|
+
it "should use the Bundle-ClassPath entry whenever present to determine the classpath" do
|
373
|
+
Buildr::write "META-INF/MANIFEST.MF", "Bundle-SymbolicName: dev\nExport-Package: package1,\n package2\nBundle-Version: 1.0.0\nBundle-ClassPath: WEB-INF/classes"
|
374
374
|
Buildr::write "src/main/java/Hello.java", "public class Hello {}"
|
375
375
|
|
376
376
|
foo = define("foo", :version => "1.0.0.qualifier") do
|
@@ -384,8 +384,8 @@ describe OSGi::BundleTask, "with existing manifests" do
|
|
384
384
|
|
385
385
|
end
|
386
386
|
|
387
|
-
it "should use the _first_ Bundle-
|
388
|
-
Buildr::write "META-INF/MANIFEST.MF", "Bundle-SymbolicName: dev\nExport-Package: package1,\n package2\nBundle-Version: 1.0.0\nBundle-
|
387
|
+
it "should use the _first_ Bundle-ClassPath entry whenever present to determine the classpath" do
|
388
|
+
Buildr::write "META-INF/MANIFEST.MF", "Bundle-SymbolicName: dev\nExport-Package: package1,\n package2\nBundle-Version: 1.0.0\nBundle-ClassPath: WEB-INF/classes,else"
|
389
389
|
Buildr::write "src/main/java/Hello.java", "public class Hello {}"
|
390
390
|
|
391
391
|
foo = define("foo", :version => "1.0.0.qualifier") do
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildr4osgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 49
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 5
|
10
|
+
version: 0.9.5
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Antoine Toulme
|
@@ -9,19 +15,25 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-09-15 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: manifest
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - "="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 8
|
23
34
|
version: 0.0.8
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
description: |
|
26
38
|
A plugin for adding OSGi support to Buildr. Ever dreamt you could resolve your OSGi dependencies ?
|
27
39
|
|
@@ -35,10 +47,6 @@ extra_rdoc_files:
|
|
35
47
|
- LICENSE
|
36
48
|
- NOTICE
|
37
49
|
files:
|
38
|
-
- lib/buildr4osgi/compile/compiler.rb
|
39
|
-
- lib/buildr4osgi/compile/ecj-3.4.1.jar
|
40
|
-
- lib/buildr4osgi/compile/external.rb
|
41
|
-
- lib/buildr4osgi/compile.rb
|
42
50
|
- lib/buildr4osgi/eclipse/feature.rb
|
43
51
|
- lib/buildr4osgi/eclipse/p2.rb
|
44
52
|
- lib/buildr4osgi/eclipse/plugin.rb
|
@@ -68,8 +76,6 @@ files:
|
|
68
76
|
- rakelib/rspec.rake
|
69
77
|
- rakelib/setup.rake
|
70
78
|
- rakelib/stage.rake
|
71
|
-
- spec/compile/compiler_spec.rb
|
72
|
-
- spec/compile/external_spec.rb
|
73
79
|
- spec/eclipse/feature_spec.rb
|
74
80
|
- spec/eclipse/p2_spec.rb
|
75
81
|
- spec/eclipse/site_spec.rb
|
@@ -126,21 +132,27 @@ rdoc_options:
|
|
126
132
|
require_paths:
|
127
133
|
- lib
|
128
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
129
136
|
requirements:
|
130
137
|
- - ">="
|
131
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
140
|
+
segments:
|
141
|
+
- 0
|
132
142
|
version: "0"
|
133
|
-
version:
|
134
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
135
145
|
requirements:
|
136
146
|
- - ">="
|
137
147
|
- !ruby/object:Gem::Version
|
148
|
+
hash: 3
|
149
|
+
segments:
|
150
|
+
- 0
|
138
151
|
version: "0"
|
139
|
-
version:
|
140
152
|
requirements: []
|
141
153
|
|
142
154
|
rubyforge_project:
|
143
|
-
rubygems_version: 1.3.
|
155
|
+
rubygems_version: 1.3.7
|
144
156
|
signing_key:
|
145
157
|
specification_version: 3
|
146
158
|
summary: A plugin for adding OSGi support to Buildr.
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
module Buildr4OSGi
|
17
|
-
module CompilerSupport
|
18
|
-
class OSGiC < Buildr::Compiler::Javac
|
19
|
-
|
20
|
-
CURRENT_JDT_COMPILER = '3.4.1'
|
21
|
-
OPTIONS = [:warnings, :debug, :deprecation, :source, :target, :lint, :other]
|
22
|
-
|
23
|
-
specify :language=>:java, :sources => 'java', :source_ext => 'java',
|
24
|
-
:target=>'classes', :target_ext=>'class', :packaging=>:jar
|
25
|
-
|
26
|
-
|
27
|
-
def compile(sources, target, dependencies) #:nodoc:
|
28
|
-
check_options options, OPTIONS
|
29
|
-
cmd_args = []
|
30
|
-
cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty?
|
31
|
-
source_paths = sources.select { |source| File.directory?(source) }
|
32
|
-
cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
|
33
|
-
cmd_args << '-d' << File.expand_path(target)
|
34
|
-
cmd_args += osgic_args
|
35
|
-
cmd_args += files_from_sources(sources)
|
36
|
-
unless Buildr.application.options.dryrun
|
37
|
-
trace((%w[java -classpath org.eclipse.jdt.internal.compiler.batch.Main] + cmd_args).join(' '))
|
38
|
-
Java.load
|
39
|
-
Java.org.eclipse.jdt.internal.compiler.batch.Main.compile(cmd_args.join(" ")) or
|
40
|
-
fail 'Failed to compile, see errors above'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
# See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
|
47
|
-
def osgic_args #:nodoc:
|
48
|
-
args = []
|
49
|
-
args << '-warn:none' unless options[:warnings]
|
50
|
-
args << '-verbose' if Buildr.application.options.trace
|
51
|
-
args << '-g' if options[:debug]
|
52
|
-
args << '-deprecation' if options[:deprecation]
|
53
|
-
args << '-source' << options[:source].to_s if options[:source]
|
54
|
-
args << '-target' << options[:target].to_s if options[:target]
|
55
|
-
case options[:lint]
|
56
|
-
when Array then args << "-Xlint:#{options[:lint].join(',')}"
|
57
|
-
when String then args << "-Xlint:#{options[:lint]}"
|
58
|
-
when true then args << '-Xlint'
|
59
|
-
end
|
60
|
-
args + Array(options[:other])
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
Java.classpath << File.expand_path(File.join(File.dirname(__FILE__), "ecj-#{Buildr4OSGi::CompilerSupport::OSGiC::CURRENT_JDT_COMPILER}.jar"))
|
69
|
-
|
70
|
-
Buildr::Compiler.compilers.unshift Buildr4OSGi::CompilerSupport::OSGiC
|
Binary file
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
# We use an external compiler defined by ENV['EXTERNAL_COMPILER']
|
17
|
-
module Buildr4OSGi
|
18
|
-
module CompilerSupport
|
19
|
-
class ExternalC < Buildr::Compiler::Javac
|
20
|
-
|
21
|
-
OPTIONS = [:warnings, :debug, :deprecation, :source, :target, :lint, :other]
|
22
|
-
|
23
|
-
specify :language=>:java, :sources => 'java', :source_ext => 'java',
|
24
|
-
:target=>'classes', :target_ext=>'class', :packaging=>:jar
|
25
|
-
|
26
|
-
|
27
|
-
def compile(sources, target, dependencies) #:nodoc:
|
28
|
-
check_options options, OPTIONS
|
29
|
-
cmd_args = []
|
30
|
-
cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty?
|
31
|
-
source_paths = sources.select { |source| File.directory?(source) }
|
32
|
-
cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
|
33
|
-
cmd_args << '-d' << File.expand_path(target)
|
34
|
-
cmd_args += externalc_args
|
35
|
-
Tempfile.open("external") {|tmp|
|
36
|
-
tmp.write files_from_sources(sources).join(' ')
|
37
|
-
cmd_args << "@#{tmp.path}"
|
38
|
-
}
|
39
|
-
unless Buildr.application.options.dryrun
|
40
|
-
fail "ENV['EXTERNAL_COMPILER'] is not defined" if ENV['EXTERNAL_COMPILER'].nil?
|
41
|
-
javac_path = File.join(ENV['EXTERNAL_COMPILER'], "bin", "javac")
|
42
|
-
final_args = cmd_args.insert(0, javac_path).push('2>&1').join(' ')
|
43
|
-
trace(final_args)
|
44
|
-
info %x[#{final_args}]
|
45
|
-
fail 'Failed to compile, see errors above' unless $?.success?
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
# See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
|
52
|
-
def externalc_args #:nodoc:
|
53
|
-
args = []
|
54
|
-
args << '-nowarn' unless options[:warnings]
|
55
|
-
args << '-verbose' if Buildr.application.options.trace
|
56
|
-
args << '-g' if options[:debug]
|
57
|
-
args << '-deprecation' if options[:deprecation]
|
58
|
-
args << '-source' << options[:source].to_s if options[:source]
|
59
|
-
args << '-target' << options[:target].to_s if options[:target]
|
60
|
-
case options[:lint]
|
61
|
-
when Array then args << "-Xlint:#{options[:lint].join(',')}"
|
62
|
-
when String then args << "-Xlint:#{options[:lint]}"
|
63
|
-
when true then args << '-Xlint'
|
64
|
-
end
|
65
|
-
args + Array(options[:other])
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
Buildr::Compiler.compilers << Buildr4OSGi::CompilerSupport::ExternalC
|
data/lib/buildr4osgi/compile.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
require 'buildr4osgi/compile/compiler'
|
17
|
-
require 'buildr4osgi/compile/external'
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
18
|
-
|
19
|
-
describe Buildr4OSGi::CompilerSupport::OSGiC do
|
20
|
-
describe "should compile a Java project just in the same way javac does" do
|
21
|
-
javac_spec = File.read(File.join(File.dirname(__FILE__), "..", "..", "buildr", "spec", "java", "compiler_spec.rb"))
|
22
|
-
javac_spec = javac_spec.match(Regexp.escape("require File.join(File.dirname(__FILE__), '../spec_helpers')\n")).post_match
|
23
|
-
javac_spec.gsub!("javac", "osgic")
|
24
|
-
javac_spec.gsub!("nowarn", "warn:none")
|
25
|
-
eval(javac_spec)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Redirect the java error ouput, yielding so you can do something while it is
|
29
|
-
# and returning the content of the error buffer.
|
30
|
-
#
|
31
|
-
def redirect_java_err
|
32
|
-
byteArray = Rjb::import('java.io.ByteArrayOutputStream')
|
33
|
-
printStream = Rjb::import('java.io.PrintStream')
|
34
|
-
err = byteArray.new()
|
35
|
-
Rjb::import('java.lang.System').err = printStream.new(err)
|
36
|
-
yield
|
37
|
-
err.toString
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should not issue warnings for type casting when warnings are set to warn:none" do
|
41
|
-
write "src/main/java/Main.java", "import java.util.List; public class Main {public List get() {return null;}}"
|
42
|
-
foo = define("foo") {
|
43
|
-
compile.options.source = "1.5"
|
44
|
-
compile.options.target = "1.5"
|
45
|
-
}
|
46
|
-
redirect_java_err { foo.compile.invoke }.should_not match(/WARNING/)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should not issue warnings for type casting when warnings are set to warn:none" do
|
50
|
-
write "src/main/java/Main.java", "import java.util.List; public class Main {public List get() {return null;}}"
|
51
|
-
foo = define("foo") {
|
52
|
-
compile.options.source = "1.5"
|
53
|
-
compile.options.target = "1.5"
|
54
|
-
compile.options.warnings = true
|
55
|
-
}
|
56
|
-
redirect_java_err { foo.compile.invoke }.should match(/WARNING/)
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
-
# work for additional information regarding copyright ownership. The ASF
|
4
|
-
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
-
# "License"); you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
|
17
|
-
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
18
|
-
|
19
|
-
describe Buildr4OSGi::CompilerSupport::ExternalC do
|
20
|
-
|
21
|
-
before :all do
|
22
|
-
Buildr::Compiler.compilers.delete Buildr::Compiler::Javac
|
23
|
-
Buildr::Compiler.compilers.delete Buildr4OSGi::CompilerSupport::OSGiC
|
24
|
-
raise "ENV['EXTERNAL_COMPILER'] is not defined !" unless ENV['EXTERNAL_COMPILER']
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "should compile a Java project just in the same way javac does" do
|
28
|
-
javac_spec = File.read(File.join(File.dirname(__FILE__), "..", "..", "buildr", "spec", "java", "compiler_spec.rb"))
|
29
|
-
javac_spec = javac_spec.match(Regexp.escape("require File.join(File.dirname(__FILE__), '../spec_helpers')\n")).post_match
|
30
|
-
javac_spec.gsub!("javac", "externalc")
|
31
|
-
eval(javac_spec)
|
32
|
-
end
|
33
|
-
|
34
|
-
after :all do
|
35
|
-
Buildr::Compiler.compilers << Buildr::Compiler::Javac
|
36
|
-
Buildr::Compiler.compilers.unshift Buildr4OSGi::CompilerSupport::OSGiC
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
|