New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native support of mruby-cli in mruby build system. #3956
Open
take-cheeze
wants to merge
13
commits into
mruby:master
Choose a base branch
from
take-cheeze:script-tool
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
92c00db
support script only tool
take-cheeze c5f7a90
use /* */ comment
take-cheeze c89d13b
Rename `script_only` to `cli`.
take-cheeze 25685ec
Rewrite mruby-strip with CLI.
take-cheeze 6f14e09
Fix file position.
take-cheeze 7148d6c
Suppress warning.
take-cheeze 8b02ffe
Suppress warning.
take-cheeze 3886484
Use console subsystem.
take-cheeze e91c0d1
Open as binary file.
take-cheeze 554db48
Merge remote-tracking branch 'mruby/master' into script-tool
take-cheeze a7de2ac
Merge remote-tracking branch 'mruby/master' into script-tool
take-cheeze 34a3939
Generate `mrb_open_cli`.
take-cheeze 878e654
Use `File.read` instead.
take-cheeze File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
155 changes: 0 additions & 155 deletions
155
mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
This file was deleted.
Oops, something went wrong.
This file contains 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,45 @@ | ||
def print_usage_exit msg = nil | ||
$stderr.write msg if msg | ||
$stderr.write "Usage: #{$0} [switches] irepfiles\n" | ||
$stderr.write "switches:\n" | ||
$stderr.write " -l, --lvar remove LVAR section too.\n" | ||
exit 1 | ||
end | ||
|
||
print_usage_exit "no files to strip\n" if ARGV.empty? | ||
|
||
$remove_lvar = false | ||
targets = [] | ||
|
||
ARGV.each do |v| | ||
case v | ||
when '-l', '--lvar' | ||
$remove_lvar = true | ||
next | ||
else | ||
print_usage_exit "invalid flag: #{v}" if v[0] == '-' | ||
end | ||
|
||
targets << v | ||
end | ||
|
||
targets.each do |fname| | ||
iseq = nil | ||
|
||
# load | ||
begin | ||
iseq = MRubyVM::InstructionSequence.load_from_binary File.read(fname, mode: 'rb') | ||
iseq.remove_lvar if $remove_lvar | ||
rescue ScriptError | ||
$stderr.write "can't read irep file #{fname}\n" | ||
exit 1 | ||
rescue | ||
$stderr.write "can't open file for reading #{fname}\n" | ||
exit 1 | ||
end | ||
|
||
# re-dump | ||
File.open fname, 'wb' do |f| | ||
f.write iseq.to_binary mrb_debug_info: false | ||
end | ||
end |
This file contains 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,8 @@ | ||
MRuby::Gem::Specification.new 'mruby-mrubyvm' do |spec| | ||
spec.license = 'MIT' | ||
spec.author = 'mruby developers' | ||
spec.summary = 'mruby implementation of `RubyVM`' | ||
|
||
add_dependency 'mruby-compiler' | ||
end | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry these corresponds to those in CRuby:
https://github.com/ruby/ruby/blob/421a73f51a39ff6829f9715b423a928782ec8ec3/vm.c#L339-L341
And it should be
mrb_state
specific.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be optional like VM hooks.