buildr 1.3.5 → 1.4.0
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 +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/shell.rb +33 -33
- data/lib/buildr.rb +1 -1
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +149 -133
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- data/rakelib/stage.rake~ +0 -213
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
class Scaladoc < Base
|
|
22
|
+
specify :language => :scala, :source_ext => 'scala'
|
|
23
|
+
|
|
24
|
+
def generate(sources, target, options = {})
|
|
25
|
+
cmd_args = [ '-d', target, Buildr.application.options.trace ? '-verbose' : '' ]
|
|
26
|
+
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
|
27
|
+
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
|
28
|
+
each do |key, value|
|
|
29
|
+
case value
|
|
30
|
+
when true, nil
|
|
31
|
+
cmd_args << "-#{key}"
|
|
32
|
+
when false
|
|
33
|
+
cmd_args << "-no#{key}"
|
|
34
|
+
when Hash
|
|
35
|
+
value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
|
|
36
|
+
else
|
|
37
|
+
cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
[:sourcepath, :classpath].each do |option|
|
|
41
|
+
Array(options[option]).flatten.tap do |paths|
|
|
42
|
+
cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
cmd_args += sources.flatten.uniq
|
|
46
|
+
unless Buildr.application.options.dryrun
|
|
47
|
+
info "Generating Scaladoc for #{project.name}"
|
|
48
|
+
trace (['scaladoc'] + cmd_args).join(' ')
|
|
49
|
+
Java.load
|
|
50
|
+
Java.scala.tools.nsc.ScalaDoc.main(cmd_args.to_java(Java.java.lang.String)) == 0 or
|
|
51
|
+
fail 'Failed to generate Scaladocs, see errors above'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class VScaladoc < Base
|
|
57
|
+
VERSION = '1.2-SNAPSHOT'
|
|
58
|
+
Buildr.repositories.remote << 'http://scala-tools.org/repo-snapshots'
|
|
59
|
+
|
|
60
|
+
class << self
|
|
61
|
+
def dependencies
|
|
62
|
+
[ "org.scala-tools:vscaladoc:jar:#{VERSION}" ]
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
Java.classpath << dependencies
|
|
67
|
+
|
|
68
|
+
specify :language => :scala, :source_ext => 'scala'
|
|
69
|
+
|
|
70
|
+
def generate(sources, target, options = {})
|
|
71
|
+
cmd_args = [ '-d', target, (Buildr.application.options.trace ? '-verbose' : ''),
|
|
72
|
+
'-sourcepath', project.compile.sources.join(File::PATH_SEPARATOR) ]
|
|
73
|
+
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
|
74
|
+
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
|
75
|
+
each do |key, value|
|
|
76
|
+
case value
|
|
77
|
+
when true, nil
|
|
78
|
+
cmd_args << "-#{key}"
|
|
79
|
+
when false
|
|
80
|
+
cmd_args << "-no#{key}"
|
|
81
|
+
when Hash
|
|
82
|
+
value.each { |k,v| cmd_args << "-#{key}" << k.to_s << v.to_s }
|
|
83
|
+
else
|
|
84
|
+
cmd_args += Array(value).map { |item| ["-#{key}", item.to_s] }.flatten
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
[:sourcepath, :classpath].each do |option|
|
|
88
|
+
Array(options[option]).flatten.tap do |paths|
|
|
89
|
+
cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
cmd_args += sources.flatten.uniq
|
|
93
|
+
unless Buildr.application.options.dryrun
|
|
94
|
+
info "Generating VScaladoc for #{project.name}"
|
|
95
|
+
trace (['vscaladoc'] + cmd_args).join(' ')
|
|
96
|
+
Java.load
|
|
97
|
+
Java.org.scala_tools.vscaladoc.Main.main(cmd_args.to_java(Java.java.lang.String)) == 0 or
|
|
98
|
+
fail 'Failed to generate VScaladocs, see errors above'
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
Buildr::Doc.engines << Buildr::Doc::Scaladoc
|
|
106
|
+
Buildr::Doc.engines << Buildr::Doc::VScaladoc
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
|
14
|
+
* under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
package org.apache.buildr;
|
|
18
|
+
|
|
19
|
+
import java.lang.reflect.Field;
|
|
20
|
+
import java.lang.reflect.Method;
|
|
21
|
+
import java.net.URL;
|
|
22
|
+
import java.net.URLClassLoader;
|
|
23
|
+
import java.io.File;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @author Daniel Spiewak
|
|
27
|
+
*/
|
|
28
|
+
public class SpecsSingletonRunner {
|
|
29
|
+
// Incompatible with JVM 1.4 target
|
|
30
|
+
// @throws(classOf[Throwable])
|
|
31
|
+
public static void main(String[] args) {
|
|
32
|
+
boolean colors = (args.length > 1 && args[1].equals("-c"));
|
|
33
|
+
String spec = colors ? args[2] : args[1];
|
|
34
|
+
|
|
35
|
+
run(args[0], colors, spec);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Incompatible with JVM 1.4 target
|
|
39
|
+
// @throws(classOf[Throwable])
|
|
40
|
+
static void run(String path, boolean colors, String spec) {
|
|
41
|
+
try {
|
|
42
|
+
File parent = new File(path);
|
|
43
|
+
URL specURL = new File(parent, spec.replace('.', '/') + ".class").toURL();
|
|
44
|
+
URLClassLoader loader = new URLClassLoader(new URL[] { specURL }, Thread.currentThread().getContextClassLoader());
|
|
45
|
+
|
|
46
|
+
Class clazz = loader.loadClass(spec);
|
|
47
|
+
Object instance = clazz.getField("MODULE$").get(null);
|
|
48
|
+
|
|
49
|
+
Method main = clazz.getMethod("main", String[].class);
|
|
50
|
+
|
|
51
|
+
String[] args = colors ? new String[] { "-c" } : new String[] {};
|
|
52
|
+
main.invoke(instance, new Object[] { args });
|
|
53
|
+
} catch (Exception e) {
|
|
54
|
+
throw new RuntimeException(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
data/lib/buildr/scala/shell.rb
CHANGED
|
@@ -21,30 +21,35 @@ module Buildr
|
|
|
21
21
|
module Scala
|
|
22
22
|
class ScalaShell < Buildr::Shell::Base
|
|
23
23
|
include Buildr::Shell::JavaRebel
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
class << self
|
|
26
26
|
def lang
|
|
27
27
|
:scala
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
def to_sym
|
|
31
31
|
:scala
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
def launch
|
|
36
|
-
cp = project.compile.dependencies +
|
|
36
|
+
cp = project.compile.dependencies +
|
|
37
37
|
Scalac.dependencies +
|
|
38
38
|
[project.path_to(:target, :classes)]
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
props = {
|
|
41
|
-
'env.classpath' => cp.join(File::PATH_SEPARATOR),
|
|
42
41
|
'scala.home' => Scalac.scala_home
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
jline = [File.expand_path("lib/jline.jar", Scalac.scala_home)].find_all do |f|
|
|
45
|
+
File.exist? f
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Java::Commands.java 'scala.tools.nsc.MainGenericRunner',
|
|
49
|
+
'-cp', cp.join(File::PATH_SEPARATOR),
|
|
50
|
+
{
|
|
46
51
|
:properties => props.merge(rebel_props(project)),
|
|
47
|
-
:classpath =>
|
|
52
|
+
:classpath => Scalac.dependencies + jline,
|
|
48
53
|
:java_args => rebel_args
|
|
49
54
|
}
|
|
50
55
|
end
|
data/lib/buildr/scala/tests.rb
CHANGED
|
@@ -23,16 +23,20 @@ require 'buildr/java/tests'
|
|
|
23
23
|
module Buildr::Scala
|
|
24
24
|
# Scala::Check is available when using Scala::Test or Scala::Specs
|
|
25
25
|
module Check
|
|
26
|
-
VERSION = '1.
|
|
27
|
-
|
|
26
|
+
VERSION = '1.6'
|
|
27
|
+
|
|
28
28
|
class << self
|
|
29
29
|
def version
|
|
30
30
|
Buildr.settings.build['scala.check'] || VERSION
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
def classifier
|
|
34
|
+
Buildr.settings.build['scala.check.classifier'] || ""
|
|
35
|
+
end
|
|
36
|
+
|
|
33
37
|
def dependencies
|
|
34
|
-
["org.scala-tools.testing:scalacheck:jar:#{version}"]
|
|
35
|
-
end
|
|
38
|
+
["org.scala-tools.testing:scalacheck:jar:#{classifier}:#{version}"]
|
|
39
|
+
end
|
|
36
40
|
|
|
37
41
|
private
|
|
38
42
|
def const_missing(const)
|
|
@@ -42,8 +46,8 @@ module Buildr::Scala
|
|
|
42
46
|
end
|
|
43
47
|
end
|
|
44
48
|
end
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
|
|
50
|
+
|
|
47
51
|
# ScalaTest framework, the default test framework for Scala tests.
|
|
48
52
|
#
|
|
49
53
|
# Support the following options:
|
|
@@ -52,36 +56,36 @@ module Buildr::Scala
|
|
|
52
56
|
# * :java_args -- Arguments passed as is to the JVM.
|
|
53
57
|
class ScalaTest < Buildr::TestFramework::Java
|
|
54
58
|
|
|
55
|
-
VERSION = '0.
|
|
59
|
+
VERSION = '1.0.1'
|
|
56
60
|
|
|
57
61
|
class << self
|
|
58
62
|
def version
|
|
59
63
|
Buildr.settings.build['scala.test'] || VERSION
|
|
60
64
|
end
|
|
61
|
-
|
|
65
|
+
|
|
62
66
|
def dependencies
|
|
63
|
-
["org.
|
|
67
|
+
["org.scalatest:scalatest:jar:#{version}"] + Check.dependencies +
|
|
64
68
|
JMock.dependencies + JUnit.dependencies
|
|
65
|
-
end
|
|
69
|
+
end
|
|
66
70
|
|
|
67
71
|
def applies_to?(project) #:nodoc:
|
|
68
72
|
!Dir[project.path_to(:source, :test, :scala, '**/*.scala')].empty?
|
|
69
|
-
end
|
|
70
|
-
|
|
73
|
+
end
|
|
74
|
+
|
|
71
75
|
private
|
|
72
76
|
def const_missing(const)
|
|
73
77
|
return super unless const == :REQUIRES # TODO: remove in 1.5
|
|
74
78
|
Buildr.application.deprecated "Please use Scala::Test.dependencies/.version instead of ScalaTest::REQUIRES/VERSION"
|
|
75
79
|
dependencies
|
|
76
80
|
end
|
|
77
|
-
end
|
|
81
|
+
end
|
|
78
82
|
|
|
79
83
|
# annotation-based group inclusion
|
|
80
84
|
attr_accessor :group_includes
|
|
81
|
-
|
|
85
|
+
|
|
82
86
|
# annotation-based group exclusion
|
|
83
87
|
attr_accessor :group_excludes
|
|
84
|
-
|
|
88
|
+
|
|
85
89
|
def initialize(test_task, options)
|
|
86
90
|
super
|
|
87
91
|
@group_includes = []
|
|
@@ -100,7 +104,8 @@ module Buildr::Scala
|
|
|
100
104
|
scalatest.each do |suite|
|
|
101
105
|
info "ScalaTest #{suite.inspect}"
|
|
102
106
|
# Use Ant to execute the ScalaTest task, gives us performance and reporting.
|
|
103
|
-
|
|
107
|
+
reportDir = task.report_to.to_s
|
|
108
|
+
reportFile = File.join(reportDir, "TEST-#{suite}.txt")
|
|
104
109
|
taskdef = Buildr.artifacts(self.class.dependencies).each(&:invoke).map(&:to_s)
|
|
105
110
|
Buildr.ant('scalatest') do |ant|
|
|
106
111
|
ant.taskdef :name=>'scalatest', :classname=>'org.scalatest.tools.ScalaTestTask',
|
|
@@ -109,42 +114,44 @@ module Buildr::Scala
|
|
|
109
114
|
ant.suite :classname=>suite
|
|
110
115
|
ant.reporter :type=>'stdout', :config=>reporter_options
|
|
111
116
|
ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
|
|
117
|
+
ant.reporter :type=>(ScalaTest.version == "1.0") ? "xml" : "junitxml",
|
|
118
|
+
:directory=> reportDir, :config=>reporter_options
|
|
112
119
|
# TODO: This should be name=>value pairs!
|
|
113
120
|
#ant.includes group_includes.join(" ") if group_includes
|
|
114
121
|
#ant.excludes group_excludes.join(" ") if group_excludes
|
|
115
|
-
(options[:properties] || []).each { |name, value| ant.
|
|
122
|
+
(options[:properties] || []).each { |name, value| ant.config :name=>name, :value=>value }
|
|
116
123
|
end
|
|
117
124
|
end
|
|
118
|
-
|
|
125
|
+
|
|
119
126
|
# Parse for failures, errors, etc.
|
|
120
127
|
# This is a bit of a pain right now because ScalaTest doesn't flush its
|
|
121
|
-
# output synchronously before the Ant test finishes so we have to loop
|
|
122
|
-
# and wait for an indication that the test run was completed.
|
|
128
|
+
# output synchronously before the Ant test finishes so we have to loop
|
|
129
|
+
# and wait for an indication that the test run was completed.
|
|
123
130
|
failed = false
|
|
124
131
|
completed = false
|
|
125
132
|
wait = 0
|
|
126
133
|
while (!completed) do
|
|
127
134
|
File.open(reportFile, "r") do |input|
|
|
128
135
|
while (line = input.gets) do
|
|
129
|
-
failed = (line =~ /(TESTS? FAILED
|
|
130
|
-
completed |= (line =~ /Run completed
|
|
136
|
+
failed = (line =~ /(TESTS? FAILED)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
|
|
137
|
+
completed |= (line =~ /Run completed/)
|
|
131
138
|
break if (failed)
|
|
132
139
|
end
|
|
133
140
|
end
|
|
134
141
|
wait += 1
|
|
135
|
-
break if (failed || wait > 10)
|
|
142
|
+
break if (failed || wait > 10)
|
|
136
143
|
unless completed
|
|
137
144
|
sleep(1)
|
|
138
145
|
end
|
|
139
146
|
end
|
|
140
147
|
success << suite if (completed && !failed)
|
|
141
148
|
end
|
|
142
|
-
|
|
149
|
+
|
|
143
150
|
success
|
|
144
151
|
end # run
|
|
145
152
|
|
|
146
153
|
end # ScalaTest
|
|
147
|
-
|
|
154
|
+
|
|
148
155
|
end
|
|
149
156
|
|
|
150
157
|
|
data/lib/buildr/scala.rb
CHANGED
|
@@ -20,6 +20,7 @@ Buildr.repositories.remote << 'http://scala-tools.org/repo-releases'
|
|
|
20
20
|
require 'buildr/scala/compiler'
|
|
21
21
|
require 'buildr/scala/tests'
|
|
22
22
|
require 'buildr/scala/bdd'
|
|
23
|
+
require 'buildr/scala/doc'
|
|
23
24
|
require 'buildr/scala/shell'
|
|
24
25
|
|
|
25
26
|
Object::Scala = Buildr::Scala
|
data/lib/buildr/shell.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Buildr
|
|
|
19
19
|
class << self
|
|
20
20
|
def add(p)
|
|
21
21
|
@providers ||= {}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
if p.lang == :none
|
|
24
24
|
@providers[:none] ||= []
|
|
25
25
|
@providers[:none] << p
|
|
@@ -28,11 +28,11 @@ module Buildr
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
alias :<< :add
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
def providers
|
|
33
33
|
@providers ||= {}
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
def each
|
|
37
37
|
providers.each do |lang, p|
|
|
38
38
|
if lang == :none
|
|
@@ -46,51 +46,51 @@ module Buildr
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
module Shell
|
|
51
51
|
class Base
|
|
52
52
|
attr_reader :project
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
class << self
|
|
55
55
|
def lang
|
|
56
56
|
:none
|
|
57
57
|
end
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
def to_sym
|
|
60
60
|
@symbol ||= name.split('::').last.downcase.to_sym
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
def initialize(project)
|
|
65
65
|
@project = project
|
|
66
66
|
end
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
def build?
|
|
69
69
|
true
|
|
70
70
|
end
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
def launch
|
|
73
73
|
fail 'Not implemented'
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
module JavaRebel
|
|
78
78
|
def rebel_home
|
|
79
79
|
unless @rebel_home
|
|
80
|
-
@rebel_home = ENV['REBEL_HOME'] or ENV['
|
|
81
|
-
|
|
80
|
+
@rebel_home = ENV['REBEL_HOME'] or ENV['JREBEL'] or ENV['JREBEL_HOME']
|
|
81
|
+
|
|
82
82
|
if @rebel_home and File.directory? @rebel_home
|
|
83
|
-
@rebel_home += File::SEPARATOR + '
|
|
83
|
+
@rebel_home += File::SEPARATOR + 'jrebel.jar'
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
if @rebel_home and File.exists? @rebel_home
|
|
88
88
|
@rebel_home
|
|
89
89
|
else
|
|
90
90
|
nil
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
def rebel_args
|
|
95
95
|
if rebel_home
|
|
96
96
|
[
|
|
@@ -101,44 +101,44 @@ module Buildr
|
|
|
101
101
|
[]
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
def rebel_props(project)
|
|
106
106
|
{}
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
module ShellExtension
|
|
112
112
|
include Extension
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
first_time do
|
|
115
115
|
Project.local_task 'shell'
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
|
|
118
118
|
end
|
|
119
|
-
|
|
120
|
-
before_define do |project|
|
|
119
|
+
|
|
120
|
+
before_define(:shell => :compile) do |project|
|
|
121
121
|
ShellProviders.each do |p|
|
|
122
122
|
name = p.to_sym
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
trace "Defining task #{project.name}:shell:#{name}"
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
p_inst = p.new project
|
|
127
127
|
deps = if p_inst.build? then [:compile] else [] end
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
project.task "shell:#{name}" => deps do
|
|
130
130
|
trace "Launching #{name} shell"
|
|
131
131
|
p_inst.launch
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
|
-
|
|
136
|
-
after_define do |project|
|
|
135
|
+
|
|
136
|
+
after_define(:shell => :compile) do |project|
|
|
137
137
|
default_shell = project.shell.using
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
if default_shell
|
|
140
140
|
dep = "shell:#{default_shell.to_sym}"
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
trace "Defining task shell based on #{dep}"
|
|
143
143
|
project.task :shell => dep
|
|
144
144
|
else
|
|
@@ -147,12 +147,12 @@ module Buildr
|
|
|
147
147
|
end
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
class ShellConfig
|
|
152
152
|
def initialize(project)
|
|
153
153
|
@project = project
|
|
154
154
|
end
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
def using(*args)
|
|
157
157
|
if args.size > 0
|
|
158
158
|
@using ||= args.first
|
|
@@ -160,20 +160,20 @@ module Buildr
|
|
|
160
160
|
@using ||= find_shell_task
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
|
-
|
|
163
|
+
|
|
164
164
|
private
|
|
165
165
|
def find_shell_task
|
|
166
166
|
lang = @project.compile.language
|
|
167
167
|
ShellProviders.providers[lang]
|
|
168
168
|
end
|
|
169
169
|
end
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
# TODO temporary hack
|
|
172
172
|
def shell
|
|
173
173
|
@shell ||= ShellConfig.new self
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
class Project
|
|
178
178
|
include ShellExtension
|
|
179
179
|
end
|
data/lib/buildr.rb
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
desc "Create JRuby all-in-one distribution"
|
|
17
|
+
task "all-in-one" => 'all-in-one:all-in-one'
|
|
18
|
+
|
|
19
|
+
namespace :'all-in-one' do
|
|
20
|
+
|
|
21
|
+
version = "1.5.1"
|
|
22
|
+
jruby_distro = "jruby-bin-#{version}.tar.gz"
|
|
23
|
+
url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}"
|
|
24
|
+
dir = "jruby-#{version}"
|
|
25
|
+
|
|
26
|
+
task "all-in-one" => [:gem,
|
|
27
|
+
# Prepare to run
|
|
28
|
+
:prepare,
|
|
29
|
+
# Download and extract JRuby
|
|
30
|
+
:download_and_extract,
|
|
31
|
+
# Cleanup JRuby distribution
|
|
32
|
+
:clean_dist,
|
|
33
|
+
# Install Buildr gem and dependencies
|
|
34
|
+
:install_dependencies,
|
|
35
|
+
# Add Buildr executables/scripts
|
|
36
|
+
:add_execs,
|
|
37
|
+
# Package distribution
|
|
38
|
+
:package
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
desc 'Prepare to run'
|
|
42
|
+
task :prepare do
|
|
43
|
+
mkpath '_all-in-one'
|
|
44
|
+
cd '_all-in-one'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc 'Download and extract JRuby'
|
|
48
|
+
task :download_and_extract do
|
|
49
|
+
unless File.exist? jruby_distro
|
|
50
|
+
puts "Downloading JRuby from #{url} ..."
|
|
51
|
+
sh 'wget', url
|
|
52
|
+
puts "[X] Downloaded JRuby"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
rm_rf dir if File.exist? dir
|
|
56
|
+
|
|
57
|
+
puts "Extracting JRuby to #{dir} ..."
|
|
58
|
+
sh 'tar', 'xzf', jruby_distro
|
|
59
|
+
puts "[X] Extracted JRuby"
|
|
60
|
+
cd dir
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc 'Cleanup JRuby distribution'
|
|
64
|
+
task :clean_dist do
|
|
65
|
+
puts 'Cleaning...'
|
|
66
|
+
rm_rf 'docs'
|
|
67
|
+
mkpath 'jruby-docs'
|
|
68
|
+
mv Dir["COPYING*"], 'jruby-docs'
|
|
69
|
+
mv Dir["LICENSE*"], 'jruby-docs'
|
|
70
|
+
mv 'README', 'jruby-docs'
|
|
71
|
+
rm_rf 'lib/ruby/1.9'
|
|
72
|
+
rm_rf 'lib/ruby/gems/1.8/doc'
|
|
73
|
+
rm_rf 'samples'
|
|
74
|
+
rm_rf 'share'
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
desc 'Install Buildr gem and dependencies'
|
|
78
|
+
task :install_dependencies do
|
|
79
|
+
puts "Install Buildr gem ..."
|
|
80
|
+
sh "bin/jruby", '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
|
|
81
|
+
'--no-rdoc', '--no-ri'
|
|
82
|
+
puts "[X] Install Buildr gem"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
desc 'Add Buildr executables/scripts'
|
|
86
|
+
task :add_execs do
|
|
87
|
+
cp 'bin/jruby.exe', 'bin/_buildr.exe'
|
|
88
|
+
cp Dir["../../all-in-one/*"], 'bin'
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
desc 'Package distribution'
|
|
92
|
+
task :package do
|
|
93
|
+
puts "Zipping distribution ..."
|
|
94
|
+
cd '..'
|
|
95
|
+
new_dir = "#{spec.name}-#{spec.version}"
|
|
96
|
+
mv dir, new_dir
|
|
97
|
+
zip = "#{new_dir}.zip"
|
|
98
|
+
rm zip if File.exist? zip
|
|
99
|
+
sh 'zip', '-q', '-r', zip, new_dir
|
|
100
|
+
puts "[X] Zipped distribution"
|
|
101
|
+
|
|
102
|
+
puts "Tarring distribution ..."
|
|
103
|
+
tar = "#{new_dir}.tar.gz"
|
|
104
|
+
rm tar if File.exist? tar
|
|
105
|
+
sh 'tar', 'czf', tar, new_dir
|
|
106
|
+
puts "[X] Tarred distribution"
|
|
107
|
+
|
|
108
|
+
rm_rf new_dir
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
task(:clobber) { rm_rf '_all-in-one' }
|
data/rakelib/checks.rake
CHANGED
|
@@ -18,7 +18,7 @@ desc "Check that source files contain the Apache license"
|
|
|
18
18
|
task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
|
|
19
19
|
puts "Checking that files contain the Apache license ... "
|
|
20
20
|
required = task.prerequisites.select { |fn| File.file?(fn) }
|
|
21
|
-
missing = required.reject { |fn|
|
|
21
|
+
missing = required.reject { |fn|
|
|
22
22
|
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
|
|
23
23
|
map { |match| match.compact }.flatten.join("\n")
|
|
24
24
|
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
|