Skip to content
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

need to support projectors arguments #14

Closed
zwetan opened this issue Sep 13, 2015 · 7 comments
Closed

need to support projectors arguments #14

zwetan opened this issue Sep 13, 2015 · 7 comments

Comments

@zwetan
Copy link
Member

zwetan commented Sep 13, 2015

Projectors are our "static binaries", they allow us to merge a redshell runtime with an ABC or SWF program into a single executable.

But they have one little problem: the arguments

because the projectors is basically the redshell runtime
we then inherit the argument logic of this one

for example in the case of the tool redbean

we can not directly use $ redbean -f mybuild.as3
we have to use $ redbean -- -f mybuild.as3

the logic is redshell [avmplus arguments] -- [program arguments]

ideally we want to detect from the runtime that we are inside a "projector
and then alter the logic for those arguments (already done in redtamarin 0.2.5 but removed since then).

it would be "nice to have" to be able to still configure the runtime from a projector
see:

@zwetan
Copy link
Member Author

zwetan commented Dec 28, 2015

here what we want

  • redshell [avmplus arguments] -- [program arguments]
    for ex: $ redshell -api AIR_3_0 program.abc -- arg1 arg2
  • projector [program arguments]
    for ex: $ program arg1 arg2
  • shellscript [program arguments]
    for ex: $ script arg1 arg2

also we need to know in which context we are

the same thing you have in Capabilities. playerType
that can outpout "ActiveX", "Desktop", "External", "PlugIn" or "StandAlone"
see playerType

we need something like Runtime.type
that output either

  • "runtime" for something run with redshell
  • "script" for something run as a shell script with as3shebang
  • "projector" for something run as an executable

we need to update at the same time redbean
to produce those special projectors that can embed projector arguments

pros

  • real independent exe
    if something goes wrong you don't end up with the default redshell usage
    no need to warn the user about special use of the arguments eg. "you need to use --"
  • allow to embed the runtime with the program (like AIR)
    an exe produced with v0.4 will still work even if you update redtamarin to v0.5 etc
  • "real" exe are easier to package, distribute, version, etc.
  • give us more options for tooling like as3shebang, redbean, etc.
  • "real" exe are easier to symlink and/or install at the system level
    eg. now we have /usr/bin/redbean (symlink) -> /sdk/redtamarin/bin/redbean (bash) -> /sdk/redtamarin/bin/redbean-macintosh (exe)
    after we can have /usr/bin/redbean (symlink) -> /sdk/redtamarin/bin/redbean (exe)

cons

  • Shell C/C++ logic is more complex
  • total projectors incompatibility between what we have now and after that
  • high dependency on a tool to build the projector (eg. redbean)

@zwetan
Copy link
Member Author

zwetan commented Dec 28, 2015

also related to new projector and abc versioning support (google code Issue 52)

abc versioning is fixed and do works

@zwetan
Copy link
Member Author

zwetan commented Jan 11, 2016

So "Bug 765905 - Improve the avmshell projector" helped a lot, but still the code was not working "as is"
as it must have been suggested while the shell was not managing workers thread.

It works now but there are some change in behaviour to note

  • asc -exe option will not produce a compatible projector anymore
  • we need to use a specific "projector builder" (integrated in redbean)
  • because of the change in args handling redshell args order is important
    before $ ./redshell helloworld.abc -api SWF_12 would work
    now $ ./redshell helloworld.abc -api SWF_12 would not work
    you have to use $ ./redshell -api SWF_12 helloworld.abc to make it work
  • the "projector builder" have to contain at least 1 vmarg
    otherwise the beahviour is like the "old" projector and we need to use "--"

IMPORTANT
the command-line arguments order have to be the following
./redshell [vm options] filenames [-- prog arg]

When using the new "projector builder"
even if the user does not define any vmargs
we will use by default "-Dlanguage en"
eg. localize runtime errors to "english" by default

in redbean, the function would look like
public function projector( name:String, debug:Boolean = false, target:OS = null, filepath:Array = null, vmargs:String = null ):void

and

if( vmargs == null )
{
    vmargs = "-Dlanguage en";
}

also the current redbean projector() function will be kept and renamed as flash_projector()
as the function is still valid to produce flash player projectors.
(note: the name "flash_projector" could change)

@zwetan
Copy link
Member Author

zwetan commented Jan 11, 2016

another important thing, once you generated a projector, this one can not anymore be configured with vmargs

for ex:
$ ./test_projector redshell helloworld.abc -- -Dlanguage en will produce the exe helloworld

$ ./helloworld -api SWF_12 those params will not apply to the vm
but will be passed to the program directly (eg. Program.argv)

if you want to apply the args -api SWF_12 to the vm you need to regenerate your projector
$ ./test_projector redshell helloworld.abc -- -Dlanguage en -api SWF_12

@zwetan
Copy link
Member Author

zwetan commented Jan 11, 2016

feature is tested and working under Mac OS X

@zwetan
Copy link
Member Author

zwetan commented Jan 11, 2016

feature is tested and working under Linux Ubuntu

@zwetan
Copy link
Member Author

zwetan commented Jan 12, 2016

feature is tested and working under Windows

note: had to disable some warnings in swf.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant