buildr 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +46 -0
- data/Rakefile +0 -1
- data/addon/buildr/bnd.rb +147 -0
- data/addon/buildr/jaxb_xjc.rb +72 -0
- data/addon/buildr/protobuf.rb +14 -1
- data/buildr.gemspec +6 -2
- data/doc/artifacts.textile +6 -0
- data/doc/contributing.textile +3 -0
- data/doc/download.textile +60 -0
- data/doc/index.textile +9 -15
- data/doc/installing.textile +23 -6
- data/doc/mailing_lists.textile +4 -0
- data/doc/more_stuff.textile +333 -6
- data/doc/packaging.textile +187 -1
- data/lib/buildr.rb +8 -1
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +3 -0
- data/lib/buildr/core/#application.rb# +700 -0
- data/lib/buildr/core/application.rb +18 -8
- data/lib/buildr/core/build.rb +2 -2
- data/lib/buildr/core/cc.rb +57 -63
- data/lib/buildr/core/checks.rb +4 -5
- data/lib/buildr/core/doc.rb +3 -1
- data/lib/buildr/core/generate.rb +2 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/project.rb +9 -8
- data/lib/buildr/core/run.rb +3 -3
- data/lib/buildr/core/shell.rb +29 -90
- data/lib/buildr/core/test.rb +3 -3
- data/lib/buildr/core/transports.rb +5 -5
- data/lib/buildr/core/util.rb +2 -2
- data/lib/buildr/groovy.rb +1 -0
- data/lib/buildr/groovy/compiler.rb +12 -1
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +24 -15
- data/lib/buildr/ide.rb +1 -1
- data/lib/buildr/ide/idea.rb +527 -141
- data/lib/buildr/java/bdd.rb +18 -13
- data/lib/buildr/java/ecj.rb +1 -3
- data/lib/buildr/java/jtestr_result.rb +295 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +4 -6
- data/lib/buildr/java/packaging.rb +14 -3
- data/lib/buildr/java/pom.rb +6 -2
- data/lib/buildr/java/test_result.rb +15 -243
- data/lib/buildr/java/tests.rb +1 -1
- data/lib/buildr/packaging.rb +2 -1
- data/lib/buildr/packaging/#package.rb.rej# +19 -0
- data/lib/buildr/packaging/archive.rb +13 -3
- data/lib/buildr/packaging/artifact.rb +11 -12
- data/lib/buildr/packaging/tar.rb +4 -1
- data/lib/buildr/packaging/zip.rb +106 -1
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +7 -14
- data/lib/buildr/scala/#Untitled-2# +7 -0
- data/lib/buildr/scala/bdd.rb +1 -1
- data/lib/buildr/scala/compiler.rb +1 -1
- data/lib/buildr/scala/doc.rb +20 -2
- data/lib/buildr/scala/shell.rb +14 -22
- data/lib/buildr/scala/tests.rb +2 -2
- data/lib/buildr/shell.rb +113 -108
- data/lib/buildr/version.rb +1 -1
- data/rakelib/checks.rake +9 -7
- data/rakelib/doc.rake +10 -0
- data/rakelib/release.rake +9 -0
- data/rakelib/rspec.rake +27 -28
- data/rakelib/setup.rake +1 -1
- data/rakelib/stage.rake +2 -2
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +1 -1
- data/spec/core/build_spec.rb +7 -7
- data/spec/core/cc_spec.rb +154 -104
- data/spec/core/compile_spec.rb +3 -3
- data/spec/core/project_spec.rb +10 -0
- data/spec/core/run_spec.rb +1 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +1 -1
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/bdd_spec.rb +3 -3
- data/spec/java/emma_spec.rb +2 -0
- data/spec/java/packaging_spec.rb +40 -11
- data/spec/java/test_coverage_helper.rb +1 -1
- data/spec/packaging/archive_spec.rb +76 -21
- data/spec/packaging/artifact_namespace_spec.rb +1 -1
- data/spec/packaging/artifact_spec.rb +14 -7
- data/spec/sandbox.rb +11 -4
- data/spec/scala/bdd_spec.rb +2 -2
- data/spec/scala/compiler_spec.rb +2 -2
- data/spec/scala/doc_spec.rb +24 -4
- data/spec/scala/scala.rb +2 -2
- data/spec/scala/tests_spec.rb +2 -2
- data/spec/spec_helpers.rb +9 -8
- data/spec/xpath_matchers.rb +121 -0
- metadata +248 -164
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -231
- data/spec/ide/idea7x_spec.rb +0 -96
@@ -0,0 +1,125 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
require File.expand_path('../spec_helpers', File.dirname(__FILE__))
|
18
|
+
Sandbox.require_optional_extension 'buildr/jaxb_xjc'
|
19
|
+
|
20
|
+
XSD_CONTENT = <<XSD
|
21
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
22
|
+
|
23
|
+
<xsd:simpleType name="agency">
|
24
|
+
<xsd:restriction base="xsd:string">
|
25
|
+
<xsd:enumeration value="DSE"/>
|
26
|
+
<xsd:enumeration value="PV"/>
|
27
|
+
<xsd:enumeration value="CFA"/>
|
28
|
+
<xsd:enumeration value="DPI"/>
|
29
|
+
<xsd:enumeration value="VF"/>
|
30
|
+
<xsd:enumeration value="Unknown"/>
|
31
|
+
</xsd:restriction>
|
32
|
+
</xsd:simpleType>
|
33
|
+
|
34
|
+
<xsd:complexType name="latLongCoordinate">
|
35
|
+
<xsd:all>
|
36
|
+
<xsd:element name="latitude" type="xsd:float"/>
|
37
|
+
<xsd:element name="longitude" type="xsd:float"/>
|
38
|
+
</xsd:all>
|
39
|
+
</xsd:complexType>
|
40
|
+
|
41
|
+
<xsd:element name="wildfire">
|
42
|
+
<xsd:complexType>
|
43
|
+
<xsd:sequence>
|
44
|
+
<xsd:element name="name" type="xsd:string"/>
|
45
|
+
<xsd:element name="district" type="xsd:string">
|
46
|
+
<xsd:annotation>
|
47
|
+
<xsd:documentation xml:lang="en">
|
48
|
+
The name of the district WITHOUT the "FIRE DISTRICT" suffix.
|
49
|
+
</xsd:documentation>
|
50
|
+
</xsd:annotation>
|
51
|
+
</xsd:element>
|
52
|
+
<xsd:element name="status">
|
53
|
+
<xsd:simpleType>
|
54
|
+
<xsd:restriction base="xsd:string">
|
55
|
+
<xsd:enumeration value="GOING"/>
|
56
|
+
<xsd:enumeration value="CONTAINED"/>
|
57
|
+
<xsd:enumeration value="UNDER CONTROL - 1"/>
|
58
|
+
<xsd:enumeration value="UNDER CONTROL - 2"/>
|
59
|
+
<xsd:enumeration value="SAFE"/>
|
60
|
+
<xsd:enumeration value="SAFE - OVERRUN"/>
|
61
|
+
<xsd:enumeration value="SAFE - NOT FOUND"/>
|
62
|
+
<xsd:enumeration value="SAFE - FALSE ALARM"/>
|
63
|
+
<xsd:enumeration value="NOT FOUND"/>
|
64
|
+
<xsd:enumeration value="UNKNOWN"/>
|
65
|
+
</xsd:restriction>
|
66
|
+
</xsd:simpleType>
|
67
|
+
</xsd:element>
|
68
|
+
<xsd:element name="reported-at" type="xsd:dateTime"/>
|
69
|
+
<xsd:element name="lead-agency" type="xsd:string"/>
|
70
|
+
<xsd:element name="origin" type="latLongCoordinate" minOccurs="0">
|
71
|
+
<xsd:annotation>
|
72
|
+
<xsd:documentation xml:lang="en">
|
73
|
+
This is a grid reference in lat/long format.
|
74
|
+
</xsd:documentation>
|
75
|
+
</xsd:annotation>
|
76
|
+
</xsd:element>
|
77
|
+
<xsd:element name="area" type="xsd:decimal" minOccurs="0"/>
|
78
|
+
<xsd:element name="number">
|
79
|
+
<xsd:simpleType>
|
80
|
+
<xsd:restriction base="xsd:integer">
|
81
|
+
<xsd:minInclusive value="0"/>
|
82
|
+
</xsd:restriction>
|
83
|
+
</xsd:simpleType>
|
84
|
+
</xsd:element>
|
85
|
+
<xsd:element name="global-id">
|
86
|
+
<xsd:simpleType>
|
87
|
+
<xsd:restriction base="xsd:integer">
|
88
|
+
<xsd:minInclusive value="0"/>
|
89
|
+
</xsd:restriction>
|
90
|
+
</xsd:simpleType>
|
91
|
+
</xsd:element>
|
92
|
+
<xsd:element name="data-source" type="xsd:string"/>
|
93
|
+
</xsd:sequence>
|
94
|
+
</xsd:complexType>
|
95
|
+
</xsd:element>
|
96
|
+
</xsd:schema>
|
97
|
+
XSD
|
98
|
+
|
99
|
+
describe Buildr::JaxbXjc do
|
100
|
+
describe "compiled with specified xsd" do
|
101
|
+
before do
|
102
|
+
write "src/main/xsd/wildfire-1.3.xsd", XSD_CONTENT
|
103
|
+
@foo = define "foo" do
|
104
|
+
project.version = "2.1.3"
|
105
|
+
compile.from compile_jaxb("src/main/xsd/wildfire-1.3.xsd", "-quiet", :package => "org.foo.api")
|
106
|
+
package :jar
|
107
|
+
end
|
108
|
+
task('compile').invoke
|
109
|
+
end
|
110
|
+
|
111
|
+
it "produce .java files in the correct location" do
|
112
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/Agency.java"))
|
113
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/LatLongCoordinate.java"))
|
114
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/ObjectFactory.java"))
|
115
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/Wildfire.java"))
|
116
|
+
end
|
117
|
+
|
118
|
+
it "produce .class files in the correct location" do
|
119
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/Agency.class"))
|
120
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/LatLongCoordinate.class"))
|
121
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/ObjectFactory.class"))
|
122
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/Wildfire.class"))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/spec/core/build_spec.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
18
|
|
19
|
-
|
19
|
+
shared_examples_for 'local task' do
|
20
20
|
it "should execute task for project in current directory" do
|
21
21
|
define 'foobar'
|
22
22
|
lambda { @task.invoke }.should run_task("foobar:#{@task.name}")
|
@@ -369,7 +369,7 @@ describe Release do
|
|
369
369
|
end
|
370
370
|
|
371
371
|
|
372
|
-
|
372
|
+
shared_examples_for 'a release process' do
|
373
373
|
|
374
374
|
describe '#make' do
|
375
375
|
before do
|
@@ -406,7 +406,7 @@ describe 'a release process', :shared=>true do
|
|
406
406
|
@release.make
|
407
407
|
file('buildfile').should contain('VERSION_NUMBER = "1.0.002-SNAPSHOT"')
|
408
408
|
end
|
409
|
-
|
409
|
+
|
410
410
|
it 'should commit the updated buildfile' do
|
411
411
|
@release.stub!(:tag_release)
|
412
412
|
@release.make
|
@@ -419,7 +419,7 @@ describe 'a release process', :shared=>true do
|
|
419
419
|
@release.make
|
420
420
|
file('buildfile').should contain('VERSION_NUMBER = "1.0.0-rc1"')
|
421
421
|
end
|
422
|
-
|
422
|
+
|
423
423
|
it 'should only commit the updated buildfile if the version changed' do
|
424
424
|
write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
|
425
425
|
@release.should_not_receive(:update_version_to_next)
|
@@ -465,7 +465,7 @@ describe 'a release process', :shared=>true do
|
|
465
465
|
Release.next_version = lambda {|version| "#{version}++"}
|
466
466
|
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
467
467
|
end
|
468
|
-
after {
|
468
|
+
after {
|
469
469
|
Release.next_version = nil
|
470
470
|
ENV['NEXT_VERSION'] = nil
|
471
471
|
ENV['next_version'] = nil
|
@@ -509,7 +509,7 @@ describe 'a release process', :shared=>true do
|
|
509
509
|
Release.next_version = lambda {|version| "#{version}++"}
|
510
510
|
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
511
511
|
end
|
512
|
-
after {
|
512
|
+
after {
|
513
513
|
Release.next_version = nil
|
514
514
|
ENV['NEXT_VERSION'] = nil
|
515
515
|
ENV['next_version'] = nil
|
@@ -553,7 +553,7 @@ describe 'a release process', :shared=>true do
|
|
553
553
|
Release.next_version = lambda {|version| "#{version}++"}
|
554
554
|
@release.send(:resolve_next_version, "1.0.0").should == 'ze_version_from_env_lowercase'
|
555
555
|
end
|
556
|
-
after {
|
556
|
+
after {
|
557
557
|
Release.next_version = nil
|
558
558
|
ENV['NEXT_VERSION'] = nil
|
559
559
|
ENV['next_version'] = nil
|
data/spec/core/cc_spec.rb
CHANGED
@@ -17,50 +17,38 @@
|
|
17
17
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
18
|
|
19
19
|
module CCHelper
|
20
|
-
def setup_cc
|
21
|
-
project = define('foo')
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
project.stub!(:task).with(:compile).and_return(compile)
|
28
|
-
|
29
|
-
test_compile = mock 'test:compile'
|
30
|
-
project.stub!(:task).with('test:compile').and_return(test_compile)
|
31
|
-
|
32
|
-
filter = mock('resources').tap do |resources|
|
33
|
-
project.stub!(:task).with(:resources).and_return(resources)
|
34
|
-
|
35
|
-
back = mock 'filter'
|
36
|
-
resources.stub!(:filter).and_return(back)
|
37
|
-
|
38
|
-
back
|
21
|
+
# monkey-patch task instance to track number of times it is run
|
22
|
+
def instrument_task(task)
|
23
|
+
class << task
|
24
|
+
attr_accessor :run_count
|
39
25
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
[ project, compile, test_compile, filter ]
|
26
|
+
task.run_count = 0
|
27
|
+
task.enhance do |t|
|
28
|
+
t.run_count += 1
|
29
|
+
end
|
30
|
+
task
|
46
31
|
end
|
47
32
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
33
|
+
def instrument_project(project)
|
34
|
+
instrument_task project.compile
|
35
|
+
instrument_task project.test.compile
|
36
|
+
instrument_task project.resources
|
37
|
+
project
|
51
38
|
end
|
52
39
|
|
53
|
-
def
|
54
|
-
@
|
55
|
-
|
40
|
+
def define_foo()
|
41
|
+
@foo = define('foo')
|
42
|
+
instrument_project @foo
|
43
|
+
@foo
|
56
44
|
end
|
57
45
|
|
58
|
-
def
|
59
|
-
@
|
60
|
-
each { |src| write src, '<html></html>' }
|
46
|
+
def foo()
|
47
|
+
@foo
|
61
48
|
end
|
62
49
|
end
|
63
50
|
|
51
|
+
|
64
52
|
describe Buildr::CCTask do
|
65
53
|
include CCHelper
|
66
54
|
|
@@ -69,106 +57,168 @@ describe Buildr::CCTask do
|
|
69
57
|
end
|
70
58
|
|
71
59
|
it 'should compile and test:compile on initial start' do
|
72
|
-
|
60
|
+
['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
|
61
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
62
|
+
|
63
|
+
['Test1.java', 'Test2.java'].map { |f| File.join('src/test/java/thepackage', f) }.
|
64
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
65
|
+
|
66
|
+
['Test1.html', 'Test2.html'].map { |f| File.join('src/main/resources', f) }.
|
67
|
+
each { |src| write src, '<html></html>' }
|
73
68
|
|
74
|
-
|
75
|
-
test_compile.should_receive :invoke
|
76
|
-
filter.should_not_receive :run
|
69
|
+
define_foo()
|
77
70
|
|
78
71
|
thread = Thread.new do
|
79
|
-
|
72
|
+
foo.cc.invoke
|
80
73
|
end
|
81
74
|
|
82
|
-
sleep
|
75
|
+
sleep 1
|
76
|
+
|
77
|
+
foo.compile.run_count.should == 1
|
78
|
+
foo.test.compile.run_count.should == 1
|
83
79
|
|
84
80
|
thread.exit
|
85
81
|
end
|
86
82
|
|
87
83
|
it 'should detect a file change' do |spec|
|
88
|
-
|
84
|
+
write 'src/main/resources/my.properties', "# comment"
|
89
85
|
write 'src/main/java/Example.java', "public class Example {}"
|
90
86
|
write 'src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
compile = project.compile
|
96
|
-
|
97
|
-
|
98
|
-
test_compile = project.test.compile
|
99
|
-
|
100
|
-
filter = project.resources
|
101
|
-
|
102
|
-
# After first period:
|
103
|
-
compile.should_receive :invoke
|
104
|
-
test_compile.should_receive :invoke
|
105
|
-
filter.should_not_receive :run
|
106
|
-
|
87
|
+
|
88
|
+
define_foo
|
89
|
+
|
107
90
|
thread = Thread.new do
|
108
|
-
|
91
|
+
begin
|
92
|
+
foo.cc.invoke
|
93
|
+
rescue => e
|
94
|
+
p "unexpected exception #{e.inspect}"
|
95
|
+
p e.backtrace.join("\n").inspect
|
96
|
+
end
|
109
97
|
end
|
110
|
-
|
111
|
-
sleep 0.5
|
112
|
-
|
113
|
-
compile.should_receive :reenable
|
114
|
-
compile.should_receive :invoke
|
115
98
|
|
116
|
-
|
117
|
-
|
99
|
+
sleep 1
|
100
|
+
|
101
|
+
foo.compile.run_count.should == 1
|
102
|
+
foo.test.compile.run_count.should == 1
|
103
|
+
foo.resources.run_count.should == 1
|
118
104
|
|
119
|
-
filter.should_not_receive :run
|
120
|
-
|
121
105
|
sleep 1 # Wait one sec as the timestamp needs to be different.
|
106
|
+
|
122
107
|
touch File.join(Dir.pwd, 'src/main/java/Example.java')
|
123
|
-
|
124
|
-
|
108
|
+
|
109
|
+
sleep 1
|
110
|
+
|
111
|
+
foo.compile.run_count.should == 2
|
112
|
+
foo.test.compile.run_count.should == 2
|
113
|
+
foo.resources.run_count.should == 2
|
114
|
+
|
125
115
|
thread.exit
|
126
116
|
end
|
127
|
-
|
128
|
-
|
117
|
+
|
129
118
|
it 'should support subprojects' do |spec|
|
130
|
-
|
131
119
|
write 'foo/src/main/java/Example.java', "public class Example {}"
|
132
120
|
write 'foo/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
133
|
-
|
121
|
+
|
134
122
|
define 'container' do
|
135
123
|
define('foo')
|
136
124
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
compile = project.compile
|
142
|
-
|
143
|
-
test_compile = project.test.compile
|
144
|
-
|
145
|
-
filter = project.resources
|
146
|
-
|
147
|
-
|
148
|
-
# After first period:
|
149
|
-
compile.should_receive :invoke
|
150
|
-
test_compile.should_receive :invoke
|
151
|
-
filter.should_not_receive :run
|
152
|
-
|
125
|
+
|
126
|
+
foo = instrument_project project("container:foo")
|
127
|
+
|
153
128
|
thread = Thread.new do
|
154
|
-
|
129
|
+
begin
|
130
|
+
project("container").cc.invoke
|
131
|
+
rescue => e
|
132
|
+
p "unexpected exception #{e.inspect}"
|
133
|
+
p e.backtrace.join("\n").inspect
|
134
|
+
end
|
155
135
|
end
|
156
|
-
|
157
|
-
sleep
|
158
|
-
|
159
|
-
|
160
|
-
compile.
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
filter.should_not_receive :run
|
167
|
-
|
168
|
-
sleep 1 # Wait one sec as the timestamp needs to be different.
|
136
|
+
|
137
|
+
sleep 1
|
138
|
+
|
139
|
+
foo.compile.run_count.should == 1
|
140
|
+
foo.test.compile.run_count.should == 1
|
141
|
+
foo.resources.run_count.should == 1
|
142
|
+
|
143
|
+
file("foo/target/classes/Example.class").should exist
|
144
|
+
tstamp = File.mtime("foo/target/classes/Example.class")
|
169
145
|
touch File.join(Dir.pwd, 'foo/src/main/java/Example.java')
|
170
|
-
|
171
|
-
|
146
|
+
|
147
|
+
sleep 1
|
148
|
+
|
149
|
+
foo.compile.run_count.should == 2
|
150
|
+
foo.test.compile.run_count.should == 2
|
151
|
+
foo.resources.run_count.should == 2
|
152
|
+
File.mtime("foo/target/classes/Example.class").should_not == tstamp
|
153
|
+
|
154
|
+
thread.exit
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'should support parent and subprojects' do |spec|
|
158
|
+
write 'foo/src/main/java/Example.java', "public class Example {}"
|
159
|
+
write 'foo/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
160
|
+
|
161
|
+
write 'bar/src/main/java/Example.java', "public class Example {}"
|
162
|
+
write 'bar/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
163
|
+
|
164
|
+
write 'src/main/java/Example.java', "public class Example {}"
|
165
|
+
write 'src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
166
|
+
|
167
|
+
write 'src/main/resources/foo.txt', "content"
|
168
|
+
|
169
|
+
define 'container' do
|
170
|
+
define('foo')
|
171
|
+
define('bar')
|
172
|
+
end
|
173
|
+
|
174
|
+
all = projects("container", "container:foo", "container:bar")
|
175
|
+
all.each { |p| instrument_project(p) }
|
176
|
+
|
177
|
+
thread = Thread.new do
|
178
|
+
begin
|
179
|
+
project("container").cc.invoke
|
180
|
+
rescue => e
|
181
|
+
p "unexpected exception #{e.inspect}"
|
182
|
+
p e.backtrace.join("\n").inspect
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
sleep 2
|
187
|
+
|
188
|
+
all.each do |p|
|
189
|
+
p.compile.run_count.should == 1
|
190
|
+
p.test.compile.run_count.should == 1
|
191
|
+
p.resources.run_count.should == 1
|
192
|
+
end
|
193
|
+
|
194
|
+
file("foo/target/classes/Example.class").should exist
|
195
|
+
tstamp = File.mtime("foo/target/classes/Example.class")
|
196
|
+
|
197
|
+
touch 'foo/src/main/java/Example.java'
|
198
|
+
p "after touch"
|
199
|
+
sleep 2
|
200
|
+
|
201
|
+
project("container:foo").tap do |p|
|
202
|
+
p.compile.run_count.should == 2
|
203
|
+
p.test.compile.run_count.should == 2
|
204
|
+
p.resources.run_count.should == 2
|
205
|
+
end
|
206
|
+
project("container").tap do |p|
|
207
|
+
p.compile.run_count.should == 1 # not_needed
|
208
|
+
p.test.compile.run_count.should == 1 # not_needed
|
209
|
+
p.resources.run_count.should == 2
|
210
|
+
end
|
211
|
+
File.mtime("foo/target/classes/Example.class").should_not == tstamp
|
212
|
+
|
213
|
+
touch 'src/main/java/Example.java'
|
214
|
+
sleep 2
|
215
|
+
|
216
|
+
project("container").tap do |p|
|
217
|
+
p.compile.run_count.should == 2
|
218
|
+
p.test.compile.run_count.should == 2
|
219
|
+
p.resources.run_count.should == 3
|
220
|
+
end
|
221
|
+
|
172
222
|
thread.exit
|
173
223
|
end
|
174
224
|
end
|