buildr-gemjar 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +8 -0
- data/buildr-gemjar.gemspec +42 -0
- data/lib/buildr-gemjar.rb +162 -0
- data/lib/buildr-gemjar/version.rb +3 -0
- data/meta.rakefile +30 -0
- data/spec/buildr-gemjar/version_spec.rb +11 -0
- data/spec/buildr-gemjar_spec.rb +179 -0
- data/spec/repo_builder.rb +59 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/buildr/.gitignore +17 -0
- data/vendor/buildr/CHANGELOG +1283 -0
- data/vendor/buildr/Gemfile +4 -0
- data/vendor/buildr/LICENSE +176 -0
- data/vendor/buildr/NOTICE +26 -0
- data/vendor/buildr/README.rdoc +134 -0
- data/vendor/buildr/Rakefile +44 -0
- data/vendor/buildr/_buildr +35 -0
- data/vendor/buildr/_jbuildr +35 -0
- data/vendor/buildr/addon/buildr/antlr.rb +65 -0
- data/vendor/buildr/addon/buildr/bnd.rb +147 -0
- data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
- data/vendor/buildr/addon/buildr/drb.rb +281 -0
- data/vendor/buildr/addon/buildr/emma.rb +22 -0
- data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
- data/vendor/buildr/addon/buildr/javacc.rb +85 -0
- data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
- data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
- data/vendor/buildr/addon/buildr/jetty.rb +248 -0
- data/vendor/buildr/addon/buildr/jibx.rb +86 -0
- data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
- data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
- data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
- data/vendor/buildr/all-in-one/_buildr +19 -0
- data/vendor/buildr/all-in-one/buildr +368 -0
- data/vendor/buildr/all-in-one/buildr.cmd +1 -0
- data/vendor/buildr/bin/buildr +19 -0
- data/vendor/buildr/buildr.buildfile +58 -0
- data/vendor/buildr/buildr.gemspec +74 -0
- data/vendor/buildr/doc/_config.yml +1 -0
- data/vendor/buildr/doc/_layouts/default.html +90 -0
- data/vendor/buildr/doc/_layouts/preface.html +22 -0
- data/vendor/buildr/doc/artifacts.textile +217 -0
- data/vendor/buildr/doc/building.textile +276 -0
- data/vendor/buildr/doc/contributing.textile +268 -0
- data/vendor/buildr/doc/css/default.css +236 -0
- data/vendor/buildr/doc/css/print.css +101 -0
- data/vendor/buildr/doc/css/syntax.css +23 -0
- data/vendor/buildr/doc/download.textile +138 -0
- data/vendor/buildr/doc/extending.textile +212 -0
- data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
- data/vendor/buildr/doc/images/asf-logo.gif +0 -0
- data/vendor/buildr/doc/images/asf-logo.png +0 -0
- data/vendor/buildr/doc/images/buildr-hires.png +0 -0
- data/vendor/buildr/doc/images/buildr.png +0 -0
- data/vendor/buildr/doc/images/favicon.png +0 -0
- data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
- data/vendor/buildr/doc/images/note.png +0 -0
- data/vendor/buildr/doc/images/project-structure.png +0 -0
- data/vendor/buildr/doc/images/tip.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.tif +0 -0
- data/vendor/buildr/doc/index.textile +69 -0
- data/vendor/buildr/doc/installing.textile +284 -0
- data/vendor/buildr/doc/languages.textile +599 -0
- data/vendor/buildr/doc/mailing_lists.textile +29 -0
- data/vendor/buildr/doc/more_stuff.textile +845 -0
- data/vendor/buildr/doc/packaging.textile +618 -0
- data/vendor/buildr/doc/preface.textile +54 -0
- data/vendor/buildr/doc/projects.textile +276 -0
- data/vendor/buildr/doc/quick_start.textile +210 -0
- data/vendor/buildr/doc/releasing.textile +117 -0
- data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
- data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
- data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
- data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
- data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
- data/vendor/buildr/doc/settings_profiles.textile +287 -0
- data/vendor/buildr/doc/testing.textile +247 -0
- data/vendor/buildr/etc/KEYS +189 -0
- data/vendor/buildr/lib/buildr.rb +44 -0
- data/vendor/buildr/lib/buildr/clojure.rb +34 -0
- data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/core.rb +34 -0
- data/vendor/buildr/lib/buildr/core/application.rb +700 -0
- data/vendor/buildr/lib/buildr/core/build.rb +516 -0
- data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
- data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
- data/vendor/buildr/lib/buildr/core/common.rb +151 -0
- data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
- data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
- data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
- data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
- data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
- data/vendor/buildr/lib/buildr/core/help.rb +119 -0
- data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
- data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
- data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
- data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
- data/vendor/buildr/lib/buildr/core/project.rb +975 -0
- data/vendor/buildr/lib/buildr/core/run.rb +43 -0
- data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
- data/vendor/buildr/lib/buildr/core/test.rb +843 -0
- data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
- data/vendor/buildr/lib/buildr/core/util.rb +537 -0
- data/vendor/buildr/lib/buildr/groovy.rb +20 -0
- data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
- data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
- data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
- data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
- data/vendor/buildr/lib/buildr/ide.rb +19 -0
- data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
- data/vendor/buildr/lib/buildr/java.rb +25 -0
- data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
- data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
- data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
- data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
- data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
- data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
- data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
- data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
- data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
- data/vendor/buildr/lib/buildr/java/external.rb +73 -0
- data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
- data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
- data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
- data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
- data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
- data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
- data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
- data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
- data/vendor/buildr/lib/buildr/packaging.rb +25 -0
- data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
- data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
- data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
- data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
- data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
- data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
- data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
- data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
- data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
- data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
- data/vendor/buildr/lib/buildr/run.rb +195 -0
- data/vendor/buildr/lib/buildr/scala.rb +26 -0
- data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
- data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
- data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
- data/vendor/buildr/lib/buildr/shell.rb +185 -0
- data/vendor/buildr/lib/buildr/version.rb +18 -0
- data/vendor/buildr/rakelib/all-in-one.rake +113 -0
- data/vendor/buildr/rakelib/checks.rake +57 -0
- data/vendor/buildr/rakelib/doc.rake +137 -0
- data/vendor/buildr/rakelib/metrics.rake +39 -0
- data/vendor/buildr/rakelib/package.rake +73 -0
- data/vendor/buildr/rakelib/release.rake +161 -0
- data/vendor/buildr/rakelib/rspec.rake +101 -0
- data/vendor/buildr/rakelib/setup.rake +66 -0
- data/vendor/buildr/rakelib/stage.rake +220 -0
- data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
- data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
- data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/vendor/buildr/spec/core/application_spec.rb +631 -0
- data/vendor/buildr/spec/core/build_spec.rb +837 -0
- data/vendor/buildr/spec/core/cc_spec.rb +224 -0
- data/vendor/buildr/spec/core/checks_spec.rb +519 -0
- data/vendor/buildr/spec/core/common_spec.rb +725 -0
- data/vendor/buildr/spec/core/compile_spec.rb +658 -0
- data/vendor/buildr/spec/core/doc_spec.rb +195 -0
- data/vendor/buildr/spec/core/extension_spec.rb +201 -0
- data/vendor/buildr/spec/core/generate_spec.rb +33 -0
- data/vendor/buildr/spec/core/project_spec.rb +772 -0
- data/vendor/buildr/spec/core/run_spec.rb +93 -0
- data/vendor/buildr/spec/core/shell_spec.rb +146 -0
- data/vendor/buildr/spec/core/test_spec.rb +1320 -0
- data/vendor/buildr/spec/core/transport_spec.rb +544 -0
- data/vendor/buildr/spec/core/util_spec.rb +141 -0
- data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
- data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
- data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
- data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
- data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
- data/vendor/buildr/spec/java/ant_spec.rb +37 -0
- data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
- data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
- data/vendor/buildr/spec/java/commands_spec.rb +93 -0
- data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
- data/vendor/buildr/spec/java/doc_spec.rb +56 -0
- data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
- data/vendor/buildr/spec/java/emma_spec.rb +121 -0
- data/vendor/buildr/spec/java/external_spec.rb +56 -0
- data/vendor/buildr/spec/java/java_spec.rb +132 -0
- data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
- data/vendor/buildr/spec/java/run_spec.rb +78 -0
- data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
- data/vendor/buildr/spec/java/tests_spec.rb +497 -0
- data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
- data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
- data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
- data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
- data/vendor/buildr/spec/sandbox.rb +165 -0
- data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
- data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
- data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
- data/vendor/buildr/spec/scala/scala.rb +38 -0
- data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
- data/vendor/buildr/spec/spec_helpers.rb +369 -0
- data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
- data/vendor/buildr/spec/xpath_matchers.rb +121 -0
- data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
- data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
- data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
- data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
- data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
- data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
- data/vendor/buildr/tests/integration_testing.rb +56 -0
- data/vendor/buildr/tests/junit3/Buildfile +9 -0
- data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
- data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
- data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
- metadata +524 -0
@@ -0,0 +1,26 @@
|
|
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
|
+
ENV['SCALA_HOME'] ||= '/opt/local/share/scala/' if File.exist?('/opt/local/share/scala/lib/scala-compiler.jar')
|
18
|
+
Buildr.repositories.remote << 'http://scala-tools.org/repo-releases'
|
19
|
+
|
20
|
+
require 'buildr/scala/compiler'
|
21
|
+
require 'buildr/scala/tests'
|
22
|
+
require 'buildr/scala/bdd'
|
23
|
+
require 'buildr/scala/doc'
|
24
|
+
require 'buildr/scala/shell'
|
25
|
+
|
26
|
+
Object::Scala = Buildr::Scala
|
@@ -0,0 +1,118 @@
|
|
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 'buildr/core/build'
|
18
|
+
require 'buildr/core/compile'
|
19
|
+
require 'buildr/java/bdd'
|
20
|
+
require 'buildr/scala/tests'
|
21
|
+
|
22
|
+
module Buildr::Scala
|
23
|
+
|
24
|
+
# Specs is a Scala based BDD framework.
|
25
|
+
# To use in your project:
|
26
|
+
#
|
27
|
+
# test.using :specs
|
28
|
+
#
|
29
|
+
# This framework will search in your project for:
|
30
|
+
# src/spec/scala/**/*.scala
|
31
|
+
class Specs < Buildr::TestFramework::JavaBDD
|
32
|
+
@lang = :scala
|
33
|
+
@bdd_dir = :spec
|
34
|
+
|
35
|
+
VERSION = '1.6.6'
|
36
|
+
|
37
|
+
class << self
|
38
|
+
def version
|
39
|
+
Buildr.settings.build['scala.specs'] || VERSION
|
40
|
+
end
|
41
|
+
|
42
|
+
def artifact
|
43
|
+
Buildr.settings.build['scala.specs.artifact'] || "specs_#{Buildr::Scala.version}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def dependencies
|
47
|
+
unless @dependencies
|
48
|
+
super
|
49
|
+
specs = (version =~ /:/) ? [version] : ["org.scala-tools.testing:#{artifact}:jar:#{version}"]
|
50
|
+
# Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
|
51
|
+
@dependencies |= [ File.join(File.dirname(__FILE__)) ] + specs +
|
52
|
+
Check.dependencies + JUnit.dependencies + Scalac.dependencies
|
53
|
+
end
|
54
|
+
@dependencies
|
55
|
+
end
|
56
|
+
|
57
|
+
def applies_to?(project) #:nodoc:
|
58
|
+
!Dir[project.path_to(:source, bdd_dir, lang, '**/*.scala')].empty?
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def const_missing(const)
|
63
|
+
return super unless const == :REQUIRES # TODO: remove in 1.5
|
64
|
+
Buildr.application.deprecated "Please use Scala::Specs.dependencies/.version instead of ScalaSpecs::REQUIRES/VERSION"
|
65
|
+
dependencies
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def initialize(task, options) #:nodoc:
|
70
|
+
super
|
71
|
+
|
72
|
+
specs = task.project.path_to(:source, :spec, :scala)
|
73
|
+
task.compile.from specs if File.directory?(specs)
|
74
|
+
|
75
|
+
resources = task.project.path_to(:source, :spec, :resources)
|
76
|
+
task.resources.from resources if File.directory?(resources)
|
77
|
+
end
|
78
|
+
|
79
|
+
def tests(dependencies)
|
80
|
+
candidates = filter_classes(dependencies, :interfaces => ['org.specs.Specification'])
|
81
|
+
|
82
|
+
Java.load # Java is already loaded, but just in case
|
83
|
+
|
84
|
+
filter = Java.org.apache.buildr.JavaTestFilter.new(dependencies.to_java(Java.java.lang.String))
|
85
|
+
filter.add_fields ['MODULE$'].to_java(Java.java.lang.String)
|
86
|
+
filter.filter(candidates.to_java(Java.java.lang.String)).map { |s| s[0..(s.size - 2)] }
|
87
|
+
end
|
88
|
+
|
89
|
+
def run(specs, dependencies) #:nodoc:
|
90
|
+
cmd_options = { :properties => options[:properties],
|
91
|
+
:java_args => options[:java_args],
|
92
|
+
:classpath => dependencies,
|
93
|
+
:name => false }
|
94
|
+
|
95
|
+
runner = 'org.apache.buildr.SpecsSingletonRunner'
|
96
|
+
specs.inject [] do |passed, spec|
|
97
|
+
begin
|
98
|
+
unless Util.win_os?
|
99
|
+
Java::Commands.java(runner, task.compile.target.to_s, '-c', spec + '$', cmd_options)
|
100
|
+
else
|
101
|
+
Java::Commands.java(runner, task.compile.target.to_s, spec + '$', cmd_options)
|
102
|
+
end
|
103
|
+
rescue => e
|
104
|
+
passed
|
105
|
+
else
|
106
|
+
passed << spec
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Backwards compatibility stuff. Remove in 1.5.
|
114
|
+
module Buildr
|
115
|
+
ScalaSpecs = Scala::Specs
|
116
|
+
end
|
117
|
+
|
118
|
+
Buildr::TestFramework << Buildr::Scala::Specs
|
@@ -0,0 +1,242 @@
|
|
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 'buildr/core/project'
|
17
|
+
require 'buildr/core/common'
|
18
|
+
require 'buildr/core/compile'
|
19
|
+
require 'buildr/packaging'
|
20
|
+
|
21
|
+
module Buildr::Scala
|
22
|
+
DEFAULT_VERSION = '2.8.1'
|
23
|
+
|
24
|
+
class << self
|
25
|
+
|
26
|
+
def version_str
|
27
|
+
warn "Use of Scala.version_str is deprecated. Use Scala.version instead"
|
28
|
+
version
|
29
|
+
end
|
30
|
+
|
31
|
+
def installed_version
|
32
|
+
unless @installed_version
|
33
|
+
@installed_version = if Scalac.installed?
|
34
|
+
begin
|
35
|
+
# try to read the value from the properties file
|
36
|
+
props = Zip::ZipFile.open(File.expand_path('lib/scala-library.jar', Scalac.scala_home)) do |zipfile|
|
37
|
+
zipfile.read 'library.properties'
|
38
|
+
end
|
39
|
+
|
40
|
+
version_str = props.match(/version\.number\s*=\s*([^\s]+)/).to_a[1]
|
41
|
+
|
42
|
+
if version_str
|
43
|
+
md = version_str.match(/\d+\.\d[\d\.]*/) or
|
44
|
+
fail "Unable to parse Scala version: #{version_str}"
|
45
|
+
|
46
|
+
md[0].sub(/.$/, "") # remove trailing dot, if any
|
47
|
+
end
|
48
|
+
rescue => e
|
49
|
+
warn "Unable to parse library.properties in $SCALA_HOME/lib/scala-library.jar: #{e}"
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
@installed_version
|
56
|
+
end
|
57
|
+
|
58
|
+
def version
|
59
|
+
Buildr.settings.build['scala.version'] || installed_version || DEFAULT_VERSION
|
60
|
+
end
|
61
|
+
|
62
|
+
def compatible_28?
|
63
|
+
major, minor = version.match(/^(\d)\.(\d)/).to_a[1,2]
|
64
|
+
if major && minor
|
65
|
+
(major.to_i == 2 && minor.to_i >= 8) || (major.to_i > 2)
|
66
|
+
else
|
67
|
+
false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Scalac compiler:
|
73
|
+
# compile.using(:scalac)
|
74
|
+
# Used by default if .scala files are found in the src/main/scala directory (or src/test/scala)
|
75
|
+
# and sets the target directory to target/classes (or target/test/classes).
|
76
|
+
#
|
77
|
+
# Accepts the following options:
|
78
|
+
# * :warnings -- Generate warnings if true (opposite of -nowarn).
|
79
|
+
# * :deprecation -- Output source locations where deprecated APIs are used.
|
80
|
+
# * :optimise -- Generates faster bytecode by applying optimisations to the program.
|
81
|
+
# * :target -- Class file compatibility with specified release.
|
82
|
+
# * :debug -- Generate debugging info.
|
83
|
+
# * :other -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
|
84
|
+
class Scalac < Buildr::Compiler::Base
|
85
|
+
|
86
|
+
# The scalac compiler jars are added to classpath at load time,
|
87
|
+
# if you want to customize artifact versions, you must set them on the
|
88
|
+
#
|
89
|
+
# artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
|
90
|
+
#
|
91
|
+
# namespace before this file is required. This is of course, only
|
92
|
+
# if SCALA_HOME is not set or invalid.
|
93
|
+
REQUIRES = ArtifactNamespace.for(self) do |ns|
|
94
|
+
version = Buildr.settings.build['scala.version'] || DEFAULT_VERSION
|
95
|
+
ns.library! 'org.scala-lang:scala-library:jar:>=' + version
|
96
|
+
ns.compiler! 'org.scala-lang:scala-compiler:jar:>=' + version
|
97
|
+
end
|
98
|
+
|
99
|
+
class << self
|
100
|
+
def scala_home
|
101
|
+
env_home = ENV['SCALA_HOME']
|
102
|
+
|
103
|
+
@home ||= (if !env_home.nil? && File.exists?(env_home + '/lib/scala-library.jar') && File.exists?(env_home + '/lib/scala-compiler.jar')
|
104
|
+
env_home
|
105
|
+
else
|
106
|
+
nil
|
107
|
+
end)
|
108
|
+
end
|
109
|
+
|
110
|
+
def installed?
|
111
|
+
!scala_home.nil?
|
112
|
+
end
|
113
|
+
|
114
|
+
def use_installed?
|
115
|
+
if installed? && Buildr.settings.build['scala.version']
|
116
|
+
Buildr.settings.build['scala.version'] == Scala.installed_version
|
117
|
+
else
|
118
|
+
Buildr.settings.build['scala.version'].nil? && installed?
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def dependencies
|
123
|
+
if use_installed?
|
124
|
+
['scala-library', 'scala-compiler'].map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
|
125
|
+
else
|
126
|
+
REQUIRES.artifacts.map(&:to_s)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def use_fsc
|
131
|
+
use_installed? && ENV["USE_FSC"] =~ /^(yes|on|true)$/i
|
132
|
+
end
|
133
|
+
|
134
|
+
def applies_to?(project, task) #:nodoc:
|
135
|
+
paths = task.sources + [sources].flatten.map { |src| Array(project.path_to(:source, task.usage, src.to_sym)) }
|
136
|
+
paths.flatten!
|
137
|
+
|
138
|
+
# Just select if we find .scala files
|
139
|
+
paths.any? { |path| !Dir["#{path}/**/*.scala"].empty? }
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
Javac = Buildr::Compiler::Javac
|
144
|
+
|
145
|
+
OPTIONS = [:warnings, :deprecation, :optimise, :target, :debug, :other, :javac]
|
146
|
+
|
147
|
+
# Lazy evaluation to allow change in buildfile
|
148
|
+
Java.classpath << lambda { dependencies }
|
149
|
+
|
150
|
+
specify :language=>:scala, :sources => [:scala, :java], :source_ext => [:scala, :java],
|
151
|
+
:target=>'classes', :target_ext=>'class', :packaging=>:jar
|
152
|
+
|
153
|
+
def initialize(project, options) #:nodoc:
|
154
|
+
super
|
155
|
+
options[:debug] = Buildr.options.debug if options[:debug].nil?
|
156
|
+
options[:warnings] = verbose if options[:warnings].nil?
|
157
|
+
options[:deprecation] ||= false
|
158
|
+
options[:optimise] ||= false
|
159
|
+
options[:make] ||= :transitivenocp if Scala.compatible_28?
|
160
|
+
options[:javac] ||= {}
|
161
|
+
|
162
|
+
@java = Javac.new(project, options[:javac])
|
163
|
+
end
|
164
|
+
|
165
|
+
def compile(sources, target, dependencies) #:nodoc:
|
166
|
+
check_options(options, OPTIONS + (Scala.compatible_28? ? [:make] : []))
|
167
|
+
|
168
|
+
java_sources = java_sources(sources)
|
169
|
+
enable_dep_tracing = Scala.compatible_28? && java_sources.empty?
|
170
|
+
|
171
|
+
dependencies.unshift target if enable_dep_tracing
|
172
|
+
|
173
|
+
cmd_args = []
|
174
|
+
cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR)
|
175
|
+
source_paths = sources.select { |source| File.directory?(source) }
|
176
|
+
cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
|
177
|
+
cmd_args << '-d' << File.expand_path(target)
|
178
|
+
cmd_args += scalac_args
|
179
|
+
|
180
|
+
if enable_dep_tracing
|
181
|
+
dep_dir = File.expand_path(target)
|
182
|
+
Dir.mkdir dep_dir unless File.exists? dep_dir
|
183
|
+
|
184
|
+
cmd_args << '-make:' + options[:make].to_s
|
185
|
+
cmd_args << '-dependencyfile'
|
186
|
+
cmd_args << File.expand_path('.scala-deps', dep_dir)
|
187
|
+
end
|
188
|
+
|
189
|
+
cmd_args += files_from_sources(sources)
|
190
|
+
|
191
|
+
unless Buildr.application.options.dryrun
|
192
|
+
trace((['scalac'] + cmd_args).join(' '))
|
193
|
+
|
194
|
+
if Scalac.use_fsc
|
195
|
+
system(([File.expand_path('bin/fsc', Scalac.scala_home)] + cmd_args).join(' ')) or
|
196
|
+
fail 'Failed to compile, see errors above'
|
197
|
+
else
|
198
|
+
Java.load
|
199
|
+
begin
|
200
|
+
Java.scala.tools.nsc.Main.process(cmd_args.to_java(Java.java.lang.String))
|
201
|
+
rescue => e
|
202
|
+
fail "Scala compiler crashed:\n#{e.inspect}"
|
203
|
+
end
|
204
|
+
fail 'Failed to compile, see errors above' if Java.scala.tools.nsc.Main.reporter.hasErrors
|
205
|
+
end
|
206
|
+
|
207
|
+
unless java_sources.empty?
|
208
|
+
trace 'Compiling mixed Java/Scala sources'
|
209
|
+
|
210
|
+
# TODO includes scala-compiler.jar
|
211
|
+
deps = dependencies + Scalac.dependencies + [ File.expand_path(target) ]
|
212
|
+
@java.compile(java_sources, target, deps)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
private
|
218
|
+
|
219
|
+
def java_sources(sources)
|
220
|
+
sources.flatten.map { |source| File.directory?(source) ? FileList["#{source}/**/*.java"] : source } .
|
221
|
+
flatten.reject { |file| File.directory?(file) || File.extname(file) != '.java' }.map { |file| File.expand_path(file) }.uniq
|
222
|
+
end
|
223
|
+
|
224
|
+
# Returns Scalac command line arguments from the set of options.
|
225
|
+
def scalac_args #:nodoc:
|
226
|
+
args = []
|
227
|
+
args << "-nowarn" unless options[:warnings]
|
228
|
+
args << "-verbose" if trace?(:scalac)
|
229
|
+
args << "-g" if options[:debug]
|
230
|
+
args << "-deprecation" if options[:deprecation]
|
231
|
+
args << "-optimise" if options[:optimise]
|
232
|
+
args << "-target:jvm-" + options[:target].to_s if options[:target]
|
233
|
+
args + Array(options[:other])
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
# Scala compiler comes first, ahead of Javac, this allows it to pick
|
241
|
+
# projects that mix Scala and Java code by spotting Scala code first.
|
242
|
+
Buildr::Compiler.compilers.unshift Buildr::Scala::Scalac
|
@@ -0,0 +1,142 @@
|
|
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 'buildr/core/doc'
|
17
|
+
require 'buildr/scala/compiler' # ensure Scala dependencies are ready
|
18
|
+
|
19
|
+
module Buildr
|
20
|
+
module Doc
|
21
|
+
|
22
|
+
module ScaladocDefaults
|
23
|
+
include Extension
|
24
|
+
|
25
|
+
# Default scaladoc -doc-title to project's comment or name
|
26
|
+
after_define(:scaladoc => :doc) do |project|
|
27
|
+
if project.doc.engine? Scaladoc
|
28
|
+
options = project.doc.options
|
29
|
+
key = Scala.compatible_28? ? "doc-title".to_sym : :windowtitle
|
30
|
+
options[key] = (project.comment || project.name) unless options[key]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Scaladoc < Base
|
36
|
+
specify :language => :scala, :source_ext => 'scala'
|
37
|
+
|
38
|
+
def generate(sources, target, options = {})
|
39
|
+
cmd_args = [ '-d', target, trace?(:scaladoc) ? '-verbose' : '' ]
|
40
|
+
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
41
|
+
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
42
|
+
each do |key, value|
|
43
|
+
case value
|
44
|
+
when true, nil
|
45
|
+
cmd_args << "-#{key}"
|
46
|
+
when false
|
47
|
+
cmd_args << "-no#{key}"
|
48
|
+
when Hash
|
49
|
+
value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
|
50
|
+
else
|
51
|
+
cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
|
52
|
+
end
|
53
|
+
end
|
54
|
+
[:sourcepath, :classpath].each do |option|
|
55
|
+
Array(options[option]).flatten.tap do |paths|
|
56
|
+
cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
cmd_args += sources.flatten.uniq
|
60
|
+
unless Buildr.application.options.dryrun
|
61
|
+
info "Generating Scaladoc for #{project.name}"
|
62
|
+
trace (['scaladoc'] + cmd_args).join(' ')
|
63
|
+
Java.load
|
64
|
+
begin
|
65
|
+
Java.scala.tools.nsc.ScalaDoc.process(cmd_args.to_java(Java.java.lang.String))
|
66
|
+
rescue => e
|
67
|
+
fail 'Failed to generate Scaladocs, see errors above: ' + e
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class VScaladoc < Base
|
74
|
+
VERSION = '1.2-m1'
|
75
|
+
Buildr.repositories.remote << 'http://scala-tools.org/repo-snapshots'
|
76
|
+
|
77
|
+
class << self
|
78
|
+
def dependencies
|
79
|
+
[ "org.scala-tools:vscaladoc:jar:#{VERSION}" ]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
Java.classpath << dependencies
|
84
|
+
|
85
|
+
specify :language => :scala, :source_ext => 'scala'
|
86
|
+
|
87
|
+
def generate(sources, target, options = {})
|
88
|
+
cmd_args = [ '-d', target, (trace?(:vscaladoc) ? '-verbose' : ''),
|
89
|
+
'-sourcepath', project.compile.sources.join(File::PATH_SEPARATOR) ]
|
90
|
+
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
91
|
+
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
92
|
+
each do |key, value|
|
93
|
+
case value
|
94
|
+
when true, nil
|
95
|
+
cmd_args << "-#{key}"
|
96
|
+
when false
|
97
|
+
cmd_args << "-no#{key}"
|
98
|
+
when Hash
|
99
|
+
value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
|
100
|
+
else
|
101
|
+
cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
|
102
|
+
end
|
103
|
+
end
|
104
|
+
[:sourcepath, :classpath].each do |option|
|
105
|
+
Array(options[option]).flatten.tap do |paths|
|
106
|
+
cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
|
107
|
+
end
|
108
|
+
end
|
109
|
+
cmd_args += sources.flatten.uniq
|
110
|
+
unless Buildr.application.options.dryrun
|
111
|
+
info "Generating VScaladoc for #{project.name}"
|
112
|
+
trace (['vscaladoc'] + cmd_args).join(' ')
|
113
|
+
Java.load
|
114
|
+
Java.org.scala_tools.vscaladoc.Main.main(cmd_args.to_java(Java.java.lang.String)) == 0 or
|
115
|
+
fail 'Failed to generate VScaladocs, see errors above'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
module Packaging
|
122
|
+
module Scala
|
123
|
+
def package_as_scaladoc_spec(spec) #:nodoc:
|
124
|
+
spec.merge(:type=>:jar, :classifier=>'scaladoc')
|
125
|
+
end
|
126
|
+
|
127
|
+
def package_as_scaladoc(file_name) #:nodoc:
|
128
|
+
ZipTask.define_task(file_name).tap do |zip|
|
129
|
+
zip.include :from=>doc.target
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class Project
|
136
|
+
include ScaladocDefaults
|
137
|
+
include Packaging::Scala
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
Buildr::Doc.engines << Buildr::Doc::Scaladoc
|
142
|
+
Buildr::Doc.engines << Buildr::Doc::VScaladoc
|