diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 780446755e3..c85d59b7bfa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,15 +23,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
@@ -53,15 +53,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
@@ -79,15 +79,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '8'
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
@@ -106,15 +106,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '8'
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
@@ -123,23 +123,20 @@ jobs:
jruby-tests-dev:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
env:
JRUBY_OPTS: '--dev'
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake test:jruby
@@ -161,15 +158,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
@@ -188,15 +185,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: mvn package ${{ matrix.package-flags }}
@@ -218,15 +215,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: mvn package ${{ matrix.package-flags }}
@@ -237,23 +234,20 @@ jobs:
regression-specs-jit:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
env:
JRUBY_OPTS: '-Xjit.threshold=0'
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 8
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake spec:regression
@@ -262,9 +256,6 @@ jobs:
mvn-test-windows:
runs-on: windows-latest
- strategy:
- fail-fast: false
-
name: mvn -Ptest, rake test:jruby (Windows, Java 11)
env:
@@ -273,15 +264,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 11
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake test:jruby
@@ -289,7 +280,7 @@ jobs:
env:
JRUBY_OPTS: ''
- name: mvn -P test
- run: ./mvnw package -B -Ptest
+ run: ./mvnw -ntp package -Ptest
dependency-check:
runs-on: ubuntu-latest
@@ -298,9 +289,9 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '8'
@@ -313,15 +304,12 @@ jobs:
test-versions:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
name: Verify build artifacts
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 8
@@ -334,9 +322,6 @@ jobs:
sequel:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
services:
postgres:
image: postgres:latest
@@ -361,15 +346,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: sequel
@@ -378,20 +363,17 @@ jobs:
concurrent-ruby:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
-
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: concurrent-ruby
@@ -411,9 +393,9 @@ jobs:
#
# steps:
# - name: checkout
-# uses: actions/checkout@v3
+# uses: actions/checkout@v6
# - name: set up java ${{ matrix.java-version }}
-# uses: actions/setup-java@v3
+# uses: actions/setup-java@v5
# with:
# distribution: 'zulu'
# java-version: ${{ matrix.java-version }}
@@ -440,7 +422,7 @@ jobs:
# - name: Bootstrap build
# uses: jruby/jruby-ci-build@v1
# - name: set up java ${{ matrix.java-version }}
-# uses: actions/setup-java@v3
+# uses: actions/setup-java@v5
# with:
# distribution: 'zulu'
# java-version: ${{ matrix.java-version }}
@@ -457,15 +439,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'semeru'
java-version: '17'
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby -S bundle install
- name: test profile
@@ -480,7 +462,7 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: install shellcheck
run: sudo apt install shellcheck
- name: run shellcheck
@@ -498,15 +480,15 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up java 8
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '8'
cache: 'maven'
- name: bootstrap
- run: mvn -ntp -Pbootstrap clean package
+ run: ./mvnw -ntp -Pbootstrap clean package
- name: bundle install
run: bin/jruby --dev -S bundle install
- name: rake ${{ matrix.target }}
diff --git a/.github/workflows/dist-verification-ci.yml b/.github/workflows/dist-verification-ci.yml
new file mode 100644
index 00000000000..9d85d6c6971
--- /dev/null
+++ b/.github/workflows/dist-verification-ci.yml
@@ -0,0 +1,301 @@
+name: Dist Verification CI
+
+on:
+ push:
+ pull_request:
+ workflow_call:
+ secrets:
+ INSTALL4J_LICENSE:
+ required: true
+
+
+env:
+ JAVA_OPTS: '-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xms60M -Xmx1G -XX:InitialCodeCacheSize=40M -XX:ReservedCodeCacheSize=120M'
+
+permissions:
+ contents: read
+
+jobs:
+ build-dist:
+
+ strategy:
+ matrix:
+ java-version: ['8']
+ fail-fast: false
+
+ runs-on: ubuntu-latest
+
+ name: Build JRuby release artifacts
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@v6
+ - name: set up java 8
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'temurin'
+ java-version: 8
+ cache: 'maven'
+ - name: build release artifacts
+ run: |
+ ./mvnw -ntp clean package -Pall
+ - uses: cedx/SetupAnt@v6
+ - name: install dependencies
+ run: bin/jruby -S bundle install
+ - name: cache release artifacts
+ run: |
+ mv maven/jruby-dist/target/jruby-dist*-bin.tar.gz jruby-dist-bin.tar.gz
+ mv maven/jruby-dist/target/jruby-dist*-src.tar.gz jruby-dist-src.tar.gz
+ mv maven/jruby-complete/target/jruby-complete*.jar jruby-complete.jar
+ - name: cache dist bin
+ uses: actions/upload-artifact@v7
+ with:
+ path: jruby-dist-bin.tar.gz
+ retention-days: 1
+ archive: false
+ - name: cache dist src
+ uses: actions/upload-artifact@v7
+ with:
+ path: jruby-dist-src.tar.gz
+ retention-days: 1
+ archive: false
+ - name: cache jruby-complete
+ uses: actions/upload-artifact@v7
+ with:
+ path: jruby-complete.jar
+ retention-days: 1
+ archive: false
+
+ build-installer:
+
+ if: ${{ github.repository == 'jruby/jruby' && github.event_name == 'push' }}
+
+ strategy:
+ matrix:
+ java-version: ['8']
+ fail-fast: false
+
+ runs-on: ubuntu-latest
+
+ name: Build JRuby Windows installers
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@v6
+ - name: set up java 8
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'temurin'
+ java-version: 8
+ cache: 'maven'
+ - name: set up install4j
+ uses: luangong/setup-install4j@v1
+ with:
+ version: 9.0.7
+ license: ${{ secrets.INSTALL4J_LICENSE_9 }}
+ - name: build release artifacts
+ run: |
+ ./mvnw -ntp clean package -Pall
+ - uses: cedx/SetupAnt@v6
+ - name: install dependencies
+ run: bin/jruby -S bundle install
+ - name: build installer
+ run: bin/jruby -S rake installer INSTALL4J_EXECUTABLE=/opt/install4j/bin/install4jc
+ - name: cache release artifacts
+ run: |
+ mv release/jruby_windows-x32*.exe jruby_windows-x32.exe
+ mv release/jruby_windows_x64*.exe jruby_windows-x64.exe
+ - name: cache x32 installer
+ uses: actions/upload-artifact@v7
+ with:
+ path: jruby_windows-x32.exe
+ retention-days: 1
+ archive: false
+ - name: cache x64 installer
+ uses: actions/upload-artifact@v7
+ with:
+ path: jruby_windows-x64.exe
+ retention-days: 1
+ archive: false
+
+ rails-verification:
+
+ needs: build-dist
+
+ strategy:
+ matrix:
+ java-version: ['8', '21']
+ runs-on: [windows-latest, macos-latest, ubuntu-latest]
+ fail-fast: false
+
+ runs-on: ${{ matrix.runs-on }}
+
+ name: rails verification on ${{ matrix.runs-on }} (Java ${{ matrix.java-version }})
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@v6
+ with:
+ path: jruby-src
+ - name: set up java ${{ matrix.java-version }}
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+ - name: download cached dist bin
+ uses: actions/download-artifact@v8
+ with:
+ name: jruby-dist-bin.tar.gz
+ - name: unpack dist
+ run: tar xzf jruby-dist-bin.tar.gz --strip-components=1
+ - name: dist verification (Windows)
+ if: matrix.runs-on == 'windows-latest'
+ run: echo "${{ github.workspace }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
+ - name: set up dist path (Unix)
+ if: matrix.runs-on != 'windows-latest'
+ run: echo "$(pwd)/bin" >> $GITHUB_PATH
+ - name: rails verification
+ run: jruby jruby-src/tool/rails_runner
+
+ src-verification:
+
+ needs: build-dist
+
+ strategy:
+ matrix:
+ java-version: ['8', '21']
+ runs-on: [windows-latest, macos-latest, ubuntu-latest]
+ fail-fast: false
+
+ runs-on: ${{ matrix.runs-on }}
+
+ name: src verification on ${{ matrix.runs-on }} (Java ${{ matrix.java-version }})
+
+ steps:
+ - name: set up java ${{ matrix.java-version }}
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+ - name: download cached dist src
+ uses: actions/download-artifact@v8
+ with:
+ name: jruby-dist-src.tar.gz
+ - name: test compilation of dist src
+ run: |
+ mkdir jruby-dist-src
+ cd jruby-dist-src
+ tar xzf ../jruby-dist-src.tar.gz --strip-components=1
+ ./mvnw -ntp clean install -Pdist
+ cd ..
+
+ jruby-complete-verification:
+
+ needs: build-dist
+
+ strategy:
+ matrix:
+ java-version: ['8', '21']
+ runs-on: [windows-latest, macos-latest, ubuntu-latest]
+ fail-fast: false
+
+ runs-on: ${{ matrix.runs-on }}
+
+ name: jruby-complete verification on ${{ matrix.runs-on }} (Java ${{ matrix.java-version }})
+
+ steps:
+ - name: set up java ${{ matrix.java-version }}
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+ - name: download cached jruby-complete
+ uses: actions/download-artifact@v8
+ with:
+ name: jruby-complete.jar
+ - name: confirm rubygems works with jruby-complete
+ run: java -jar jruby-complete.jar -S gem list
+
+ misc-verification:
+
+ needs: build-dist
+
+ strategy:
+ matrix:
+ java-version: ['8', '21']
+ runs-on: [windows-latest, macos-latest, ubuntu-latest]
+ fail-fast: false
+
+ runs-on: ${{ matrix.runs-on }}
+
+ name: misc verification on ${{ matrix.runs-on }} (Java ${{ matrix.java-version }})
+
+ steps:
+ - name: set up java ${{ matrix.java-version }}
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+ - name: download cached dist bin
+ uses: actions/download-artifact@v8
+ with:
+ name: jruby-dist-bin.tar.gz
+ - name: unpack dist
+ run: tar xzf jruby-dist-bin.tar.gz --strip-components=1
+ - name: dist verification (Windows)
+ if: matrix.runs-on == 'windows-latest'
+ run: echo "${{ github.workspace }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
+ - name: set up dist path (Unix)
+ if: matrix.runs-on != 'windows-latest'
+ run: echo "$(pwd)/bin" >> $GITHUB_PATH
+ - name: syslog verification (Unix)
+ if: matrix.runs-on != 'windows-latest'
+ run: jruby -rsyslog -e 1
+
+ installer-verification:
+
+ if: ${{ github.repository == 'jruby/jruby' && github.event_name == 'push' }}
+
+ needs: build-installer
+
+ strategy:
+ matrix:
+ java-version: ['8', '21']
+ fail-fast: false
+
+ runs-on: windows-latest
+
+ name: installer verification on Windows (Java ${{ matrix.java-version }})
+
+ steps:
+ - name: set up java (x64, ${{ matrix.java-version }})
+ uses: actions/setup-java@v5
+ with:
+ architecture: x64
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+ - name: download cached installer x64
+ uses: actions/download-artifact@v8
+ with:
+ name: jruby_windows-x64.exe
+ - name: run installer x64
+ shell: cmd
+ run: .\jruby_windows-x64.exe -q -console -dir installed_jruby
+ - name: run installed JRuby x64
+ run: installed_jruby\bin\jruby -e "puts 'hello'"
+
+# - name: set up java (x86, ${{ matrix.java-version }})
+# uses: actions/setup-java@v5
+# with:
+# architecture: x86
+# distribution: 'zulu'
+# java-version: ${{ matrix.java-version }}
+# - name: download cached installer x86
+# uses: actions/download-artifact@v8
+# with:
+# name: jruby_windows-x32.exe
+# - name: run installer x86
+# shell: cmd
+# run: .\jruby_windows-x64.exe -q -console -dir installed_jruby
+# - name: run installed JRuby x86
+# run: installed_jruby\bin\jruby -e "puts 'hello'"
diff --git a/.github/workflows/snapshot-publish.yml b/.github/workflows/snapshot-publish.yml
index 591d1eb86e2..90656d3e1a9 100644
--- a/.github/workflows/snapshot-publish.yml
+++ b/.github/workflows/snapshot-publish.yml
@@ -23,9 +23,9 @@ jobs:
steps:
- name: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v6
- name: set up Java
- uses: actions/setup-java@v2
+ uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: ${{ inputs.javaLevel }}
@@ -33,14 +33,13 @@ jobs:
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
- run: ./mvnw -B clean deploy -Prelease
+ run: ./mvnw -ntp clean deploy -Prelease
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Archive non-Maven artifacts
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v7
with:
- name: jruby-jars gem
- path: |
- maven/jruby-jars/pkg/jruby-jars-*.SNAPSHOT.gem
+ path: maven/jruby-jars/pkg/jruby-jars-*.SNAPSHOT.gem
+ archive: false
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index cb28b0e37c7..00000000000
Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 70f4f50fc39..c595b0093af 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1,18 +1,3 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
+wrapperVersion=3.3.4
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip
diff --git a/BUILDING.md b/BUILDING.md
index 3a6afa3ca6e..92fa9931268 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -5,10 +5,12 @@ Prerequisites:
* A [Java 8-compatible (or higher) Java development kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
* If `JAVA_HOME` is not set on Mac OS X: `export JAVA_HOME=$(/usr/libexec/java_home)`
-* [Maven](https://maven.apache.org/download.cgi) 3.3.0+ (Maven Wrapper provided with `./mvnw`)
-* [Apache Ant](https://ant.apache.org/bindownload.cgi) 1.8+ (see https://github.com/jruby/jruby/issues/2236)
* [Make](https://www.gnu.org/software/make/) and a C++ compiler for installing the jruby-launcher gem
+For running tests, you will need Ant:
+
+* [Apache Ant](https://ant.apache.org/bindownload.cgi) 1.8+ (see https://github.com/jruby/jruby/issues/2236)
+
JRuby uses Maven for building and bootstrapping itself, along with Rake,
RSpec, and MSpec for running integration tests.
@@ -23,7 +25,7 @@ command to execute is:
./mvnw
```
-This will run the default "install" goal (`mvn install`) and will do all of the following:
+This will run the default "install" goal (`./mvnw install`) and will do all of the following:
* Compile JRuby
* Build `lib/jruby.jar`, needed for running at command line
@@ -31,13 +33,11 @@ This will run the default "install" goal (`mvn install`) and will do all of the
The environment is now suitable for running Ruby applications.
-If you have Maven installed in your PATH, you can just use `mvn` instead of `./mvnw`.
-
Incremental Builds
------------------
When working on JRuby sources, it is helpful to incrementally rebuild only the `lib/jruby.jar` file rather than also
-re-assembling the standard library. You can add `-Dcore` to the `mvn` command line to speed up incremental builds:
+re-assembling the standard library. You can add `-Dcore` to the `./mvnw` command line to speed up incremental builds:
```
./mvnw -Dcore
@@ -90,7 +90,7 @@ environment. This will do the following:
needed to run integration tests.
```
-mvn -Pbootstrap
+./mvnw -Pbootstrap
```
In case there is a problem with installing the jruby-launcher (due to missing compiler or so) use
@@ -108,7 +108,7 @@ After changing Java code, you can recompile quickly by running one of the
jar files by
```
-mvn -pl core
+./mvnw -pl core
```
### Day to Day Testing
@@ -158,7 +158,7 @@ Most of the specs under the spec/ directory are written for rspec, and can be ru
The notable exception is the "Ruby specs" under spec/ruby, which are run with mspec as described later in this document.
-rspec will be installed with `mvn package -Pbootstrap` or you can install it manually.
+rspec will be installed with `./mvnw package -Pbootstrap` or you can install it manually.
```
./bin/jruby -S rspec spec/path/to/spec
@@ -191,7 +191,7 @@ If you are making changes that would affect JRuby's core runtime
or embedding APIs, you should run JRuby's Java-based unit tests via
```
-mvn -Ptest
+./mvnw -Ptest
```
#### Tests for other ways of deploying and packaging JRuby
@@ -199,9 +199,9 @@ mvn -Ptest
There are some maven integration tests (i.e. consistency test if all gems are included, osgi test, etc) for the various distributions of JRuby which can be invoked with
```
-mvn -Pmain -Dinvoker.skip=false
-mvn -Pcomplete -Dinvoker.skip=false
-mvn -Pdist -Dinvoker.skip=false
+./mvnw -Pmain -Dinvoker.skip=false
+./mvnw -Pcomplete -Dinvoker.skip=false
+./mvnw -Pdist -Dinvoker.skip=false
```
#### Just Like CI
@@ -222,18 +222,18 @@ maven/jruby-dist/src/it
To trigger the tests with the build:
```
-mvn -Pmain -Dinvoker.skip=false
-mvn -Pcomplete -Dinvoker.skip=false
-mvn -Pdist -Dinvoker.skip=false
-mvn -Pjruby-jars -Dinvoker.skip=false
+./mvnw -Pmain -Dinvoker.skip=false
+./mvnw -Pcomplete -Dinvoker.skip=false
+./mvnw -Pdist -Dinvoker.skip=false
+./mvnw -Pjruby-jars -Dinvoker.skip=false
```
To pick a particular test, add the name of the directory inside the respective *src/it* folder, like (wildcards are possible):
```
-mvn -Pmain -Dinvoker.skip=false -Dinvoker.test=integrity
-mvn -Pmain -Dinvoker.skip=false -Dinvoker.test=j2ee*
-mvn -Pmain -Dinvoker.skip=false -Dinvoker.test=osgi*
+./mvnw -Pmain -Dinvoker.skip=false -Dinvoker.test=integrity
+./mvnw -Pmain -Dinvoker.skip=false -Dinvoker.test=j2ee*
+./mvnw -Pmain -Dinvoker.skip=false -Dinvoker.test=osgi*
```
Clean Build
@@ -242,7 +242,7 @@ Clean Build
To clean the build it is important to use the same profile for the clean as what you want to build. The best way to clean build something is, i.e. jruby-jars
```
-mvn clean install -Pjruby-jars
+./mvnw clean install -Pjruby-jars
```
This first cleans everything and then starts the new build in one go!
@@ -251,12 +251,12 @@ Cleaning the build may be necessary after switching to a different
version of JRuby (for example, after switching git branches) to ensure
that everything is rebuilt properly.
-NOTE: `mvn clean` just cleans the **jruby-core** artifact and the **./lib/jruby.jar**!
+NOTE: `./mvnw clean` just cleans the **jruby-core** artifact and the **./lib/jruby.jar**!
Clean everything:
```
-mvn -Pclean
+./mvnw -Pclean
```
Distribution Packages
diff --git a/VERSION b/VERSION
index cde2a4bfb39..2d112dfa122 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-9.4.15.0-SNAPSHOT
+9.4.16.0-SNAPSHOT
diff --git a/antlib/extra.xml b/antlib/extra.xml
deleted file mode 100644
index ea5abb87941..00000000000
--- a/antlib/extra.xml
+++ /dev/null
@@ -1,517 +0,0 @@
-
-
-
-
-
-
-
-
-build jruby maven artifact
-
-
-
-
-
-
-build jruby-complete.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/bin/.jruby.release b/bin/.jruby.release
index 749437cb121..6c3342ddbc0 100644
--- a/bin/.jruby.release
+++ b/bin/.jruby.release
@@ -1,3 +1,3 @@
-JRUBY_VERSION=9.4.15.0-SNAPSHOT
+JRUBY_VERSION=9.4.16.0-SNAPSHOT
JRUBY_MAIN=org.jruby.Main
JRUBY_MINIMUM_JAVA_VERSION=8
diff --git a/core/pom.xml b/core/pom.xml
index 26c3aa8f9f1..a1a8216dc3a 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -12,7 +12,7 @@ DO NOT MODIFY - GENERATED CODE
org.jruby
jruby-parent
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
jruby-base
JRuby Base
@@ -692,7 +692,7 @@ DO NOT MODIFY - GENERATED CODE
org.jruby
jruby-base
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
diff --git a/core/src/main/java/org/jruby/RubyInstanceConfig.java b/core/src/main/java/org/jruby/RubyInstanceConfig.java
index 0609818d280..87b5278addc 100644
--- a/core/src/main/java/org/jruby/RubyInstanceConfig.java
+++ b/core/src/main/java/org/jruby/RubyInstanceConfig.java
@@ -55,6 +55,7 @@
import org.objectweb.asm.Opcodes;
import java.io.*;
+import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
@@ -1802,40 +1803,25 @@ public boolean shouldPrecompileAll() {
private static int initJavaBytecodeVersion() {
final String specVersion = Options.BYTECODE_VERSION.load();
+ return calculateBytecodeVersion(specVersion);
+ }
+
+ public static int calculateBytecodeVersion(String specVersion) {
if (specVersion.indexOf('.') != -1) {
switch (specVersion) {
default:
- System.err.println("unsupported Java version, using 1.8: " + specVersion);
+ System.err.println("unsupported Java version " + specVersion + ", using 1.8");
case "1.8":
return Opcodes.V1_8;
}
}
int version = Integer.parseInt(specVersion);
- switch (version) {
- case 8 :
- return Opcodes.V1_8; // 52
- case 9 :
- return Opcodes.V9;
- case 10 :
- return Opcodes.V10;
- case 11 :
- return Opcodes.V11;
- case 12 :
- return Opcodes.V12;
- case 13 :
- return Opcodes.V13;
- case 14 :
- return Opcodes.V14;
- case 15 :
- return Opcodes.V15;
- case 16 :
- return Opcodes.V16;
- case 17 :
- return Opcodes.V17;
- case 18 :
- default :
- return Opcodes.V18;
+ try {
+ Field versionField = Opcodes.class.getField("V" + version);
+ return (Integer) versionField.get(null);
+ } catch (Exception e) {
+ return Opcodes.V21;
}
}
diff --git a/core/src/main/java/org/jruby/anno/MethodDescriptor.java b/core/src/main/java/org/jruby/anno/MethodDescriptor.java
index fabdda57db5..7647795bdb0 100644
--- a/core/src/main/java/org/jruby/anno/MethodDescriptor.java
+++ b/core/src/main/java/org/jruby/anno/MethodDescriptor.java
@@ -159,7 +159,7 @@ public MethodDescriptor(T methodObject) {
* @return arity value of specific required arity which can be used as an unboxed call or -1 for all other cases.
*/
public int calculateSpecificCallArity() {
- if (optional == 0 && !rest) {
+ if (optional == 0 && !rest && !hasVarArgs) {
if (required == 0) {
if (actualRequired <= MAX_REQUIRED_UNBOXED_ARITY) return actualRequired;
} else if (required >= 0 && required <= MAX_REQUIRED_UNBOXED_ARITY) {
diff --git a/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java b/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java
index be8fcf7a4d2..f6ebc4b9f50 100644
--- a/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java
+++ b/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java
@@ -43,6 +43,7 @@
import org.jruby.runtime.JavaInternalBlockBody;
import org.jruby.runtime.Signature;
import org.jruby.runtime.ThreadContext;
+import org.jruby.runtime.backtrace.RubyStackTraceElement;
import org.jruby.runtime.backtrace.TraceType;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.RubyStringBuilder;
@@ -229,9 +230,8 @@ static RubyModule define(final Ruby runtime, final RubyClass proxy) {
public static IRubyObject backtrace(final ThreadContext context, final IRubyObject self) {
final Ruby runtime = context.runtime;
java.lang.Throwable throwable = unwrapIfJavaObject(self);
- // TODO instead this should get aligned with NativeException !?!
StackTraceElement[] stackTrace = throwable.getStackTrace();
- if ( stackTrace == null ) return context.nil; // never actually happens
+ if ( stackTrace == null ) return context.nil;
final int len = stackTrace.length;
if ( len == 0 ) return RubyArray.newEmptyArray(runtime);
IRubyObject[] backtrace = new IRubyObject[len];
@@ -241,6 +241,20 @@ public static IRubyObject backtrace(final ThreadContext context, final IRubyObje
return RubyArray.newArrayMayCopy(runtime, backtrace);
}
+ @JRubyMethod
+ public static IRubyObject backtrace_locations(final ThreadContext context, final IRubyObject self) {
+ java.lang.Throwable throwable = unwrapIfJavaObject(self);
+ StackTraceElement[] stackTrace = throwable.getStackTrace();
+ if ( stackTrace == null ) return context.nil;
+ final int len = stackTrace.length;
+ if ( len == 0 ) return RubyArray.newEmptyArray(context.runtime);
+ RubyStackTraceElement[] rubyStackTrace = new RubyStackTraceElement[len];
+ for ( int i = 0; i < len; i++ ) {
+ rubyStackTrace[i] = new RubyStackTraceElement(stackTrace[i]);
+ }
+ return RubyThread.Location.newLocationArray(context.runtime, rubyStackTrace);
+ }
+
@JRubyMethod // can not set backtrace for a java.lang.Throwable
public static IRubyObject set_backtrace(final IRubyObject self, final IRubyObject backtrace) {
return self.getRuntime().getNil();
diff --git a/core/src/main/java/org/jruby/util/io/PopenExecutor.java b/core/src/main/java/org/jruby/util/io/PopenExecutor.java
index b4a534a5169..d221c46e744 100644
--- a/core/src/main/java/org/jruby/util/io/PopenExecutor.java
+++ b/core/src/main/java/org/jruby/util/io/PopenExecutor.java
@@ -155,19 +155,15 @@ long spawnProcess(ThreadContext context, Ruby runtime, ExecArg eargp, String[] e
prog = eargp.use_shell ? eargp.command_name : eargp.command_name;
- if (eargp.chdirGiven) {
- // we can'd do chdir with posix_spawn, so we should be set to use_shell and now
- // just need to add chdir to the cmd
- String script = "cd '" + eargp.chdir_dir + "'; ";
+ String progString;
- // use exec to eliminate extra sh process if we do not need to run command as a shell script
- if (!searchForMetaChars(prog)) {
- script = script + "exec ";
- }
+ if (eargp.chdirGiven) { // posix_spawn cannot chdir; run a guarded shell command instead
+ progString = chdirShellCommand(eargp.chdir_dir, prog, !searchForMetaChars(prog));
- prog = (RubyString)prog.strDup(runtime).prepend(context, newString(runtime, script));
eargp.chdir_dir = null;
eargp.chdirGiven = false;
+ } else {
+ progString = prog.toString();
}
if (execargRunOptions(context, runtime, eargp, sarg, errmsg) < 0) {
@@ -182,11 +178,11 @@ long spawnProcess(ThreadContext context, Ruby runtime, ExecArg eargp, String[] e
// }
}
if (eargp.use_shell) {
- pid = procSpawnSh(runtime, prog.toString(), eargp);
+ pid = procSpawnSh(runtime, progString, eargp);
}
else {
String[] argv = eargp.argv_str.argv;
- pid = procSpawnCmd(runtime, argv, prog.toString(), eargp);
+ pid = procSpawnCmd(runtime, argv, progString, eargp);
}
if (pid == -1) {
context.setLastExitStatus(new RubyProcess.RubyStatus(runtime, runtime.getProcStatus(), 0x7f << 8, 0));
@@ -588,9 +584,8 @@ private RubyIO pipeOpen(ThreadContext context, ExecArg eargp, String modestr, in
cmd = StringSupport.checkEmbeddedNulls(runtime, prog).toString();
if (eargp.chdirGiven) {
- // we can'd do chdir with posix_spawn, so we should be set to use_shell and now
- // just need to add chdir to the cmd
- cmd = "cd '" + eargp.chdir_dir + "'; " + cmd;
+ // posix_spawn cannot chdir; run a guarded shell command instead.
+ cmd = chdirShellCommand(eargp.chdir_dir, cmd, false);
eargp.chdir_dir = null;
eargp.chdirGiven = false;
}
@@ -1950,6 +1945,15 @@ private static void execFillarg(ThreadContext context, RubyString prog, IRubyObj
}
}
+ private static String chdirShellCommand(String dir, CharSequence command, boolean exec) {
+ final String script = "cd -- " + quotePosixShellWord(dir) + " && ";
+ return exec ? (script + "exec " + command) : (script + "eval " + quotePosixShellWord(command.toString()));
+ }
+
+ private static String quotePosixShellWord(String str) {
+ return '\'' + str.replace("'", "'\\''") + '\'';
+ }
+
/**
* Search for meta characters in the command, to know whether we should use a shell to launch.
*
diff --git a/core/src/test/java/org/jruby/test/TestMethodFactories.java b/core/src/test/java/org/jruby/test/TestMethodFactories.java
index 4e44e74ec75..493e7c8dec9 100644
--- a/core/src/test/java/org/jruby/test/TestMethodFactories.java
+++ b/core/src/test/java/org/jruby/test/TestMethodFactories.java
@@ -52,6 +52,7 @@ public void testInvocationMethodFactory() {
mod.defineAnnotatedMethods(MyBoundClass.class);
+ confirmMethods(mod);
confirmCheckArity(mod);
}
@@ -70,6 +71,13 @@ private void confirmMethods(RubyModule mod) {
IRubyObject nil = runtime.getNil();
assertTrue("four-arg method should be callable",
mod.searchMethod("four_arg_method").call(context, mod, mod.getMetaClass(), "four_arg_method", new IRubyObject[] {nil, nil, nil, nil}).isTrue());
+ // methods with required <= 3 and IRubyObject[] args (missing rest=true) should bind and be callable
+ assertTrue("one-arg method should be callable",
+ mod.searchMethod("one_arg_method").call(context, mod, mod.getMetaClass(), "one_arg_method", new IRubyObject[] {nil}).isTrue());
+ assertTrue("two-arg method should be callable",
+ mod.searchMethod("two_arg_method").call(context, mod, mod.getMetaClass(), "two_arg_method", new IRubyObject[] {nil, nil}).isTrue());
+ assertTrue("three-arg method should be callable",
+ mod.searchMethod("three_arg_method").call(context, mod, mod.getMetaClass(), "three_arg_method", new IRubyObject[] {nil, nil, nil}).isTrue());
}
// jruby/jruby#7851: Restore automatic arity checking with an opt-out
@@ -106,6 +114,23 @@ public static IRubyObject four_arg_method(IRubyObject self, IRubyObject[] obj) {
return self.getRuntime().getTrue();
}
+ // methods with required <= 3 and IRubyObject[] args (missing rest=true) should bind correctly
+ // instead of crashing with ArrayIndexOutOfBoundsException in loadArguments
+ @JRubyMethod(required = 1)
+ public static IRubyObject one_arg_method(ThreadContext context, IRubyObject self, IRubyObject[] args) {
+ return context.tru;
+ }
+
+ @JRubyMethod(required = 2)
+ public static IRubyObject two_arg_method(ThreadContext context, IRubyObject self, IRubyObject[] args) {
+ return context.tru;
+ }
+
+ @JRubyMethod(required = 3)
+ public static IRubyObject three_arg_method(ThreadContext context, IRubyObject self, IRubyObject[] args) {
+ return context.tru;
+ }
+
// jruby/jruby#7851: Restore automatic arity checking with an opt-out
@JRubyMethod(required = 1, optional = 1, checkArity = true)
public static IRubyObject optWithCheckArityTrue(ThreadContext context, IRubyObject self, IRubyObject[] args) {
diff --git a/core/src/test/java/org/jruby/test/TestRubyInstanceConfig.java b/core/src/test/java/org/jruby/test/TestRubyInstanceConfig.java
index b2dd3ad969b..43f3d867cfe 100644
--- a/core/src/test/java/org/jruby/test/TestRubyInstanceConfig.java
+++ b/core/src/test/java/org/jruby/test/TestRubyInstanceConfig.java
@@ -30,7 +30,9 @@
package org.jruby.test;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.PrintStream;
import java.util.Locale;
import org.jruby.exceptions.MainExitException;
@@ -38,6 +40,7 @@
import org.jruby.RubyInstanceConfig;
import org.jruby.platform.Platform;
import org.jruby.runtime.load.LoadService;
+import org.objectweb.asm.Opcodes;
/**
* This should be filled up with more tests for RubyInstanceConfig later
@@ -146,4 +149,20 @@ private String getSTDINPath() {
}
return "/dev/stdin";
}
+
+ public void testBytecodeVersion() throws Exception {
+ assertEquals("it uses Opcodes.V1_8 for '1.8'", Opcodes.V1_8, RubyInstanceConfig.calculateBytecodeVersion("1.8"));
+ assertEquals("it uses Opcodes.V9 for '9'", Opcodes.V9, RubyInstanceConfig.calculateBytecodeVersion("9"));
+ assertEquals("it uses Opcodes.V21 for '21'", Opcodes.V21, RubyInstanceConfig.calculateBytecodeVersion("21"));
+ assertEquals("it uses Opcodes.V21 for '21'", Opcodes.V21, RubyInstanceConfig.calculateBytecodeVersion("21"));
+ assertEquals("it falls back on Opcodes.V21 for high unsupported versions", Opcodes.V21, RubyInstanceConfig.calculateBytecodeVersion("99"));
+ PrintStream err = System.err;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos)) {
+ System.setErr(ps);
+ assertEquals("it falls back on Opcodes.V1_8 for low unsupported versions", Opcodes.V1_8, RubyInstanceConfig.calculateBytecodeVersion("1.7"));
+ assertEquals("it outputs an error message for low unsupported versions", "unsupported Java version 1.7, using 1.8", new String(baos.toByteArray()).replaceAll("[\\n\\r]", ""));
+ } finally {
+ System.setErr(err);
+ }
+ }
}
diff --git a/ivy/build.xml b/ivy/build.xml
deleted file mode 100644
index 10142598558..00000000000
--- a/ivy/build.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ivy/ivy.xml b/ivy/ivy.xml
deleted file mode 100644
index 8c1969adcfe..00000000000
--- a/ivy/ivy.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ivy/ivysettings.xml b/ivy/ivysettings.xml
deleted file mode 100644
index da6549ee684..00000000000
--- a/ivy/ivysettings.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/pom.xml b/lib/pom.xml
index 37363f4158a..b88712dbfbf 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -12,7 +12,7 @@ DO NOT MODIFY - GENERATED CODE
org.jruby
jruby-parent
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
jruby-stdlib
JRuby Lib Setup
@@ -27,7 +27,7 @@ DO NOT MODIFY - GENERATED CODE
org.jruby
jruby-core
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
test
diff --git a/maven/jruby/README.md b/maven/jruby/README.md
index 8390ca7a31d..f124d4d914d 100644
--- a/maven/jruby/README.md
+++ b/maven/jruby/README.md
@@ -6,7 +6,7 @@ mvn verify -Papps
```
or from the jruby root directory
```
-mvn -Papps
+./mvnw -Papps
```
diff --git a/mvnw b/mvnw
index 8d937f4c14f..bd8896bf221 100755
--- a/mvnw
+++ b/mvnw
@@ -19,290 +19,277 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# Apache Maven Wrapper startup batch script, version 3.2.0
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
+# Apache Maven Wrapper startup batch script, version 3.3.4
#
# Optional ENV vars
# -----------------
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# JAVA_HOME - location of a JDK home dir, required when download maven via java source
+# MVNW_REPOURL - repo url base for downloading maven distribution
+# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
# ----------------------------------------------------------------------------
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /usr/local/etc/mavenrc ] ; then
- . /usr/local/etc/mavenrc
- fi
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
+set -euf
+[ "${MVNW_VERBOSE-}" != debug ] || set -x
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
+# OS specific support.
+native_path() { printf %s\\n "$1"; }
case "$(uname)" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
- else
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
- fi
- ;;
+CYGWIN* | MINGW*)
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+ native_path() { cygpath --path --windows "$1"; }
+ ;;
esac
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=$(java-config --jre-home)
- fi
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
- JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="$(which javac)"
- if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=$(which readlink)
- if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
- if $darwin ; then
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
- else
- javaExecutable="$(readlink -f "\"$javaExecutable\"")"
- fi
- javaHome="$(dirname "\"$javaExecutable\"")"
- javaHome=$(expr "$javaHome" : '\(.*\)/bin')
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+# set JAVACMD and JAVACCMD
+set_java_home() {
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+ if [ -n "${JAVA_HOME-}" ]; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
else
JAVACMD="$JAVA_HOME/bin/java"
+ JAVACCMD="$JAVA_HOME/bin/javac"
+
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
+ return 1
+ fi
fi
else
- JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
- fi
-fi
+ JAVACMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v java
+ )" || :
+ JAVACCMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v javac
+ )" || :
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
+ return 1
+ fi
fi
+}
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=$(cd "$wdir/.." || exit 1; pwd)
- fi
- # end of workaround
+# hash string like Java String::hashCode
+hash_string() {
+ str="${1:-}" h=0
+ while [ -n "$str" ]; do
+ char="${str%"${str#?}"}"
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
+ str="${str#?}"
done
- printf '%s' "$(cd "$basedir" || exit 1; pwd)"
+ printf %x\\n $h
}
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- # Remove \r in case we run on Windows within Git Bash
- # and check out the repository with auto CRLF management
- # enabled. Otherwise, we may read lines that are delimited with
- # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
- # splitting rules.
- tr -s '\r\n' ' ' < "$1"
- fi
+verbose() { :; }
+[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
+
+die() {
+ printf %s\\n "$1" >&2
+ exit 1
}
-log() {
- if [ "$MVNW_VERBOSE" = true ]; then
- printf '%s\n' "$1"
- fi
+trim() {
+ # MWRAPPER-139:
+ # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
+ # Needed for removing poorly interpreted newline sequences when running in more
+ # exotic environments such as mingw bash on Windows.
+ printf "%s" "${1}" | tr -d '[:space:]'
+}
+
+scriptDir="$(dirname "$0")"
+scriptName="$(basename "$0")"
+
+# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
+while IFS="=" read -r key value; do
+ case "${key-}" in
+ distributionUrl) distributionUrl=$(trim "${value-}") ;;
+ distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
+ esac
+done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
+[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
+
+case "${distributionUrl##*/}" in
+maven-mvnd-*bin.*)
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
+ *)
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
+ distributionPlatform=linux-amd64
+ ;;
+ esac
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
+ ;;
+maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
+*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
+esac
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
+distributionUrlName="${distributionUrl##*/}"
+distributionUrlNameMain="${distributionUrlName%.*}"
+distributionUrlNameMain="${distributionUrlNameMain%-bin}"
+MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
+MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
+
+exec_maven() {
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
}
-BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
-if [ -z "$BASE_DIR" ]; then
- exit 1;
+if [ -d "$MAVEN_HOME" ]; then
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ exec_maven "$@"
fi
-MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
-log "$MAVEN_PROJECTBASEDIR"
+case "${distributionUrl-}" in
+*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
+*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
+esac
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
-if [ -r "$wrapperJarPath" ]; then
- log "Found $wrapperJarPath"
+# prepare tmp dir
+if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
+ trap clean HUP INT TERM EXIT
else
- log "Couldn't find $wrapperJarPath, downloading it ..."
+ die "cannot create temp dir"
+fi
- if [ -n "$MVNW_REPOURL" ]; then
- wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- else
- wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- fi
- while IFS="=" read -r key value; do
- # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
- safeValue=$(echo "$value" | tr -d '\r')
- case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
- esac
- done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
- log "Downloading from: $wrapperUrl"
-
- if $cygwin; then
- wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
- fi
+mkdir -p -- "${MAVEN_HOME%/*}"
- if command -v wget > /dev/null; then
- log "Found wget ... using wget"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- else
- wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
- fi
- elif command -v curl > /dev/null; then
- log "Found curl ... using curl"
- [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- else
- curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
- fi
- else
- log "Falling back to using Java to download"
- javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
- javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
- # For Cygwin, switch paths to Windows format before running javac
- if $cygwin; then
- javaSource=$(cygpath --path --windows "$javaSource")
- javaClass=$(cygpath --path --windows "$javaClass")
- fi
- if [ -e "$javaSource" ]; then
- if [ ! -e "$javaClass" ]; then
- log " - Compiling MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/javac" "$javaSource")
- fi
- if [ -e "$javaClass" ]; then
- log " - Running MavenWrapperDownloader.java ..."
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
- fi
- fi
- fi
+# Download and Install Apache Maven
+verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+verbose "Downloading from: $distributionUrl"
+verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+# select .zip or .tar.gz
+if ! command -v unzip >/dev/null; then
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
+ distributionUrlName="${distributionUrl##*/}"
fi
-##########################################################################################
-# End of extension
-##########################################################################################
-# If specified, validate the SHA-256 sum of the Maven wrapper jar file
-wrapperSha256Sum=""
-while IFS="=" read -r key value; do
- case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
- esac
-done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
-if [ -n "$wrapperSha256Sum" ]; then
- wrapperSha256Result=false
- if command -v sha256sum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
- wrapperSha256Result=true
+# verbose opt
+__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
+[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
+
+# normalize http auth
+case "${MVNW_PASSWORD:+has-password}" in
+'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+esac
+
+if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
+ verbose "Found wget ... using wget"
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
+ verbose "Found curl ... using curl"
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+elif set_java_home; then
+ verbose "Falling back to use Java to download"
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
+ cat >"$javaSource" <<-END
+ public class Downloader extends java.net.Authenticator
+ {
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
+ {
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
+ }
+ public static void main( String[] args ) throws Exception
+ {
+ setDefault( new Downloader() );
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
+ }
+ }
+ END
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
+ verbose " - Compiling Downloader.java ..."
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
+ verbose " - Running Downloader.java ..."
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
+fi
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+if [ -n "${distributionSha256Sum-}" ]; then
+ distributionSha256Result=false
+ if [ "$MVN_CMD" = mvnd.sh ]; then
+ echo "Checksum validation is not supported for maven-mvnd." >&2
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ elif command -v sha256sum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
+ distributionSha256Result=true
fi
- elif command -v shasum > /dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
- wrapperSha256Result=true
+ elif command -v shasum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
+ distributionSha256Result=true
fi
else
- echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
- echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
fi
- if [ $wrapperSha256Result = false ]; then
- echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
- echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
- echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
+ if [ $distributionSha256Result = false ]; then
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
exit 1
fi
fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+# unzip and move
+if command -v unzip >/dev/null; then
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
+else
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
+fi
+
+# Find the actual extracted directory name (handles snapshots where filename != directory name)
+actualDistributionDir=""
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
+# First try the expected directory name (for regular distributions)
+if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
+ if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
+ actualDistributionDir="$distributionUrlNameMain"
+ fi
fi
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
-export MAVEN_CMD_LINE_ARGS
+# If not found, search for any directory with the Maven executable (for snapshots)
+if [ -z "$actualDistributionDir" ]; then
+ # enable globbing to iterate over items
+ set +f
+ for dir in "$TMP_DOWNLOAD_DIR"/*; do
+ if [ -d "$dir" ]; then
+ if [ -f "$dir/bin/$MVN_CMD" ]; then
+ actualDistributionDir="$(basename "$dir")"
+ break
+ fi
+ fi
+ done
+ set -f
+fi
+
+if [ -z "$actualDistributionDir" ]; then
+ verbose "Contents of $TMP_DOWNLOAD_DIR:"
+ verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
+ die "Could not find Maven distribution directory in extracted archive"
+fi
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+verbose "Found extracted Maven distribution directory: $actualDistributionDir"
+printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
+mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
-# shellcheck disable=SC2086 # safe args
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- $MAVEN_DEBUG_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
+clean || :
+exec_maven "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
index f80fbad3e76..5761d948924 100644
--- a/mvnw.cmd
+++ b/mvnw.cmd
@@ -1,3 +1,4 @@
+<# : batch portion
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@@ -18,188 +19,171 @@
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
-@REM Apache Maven Wrapper startup batch script, version 3.2.0
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
+@REM Apache Maven Wrapper startup batch script, version 3.3.4
@REM
@REM Optional ENV vars
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM MVNW_REPOURL - repo url base for downloading maven distribution
+@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
@REM ----------------------------------------------------------------------------
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
-
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %WRAPPER_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
-SET WRAPPER_SHA_256_SUM=""
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
+@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
+@SET __MVNW_CMD__=
+@SET __MVNW_ERROR__=
+@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
+@SET PSModulePath=
+@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
)
-IF NOT %WRAPPER_SHA_256_SUM%=="" (
- powershell -Command "&{"^
- "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
- "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
- " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
- " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
- " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
- " exit 1;"^
- "}"^
- "}"
- if ERRORLEVEL 1 goto error
-)
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% ^
- %JVM_CONFIG_MAVEN_PROPS% ^
- %MAVEN_OPTS% ^
- %MAVEN_DEBUG_OPTS% ^
- -classpath %WRAPPER_JAR% ^
- "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
- %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
+@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
+@SET __MVNW_PSMODULEP_SAVE=
+@SET __MVNW_ARG0_NAME__=
+@SET MVNW_USERNAME=
+@SET MVNW_PASSWORD=
+@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
+@echo Cannot start maven from wrapper >&2 && exit /b 1
+@GOTO :EOF
+: end batch / begin powershell #>
+
+$ErrorActionPreference = "Stop"
+if ($env:MVNW_VERBOSE -eq "true") {
+ $VerbosePreference = "Continue"
+}
+
+# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
+$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
+if (!$distributionUrl) {
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
+}
+
+switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
+ "maven-mvnd-*" {
+ $USE_MVND = $true
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
+ $MVN_CMD = "mvnd.cmd"
+ break
+ }
+ default {
+ $USE_MVND = $false
+ $MVN_CMD = $script -replace '^mvnw','mvn'
+ break
+ }
+}
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+if ($env:MVNW_REPOURL) {
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
+}
+$distributionUrlName = $distributionUrl -replace '^.*/',''
+$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
+
+$MAVEN_M2_PATH = "$HOME/.m2"
+if ($env:MAVEN_USER_HOME) {
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
+}
+
+if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
+}
+
+$MAVEN_WRAPPER_DISTS = $null
+if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
+} else {
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
+}
+
+$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
+$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
+$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
+
+if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
+ exit $?
+}
+
+if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
+}
+
+# prepare tmp dir
+$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
+$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
+$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
+trap {
+ if ($TMP_DOWNLOAD_DIR.Exists) {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+ }
+}
+
+New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
+
+# Download and Install Apache Maven
+Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+Write-Verbose "Downloading from: $distributionUrl"
+Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+$webclient = New-Object System.Net.WebClient
+if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
+}
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
+if ($distributionSha256Sum) {
+ if ($USE_MVND) {
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
+ }
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
+ }
+}
+
+# unzip and move
+Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
+
+# Find the actual extracted directory name (handles snapshots where filename != directory name)
+$actualDistributionDir = ""
+
+# First try the expected directory name (for regular distributions)
+$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
+$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
+if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
+ $actualDistributionDir = $distributionUrlNameMain
+}
+
+# If not found, search for any directory with the Maven executable (for snapshots)
+if (!$actualDistributionDir) {
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
+ if (Test-Path -Path $testPath -PathType Leaf) {
+ $actualDistributionDir = $_.Name
+ }
+ }
+}
+
+if (!$actualDistributionDir) {
+ Write-Error "Could not find Maven distribution directory in extracted archive"
+}
+
+Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
+Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
+try {
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
+} catch {
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
+ Write-Error "fail to move MAVEN_HOME"
+ }
+} finally {
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
+}
+
+Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
diff --git a/pom.xml b/pom.xml
index c98fa449627..c32ca674b11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@ DO NOT MODIFY - GENERATED CODE
4.0.0
org.jruby
jruby-parent
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
pom
JRuby
JRuby is the effort to recreate the Ruby (https://www.ruby-lang.org) interpreter in Java.
diff --git a/rakelib/installer.rake b/rakelib/installer.rake
index e172f91abcd..309cd459a42 100644
--- a/rakelib/installer.rake
+++ b/rakelib/installer.rake
@@ -14,10 +14,12 @@ task :windows_installer => :init_release do
install_windows_gems(unpacked_dir)
- if File.executable?(INSTALL4J_EXECUTABLE)
+ install4j_executable = ENV['INSTALL4J_EXECUTABLE']
+
+ if File.executable?(install4j_executable)
root_dir = Dir.pwd
Dir.chdir(unpacked_dir) do
- sh %Q^"#{INSTALL4J_EXECUTABLE}" -m windows -D jruby.dist.location=#{root_dir},jruby.location=#{unpacked_dir},ruby.version=#{VERSION_RUBY},jruby.version=#{version},ruby.patchlevel=0,ruby.buildplatform=i386-mingw32 #{INSTALL4J_CONFIG_FILE}^ do |ok, result|
+ sh %Q^"#{install4j_executable}" -m windows -D jruby.dist.location=#{root_dir},jruby.location=#{unpacked_dir},ruby.version=#{VERSION_RUBY},jruby.version=#{version},ruby.patchlevel=0,ruby.buildplatform=i386-mingw32 #{INSTALL4J_CONFIG_FILE}^ do |ok, result|
$stderr.puts "** Something went wrong: #{result}" unless ok
end
mv Dir[File.join(root_dir, 'install', '*.exe')], File.join(root_dir, RELEASE_DIR)
diff --git a/rakelib/maven.rake b/rakelib/maven.rake
index efe73678b8f..f27e03b4c5a 100644
--- a/rakelib/maven.rake
+++ b/rakelib/maven.rake
@@ -45,6 +45,6 @@ namespace :maven do
desc "Deploy release and bump version"
task :deploy_release do
- system "mvn clean deploy -Psonatype-oss-release,release"
+ system "./mvnw clean deploy -Psonatype-oss-release,release"
end
end
diff --git a/rakelib/release.rake b/rakelib/release.rake
index 2dad7631460..63c7d684ff4 100644
--- a/rakelib/release.rake
+++ b/rakelib/release.rake
@@ -36,5 +36,5 @@ def jruby_version
Dir[File.join(DIST_FILES_DIR, "jruby-dist-*.zip")].each do |f|
return $1 if f =~ /jruby-dist-(.*)-bin.zip/
end
- raise ArgumentError "mvn release:prepare has not been run"
+ raise ArgumentError "./mvnw release:prepare has not been run"
end
diff --git a/shaded/pom.xml b/shaded/pom.xml
index b8e6a5f2ef5..58724e884a2 100644
--- a/shaded/pom.xml
+++ b/shaded/pom.xml
@@ -12,7 +12,7 @@ DO NOT MODIFY - GENERATED CODE
org.jruby
jruby-parent
- 9.4.15.0-SNAPSHOT
+ 9.4.16.0-SNAPSHOT
jruby-core
JRuby Core
diff --git a/test/check_versions.sh b/test/check_versions.sh
index 816d2024c43..7f58368d310 100755
--- a/test/check_versions.sh
+++ b/test/check_versions.sh
@@ -8,11 +8,11 @@ gem_version=${jar_version/-/.}
rm -rf maven/*/target/*
-./mvnw install -Pbootstrap
-./mvnw -Pcomplete
-./mvnw -Pdist
-./mvnw -Pjruby-jars
-./mvnw -Pmain
+./mvnw -ntp install -Pbootstrap
+./mvnw -ntp -Pcomplete
+./mvnw -ntp -Pdist
+./mvnw -ntp -Pjruby-jars
+./mvnw -ntp -Pmain
declare -a failed
failed[0]=0
diff --git a/test/jruby/test_backtraces.rb b/test/jruby/test_backtraces.rb
index 32538a811b0..951cbb2ecab 100644
--- a/test/jruby/test_backtraces.rb
+++ b/test/jruby/test_backtraces.rb
@@ -82,6 +82,22 @@ def test_java_backtrace
assert_equal 1, ruby_trace.length # only once!
end
+ def test_java_backtrace_locations
+ org.jruby.test.TestHelper.throwTestHelperException
+ raise 'did no raise exception'
+ rescue java.lang.Exception => e
+ locations = e.backtrace_locations
+ assert_kind_of Array, locations
+ assert_kind_of Thread::Backtrace::Location, locations[0]
+
+ location = locations[0]
+ assert_equal 'org/jruby/test/TestHelper.java', location.path
+
+ assert_operator location.lineno, :>, 1
+ assert_equal 'throwTestHelperException', location.label
+ assert_match /TestHelper\.java:\d+:in .throwTestHelperException/, location.to_s
+ end
+
def test_simple_exception_recursive
@offset = __LINE__
def meth(n)
diff --git a/test/jruby/test_jar_complete.rb b/test/jruby/test_jar_complete.rb
index 6e198dc42ec..7ea81a219aa 100644
--- a/test/jruby/test_jar_complete.rb
+++ b/test/jruby/test_jar_complete.rb
@@ -1,4 +1,4 @@
-# gets run from 'mvn -P jruby_complete_jar_extended' which ensures that a complete jar is built first
+# gets run from './mvnw -Pjruby_complete_jar_extended' which ensures that a complete jar is built first
require 'test/unit'
require 'rbconfig'
diff --git a/test/jruby/test_process.rb b/test/jruby/test_process.rb
index 3d40a5aadb2..5c3b02513e8 100644
--- a/test/jruby/test_process.rb
+++ b/test/jruby/test_process.rb
@@ -1,6 +1,9 @@
require 'test/unit'
require 'test/jruby/test_helper'
+require 'fileutils'
require 'rbconfig'
+require 'shellwords'
+require 'tmpdir'
class TestProcess < Test::Unit::TestCase
include TestHelper
@@ -115,4 +118,46 @@ def test_not_implemented_methods_on_windows
assert_raise(NotImplementedError) { Process.waitall }
end if WINDOWS
+ def test_chdir_option_does_not_allow_shell_injection
+ omit 'requires POSIX shell' if WINDOWS
+
+ Dir.mktmpdir('jruby_chdir_test') do |tmpdir|
+ marker = File.join(tmpdir, 'injected_marker')
+ malicious_dir = "missing' ; touch #{Shellwords.escape(marker)} #"
+
+ system('echo safe', chdir: malicious_dir, out: File::NULL, err: File::NULL)
+
+ assert_false File.exist?(marker), 'command injection via chdir: path executed'
+ end
+ end
+
+ def test_chdir_option_does_not_run_command_when_chdir_fails
+ omit 'requires POSIX shell' if WINDOWS
+
+ Dir.mktmpdir('jruby_chdir_test') do |tmpdir|
+ marker = File.join(tmpdir, 'failed_chdir_marker')
+ missing_dir = File.join(tmpdir, 'missing')
+
+ system("echo safe; touch #{Shellwords.escape(marker)}", chdir: missing_dir, out: File::NULL, err: File::NULL)
+
+ assert_false File.exist?(marker), 'command ran even though chdir: target was missing'
+ end
+ end
+
+ def test_chdir_option_handles_shell_special_characters_in_path
+ omit 'requires POSIX shell' if WINDOWS
+
+ Dir.mktmpdir('jruby_chdir_test') do |tmpdir|
+ ["dir with ' quote $dollar ; semicolon", '-P'].each do |name|
+ dir = File.join(tmpdir, name)
+ FileUtils.mkdir_p(dir)
+
+ assert system('true', chdir: dir, out: File::NULL, err: File::NULL)
+
+ output = IO.popen('pwd', chdir: dir, &:read).strip
+ assert_equal File.realpath(dir), File.realpath(output)
+ end
+ end
+ end
+
end
diff --git a/test/tool/travis_retry.sh b/test/tool/travis_retry.sh
deleted file mode 100755
index 9b79c565501..00000000000
--- a/test/tool/travis_retry.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh -eu
-# The modified version of `travis_retry` to support custom backoffs, which is used by .travis.yml.
-# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash
-
-for sleep in 0 ${WAITS:- 1 25 100}; do
- sleep "$sleep"
-
- echo "+ $@"
- if "$@"; then
- exit 0
- fi
-done
-exit 1
diff --git a/tool/concurrent-ruby-travis.sh b/tool/concurrent-ruby-travis.sh
deleted file mode 100755
index 49a5f2cc1d2..00000000000
--- a/tool/concurrent-ruby-travis.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-set -v -e
-
-# set up JRuby
-mvn clean package
-export PATH=`pwd`/bin:$PATH
-gem install bundler --no-document
-
-# prep for test
-git clone --depth=10 https://github.com/ruby-concurrency/concurrent-ruby.git
-cd concurrent-ruby
-bundle install
-
-# run tests
-bundle exec rake ci
diff --git a/tool/maven-ci-script.sh b/tool/maven-ci-script.sh
index 38d6729e39b..9e8ec901a84 100755
--- a/tool/maven-ci-script.sh
+++ b/tool/maven-ci-script.sh
@@ -6,7 +6,7 @@ set -x
if [[ -v PHASE ]]
then
DOWNLOAD_OUTPUT_FILTER='Download|\\[exec\\] [[:digit:]]+/[[:digit:]]+|^[[:space:]]*\\[exec\\][[:space:]]*$'
- ./mvnw $MAVEN_CLI_OPTS -B -Dinvoker.skip=false $PHASE | egrep -v "$DOWNLOAD_OUTPUT_FILTER"
+ ./mvnw -ntp -Dinvoker.skip=false $PHASE | egrep -v "$DOWNLOAD_OUTPUT_FILTER"
MVN_STATUS=${PIPESTATUS[0]}
diff --git a/tool/rails_runner b/tool/rails_runner
index e92ca419429..a9ee61d7b4e 100755
--- a/tool/rails_runner
+++ b/tool/rails_runner
@@ -1,4 +1,5 @@
#!/usr/bin/env jruby
+require 'rbconfig'
require 'rubygems'
require 'fileutils'
require 'optparse'
@@ -7,9 +8,10 @@ ENV['RAILS_ENV'] = "development"
# FIXME: -rlogger is because logger is getting loaded in CRuby but not
# for us.
ENV['JRUBY_OPTS'] = "--dev -rlogger"
+ENV['JAVA_OPTS'] = "-Djava.net.preferIPv4Stack=true"
#launcher, options, rails_version = "jruby", "", "6.1.3.2"
-launcher, options, rails_version = "jruby", "", "7.0.8.7"
+launcher, options, rails_version = "jruby", "", "7.0.10"
OptionParser.new do |opt|
opt.banner = "Usage: runner [OPTIONS]"
opt.separator ""
@@ -24,14 +26,20 @@ launcher = full_path if File.exist? full_path
$jruby = "#{launcher} #{options} "
-def jruby_command(command, *args)
+def jruby_command(command, *args, wait: true)
command = "#{$jruby} -rlogger -S #{command} #{args.join(' ')}"
puts "$ #{command}"
- value = system command
+ if wait
+ value = system command
+ else
+ value = spawn command
+ end
puts value
+ value
end
rails_app = 'frogger'
+rails_pid = nil
FileUtils.rm_rf rails_app
jruby_command("gem", "install rails --version=#{rails_version}")
@@ -40,7 +48,20 @@ Dir.chdir(rails_app) do
jruby_command("bundle", "update")
jruby_command("rails", "generate scaffold person name:string")
jruby_command("rake", "db:migrate")
-# jruby_command("rails", "webpacker:install")
- jruby_command("rails", "server")
+ rails_pid = jruby_command("rails server", wait: false)
end
+
+begin
+ system("#{$jruby} #{File.join(File.dirname(__FILE__), "verify_rails")}")
+ensure
+ puts "shutting down server"
+ case RbConfig::CONFIG['host_os']
+ when /mswin|win32|windows/
+ system "taskkill /T /PID #{rails_pid}"
+ else
+ Process.kill("TERM", rails_pid)
+ Process.waitpid(rails_pid)
+ end
+end
+
puts "Done"
diff --git a/tool/release.sh b/tool/release.sh
index 129cffcf45e..a1331d96a6a 100644
--- a/tool/release.sh
+++ b/tool/release.sh
@@ -20,7 +20,7 @@ echo $JRUBY_VERSION > VERSION
set -x
-mvn
+./mvnw -ntp
git add VERSION core/pom.xml lib/pom.xml pom.xml shaded/pom.xml
git commit -m "Version $JRUBY_VERSION updated for release"
cd ..
@@ -28,7 +28,7 @@ rm -rf release
git clone $REPO release
cd release
pwd
-mvn clean deploy -Prelease
+./mvnw -ntp clean deploy -Prelease
jruby -S rake post_process_artifacts
cd release
diff --git a/tool/sequel-travis.sh b/tool/sequel-travis.sh
deleted file mode 100755
index 5f55f8f97e2..00000000000
--- a/tool/sequel-travis.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-set -v -e
-
-# set up JRuby
-mvn clean package
-export PATH=`pwd`/bin:$PATH
-gem install bundler -v "~>1.17.3"
-
-# set up databases
-mysql -e 'create database sequel_test;'
-psql -c 'create database sequel_test;' -U postgres
-
-# set up sequel
-git clone --depth=10 https://github.com/jeremyevans/sequel.git
-cd sequel
-cp .ci.gemfile Gemfile
-bundle install
-
-# run tests
-bundle exec rake spec_ci
diff --git a/tool/verify_rails b/tool/verify_rails
new file mode 100644
index 00000000000..56bc05c0b42
--- /dev/null
+++ b/tool/verify_rails
@@ -0,0 +1,244 @@
+#!/usr/bin/env ruby
+
+# This script verifies the "people" app generated by tool/rails_runner.rb.
+# All CRUD operations are confirmed.
+# Generated by ChatGPT.
+
+require "net/http"
+require "uri"
+require "cgi"
+require "securerandom"
+
+BASE_URL = "http://localhost:3000"
+
+class Session
+ def initialize(base_url)
+ @base_uri = URI(base_url)
+ @cookies = {}
+ end
+
+ def get(path, headers = {})
+ request(Net::HTTP::Get, path, headers: headers)
+ end
+
+ def post(path, form: {}, headers: {})
+ request(Net::HTTP::Post, path, form: form, headers: headers)
+ end
+
+ private
+
+ def request(klass, path, form: nil, headers: {})
+ uri = URI.join(@base_uri.to_s, path)
+
+ http = Net::HTTP.new(uri.host, uri.port)
+
+ req = klass.new(uri)
+
+ if @cookies.any?
+ req["Cookie"] = @cookies.map { |k, v| "#{k}=#{v}" }.join("; ")
+ end
+
+ headers.each do |k, v|
+ req[k] = v
+ end
+
+ req.set_form_data(form) if form
+
+ response = http.request(req)
+
+ store_cookies(response)
+
+ unless response.is_a?(Net::HTTPSuccess) ||
+ response.is_a?(Net::HTTPRedirection)
+ raise "#{req.method} #{path} failed: #{response.code}\n#{response.body}"
+ end
+
+ response
+ end
+
+ def store_cookies(response)
+ set_cookie_headers = response.get_fields("Set-Cookie")
+ return unless set_cookie_headers
+
+ set_cookie_headers.each do |cookie|
+ pair = cookie.split(";").first
+ key, value = pair.split("=", 2)
+ @cookies[key] = value
+ end
+ end
+end
+
+def extract_csrf_token(html)
+ match = html.match(
+ / 10
+ raise
+else
+ sock.close
+end
+
+session = Session.new(BASE_URL)
+
+original_name = "Person-#{SecureRandom.hex(6)}"
+updated_name = "Updated-#{SecureRandom.hex(6)}"
+
+puts "Original name: #{original_name}"
+puts "Updated name: #{updated_name}"
+
+#
+# Step 1: Load index page to establish session + csrf token
+#
+index_response = session.get("/people")
+
+csrf_token = extract_csrf_token(index_response.body)
+
+puts "Fetched CSRF token"
+
+#
+# Step 2: Create person
+#
+create_response = session.post(
+ "/people",
+ form: {
+ "person[name]" => original_name
+ },
+ headers: {
+ "X-CSRF-Token" => csrf_token,
+ "Referer" => "#{BASE_URL}/people"
+ }
+)
+
+location = create_response["Location"] || create_response["location"]
+
+raise "Missing redirect location" unless location
+
+person_id = extract_person_id(location)
+
+puts "Created person id=#{person_id}"
+
+#
+# Step 3: Verify person appears in index
+#
+index_response = session.get("/people")
+
+unless index_response.body.include?(original_name)
+ raise "Original name not found in people index"
+end
+
+puts "Verified person appears in index"
+
+#
+# Step 4: View person page
+#
+show_response = session.get("/people/#{person_id}")
+
+unless show_response.body.include?(original_name)
+ raise "Original name missing from show page"
+end
+
+puts "Verified person show page"
+
+#
+# Step 5: Update person name
+#
+update_csrf = extract_csrf_token(show_response.body)
+
+update_response = session.post(
+ "/people/#{person_id}",
+ form: {
+ "_method" => "patch",
+ "person[name]" => updated_name
+ },
+ headers: {
+ "X-CSRF-Token" => update_csrf,
+ "Referer" => "#{BASE_URL}/people/#{person_id}/edit"
+ }
+)
+
+unless update_response.is_a?(Net::HTTPRedirection)
+ raise "Update did not redirect"
+end
+
+puts "Updated person"
+
+#
+# Step 6: Verify updated name in index
+#
+updated_index = session.get("/people")
+
+unless updated_index.body.include?(updated_name)
+ raise "Updated name not found in people index"
+end
+
+if updated_index.body.include?(original_name)
+ raise "Original name still present after update"
+end
+
+puts "Verified updated name in index"
+
+#
+# Step 7: Verify updated show page
+#
+updated_show = session.get("/people/#{person_id}")
+
+unless updated_show.body.include?(updated_name)
+ raise "Updated name missing from show page"
+end
+
+puts "Verified updated show page"
+
+#
+# Step 8: Delete person
+#
+delete_csrf = extract_csrf_token(updated_show.body)
+
+delete_response = session.post(
+ "/people/#{person_id}",
+ form: {
+ "_method" => "delete"
+ },
+ headers: {
+ "X-CSRF-Token" => delete_csrf,
+ "Referer" => "#{BASE_URL}/people/#{person_id}"
+ }
+)
+
+unless delete_response.is_a?(Net::HTTPRedirection)
+ raise "Delete did not redirect"
+end
+
+puts "Deleted person"
+
+#
+# Step 9: Verify person is gone
+#
+final_index = session.get("/people")
+
+if final_index.body.include?(updated_name)
+ raise "Updated person still exists after deletion"
+end
+
+puts "Verified person removed"
+
+puts
+puts "SUCCESS"
\ No newline at end of file