FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Pregenerate bin/ruby and bin/ruby.bat by headius · Pull Request #8875 · jruby/jruby · GitHub

/ jruby Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .bat  (1) .rb  (2) .xml  (2) No extension  (3) dotfile  (1) All 5 file types selected
Only manifest files
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ rubyspec_temp
!bin/gem
!bin/update_rubygems
!bin/bundle
!bin/jruby.bash
!bin/jruby.bat
!bin/jrubyc
!bin/jrubyc.bat
Expand All @@ -157,6 +156,7 @@ rubyspec_temp
!bin/jgem
!bin/jirb
!bin/jirb_swing
!bin/jruby
!bin/jruby.bash
!bin/jruby.bat
!bin/jruby.dll
Expand Down
145 changes: 145 additions & 0 deletions bin/jruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#!/bin/sh
# -----------------------------------------------------------------------------
# jruby - Relaunches as jruby.sh from the same path.
#
# See jruby.sh for more information.
# -----------------------------------------------------------------------------

# Pure shell dirname
dir_name() {
local filename="$1" trail=
case $filename in
*/*[!/]*)
trail=${filename##*[!/]}
filename=${filename%%"$trail"}
REPLY=${filename%/*}
;;
*[!/]*)
trail=${filename##*[!/]}
REPLY="."
;;
*)
REPLY="/"
;;
esac
}

# Pure shell basename
base_name() {
local filename="$1" trail=
case $filename in
*/*[!/]*)
trail=${filename##*[!/]}
filename=${filename%%"$trail"}
REPLY=${filename##*/}
;;
*[!/]*)
trail=${filename##*[!/]}
REPLY=${filename%%"$trail"}
;;
*)
REPLY="/"
;;
esac
}

# Determine whether path is absolute and contains no relative segments or symlinks
path_is_canonical() {
local path=
for path; do
case $path in
([!/]*) return 1 ;;
(./*|../*) return 1 ;;
(*/.|*/..) return 1 ;;
(*/./*|*/../*) return 1 ;;
esac
while [ "$path" ]; do
[ -h "$path" ] && return 1
path="${path%/*}"
done
done
return 0
}

# Resolve directory to its canonical value
resolve_dir() {
# Some shells (dash, ksh) resolve relative paths by default before cd'ing, i.e.
# cd /foo/bar/../baz = cd /foo/baz
# This is fine unless bar is a symlink, in which case the second form is
# invalid. Passing -P to cd fixes this behaviour.
REPLY="$(cd -P -- "$1" && pwd)"
}

# Resolve symlink until it's not a symlink
resolve_file() {
local current="$1" target=

while [ -h "$current" ]; do
target="$(readlink "$current")" || return
case $target in
(/*) current="$target" ;;
# handle relative symlinks
(*) dir_name "$current"; current="$REPLY/$target" ;;
esac
done
REPLY="$current"
}

# Resolve path to its canonical value
resolve() {
local target="$1" base=
REPLY=

# Verify target actually exists (and isn't too deep in symlinks)
if ! [ -e "$target" ]; then
echo >&2 "Error: No such file or directory: $target"
return 1
fi

# Realpath is way faster than repeatedly calling readlink, so use it if possible
if command -v realpath >/dev/null; then
REPLY="$(realpath "$target")" && return
fi

# Take shortcut for directories
if [ -d "$target" ]; then
resolve_dir "$target" && return
fi

# Ensure $target is not a symlink
resolve_file "$target" || return
target="$REPLY"

# Resolve parent directory if it's not absolute
if ! path_is_canonical "$target"; then
dir_name "$target"
resolve_dir "$REPLY" || return
base="$REPLY"

base_name "$target"
target="$base/$REPLY"
fi
REPLY="$target"
}

# ----- Find JRuby launcher based on this executable's path -------------------

# Get the absolute path of the executable
if [ "${BASH-}" ]; then
# shellcheck disable=2128,3028
script_src=${BASH_SOURCE-}
else
script_src=$0
fi
dir_name "$script_src"
base_dir=$(cd -P -- "$REPLY" >/dev/null && pwd -P)
base_name "$script_src"
resolve "$base_dir/$REPLY"
self_path=$REPLY

# Get the directory of the target script
dir_name "$self_path"
jruby_bin=$REPLY

# Run the launcher (in the current shell as an optimization)
. "$jruby_bin/jruby.sh"
1 change: 0 additions & 1 deletion bin/ruby

This file was deleted.

145 changes: 145 additions & 0 deletions bin/ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#!/bin/sh
# -----------------------------------------------------------------------------
# ruby - Relaunches as jruby.sh from the same path.
#
# See jruby.sh for more information.
# -----------------------------------------------------------------------------

# Pure shell dirname
dir_name() {
local filename="$1" trail=
case $filename in
*/*[!/]*)
trail=${filename##*[!/]}
filename=${filename%%"$trail"}
REPLY=${filename%/*}
;;
*[!/]*)
trail=${filename##*[!/]}
REPLY="."
;;
*)
REPLY="/"
;;
esac
}

# Pure shell basename
base_name() {
local filename="$1" trail=
case $filename in
*/*[!/]*)
trail=${filename##*[!/]}
filename=${filename%%"$trail"}
REPLY=${filename##*/}
;;
*[!/]*)
trail=${filename##*[!/]}
REPLY=${filename%%"$trail"}
;;
*)
REPLY="/"
;;
esac
}

# Determine whether path is absolute and contains no relative segments or symlinks
path_is_canonical() {
local path=
for path; do
case $path in
([!/]*) return 1 ;;
(./*|../*) return 1 ;;
(*/.|*/..) return 1 ;;
(*/./*|*/../*) return 1 ;;
esac
while [ "$path" ]; do
[ -h "$path" ] && return 1
path="${path%/*}"
done
done
return 0
}

# Resolve directory to its canonical value
resolve_dir() {
# Some shells (dash, ksh) resolve relative paths by default before cd'ing, i.e.
# cd /foo/bar/../baz = cd /foo/baz
# This is fine unless bar is a symlink, in which case the second form is
# invalid. Passing -P to cd fixes this behaviour.
REPLY="$(cd -P -- "$1" && pwd)"
}

# Resolve symlink until it's not a symlink
resolve_file() {
local current="$1" target=

while [ -h "$current" ]; do
target="$(readlink "$current")" || return
case $target in
(/*) current="$target" ;;
# handle relative symlinks
(*) dir_name "$current"; current="$REPLY/$target" ;;
esac
done
REPLY="$current"
}

# Resolve path to its canonical value
resolve() {
local target="$1" base=
REPLY=

# Verify target actually exists (and isn't too deep in symlinks)
if ! [ -e "$target" ]; then
echo >&2 "Error: No such file or directory: $target"
return 1
fi

# Realpath is way faster than repeatedly calling readlink, so use it if possible
if command -v realpath >/dev/null; then
REPLY="$(realpath "$target")" && return
fi

# Take shortcut for directories
if [ -d "$target" ]; then
resolve_dir "$target" && return
fi

# Ensure $target is not a symlink
resolve_file "$target" || return
target="$REPLY"

# Resolve parent directory if it's not absolute
if ! path_is_canonical "$target"; then
dir_name "$target"
resolve_dir "$REPLY" || return
base="$REPLY"

base_name "$target"
target="$base/$REPLY"
fi
REPLY="$target"
}

# ----- Find JRuby launcher based on this executable's path -------------------

# Get the absolute path of the executable
if [ "${BASH-}" ]; then
# shellcheck disable=2128,3028
script_src=${BASH_SOURCE-}
else
script_src=$0
fi
dir_name "$script_src"
base_dir=$(cd -P -- "$REPLY" >/dev/null && pwd -P)
base_name "$script_src"
resolve "$base_dir/$REPLY"
self_path=$REPLY

# Get the directory of the target script
dir_name "$self_path"
jruby_bin=$REPLY

# Run the launcher (in the current shell as an optimization)
. "$jruby_bin/jruby.sh"
2 changes: 2 additions & 0 deletions bin/ruby.bat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
@"%~dp0jruby.exe" %*
39 changes: 0 additions & 39 deletions core/pom.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@
:phase => 'clean',
'filesets' => [ { 'directory' => '${project.build.sourceDirectory}',
'includes' => [ '${Constants.java}' ] },
{ 'directory' => '${project.basedir}/..',
'includes' => [ 'bin/jruby' ] },
{ 'directory' => '${project.basedir}/..',
'includes' => [ 'lib/jni/**' ] } ],
'failOnError' => 'false' )
Expand Down Expand Up @@ -295,23 +293,6 @@
])
end

copy_goal = [:exec, :executable => '/bin/sh', :arguments => ['-c', 'cp ${jruby.basedir}/bin/jruby.sh ${jruby.basedir}/bin/jruby']]

profile :clean do
activation do
# hack to get the os triggeer into the model
os = org.apache.maven.model.ActivationOS.new
os.family = 'unix'
@current.os = os
end

phase :clean do
plugin 'org.codehaus.mojo:exec-maven-plugin' do
execute_goals( *copy_goal )
end
end
end

profile 'error-prone' do
activation do
jdk('11') # even an older (2.10.0) version of error-prone would need an adjusted setup on Java 8
Expand Down Expand Up @@ -346,26 +327,6 @@
end
end

profile 'jruby.sh' do

activation do
file( :missing => '../bin/jruby' )
end
activation do
# hack to get the os triggeer into the model
os = org.apache.maven.model.ActivationOS.new
os.family = 'unix'
@current.os = os
end

phase :initialize do
plugin 'org.codehaus.mojo:exec-maven-plugin' do
execute_goals *copy_goal
end
end

end

jni_config = [ 'unpack', { :id => 'unzip native',
'excludes' => 'META-INF,META-INF/*',
'artifactItems' => [ { 'groupId' => 'com.github.jnr',
Expand Down
Loading

Back | FazBrowse Home | New Git URL