Skip to content

Commit

Permalink
Merge pull request #249 from headius/update_build_tooling
Browse files Browse the repository at this point in the history
Update build tooling
  • Loading branch information
headius committed May 23, 2024
2 parents e5f3041 + c3231eb commit a946ac1
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 45 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B install --file pom.xml

# Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ group :development do
gem 'appraisal', '< 1.0', :require => nil
end

gem 'rake', '~> 10.3.1', :group => :test, :require => nil
gem 'rspec', '~> 2.14.1', :group => :test
gem 'rake', '~> 13.2', :group => :test, :require => nil
gem 'rspec', :group => :test
gem 'jruby-openssl', :group => :test if JRUBY_VERSION < '1.7.0'
36 changes: 22 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ GEM
appraisal (0.5.2)
bundler
rake
diff-lcs (1.2.5)
rack (1.6.0)
rake (10.3.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
diff-lcs (1.5.1)
rack (3.0.11)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)

PLATFORMS
java
universal-java-1.8

DEPENDENCIES
appraisal (< 1.0)
rack
rake (~> 10.3.1)
rspec (~> 2.14.1)
rake (~> 13.2)
rspec

BUNDLED WITH
2.4.19
2 changes: 1 addition & 1 deletion History.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Changes from 1.1.15 apply since the previous release got yanked due a regression
- a work-around for WAS (8.5) failing on `Dir.chdir` while booting (#170)
- consider response unhandled when OPTIONS with "Allow" header set (#153)
- improved handling for jruby.compat.version (should work with jruby-head)
- start using de.saumya.mojo jruby plugins for mvn (relates to #108 as well)
- start using org.jruby.maven jruby plugins for mvn (relates to #108 as well)
this allows us to work without a GEM_HOME/GEM_PATH (local ruby install)
- use ruby-style methods for the servlet api (in our servlet_env handler)

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ task :unpack_gem => "target" do |t|
mkdir_p "target/vendor"
require 'rubygems/installer'
rack_dir = File.basename(gem_file).sub(/\.gem$/, '')
Gem::Installer.new(gem_file, :unpack => true, :install_dir => rack_dir).unpack "#{target}/#{rack_dir}"
Gem::Installer.new(Gem::Package.new(gem_file), :unpack => true, :install_dir => rack_dir).unpack "#{target}/#{rack_dir}"
File.open("#{target}/vendor/rack.rb", "w") do |f|
f << "dir = File.dirname(__FILE__)\n"
f << "if dir =~ /.jar!/ && dir !~ /^file:/\n"
Expand Down
60 changes: 36 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
</description>

<properties>
<jruby.version>1.7.19</jruby.version>
<jruby.version>9.4.7.0</jruby.version>
<vendor.gems.path>vendor/gems</vendor.gems.path>
<bundler.version>1.7.14</bundler.version>
<bundler.version>2.4.19</bundler.version>
<bundler.local>false</bundler.local> <!-- true by default -->
<saumya.mojo.version>1.0.9</saumya.mojo.version>
<jruby.maven.plugins.version>3.0.3</jruby.maven.plugins.version>
<gem.home>${project.build.directory}/rubygems</gem.home>
</properties>

Expand Down Expand Up @@ -75,10 +75,6 @@
</developers>

<repositories>
<repository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
Expand All @@ -89,6 +85,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>mavengems</id>
<url>mavengem:https://rubygems.org</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -160,9 +160,21 @@
<type>gem</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
</dependencies>

<build>
<extensions>
<extension>
<groupId>org.jruby.maven</groupId>
<artifactId>mavengem-wagon</artifactId>
<version>2.0.2</version>
</extension>
</extensions>
<defaultGoal>install</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
Expand All @@ -186,8 +198,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>8</source>
<target>8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
Expand Down Expand Up @@ -221,9 +233,9 @@
</executions>
</plugin>
<plugin>
<groupId>de.saumya.mojo</groupId>
<groupId>org.jruby.maven</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>${saumya.mojo.version}</version>
<version>${jruby.maven.plugins.version}</version>
<configuration>
<includeOpenSSL>false</includeOpenSSL>
<gemHomes>
Expand All @@ -241,9 +253,9 @@
</executions>
</plugin>
<plugin>
<groupId>de.saumya.mojo</groupId>
<groupId>org.jruby.maven</groupId>
<artifactId>bundler-maven-plugin</artifactId>
<version>${saumya.mojo.version}</version>
<version>${jruby.maven.plugins.version}</version>
<executions>
<execution>
<id>bundle-install</id>
Expand All @@ -258,19 +270,19 @@
</executions>
</plugin>
<plugin>
<groupId>de.saumya.mojo</groupId>
<groupId>org.jruby.maven</groupId>
<artifactId>rake-maven-plugin</artifactId>
<version>${saumya.mojo.version}</version>
<version>${jruby.maven.plugins.version}</version>
<executions>
<execution>
<id>rake-spec</id>
<phase>test</phase>
<goals><goal>rake</goal></goals>
<configuration>
<jruby.version>${jruby.version}</jruby.version>
<args>speconly SKIP_SPECS=${maven.test.skip} FULL_BIN_PATH=true</args>
</configuration>
</execution>
<!-- <execution>-->
<!-- <id>rake-spec</id>-->
<!-- <phase>test</phase>-->
<!-- <goals><goal>rake</goal></goals>-->
<!-- <configuration>-->
<!-- <jruby.version>${jruby.version}</jruby.version>-->
<!-- <args>speconly SKIP_SPECS=${maven.test.skip} FULL_BIN_PATH=true</args>-->
<!-- </configuration>-->
<!-- </execution>-->
<execution>
<!-- additional (ruby) generated resources -->
<id>rake-resources</id>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jruby/rack/ext/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ else if ( msg instanceof RubyException ) { // print backtrace for error
@JRubyMethod(name = "<<")
public IRubyObject append(final ThreadContext context, final IRubyObject msg) {
final RubyString msgString = msg.asString();
doLog(msgString); return msgString.length();
doLog(msgString); return msgString.rubyLength(context);
}

// private
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/jruby/rack/ext/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ public String getBody() {
final StringBuilder bodyParts = new StringBuilder();
invoke(context, this.body, "each",
new JavaInternalBlockBody(context.runtime, Arity.ONE_REQUIRED) {
@Override
public IRubyObject yield(ThreadContext context, IRubyObject[] args) {
return yield(context, args[0]);
}

@Override
public IRubyObject yield(ThreadContext context, IRubyObject part) {
bodyParts.append( part.asString().toString() );
Expand Down Expand Up @@ -377,6 +382,11 @@ public void visit(final IRubyObject key, final IRubyObject val) {
// value.each_line { |val| response.addHeader(key.to_s, val.chomp("\n")) }
invoke(context, val, each_line ? "each_line" : "each",
new JavaInternalBlockBody(context.runtime, Arity.ONE_REQUIRED) {
@Override
public IRubyObject yield(ThreadContext context, IRubyObject[] args) {
return yield(context, args[0]);
}

@Override
public IRubyObject yield(ThreadContext context, IRubyObject value) {
value.callMethod(context, "chomp!", newLine);
Expand Down Expand Up @@ -464,6 +474,11 @@ protected void writeBody(final RackResponseEnvironment response) throws IOExcept
try {
invoke(context, body, method,
new JavaInternalBlockBody(context.runtime, Arity.ONE_REQUIRED) {
@Override
public IRubyObject yield(ThreadContext context, IRubyObject[] args) {
return yield(context, args[0]);
}

@Override
public IRubyObject yield(ThreadContext context, IRubyObject line) {
//final ByteList bytes = line.asString().getByteList();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jruby/rack/util/ExceptionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public static CharSequence formatError(final RubyException error) {

private static void appendInspect(final RubyException error, final StringBuilder out) {
final RubyClass errorClass = error.getMetaClass().getRealClass();
if ( error.message != null && ! error.message.isNil() ) {
if ( error.getMessage() != null && ! error.getMessage().isNil() ) {
out.append("#<").append( errorClass.getName() ).append(": ");
out.append( error.message.asString() ).append('>');
out.append( error.getMessage().asString() ).append('>');
}
else {
out.append( errorClass.getName() );
Expand Down

0 comments on commit a946ac1

Please sign in to comment.