mpeterv / hererocks

Python script for installing Lua/LuaJIT and LuaRocks into a local directory
MIT License
180 stars 22 forks source link

Support Windows & Appveyor #8

Closed starius closed 8 years ago

starius commented 8 years ago

Great work! I think, i'll replace bash scripts with hererocks in my projects. (They are based on lua-travis-example.) However I have not only Bash scripts but also Batch scripts to automate exactly the same thing on Windows (and on AppVeyor). Batch scripts are based on lua-appveyor-example. Can I use hererocks in AppVeyor?

mpeterv commented 8 years ago

Not yet. I'll take a look at how it is done in batch and will try to reimplement it in Python.

mpeterv commented 8 years ago

It's workingpm master branch, at least when using visual studio, example appveyor.yml.

Things that lua-appveyor-example does that hererocks should also do:

Things that lua-appveyor-example does that hererocks can't do because they are appveyor specific:

starius commented 8 years ago

Can you provide flag (e.g., --mode appveyor) which would apply appveyor-specific customizations, please?

mpeterv commented 8 years ago

I think hererocks should just detect existing visual studio version just like luarocks installer does it. Luarocks will then configure itself to run corresponding paths setup script on start up. See https://ci.appveyor.com/project/mpeterv/hererocks/build/1.0.52.

mpeterv commented 8 years ago

So Appveyor provides all VS studios + Mingw already, regardless of configuration. Autodetection doesn't work then. I've implemented an ugly way for hererocks to run some path set-up command though, so an extra set_compiler_env.bat file like lua-appveyor-example uses shouldn't be necessary.

I still don't want to add an appveyor specific option reading toolchain configuration from %configuration% and %platform%, but we could have a generic option playing nicely with these environment variables. E.g.

hererocks lua_install --%LUA% --luarocks 2.3 --target %Configuration% --arch %platform%
starius commented 8 years ago

I still don't want to add an appveyor specific option reading toolchain configuration from %configuration% and %platform%, but we could have a generic option playing nicely with these environment variables.

Looks good to me.

mpeterv commented 8 years ago

At this point on master branch this should work for Appveyor:

environment:
  matrix:
  - Lua: lua 5.1
  - Lua: lua 5.2
  - Lua: lua 5.3
  - Lua: luajit 2.0

configuration:
  - mingw
  - vs08_32
  - vs10_32
  - vs12_32
  - vs12_64
  - vs13_32
  - vs13_64
  - vs15_32
  - vs15_64

build_script:
  - PATH %CD%\here\bin;C:\mingw\bin;%PATH%
  - python hererocks.py here --%Lua% --luarocks ^^ --target=%Configuration%

Although for most projects testing all combinations like that is an overkill.

This is almost enough for use with Appveyor (need to configure cmake generator), so I'll close this and split remaining tasks into several issues.

starius commented 8 years ago

I tried this new option for my repo, but it failed: https://ci.appveyor.com/project/starius/lua-npge/build/0.0.1.180-test

Problems:

mpeterv commented 8 years ago

You are fetching from latest branch which is an alias for 0.6.2, try master

mpeterv commented 8 years ago

Also format for target changed, try

configuration:
 - mingw
 - vs_32
 - vs_64

and remove platform section

starius commented 8 years ago

In https://ci.appveyor.com/project/starius/lua-npge/build/0.0.1.187-test one of jobs completed successfully.

LuaJIT on 32 bit used to crash before this as well (because of using C++ exceptions, I think) and was muted with allow_failures.

Other errors seem to be connected to line ends on Windows. I'll try to isolate this problem in a branch of your repo.

starius commented 8 years ago

Some errors were caused by the bug in Lua 5.3.2. Other errors are bugs in lua-npge itself (I forgot about \r). MinGW jobs are green now. Visual Studio jobs are still failing, I'm investigating it.

starius commented 8 years ago

I added debugging prints and found that io.lines() sometimes omits a newline!

An external tool (io.popen) produces lines separated by \n. Two lines in the middle of the output are returned by io.lines() as one line.

Visual Studio (bug):

https://ci.appveyor.com/project/starius/lua-npge/build/0.0.1.193-test/job/ow2wr7veycmo2glw#L624

LINE    Query  361  ATGCATGCATGCATGCATGCATGCATGCATGCATGCAT  398
LINE                ||||||||||||||||||||||||||||||||||||||Sbjct  38   ATGCATGCATGCATGCATGCATGCATGCATGCATGCAT  1
LINE    
LINE    
LINE     Score =   719 bits (796),  Expect = 0.0

Line break before Sbjct was omitted.

MinGW (no bug):

https://ci.appveyor.com/project/starius/lua-npge/build/0.0.1.193-test/job/g7h98l8oi93x2hx1#L527

LINE    Query  361  ATGCATGCATGCATGCATGCATGCATGCATGCATGCAT  398
LINE                ||||||||||||||||||||||||||||||||||||||
LINE    Sbjct  38   ATGCATGCATGCATGCATGCATGCATGCATGCATGCAT  1
LINE    
LINE    
LINE     Score =   719 bits (796),  Expect = 0.0

The output in JSON: https://ci.appveyor.com/project/starius/lua-npge/build/job/nndy5q2yq2uh13f5

I'm adding "b" to popen flags.

starius commented 8 years ago

Adding "b" to popen flags helps: https://ci.appveyor.com/project/starius/lua-npge/build/0.0.1.200-test It is important to add "b" to popen flags on Windows, but not to add it on other systems, because they can return "Invalid argument" error.

One job is broken (32bit, VS, LuaJIT). It was broken before. Probably I miss something when dealing with C++ exceptions and Lua erorrs. I'll try to isolate it. It is not related to hererocks.