Skip to content

Commit 929bbae

Browse files
committed
New structure for getting bootstrapped:
* mvn package will just build enough to execute JRuby. This seems more in line with package phase, since phases after this involve integration testing. * Move gem installations to integration-test phase. Ruby tests seem more like integration testing, since they're almost all hitting large parts of JRuby rather than any single unit. This also solves issues with installing gems that depend on a fully functional package, like jruby-launcher. * ant test-extended runs everything up through verify stage, which includes integration-test gem installs. It then proceeds to run rake test:extended against the fully-bootstrapped JRuby. * rake test:extended runs unit tests (via -Ptest) and all Ruby unit tests, which for our purposes are integration tests. So the workflow goes like this: * After a clean checkout of JRuby, or if you want to ensure you are properly bootstrapped (with updated gems, for example), you would run "mvn verify". * From that point, all JRuby commands should work, including gem, rake, rspec, and so on. * Subsequent updates to jruby.jar can be achieved with just "mvn package" or "mvn", which is reasonably quick. * Ruby tests can be run via rake, rspec, ant, or mspec.
1 parent 5893ad5 commit 929bbae

4 files changed

Lines changed: 42 additions & 10 deletions

File tree

antlib/test.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@
3838

3939
<target name="test" depends="test-extended"/>
4040

41-
<target name="test-extended" depends="jar">
41+
<target name="test-extended">
42+
<!-- First, run up through integration phases -->
43+
<exec executable="mvn">
44+
<arg line="-q"/>
45+
<arg line="verify"/>
46+
</exec>
47+
48+
<!-- Then run Ruby tests from Rake -->
4249
<java classname="org.jruby.Main" fork="true" failonerror="true">
4350
<classpath refid="test.class.path"/>
4451
<jvmarg line="${java.opts}"/>
File renamed without changes.

pom.xml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@
244244
<type>gem</type>
245245
<scope>provided</scope>
246246
</dependency>
247-
<!--<dependency>
247+
<dependency>
248248
<groupId>rubygems</groupId>
249249
<artifactId>jruby-launcher</artifactId>
250250
<version>${jruby-launcher.version}</version>
251251
<type>gem</type>
252252
<scope>provided</scope>
253-
</dependency>-->
253+
</dependency>
254254
</dependencies>
255255
<properties>
256256
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
@@ -274,7 +274,7 @@
274274
<rspec-expectations.version>2.12.1</rspec-expectations.version>
275275
<rspec-mocks.version>2.12.2</rspec-mocks.version>
276276
<diff-lcs.version>1.1.3</diff-lcs.version>
277-
<jruby-launcher.version>1.0.18.dev</jruby-launcher.version>
277+
<jruby-launcher.version>1.0.18.pre1</jruby-launcher.version>
278278
</properties>
279279
<build>
280280
<sourceDirectory>src</sourceDirectory>
@@ -412,7 +412,7 @@
412412
</execution>
413413
<execution>
414414
<id>install bootstrap gems</id>
415-
<phase>package</phase>
415+
<phase>integration-test</phase>
416416
<goals>
417417
<goal>exec</goal>
418418
</goals>
@@ -432,7 +432,7 @@
432432
<argument>target/rspec-expectations-${rspec-expectations.version}.gem</argument>
433433
<argument>target/rspec-mocks-${rspec-mocks.version}.gem</argument>
434434
<argument>target/rspec-${rspec.version}.gem</argument>
435-
<!--<argument>build_lib/jruby-launcher-${jruby-launcher.version}-java.gem</argument>-->
435+
<argument>target/jruby-launcher-${jruby-launcher.version}.gem</argument>
436436
</arguments>
437437
<executable>java</executable>
438438
<classpathScope>compile</classpathScope>
@@ -568,7 +568,7 @@
568568
</execution>
569569
<execution>
570570
<id>copy bootstrap gems</id>
571-
<phase>process-classes</phase>
571+
<phase>pre-integration-test</phase>
572572
<goals>
573573
<goal>copy</goal>
574574
</goals>
@@ -622,14 +622,14 @@
622622
<overWrite>false</overWrite>
623623
<outputDirectory>target</outputDirectory>
624624
</artifactItem>
625-
<!--<artifactItem>
625+
<artifactItem>
626626
<groupId>rubygems</groupId>
627627
<artifactId>jruby-launcher</artifactId>
628628
<version>${jruby-launcher.version}</version>
629629
<type>gem</type>
630630
<overWrite>false</overWrite>
631631
<outputDirectory>target</outputDirectory>
632-
</artifactItem>-->
632+
</artifactItem>
633633
</artifactItems>
634634
</configuration>
635635
</execution>
@@ -709,6 +709,28 @@
709709
</execution>
710710
</executions>
711711
</plugin>
712+
<plugin>
713+
<groupId>org.apache.maven.plugins</groupId>
714+
<artifactId>maven-antrun-plugin</artifactId>
715+
<version>1.7</version>
716+
<executions>
717+
<execution>
718+
<id>copy</id>
719+
<phase>package</phase>
720+
<configuration>
721+
<tasks>
722+
<exec executable="/bin/sh" osfamily="unix">
723+
<arg line="-c 'test -f &quot;${basedir}/bin/jruby&quot; || cp &quot;${basedir}/bin/jruby.bash&quot; &quot;${basedir}/bin/jruby&quot;'"/>
724+
</exec>
725+
<chmod perm="755" file="bin/jruby"/>
726+
</tasks>
727+
</configuration>
728+
<goals>
729+
<goal>run</goal>
730+
</goals>
731+
</execution>
732+
</executions>
733+
</plugin>
712734
<plugin>
713735
<groupId>org.apache.maven.plugins</groupId>
714736
<artifactId>maven-surefire-plugin</artifactId>

rakelib/test.rake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ namespace :test do
7171
task :rake_targets => long_tests
7272

7373
task :extended do
74-
sh 'mvn -q -Ptest test' # also compiles files needed for some ruby tests
74+
# cause unit tests to run
75+
sh 'mvn -q -Ptest test'
76+
77+
# run Ruby integration tests
7578
Rake::Task["test:rake_targets"].invoke
7679
end
7780

0 commit comments

Comments
 (0)