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,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
|
+
}
|
@@ -0,0 +1,52 @@
|
|
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/shell'
|
18
|
+
require 'buildr/java/commands'
|
19
|
+
|
20
|
+
module Buildr
|
21
|
+
module Scala
|
22
|
+
class ScalaShell < Buildr::Shell::Base
|
23
|
+
include Buildr::JRebel
|
24
|
+
|
25
|
+
specify :name => :scala, :languages => [:scala]
|
26
|
+
|
27
|
+
def launch(task)
|
28
|
+
jline = [File.expand_path("lib/jline.jar", Scalac.scala_home)].find_all { |f| File.exist? f }
|
29
|
+
jline = ['jline:jline:jar:0.9.94'] if jline.empty?
|
30
|
+
|
31
|
+
cp = project.compile.dependencies +
|
32
|
+
Scalac.dependencies +
|
33
|
+
[ project.path_to(:target, :classes) ] +
|
34
|
+
task.classpath
|
35
|
+
|
36
|
+
java_args = jrebel_args + task.java_args
|
37
|
+
|
38
|
+
props = jrebel_props(project).merge(task.properties)
|
39
|
+
|
40
|
+
Java::Commands.java 'scala.tools.nsc.MainGenericRunner',
|
41
|
+
'-cp', cp.join(File::PATH_SEPARATOR),
|
42
|
+
{
|
43
|
+
:properties => props,
|
44
|
+
:classpath => cp + jline,
|
45
|
+
:java_args => java_args
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Buildr::Shell.providers << Buildr::Scala::ScalaShell
|
@@ -0,0 +1,171 @@
|
|
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/ant'
|
20
|
+
require 'buildr/java/tests'
|
21
|
+
|
22
|
+
|
23
|
+
module Buildr::Scala
|
24
|
+
# Scala::Check is available when using Scala::Test or Scala::Specs
|
25
|
+
module Check
|
26
|
+
VERSION = '1.8'
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def version
|
30
|
+
Buildr.settings.build['scala.check'] || VERSION
|
31
|
+
end
|
32
|
+
|
33
|
+
def classifier
|
34
|
+
Buildr.settings.build['scala.check.classifier'] || ""
|
35
|
+
end
|
36
|
+
|
37
|
+
def artifact
|
38
|
+
Buildr.settings.build['scala.check.artifact'] || "scalacheck_#{Buildr::Scala.version}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def dependencies
|
42
|
+
(version =~ /:/) ? [version] : ["org.scala-tools.testing:#{artifact}:jar:#{classifier}:#{version}"]
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def const_missing(const)
|
47
|
+
return super unless const == :REQUIRES # TODO: remove in 1.5
|
48
|
+
Buildr.application.deprecated "Please use Scala::Check.dependencies/.version instead of ScalaCheck::REQUIRES/VERSION"
|
49
|
+
dependencies
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# ScalaTest framework, the default test framework for Scala tests.
|
56
|
+
#
|
57
|
+
# Support the following options:
|
58
|
+
# * :properties -- Hash of system properties available to the test case.
|
59
|
+
# * :environment -- Hash of environment variables available to the test case.
|
60
|
+
# * :java_args -- Arguments passed as is to the JVM.
|
61
|
+
class ScalaTest < Buildr::TestFramework::Java
|
62
|
+
|
63
|
+
VERSION = '1.2'
|
64
|
+
|
65
|
+
class << self
|
66
|
+
def version
|
67
|
+
Buildr.settings.build['scala.test'] || VERSION
|
68
|
+
end
|
69
|
+
|
70
|
+
def dependencies
|
71
|
+
["org.scalatest:scalatest:jar:#{version}"] + Check.dependencies +
|
72
|
+
JMock.dependencies + JUnit.dependencies
|
73
|
+
end
|
74
|
+
|
75
|
+
def applies_to?(project) #:nodoc:
|
76
|
+
!Dir[project.path_to(:source, :test, :scala, '**/*.scala')].empty?
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
def const_missing(const)
|
81
|
+
return super unless const == :REQUIRES # TODO: remove in 1.5
|
82
|
+
Buildr.application.deprecated "Please use Scala::Test.dependencies/.version instead of ScalaTest::REQUIRES/VERSION"
|
83
|
+
dependencies
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# annotation-based group inclusion
|
88
|
+
attr_accessor :group_includes
|
89
|
+
|
90
|
+
# annotation-based group exclusion
|
91
|
+
attr_accessor :group_excludes
|
92
|
+
|
93
|
+
def initialize(test_task, options)
|
94
|
+
super
|
95
|
+
@group_includes = []
|
96
|
+
@group_excludes = []
|
97
|
+
end
|
98
|
+
|
99
|
+
def tests(dependencies) #:nodoc:
|
100
|
+
filter_classes(dependencies, :interfaces => %w{org.scalatest.Suite})
|
101
|
+
end
|
102
|
+
|
103
|
+
def run(scalatest, dependencies) #:nodoc:
|
104
|
+
mkpath task.report_to.to_s
|
105
|
+
success = []
|
106
|
+
|
107
|
+
reporter_options = 'TFGBSAR' # testSucceeded, testFailed, testIgnored, suiteAborted, runStopped, runAborted, runCompleted
|
108
|
+
scalatest.each do |suite|
|
109
|
+
info "ScalaTest #{suite.inspect}"
|
110
|
+
# Use Ant to execute the ScalaTest task, gives us performance and reporting.
|
111
|
+
reportDir = task.report_to.to_s
|
112
|
+
reportFile = File.join(reportDir, "TEST-#{suite}.txt")
|
113
|
+
taskdef = Buildr.artifacts(self.class.dependencies).each(&:invoke).map(&:to_s)
|
114
|
+
Buildr.ant('scalatest') do |ant|
|
115
|
+
# ScalaTestTask was deprecated in 1.2, in favor of ScalaTestAntTask
|
116
|
+
classname = (ScalaTest.version =~ /1\.[01]/) ? \
|
117
|
+
'org.scalatest.tools.ScalaTestTask' : 'org.scalatest.tools.ScalaTestAntTask'
|
118
|
+
ant.taskdef :name=>'scalatest', :classname=>'org.scalatest.tools.ScalaTestTask',
|
119
|
+
:classpath=>taskdef.join(File::PATH_SEPARATOR)
|
120
|
+
ant.scalatest :runpath=>dependencies.join(File::PATH_SEPARATOR) do
|
121
|
+
ant.suite :classname=>suite
|
122
|
+
ant.reporter :type=>'stdout', :config=>reporter_options
|
123
|
+
ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
|
124
|
+
ant.reporter :type=>(ScalaTest.version == "1.0") ? "xml" : "junitxml",
|
125
|
+
:directory=> reportDir, :config=>reporter_options
|
126
|
+
# TODO: This should be name=>value pairs!
|
127
|
+
#ant.includes group_includes.join(" ") if group_includes
|
128
|
+
#ant.excludes group_excludes.join(" ") if group_excludes
|
129
|
+
(options[:properties] || []).each { |name, value| ant.config :name=>name, :value=>value }
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Parse for failures, errors, etc.
|
134
|
+
# This is a bit of a pain right now because ScalaTest doesn't flush its
|
135
|
+
# output synchronously before the Ant test finishes so we have to loop
|
136
|
+
# and wait for an indication that the test run was completed.
|
137
|
+
failed = false
|
138
|
+
completed = false
|
139
|
+
wait = 0
|
140
|
+
while (!completed) do
|
141
|
+
File.open(reportFile, "r") do |input|
|
142
|
+
while (line = input.gets) do
|
143
|
+
failed = (line =~ /(TESTS? FAILED)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
|
144
|
+
completed |= (line =~ /Run completed/)
|
145
|
+
break if (failed)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
wait += 1
|
149
|
+
break if (failed || wait > 10)
|
150
|
+
unless completed
|
151
|
+
sleep(1)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
success << suite if (completed && !failed)
|
155
|
+
end
|
156
|
+
|
157
|
+
success
|
158
|
+
end # run
|
159
|
+
|
160
|
+
end # ScalaTest
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
# Backwards compatibility stuff. Remove in 1.5.
|
166
|
+
module Buildr
|
167
|
+
ScalaCheck = Scala::Check
|
168
|
+
ScalaTest = Scala::ScalaTest
|
169
|
+
end
|
170
|
+
|
171
|
+
Buildr::TestFramework << Buildr::Scala::ScalaTest
|
@@ -0,0 +1,185 @@
|
|
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
|
+
module Buildr
|
18
|
+
module Shell
|
19
|
+
include Extension
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def providers
|
23
|
+
@providers ||= []
|
24
|
+
end
|
25
|
+
|
26
|
+
def select_by_lang(lang)
|
27
|
+
fail 'Unable to define shell task for nil language' if lang.nil?
|
28
|
+
providers.detect { |e| e.languages.nil? ? false : e.languages.include?(lang.to_sym) }
|
29
|
+
end
|
30
|
+
|
31
|
+
alias_method :select, :select_by_lang
|
32
|
+
|
33
|
+
def select_by_name(name)
|
34
|
+
fail 'Unable to define run task for nil' if name.nil?
|
35
|
+
providers.detect { |e| e.to_sym == name.to_sym }
|
36
|
+
end
|
37
|
+
|
38
|
+
def define_task(project, name, provider = nil)
|
39
|
+
ShellTask.define_task(name).tap do |t|
|
40
|
+
t.send(:associate_with, project)
|
41
|
+
t.enhance([project.compile]) do |t|
|
42
|
+
# double-enhance to execute the provider last
|
43
|
+
t.enhance { |t| t.run }
|
44
|
+
end
|
45
|
+
t.using provider.to_sym if provider
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
first_time do
|
51
|
+
Project.local_task 'shell'
|
52
|
+
|
53
|
+
providers.each { |provider| Project.local_task "shell:#{provider.to_sym}" }
|
54
|
+
end
|
55
|
+
|
56
|
+
before_define(:shell => :compile) do |project|
|
57
|
+
define_task(project, "shell")
|
58
|
+
providers.each { |provider| define_task(project, "shell:#{provider.to_sym}", provider) }
|
59
|
+
end
|
60
|
+
|
61
|
+
after_define(:shell => :compile) do |project|
|
62
|
+
unless project.shell.provider
|
63
|
+
provider = providers.find { |p| p.languages.include? project.compile.language if p.languages }
|
64
|
+
if provider
|
65
|
+
project.shell.using provider.to_sym
|
66
|
+
project.shell.with project.test.compile.dependencies
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Base class for any shell provider.
|
72
|
+
class Base
|
73
|
+
attr_reader :project # :nodoc:
|
74
|
+
|
75
|
+
class << self
|
76
|
+
attr_accessor :shell_name, :languages
|
77
|
+
|
78
|
+
def specify(options)
|
79
|
+
@shell_name ||= options[:name]
|
80
|
+
@languages ||= options[:languages]
|
81
|
+
end
|
82
|
+
|
83
|
+
def to_sym
|
84
|
+
@shell_name || name.split('::').last.downcase.to_sym
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def initialize(project)
|
89
|
+
@project = project
|
90
|
+
end
|
91
|
+
|
92
|
+
def launch(task)
|
93
|
+
fail 'Not implemented'
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
class ShellTask < Rake::Task
|
99
|
+
attr_reader :project # :nodoc:
|
100
|
+
|
101
|
+
# Classpath dependencies.
|
102
|
+
attr_accessor :classpath
|
103
|
+
|
104
|
+
# Returns the run options.
|
105
|
+
attr_reader :options
|
106
|
+
|
107
|
+
# Underlying shell provider
|
108
|
+
attr_reader :provider
|
109
|
+
|
110
|
+
def initialize(*args) # :nodoc:
|
111
|
+
super
|
112
|
+
@options = {}
|
113
|
+
@classpath = []
|
114
|
+
end
|
115
|
+
|
116
|
+
# :call-seq:
|
117
|
+
# with(*artifacts) => self
|
118
|
+
#
|
119
|
+
# Adds files and artifacts as classpath dependencies, and returns self.
|
120
|
+
def with(*specs)
|
121
|
+
@classpath |= Buildr.artifacts(specs.flatten).uniq
|
122
|
+
self
|
123
|
+
end
|
124
|
+
|
125
|
+
# :call-seq:
|
126
|
+
# using(options) => self
|
127
|
+
#
|
128
|
+
# Sets the run options from a hash and returns self.
|
129
|
+
#
|
130
|
+
# For example:
|
131
|
+
# shell.using :properties => {'foo' => 'bar'}
|
132
|
+
# shell.using :bsh
|
133
|
+
def using(*args)
|
134
|
+
if Hash === args.last
|
135
|
+
args.pop.each { |key, value| @options[key.to_sym] = value }
|
136
|
+
end
|
137
|
+
|
138
|
+
until args.empty?
|
139
|
+
new_shell = Shell.select_by_name(args.pop)
|
140
|
+
@provider = new_shell.new(project) unless new_shell.nil?
|
141
|
+
end
|
142
|
+
|
143
|
+
self
|
144
|
+
end
|
145
|
+
|
146
|
+
def run
|
147
|
+
fail "No shell provider defined in project '#{project.name}' for language '#{project.compile.language.inspect}'" unless provider
|
148
|
+
provider.launch(self)
|
149
|
+
end
|
150
|
+
|
151
|
+
def prerequisites #:nodoc:
|
152
|
+
super + classpath
|
153
|
+
end
|
154
|
+
|
155
|
+
def java_args
|
156
|
+
@options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split
|
157
|
+
end
|
158
|
+
|
159
|
+
def properties
|
160
|
+
@options[:properties] || {}
|
161
|
+
end
|
162
|
+
|
163
|
+
private
|
164
|
+
def associate_with(project)
|
165
|
+
@project ||= project
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
# :call-seq:
|
171
|
+
# shell(&block) => ShellTask
|
172
|
+
#
|
173
|
+
# This method returns the project's shell task. It also accepts a block to be executed
|
174
|
+
# when the shell task is invoked.
|
175
|
+
def shell(&block)
|
176
|
+
task('shell').tap do |t|
|
177
|
+
t.enhance &block if block
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
class Project
|
183
|
+
include Shell
|
184
|
+
end
|
185
|
+
end
|