compiler update
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -35,10 +35,10 @@ jobs:
|
|||||||
lua-version: 5.1.0
|
lua-version: 5.1.0
|
||||||
install-luarocks: true
|
install-luarocks: true
|
||||||
luarocks-version: 3.9.0
|
luarocks-version: 3.9.0
|
||||||
|
|
||||||
- name: install-lfs
|
- name: install-lfs
|
||||||
run: luarocks install luafilesystem
|
run: luarocks install luafilesystem
|
||||||
|
|
||||||
|
|
||||||
- name: compile-basalt
|
- name: compile-basalt
|
||||||
run: lua ${{ github.workspace }}/scripts/compiler.lua
|
run: lua ${{ github.workspace }}/scripts/compiler.lua
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
|||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build/
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
lfs = require "lfs"
|
lfs = require "lfs"
|
||||||
sourcesPath = "source/"
|
sourcesPath = "source/"
|
||||||
scriptsPath = "scripts/"
|
scriptsPath = "scripts/"
|
||||||
|
buildPath = "build/"
|
||||||
|
|
||||||
fetchFiles = function(...)
|
fetchFiles = function(...)
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
@@ -15,5 +16,27 @@ fetchFiles = function(...)
|
|||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dirExists = function(path)
|
||||||
|
local _, endIndex = string.find(path, "/")
|
||||||
|
if(endIndex == #path) then
|
||||||
|
path = string.sub(path, 1, #path - 1)
|
||||||
|
end
|
||||||
|
if(lfs.attributes(path, "mode") == "directory") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
|
local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
|
||||||
|
|
||||||
|
if not dirExists(buildPath) then
|
||||||
|
lfs.mkdir(buildPath)
|
||||||
|
assert(dirExists(buildPath), "Failed to make build directory, exiting...")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local sourceFileName = "basalt.lua"
|
||||||
|
local sourceFile = io.open(buildPath .. sourceFileName, "w")
|
||||||
|
|
||||||
|
sourceFile:write(compiledSource)
|
||||||
|
sourceFile:close()
|
||||||
Reference in New Issue
Block a user