install:
  - cd c:\projects
  - ps: |
        $wc = New-Object System.Net.WebClient
        try
        {
         $dmdVersion = $wc.DownloadString("http://downloads.dlang.org/releases/LATEST").Replace("`r","").Replace("`n","")
         Invoke-WebRequest "http://downloads.dlang.org/releases/2.x/$dmdVersion/dmd.$dmdVersion.windows.7z" -OutFile "dmd2.7z"
         7z x dmd2.7z > $null
         $Env:Path += ";c:\projects\dmd2\windows\bin\"
         c:\projects\dmd2\windows\bin\dmd.exe --version
         $dubVersion = $wc.DownloadString("http://code.dlang.org/download/LATEST").Replace("`r","").Replace("`n","")
         Invoke-WebRequest "https://code.dlang.org/files/dub-$dubVersion-windows-x86.zip" -OutFile dub.zip
         7z x -odub dub.zip > $null
         c:\projects\dub\dub.exe --version
        }
        finally
        {
         $wc.Dispose()
        }

build_script:
  - cd c:\projects\otyaSMILEBASIC
  - git submodule init && git submodule update
  - c:\projects\dub\dub.exe build

after_build:
  - ps: |
        $SDL2Version = '2.0.5'
        Invoke-WebRequest "https://www.libsdl.org/release/SDL2-$SDL2Version-win32-x86.zip" -OutFile C:\projects\SDL2.zip
        7z x -oC:\Projects\SDL2 C:\projects\SDL2.zip > $null
        $SDL2ImageVersion = '2.0.1'
        Invoke-WebRequest "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-$SDL2ImageVersion-win32-x86.zip" -OutFile C:\projects\SDL2Image.zip
        7z x -oC:\Projects\SDL2Image C:\projects\SDL2Image.zip > $null
        $SDL2ttfVersion = '2.0.14'
        Invoke-WebRequest "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$SDL2ttfVersion-win32-x86.zip" -OutFile C:\projects\SDL2ttf.zip
        7z x -oC:\Projects\SDL2ttf C:\projects\SDL2ttf.zip > $null
        copy c:\projects\dmd2\windows\bin\libcurl.dll c:\projects\otyaSMILEBASIC\out\
        copy c:\projects\otyaSMILEBASIC\LICE* c:\projects\otyaSMILEBASIC\out\
        copy c:\projects\otyaSMILEBASIC\README* c:\projects\otyaSMILEBASIC\out\
        copy C:\projects\SDL2\*.dll c:\projects\otyaSMILEBASIC\out\
        copy C:\Projects\SDL2Image\*.dll c:\projects\otyaSMILEBASIC\out\
        copy C:\Projects\SDL2Image\LICE* c:\projects\otyaSMILEBASIC\out\
        copy C:\Projects\SDL2ttf\libfreetype-6.dll c:\projects\otyaSMILEBASIC\out\
        copy C:\Projects\SDL2ttf\SDL2_ttf.dll c:\projects\otyaSMILEBASIC\out\
        copy C:\Projects\SDL2ttf\LICENSE.freetype.txt c:\projects\otyaSMILEBASIC\out\
  - 7z a c:\projects\otyasmilebasic\otyasmilebasic.zip c:\projects\otyaSMILEBASIC\out\*

test_script:
  - cd c:\projects\otyaSMILEBASIC
  - c:\projects\dub\dub.exe test

artifacts:
  - path: otyasmilebasic.zip
  
