You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2016/08/15 06:10:38 UTC
[1/7] buildr git commit: Move to Scala 2.11
Repository: buildr
Updated Branches:
refs/heads/master 4fd3b06bc -> db57d6764
Move to Scala 2.11
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/c0e155b3
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/c0e155b3
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/c0e155b3
Branch: refs/heads/master
Commit: c0e155b36bfe33873c7555cb87f51e7175bbf43d
Parents: 4fd3b06
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 18:37:47 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 18:37:47 2016 -0700
----------------------------------------------------------------------
doc/languages.textile | 34 --------------------
lib/buildr/scala.rb | 1 -
lib/buildr/scala/bdd.rb | 43 +++++++++++++++++++++----
lib/buildr/scala/compiler.rb | 67 ++++++++-------------------------------
lib/buildr/scala/tests.rb | 30 +++++++++++-------
spec/sandbox.rb | 2 +-
spec/scala/compiler_spec.rb | 67 +--------------------------------------
spec/scala/tests_spec.rb | 16 ++++------
8 files changed, 76 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/doc/languages.textile
----------------------------------------------------------------------
diff --git a/doc/languages.textile b/doc/languages.textile
index b31d6ac..5e45546 100644
--- a/doc/languages.textile
+++ b/doc/languages.textile
@@ -238,8 +238,6 @@ h4. Fast Scala Compiler
You may use @fsc@, the Fast Scala Compiler, which submits compilation jobs to a compilation daemon, by setting the environment variable @USE_FSC@ to @yes@. Note that @fsc@ _may_ cache class libraries -- don't forget to run @fsc -reset@ if you upgrade a library.
-(Note @fsc@ is not compatible with @zinc@ incremental compilation.)
-
h4. Rebuild detection
*Scala 2.7*
@@ -270,38 +268,6 @@ To avoid unusual behavior, compiler-level change detection is disabled whenever
*Scala 2.9 and later*
-Starting with Buildr 1.4.8, Buildr integrates with the "Zinc":https://github.com/typesafehub/zinc incremental compilation wrapper for @scalac@. Incremental compilation can be enabled 3 ways,
-
-1) By setting the compiler's option directly,
-
-{% highlight ruby %}
-compile.using :incremental => true
-
-compile.options.incremental = true # same as above
-{% endhighlight %}
-
-Note that this won't enable incremental compilation for both @compile@ and @test.compile@, you would have to set options on both. For this reason, it's recommended that you set the option on the project instead (see below).
-
-2) By setting the project's @scalac_options.incremental@,
-
-{% highlight ruby %}
-project.scalac_options.incremental = true
-{% endhighlight %}
-
-3) By setting the global @scalac.incremental@ option,
-
-in your @buildfile@:
-
-{% highlight ruby %}
-Buildr.settings.build['scalac.incremental'] = true
-{% endhighlight %}
-
-or in your @build.yaml@:
-
-{% highlight yaml %}
-scalac.incremental: true
-{% endhighlight %}
-
h4. Support for different Scala versions
Buildr defaults to the latest stable Scala version available at the time of the release if neither @SCALA_HOME@ nor the @scala.version@ build property are set.
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/lib/buildr/scala.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala.rb b/lib/buildr/scala.rb
index a75cae3..8e767bc 100644
--- a/lib/buildr/scala.rb
+++ b/lib/buildr/scala.rb
@@ -15,7 +15,6 @@
ENV['SCALA_HOME'] ||= '/opt/local/share/scala/' if File.exist?('/opt/local/share/scala/lib/scala-compiler.jar')
-Buildr.repositories.remote << 'http://oss.sonatype.org/content/repositories/releases'
require 'buildr/scala/compiler'
require 'buildr/scala/tests'
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/lib/buildr/scala/bdd.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/bdd.rb b/lib/buildr/scala/bdd.rb
index cac890d..c2a6f52 100644
--- a/lib/buildr/scala/bdd.rb
+++ b/lib/buildr/scala/bdd.rb
@@ -47,7 +47,14 @@ module Buildr::Scala #:nodoc:
end
def artifact
- Buildr.settings.build['scala.specs.artifact'] || "specs_#{Buildr::Scala.version_without_build}"
+ custom = Buildr.settings.build['scala.specs.artifact']
+ return custom unless custom.nil?
+
+ if Buildr::Scala.version >= "2.11"
+ "specs_2.10"
+ else
+ "specs_#{Buildr::Scala.version_without_build}"
+ end
end
def dependencies
@@ -56,7 +63,7 @@ module Buildr::Scala #:nodoc:
# Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
@dependencies |= [ File.join(File.dirname(__FILE__)) ] +
specs +
- Check.dependencies + JUnit.dependencies + Scalac.dependencies
+ Check.dependencies + JUnit.dependencies + Scalac.dependencies + ["org.scala-lang.modules:scala-xml_2.11:jar:1.0.5"]
end
@dependencies
end
@@ -136,8 +143,10 @@ module Buildr::Scala #:nodoc:
'1.5'
when Buildr::Scala.version?("2.9")
'1.11'
+ when Buildr::Scala.version?("2.10")
+ '1.12.3'
else
- '1.12.3' # default for Scala 2.10 and beyond
+ '3.7' # default for Scala 2.11 and beyond
end
class << self
@@ -148,7 +157,7 @@ module Buildr::Scala #:nodoc:
def specs
custom = Buildr.settings.build['scala.specs2']
- [ (custom =~ /:/) ? custom : "org.specs2:#{artifact}:jar:#{version}" ]
+ [ (custom =~ /:/) ? custom : "org.specs2:#{artifact}:pom:#{version}" ]
end
def artifact
@@ -156,14 +165,26 @@ module Buildr::Scala #:nodoc:
when Buildr.settings.build['scala.specs2.artifact']
Buildr.settings.build['scala.specs2.artifact']
else
- "specs2_#{Buildr::Scala.version_without_build}"
+ if Buildr::Scala.version < "2.11"
+ "specs2_#{Buildr::Scala.version_without_build_number}"
+ else
+ "specs2_#{Buildr::Scala.version_major_minor}"
+ end
+ end
+ end
+
+ def type
+ if Buildr::Scala.version < "2.11"
+ "jar"
+ else
+ "pom"
end
end
def scalaz_dependencies
if Buildr::Scala.version?("2.8")
[]
- else
+ elsif Buildr::Scala.version < "2.11"
default_version = "6.0.1"
custom_version = Buildr.settings.build['scala.specs2-scalaz']
version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
@@ -173,6 +194,16 @@ module Buildr::Scala #:nodoc:
custom_spec = Buildr.settings.build['scala.specs2-scalaz']
spec = [ (custom_spec =~ /:/) ? custom_spec : "org.specs2:#{artifact}:jar:#{version}" ]
Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true)
+ else
+ default_version = "7.2.2"
+ custom_version = Buildr.settings.build['scala.specs2-scalaz']
+ version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
+
+ artifact = Buildr.settings.build['scala.specs2-scalaz.artifact'] || "scalaz-core_#{Buildr::Scala.version_major_minor}"
+
+ custom_spec = Buildr.settings.build['scala.specs2-scalaz']
+ spec = [ (custom_spec =~ /:/) ? custom_spec : "org.scalaz:#{artifact}:jar:#{version}" ]
+ [Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true), "org.scala-lang.modules:scala-xml_2.11:jar:1.0.1"]
end
end
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/lib/buildr/scala/compiler.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
index 0fc6147..c22cb27 100644
--- a/lib/buildr/scala/compiler.rb
+++ b/lib/buildr/scala/compiler.rb
@@ -15,7 +15,7 @@
# The Scala Module
module Buildr::Scala
- DEFAULT_VERSION = '2.9.2'
+ DEFAULT_VERSION = '2.11.8'
class << self
@@ -65,6 +65,12 @@ module Buildr::Scala
def version_without_build
version.split('-')[0]
end
+
+ # returns Scala version without tiny number.
+ # e.g. "2.11.8" => "2.11"
+ def version_major_minor
+ version.split('.')[0..1].join('.')
+ end
end
# Scalac compiler:
@@ -81,9 +87,9 @@ module Buildr::Scala
# * :other -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
class Scalac < Buildr::Compiler::Base
- DEFAULT_ZINC_VERSION = '0.1.0'
- DEFAULT_SBT_VERSION = '0.12.0'
- DEFAULT_JLINE_VERSION = '1.0'
+ DEFAULT_ZINC_VERSION = '1.0.0-X1'
+ DEFAULT_SBT_VERSION = '0.13.12'
+ DEFAULT_JLINE_VERSION = '2.14.2'
class << self
def scala_home
@@ -115,9 +121,7 @@ module Buildr::Scala
REQUIRES.artifacts.map(&:to_s)
end
- zinc_dependencies = ZINC_REQUIRES.artifacts.map(&:to_s)
-
- (scala_dependencies + zinc_dependencies).compact
+ scala_dependencies.compact
end
def use_fsc
@@ -152,10 +156,8 @@ module Buildr::Scala
end
ZINC_REQUIRES = ArtifactNamespace.for(self) do |ns|
- zinc_version = Buildr.settings.build['zinc.version'] || DEFAULT_ZINC_VERSION
sbt_version = Buildr.settings.build['sbt.version'] || DEFAULT_SBT_VERSION
jline_version = Buildr.settings.build['jline.version'] || DEFAULT_JLINE_VERSION
- ns.zinc! "com.typesafe.zinc:zinc:jar:>=#{zinc_version}"
ns.sbt_interface! "com.typesafe.sbt:sbt-interface:jar:>=#{sbt_version}"
ns.incremental! "com.typesafe.sbt:incremental-compiler:jar:>=#{sbt_version}"
ns.compiler_interface_sources! "com.typesafe.sbt:compiler-interface:jar:sources:>=#{sbt_version}"
@@ -184,11 +186,7 @@ module Buildr::Scala
end
def compile(sources, target, dependencies) #:nodoc:
- if zinc?
- compile_with_zinc(sources, target, dependencies)
- else
- compile_with_scalac(sources, target, dependencies)
- end
+ compile_with_scalac(sources, target, dependencies)
end
def compile_with_scalac(sources, target, dependencies) #:nodoc:
@@ -243,37 +241,6 @@ module Buildr::Scala
end
end
- def compile_with_zinc(sources, target, dependencies) #:nodoc:
-
- dependencies.unshift target
-
- cmd_args = []
- cmd_args << '-sbt-interface' << REQUIRES.sbt_interface.artifact
- cmd_args << '-compiler-interface' << REQUIRES.compiler_interface_sources.artifact
- cmd_args << '-scala-library' << dependencies.find { |d| d =~ /scala-library/ }
- cmd_args << '-scala-compiler' << dependencies.find { |d| d =~ /scala-compiler/ }
- cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR)
- source_paths = sources.select { |source| File.directory?(source) }
- cmd_args << '-Ssourcepath' << ("-S" + source_paths.join(File::PATH_SEPARATOR)) unless source_paths.empty?
- cmd_args << '-d' << File.expand_path(target)
- cmd_args += scalac_args
- cmd_args << "-debug" if trace?(:scalac)
-
- cmd_args.map!(&:to_s)
-
- cmd_args += files_from_sources(sources)
-
- unless Buildr.application.options.dryrun
- trace((['com.typesafe.zinc.Main.main'] + cmd_args).join(' '))
-
- begin
- Java::Commands.java 'com.typesafe.zinc.Main', *(cmd_args + [{ :classpath => Scalac.dependencies}])
- rescue => e
- fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
- end
- end
- end
-
protected
# :nodoc: see Compiler:Base
@@ -318,10 +285,6 @@ module Buildr::Scala
private
- def zinc?
- (options[:incremental] || @project.scalac_options.incremental || (Buildr.settings.build['scalac.incremental'].to_s == "true"))
- end
-
def count(file, pattern)
count = 0
File.open(file, "r") do |infile|
@@ -351,11 +314,7 @@ module Buildr::Scala
args << "-optimise" if options[:optimise]
args << "-target:jvm-" + options[:target].to_s if options[:target]
args += Array(options[:other])
- if zinc?
- args.map { |arg| "-S" + arg } + Array(options[:zinc_options])
- else
- args
- end
+ args
end
end
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/lib/buildr/scala/tests.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/tests.rb b/lib/buildr/scala/tests.rb
index 4d87502..f638cf4 100644
--- a/lib/buildr/scala/tests.rb
+++ b/lib/buildr/scala/tests.rb
@@ -39,8 +39,10 @@ module Buildr::Scala#:nodoc:
'1.7'
when Buildr::Scala.version?("2.8.1")
'1.8'
- else
+ when Buildr::Scala.version < "2.11"
'1.10.0'
+ else
+ '1.12.5'
end
class << self
@@ -53,7 +55,14 @@ module Buildr::Scala#:nodoc:
end
def artifact
- Buildr.settings.build['scala.check.artifact'] || "scalacheck_#{Buildr::Scala.version_without_build}"
+ custom = Buildr.settings.build['scala.check.artifact']
+ return custom if !!custom
+ case
+ when Buildr::Scala.version < "2.11"
+ "scalacheck_#{Buildr::Scala.version_without_build}"
+ else
+ "scalacheck_#{Buildr::Scala.version_major_minor}"
+ end
end
def dependencies
@@ -92,8 +101,10 @@ module Buildr::Scala#:nodoc:
VERSION = case
when Buildr::Scala.version?(2.7)
'1.3'
- else
+ when Buildr::Scala.version < "2.11"
'1.8'
+ else
+ '2.2.6'
end
class << self
@@ -107,25 +118,20 @@ module Buildr::Scala#:nodoc:
return custom if (custom =~ /:/)
if Buildr::Scala.version?(2.7, 2.8)
"org.scalatest:scalatest:jar:#{version}"
- else
+ elsif Buildr::Scala.version < "2.11"
"org.scalatest:scalatest_#{Buildr::Scala.version_without_build}:jar:#{version}"
+ else
+ "org.scalatest:scalatest_#{Buildr::Scala.version_major_minor}:jar:#{version}"
end
end
def dependencies
- [specs] + Check.dependencies + JMock.dependencies + JUnit.dependencies + Mockito.dependencies
+ [specs] + Check.dependencies + JMock.dependencies + JUnit.dependencies + Mockito.dependencies + ["org.scala-lang.modules:scala-xml_2.11:jar:1.0.5"]
end
def applies_to?(project) #:nodoc:
!Dir[project.path_to(:source, :test, :scala, '**/*.scala')].empty?
end
-
- private
- def const_missing(const)
- return super unless const == :REQUIRES # TODO: remove in 1.5
- Buildr.application.deprecated "Please use Scala::Test.dependencies/.version instead of ScalaTest::REQUIRES/VERSION"
- dependencies
- end
end
# annotation-based group inclusion
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/spec/sandbox.rb
----------------------------------------------------------------------
diff --git a/spec/sandbox.rb b/spec/sandbox.rb
index fe42192..f5ef09a 100644
--- a/spec/sandbox.rb
+++ b/spec/sandbox.rb
@@ -24,7 +24,7 @@ repositories.remote << 'https://oss.sonatype.org/content/groups/scala-tools'
# Force Scala version for specs; don't want to rely on SCALA_HOME
module Buildr::Scala
- SCALA_VERSION_FOR_SPECS = ENV["SCALA_VERSION"] || "2.9.2"
+ SCALA_VERSION_FOR_SPECS = ENV["SCALA_VERSION"] || "2.11.8"
end
Buildr.settings.build['scala.version'] = Buildr::Scala::SCALA_VERSION_FOR_SPECS
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/spec/scala/compiler_spec.rb
----------------------------------------------------------------------
diff --git a/spec/scala/compiler_spec.rb b/spec/scala/compiler_spec.rb
index 3fc4556..d1b795d 100644
--- a/spec/scala/compiler_spec.rb
+++ b/spec/scala/compiler_spec.rb
@@ -267,31 +267,7 @@ share_as :ScalacCompiler_CommonOptions do
end
end
-
-describe 'scala compiler 2.8 options' do
-
- it_should_behave_like ScalacCompiler_CommonOptions
-
- def compile_task
- @compile_task ||= define('foo').compile.using(:scalac)
- end
-
- def scalac_args
- compile_task.instance_eval { @compiler }.send(:scalac_args)
- end
-
- it 'should use -g argument when debug option is true' do
- compile_task.using(:debug=>true)
- scalac_args.should include('-g')
- end
-
- it 'should not use -g argument when debug option is false' do
- compile_task.using(:debug=>false)
- scalac_args.should_not include('-g')
- end
-end if Buildr::Scala.version?(2.8)
-
-describe 'scala compiler 2.9 options' do
+describe 'scala compiler options' do
it_should_behave_like ScalacCompiler_CommonOptions
@@ -319,46 +295,5 @@ describe 'scala compiler 2.9 options' do
scalac_args.should_not include('-g')
end
-end if Buildr::Scala.version?(2.9)
-
-if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
-
-describe 'zinc compiler (enabled through Buildr.settings)' do
- before :each do
- Buildr.settings.build['scalac.incremental'] = true
- end
-
- it 'should compile with zinc' do
- write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
- project = define('foo')
- compile_task = project.compile.using(:scalac)
- compiler = compile_task.instance_eval { @compiler }
- compiler.send(:zinc?).should eql(true)
- compiler.should_receive(:compile_with_zinc).once
- compile_task.invoke
- end
-
- after :each do
- Buildr.settings.build['scalac.incremental'] = nil
- end
-
- it_should_behave_like ScalacCompiler
end
-describe 'zinc compiler (enabled through project.scala_options)' do
-
- it 'should compile with zinc' do
- write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
- project = define('foo')
- project.scalac_options.incremental = true
- compile_task = project.compile.using(:scalac)
- compiler = compile_task.instance_eval { @compiler }
- compiler.send(:zinc?).should eql(true)
- compiler.should_receive(:compile_with_zinc).once
- compile_task.invoke
- end
-end
-
-elsif Buildr::VERSION >= '1.5'
- raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
-end
http://git-wip-us.apache.org/repos/asf/buildr/blob/c0e155b3/spec/scala/tests_spec.rb
----------------------------------------------------------------------
diff --git a/spec/scala/tests_spec.rb b/spec/scala/tests_spec.rb
index ee80a60..49e7496 100644
--- a/spec/scala/tests_spec.rb
+++ b/spec/scala/tests_spec.rb
@@ -208,18 +208,14 @@ describe Buildr::Scala::ScalaTest do
it 'should pass properties to Suite' do
write 'src/test/scala/PropertyTestSuite.scala', <<-SCALA
import org.scalatest._
- class PropertyTestSuite extends FunSuite {
- var configMap = Map[String, Any]()
- test("testProperty") {
+ import org.scalatest.fixture.FunSuite
+ import org.scalatest.fixture.ConfigMapFixture
+
+ class PropertyTestSuite extends FunSuite with ConfigMapFixture {
+
+ test("testProperty") { (configMap: Map[String, Any]) =>
assert(configMap("name") === "value")
}
-
- protected override def runTests(testName: Option[String], reporter: Reporter, stopper: Stopper,
- filter: Filter, configMap: Map[String, Any],
- distributor: Option[Distributor], tracker: Tracker) {
- this.configMap = configMap
- super.runTests(testName, reporter, stopper, filter, configMap, distributor, tracker)
- }
}
SCALA
define('foo').test.using :properties=>{ 'name'=>'value' }
[2/7] buildr git commit: try to use JDK8 for scala testing
Posted by to...@apache.org.
try to use JDK8 for scala testing
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/02f5edeb
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/02f5edeb
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/02f5edeb
Branch: refs/heads/master
Commit: 02f5edeb2979706d1f5ce28a78912b2c3612b74f
Parents: c0e155b
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 18:39:52 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 18:39:52 2016 -0700
----------------------------------------------------------------------
.travis.yml | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/02f5edeb/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index bf5ab57..a7b5f76 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,15 @@
language: ruby
jdk:
-# - oraclejdk8 -- will turn this on once scala can be excluded
+ - oraclejdk8 -- will turn this on once scala can be excluded
- oraclejdk7
rvm:
- - 2.2.5
- 2.3.1
- jruby-1.7.25
- jruby-9.0.5.0
git:
depth: 10
scala:
-# - 2.10.0
- - 2.9.2
-# - 2.9.1
-# - 2.8.1
+ - 2.11.8
install:
- source ci-setup.sh
- export JRUBY_OPTS="-J-XX:MaxPermSize=312m -J-Xmx700M"
[7/7] buildr git commit: change the test for tools.jar presence to
test the presence of a class that is there in both versions of JDK
Posted by to...@apache.org.
change the test for tools.jar presence to test the presence of a class that is there in both versions of JDK
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/db57d676
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/db57d676
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/db57d676
Branch: refs/heads/master
Commit: db57d6764fd93bb3c56f47018b84165b1482f97e
Parents: 6784bb7
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 22:37:07 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 22:47:36 2016 -0700
----------------------------------------------------------------------
spec/java/compiler_spec.rb | 2 +-
spec/java/ecj_spec.rb | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/db57d676/spec/java/compiler_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/compiler_spec.rb b/spec/java/compiler_spec.rb
index 385e4fa..cfc3878 100644
--- a/spec/java/compiler_spec.rb
+++ b/spec/java/compiler_spec.rb
@@ -100,7 +100,7 @@ describe 'javac compiler' do
it 'should include tools.jar dependency' do
write 'src/main/java/UseJarSigner.java', <<-JAVA
- import sun.security.tools.jarsigner.Main;
+ import sun.tools.jar.Manifest;
public class UseJarSigner { }
JAVA
define('foo').compile.invoke
http://git-wip-us.apache.org/repos/asf/buildr/blob/db57d676/spec/java/ecj_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/ecj_spec.rb b/spec/java/ecj_spec.rb
index a1ca98c..2a964f9 100644
--- a/spec/java/ecj_spec.rb
+++ b/spec/java/ecj_spec.rb
@@ -75,14 +75,14 @@ describe 'ecj compiler' do
file('target/classes/DependencyTest.class').should exist
end
end
-
+
it 'should include tools.jar dependency' do
repositories.remote << "http://repo1.maven.org/maven2/"
write 'src/main/java/UseJarSigner.java', <<-JAVA
- import sun.security.tools.jarsigner.Main;
+ import sun.tools.jar.Manifest;
public class UseJarSigner { }
JAVA
- define('foo').compile.using(:ecj).invoke
+ define('foo').compile.invoke
file('target/classes/UseJarSigner.class').should exist
end
[4/7] buildr git commit: remove comment on travis build matrix
Posted by to...@apache.org.
remove comment on travis build matrix
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/eb7b6bae
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/eb7b6bae
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/eb7b6bae
Branch: refs/heads/master
Commit: eb7b6baed47a12713472ed73257c4f050d0015fd
Parents: 06d9c66
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 21:52:01 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 21:52:01 2016 -0700
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/eb7b6bae/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index a7b5f76..5543afa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: ruby
jdk:
- - oraclejdk8 -- will turn this on once scala can be excluded
+ - oraclejdk8
- oraclejdk7
rvm:
- 2.3.1
[6/7] buildr git commit: Fix scaladoc by adding the 2 missing modules
Posted by to...@apache.org.
Fix scaladoc by adding the 2 missing modules
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/6784bb73
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/6784bb73
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/6784bb73
Branch: refs/heads/master
Commit: 6784bb7332e96de3c71745b4b8b69227703d2cdb
Parents: c18b855
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 22:21:47 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 22:21:47 2016 -0700
----------------------------------------------------------------------
lib/buildr/scala/compiler.rb | 3 +++
spec/scala/doc_spec.rb | 11 -----------
2 files changed, 3 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/6784bb73/lib/buildr/scala/compiler.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
index c22cb27..8846d1e 100644
--- a/lib/buildr/scala/compiler.rb
+++ b/lib/buildr/scala/compiler.rb
@@ -152,6 +152,9 @@ module Buildr::Scala
# added in Scala 2.10
ns.reflect! 'org.scala-lang:scala-reflect:jar:>=' + version
ns.actors! 'org.scala-lang:scala-actors:jar:>=' + version
+ ns.xml! 'org.scala-lang.modules:scala-xml_2.11:jar:1.0.5'
+ ns.parser_combinators! 'org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4'
+
end
end
http://git-wip-us.apache.org/repos/asf/buildr/blob/6784bb73/spec/scala/doc_spec.rb
----------------------------------------------------------------------
diff --git a/spec/scala/doc_spec.rb b/spec/scala/doc_spec.rb
index 855d651..30cb58e 100644
--- a/spec/scala/doc_spec.rb
+++ b/spec/scala/doc_spec.rb
@@ -47,8 +47,6 @@ describe "Scaladoc" do
project('foo').doc.options[:"doc-title"].should eql('explicit')
end
-if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
-
it 'should convert :windowtitle to -doc-title for Scala 2.8.1 and later' do
write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
define('foo') do
@@ -69,14 +67,8 @@ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
project('foo').doc.invoke
end unless Buildr::Scala.version?(2.7, "2.8.0")
-elsif Buildr::VERSION >= '1.5'
- raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
-end
-
end
-if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
-
describe "package(:scaladoc)" do
it "should generate target/project-version-scaladoc.jar" do
write 'src/main/scala/Foo.scala', 'class Foo'
@@ -97,6 +89,3 @@ describe "package(:scaladoc)" do
end
end
-elsif Buildr::VERSION >= '1.5'
- raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
-end
[3/7] buildr git commit: remove Scala specs
Posted by to...@apache.org.
remove Scala specs
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/06d9c660
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/06d9c660
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/06d9c660
Branch: refs/heads/master
Commit: 06d9c6604f1d6488a7da58058262de9b1184b1ad
Parents: 02f5ede
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 21:48:55 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 21:48:55 2016 -0700
----------------------------------------------------------------------
doc/languages.textile | 2 +-
lib/buildr/scala/bdd.rb | 125 -------------------
lib/buildr/scala/doc.rb | 1 -
.../scala/org/apache/buildr/Specs2Runner.java | 7 +-
.../apache/buildr/SpecsSingletonRunner.class | Bin 1891 -> 1890 bytes
spec/scala/bdd_spec.rb | 101 ---------------
6 files changed, 5 insertions(+), 231 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/doc/languages.textile
----------------------------------------------------------------------
diff --git a/doc/languages.textile b/doc/languages.textile
index 5e45546..ec1b985 100644
--- a/doc/languages.textile
+++ b/doc/languages.textile
@@ -351,7 +351,7 @@ h4. Specs
Specs is automatically selected whenever there are @.scala@ source files under the @src/spec/scala@ directory. It is also possible to force selection of the test framework by using the @test.using :specs@ directive. This can sometimes be useful when Scala sources may be found in *both* @src/test/scala@ and @src/spec/scala@. Normally in such cases, ScalaTest will have selection precedence, meaning that in case of a conflict between it and Specs, ScalaTest will be chosen.
-Any objects which extend the @org.specs.Specification@ superclass will be automatically detected and run. Note that any *classes* which extend @Specification@ will also be invoked. As such classes will not have a @main@ method, such an invocation will raise an error.
+Any objects which extend the @org.specs.Specification@ or @org.specs2.Specification@ superclass will be automatically detected and run. Note that any *classes* which extend @Specification@ will also be invoked. As such classes will not have a @main@ method, such an invocation will raise an error.
A simple specification might look like this:
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/lib/buildr/scala/bdd.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/bdd.rb b/lib/buildr/scala/bdd.rb
index c2a6f52..e72d65f 100644
--- a/lib/buildr/scala/bdd.rb
+++ b/lib/buildr/scala/bdd.rb
@@ -15,125 +15,6 @@
module Buildr::Scala #:nodoc:
- # Specs is a Scala based BDD framework.
- # To use in your project:
- #
- # test.using :specs
- #
- # This framework will search in your project for:
- # src/spec/scala/**/*.scala
- class Specs < Buildr::TestFramework::JavaBDD
- @lang = :scala
- @bdd_dir = :spec
-
- VERSION = case
- when Buildr::Scala.version?("2.8.0")
- '1.6.5'
- when Buildr::Scala.version?("2.8.1"), Buildr::Scala.version?("2.8.2"), Buildr::Scala.version?("2.9.0")
- '1.6.8'
- else
- '1.6.9'
- end
-
- class << self
- def version
- custom = Buildr.settings.build['scala.specs']
- (custom =~ /:/) ? Buildr.artifact(custom).version : VERSION
- end
-
- def specs
- custom = Buildr.settings.build['scala.specs']
- [ (custom =~ /:/) ? custom : "org.scala-tools.testing:#{artifact}:jar:#{version}" ]
- end
-
- def artifact
- custom = Buildr.settings.build['scala.specs.artifact']
- return custom unless custom.nil?
-
- if Buildr::Scala.version >= "2.11"
- "specs_2.10"
- else
- "specs_#{Buildr::Scala.version_without_build}"
- end
- end
-
- def dependencies
- unless @dependencies
- super
- # Add utility classes (e.g. SpecsSingletonRunner) and other dependencies
- @dependencies |= [ File.join(File.dirname(__FILE__)) ] +
- specs +
- Check.dependencies + JUnit.dependencies + Scalac.dependencies + ["org.scala-lang.modules:scala-xml_2.11:jar:1.0.5"]
- end
- @dependencies
- end
-
- def applies_to?(project) #:nodoc:
- scala_files = Dir[project.path_to(:source, bdd_dir, lang, '**/*.scala')]
- return false if scala_files.empty?
- scala_files.detect { |f| find(f, /\s+(org\.specs\.)/) }
- end
-
- private
- def const_missing(const)
- return super unless const == :REQUIRES # TODO: remove in 1.5
- Buildr.application.deprecated "Please use Scala::Specs.dependencies/.version instead of ScalaSpecs::REQUIRES/VERSION"
- dependencies
- end
-
- def find(file, pattern)
- File.open(file, "r") do |infile|
- while (line = infile.gets)
- return true if line.match(pattern)
- end
- end
- false
- end
- end
-
- def initialize(task, options) #:nodoc:
- super
-
- specs = task.project.path_to(:source, :spec, :scala)
- task.compile.from specs if File.directory?(specs)
-
- resources = task.project.path_to(:source, :spec, :resources)
- task.resources.from resources if File.directory?(resources)
- end
-
- def tests(dependencies)
- candidates = filter_classes(dependencies, :interfaces => ['org.specs.Specification'])
-
- Java.load # Java is already loaded, but just in case
-
- filter = Java.org.apache.buildr.JavaTestFilter.new(dependencies.to_java(Java.java.lang.String))
- filter.add_fields ['MODULE$'].to_java(Java.java.lang.String)
- filter.filter(candidates.to_java(Java.java.lang.String)).map { |s| s[0..(s.size - 2)] }
- end
-
- def run(specs, dependencies) #:nodoc:
- cmd_options = { :properties => options[:properties],
- :java_args => options[:java_args],
- :classpath => dependencies,
- :name => false }
-
- runner = 'org.apache.buildr.SpecsSingletonRunner'
- specs.inject [] do |passed, spec|
- begin
- unless Util.win_os?
- Java::Commands.java(runner, task.compile.target.to_s, '-c', spec + '$', cmd_options)
- else
- Java::Commands.java(runner, task.compile.target.to_s, spec + '$', cmd_options)
- end
- rescue => e
- passed
- else
- passed << spec
- end
- end
- end
- end
-
class Specs2 < Buildr::TestFramework::JavaBDD
@lang = :scala
@bdd_dir = :spec
@@ -277,10 +158,4 @@ module Buildr::Scala #:nodoc:
end
end
-# Backwards compatibility stuff. Remove in 1.5.
-module Buildr #:nodoc:
- ScalaSpecs = Scala::Specs
-end
-
-Buildr::TestFramework << Buildr::Scala::Specs
Buildr::TestFramework << Buildr::Scala::Specs2
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/lib/buildr/scala/doc.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/doc.rb b/lib/buildr/scala/doc.rb
index 9d9cf0c..d30a10f 100644
--- a/lib/buildr/scala/doc.rb
+++ b/lib/buildr/scala/doc.rb
@@ -80,7 +80,6 @@ module Buildr #:nodoc:
class VScaladoc < Base
VERSION = '1.2-m1'
- Buildr.repositories.remote << 'https://oss.sonatype.org/content/groups/scala-tools'
class << self
def dependencies
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/lib/buildr/scala/org/apache/buildr/Specs2Runner.java
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/org/apache/buildr/Specs2Runner.java b/lib/buildr/scala/org/apache/buildr/Specs2Runner.java
index f0e38cf..55c52b1 100644
--- a/lib/buildr/scala/org/apache/buildr/Specs2Runner.java
+++ b/lib/buildr/scala/org/apache/buildr/Specs2Runner.java
@@ -24,9 +24,10 @@ public class Specs2Runner {
public static void main(String[] args) {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class clazz = loader.loadClass("org.specs2.runner.ClassRunner");
- Object instance = clazz.newInstance();
- Method main = clazz.getMethod("main", String[].class);
+ Class clazz = loader.loadClass("org.specs2.runner.ClassRunner$");
+ Field singleton = clazz.getField("MODULE$");
+ Object instance = singleton.get(null);
+ Method main = clazz.getMethod("run", String[].class);
main.invoke(instance, new Object[] { args });
} catch (Exception e) {
throw new RuntimeException(e);
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class b/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class
index 7a27b57..4318e43 100644
Binary files a/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class and b/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class differ
http://git-wip-us.apache.org/repos/asf/buildr/blob/06d9c660/spec/scala/bdd_spec.rb
----------------------------------------------------------------------
diff --git a/spec/scala/bdd_spec.rb b/spec/scala/bdd_spec.rb
index fb946da..25167ab 100644
--- a/spec/scala/bdd_spec.rb
+++ b/spec/scala/bdd_spec.rb
@@ -15,104 +15,6 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
-if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
-
-describe Buildr::Scala::Specs do
-
- it 'should be the default when tests in src/spec/scala reference "org.specs"' do
- write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
- package com.example
- object MySpecs extends org.specs.Specification {
- "it" should {
- "add" in {
- val sum = 1 + 1
- sum mustEqual 2
- }
- }
- }
- SCALA
- define 'foo'
- project('foo').test.framework.should eql(:specs)
- end
-
- it 'should include Specs dependencies' do
- define('foo') { test.using(:specs) }
- project('foo').test.compile.dependencies.should include(*artifacts(Scala::Specs.dependencies))
- project('foo').test.dependencies.should include(*artifacts(Scala::Specs.dependencies))
- end
-
- it 'should include ScalaCheck dependencies' do
- define('foo') { test.using(:specs) }
- project('foo').test.compile.dependencies.should include(*artifacts(Scala::Check.dependencies))
- project('foo').test.dependencies.should include(*artifacts(Scala::Check.dependencies))
- end
-
- it 'should include public objects extending org.specs.Specification' do
- write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
- package com.example
- object MySpecs extends org.specs.Specification {
- "it" should {
- "add" in {
- val sum = 1 + 1
- sum mustEqual 2
- }
- }
- }
- SCALA
- define('foo').test.invoke
- project('foo').test.tests.should include('com.example.MySpecs')
- end
-
- it 'should include public objects extending org.specs.Specification even with companion classes' do
- write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
- package com.example
- object MySpecs extends org.specs.Specification {
- "it" should {
- "add" in {
- val sum = 1 + 1
- sum mustEqual 2
- }
- }
- }
- class MySpecs extends org.specs.runner.JUnit4(MySpecs)
- SCALA
- define('foo').test.invoke
- project('foo').test.tests.should include('com.example.MySpecs')
- end
-
- it 'should pass when spec passes' do
- write 'src/spec/scala/PassingSpecs.scala', <<-SCALA
- object PassingSpecs extends org.specs.Specification {
- "it" should {
- "add" in {
- val sum = 1 + 1
- sum mustEqual 2
- }
- }
- }
- SCALA
- lambda { define('foo').test.invoke }.should_not raise_error
- end
-
- it 'should fail when spec fails' do
- write 'src/spec/scala/StringSpecs.scala', <<-SCALA
- import org.specs._
- import org.specs.runner._
-
- object StringSpecs extends Specification {
- "empty string" should {
- "have a zero length" in {
- ("".length) mustEqual(1)
- }
- }
- }
- SCALA
- define('foo')
- project('foo').test.invoke rescue
- project('foo').test.failed_tests.should include('StringSpecs')
- end
-end
-
describe Buildr::Scala::Specs2 do
it 'should be the default when tests in src/spec/scala reference "org.specs2"' do
@@ -217,6 +119,3 @@ describe Buildr::Scala::Specs2 do
end
end
-elsif Buildr::VERSION >= '1.5'
- raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
-end
[5/7] buildr git commit: Use JarSigner to test the presence of
tools.jar on the classpath
Posted by to...@apache.org.
Use JarSigner to test the presence of tools.jar on the classpath
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/c18b8555
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/c18b8555
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/c18b8555
Branch: refs/heads/master
Commit: c18b85559d7f86f2bcec53960905439d14b20617
Parents: eb7b6ba
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 21:59:54 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 21:59:54 2016 -0700
----------------------------------------------------------------------
spec/java/compiler_spec.rb | 8 ++++----
spec/java/ecj_spec.rb | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/c18b8555/spec/java/compiler_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/compiler_spec.rb b/spec/java/compiler_spec.rb
index 305ea6f..385e4fa 100644
--- a/spec/java/compiler_spec.rb
+++ b/spec/java/compiler_spec.rb
@@ -99,12 +99,12 @@ describe 'javac compiler' do
end
it 'should include tools.jar dependency' do
- write 'src/main/java/UseApt.java', <<-JAVA
- import com.sun.mirror.apt.AnnotationProcessor;
- public class UseApt { }
+ write 'src/main/java/UseJarSigner.java', <<-JAVA
+ import sun.security.tools.jarsigner.Main;
+ public class UseJarSigner { }
JAVA
define('foo').compile.invoke
- file('target/classes/UseApt.class').should exist
+ file('target/classes/UseJarSigner.class').should exist
end
it 'should ignore package-info.java files in up-to-date check' do
http://git-wip-us.apache.org/repos/asf/buildr/blob/c18b8555/spec/java/ecj_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/ecj_spec.rb b/spec/java/ecj_spec.rb
index 3f444b1..a1ca98c 100644
--- a/spec/java/ecj_spec.rb
+++ b/spec/java/ecj_spec.rb
@@ -78,12 +78,12 @@ describe 'ecj compiler' do
it 'should include tools.jar dependency' do
repositories.remote << "http://repo1.maven.org/maven2/"
- write 'src/main/java/UseApt.java', <<-JAVA
- import com.sun.mirror.apt.AnnotationProcessor;
- public class UseApt { }
+ write 'src/main/java/UseJarSigner.java', <<-JAVA
+ import sun.security.tools.jarsigner.Main;
+ public class UseJarSigner { }
JAVA
define('foo').compile.using(:ecj).invoke
- file('target/classes/UseApt.class').should exist
+ file('target/classes/UseJarSigner.class').should exist
end
it 'should ignore package-info.java files in up-to-date check' do