Skip to content

Commit 72a5653

Browse files
att
1 parent b06ca18 commit 72a5653

File tree

6 files changed

+50
-5
lines changed

6 files changed

+50
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.d
33
LuaSilverChain
44
teste.lua
5+
.cache
56
luadoTheWorld
67
debug.lua
78
release

build/cache_execution.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
function cache_execution(entries,executor,side_efect_verifier)
4+
local ident = false
5+
local entreis_data = darwin.json.dumps_to_string(entries,ident)
6+
local entries_sha = darwin.dtw.generate_sha(entreis_data)
7+
8+
local side_effect_sha = darwin.dtw.load_file(".cache/"..entries_sha)
9+
if side_effect_sha then
10+
local side_effect_verification = side_efect_verifier()
11+
if side_effect_sha == side_effect_verification then
12+
print("cached: ",entreis_data)
13+
return
14+
end
15+
end
16+
print("executing: ",entreis_data)
17+
18+
executor()
19+
local side_effect_verification = side_efect_verifier()
20+
darwin.dtw.write_file(".cache/"..entries_sha,side_effect_verification)
21+
22+
end

build/install_dependencies.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
function Install_dependencies()
3+
os.execute("mkdir -p dependencies")
4+
5+
local libs = {
6+
{url="https://github.com/OUIsolutions/SilverChain/releases/download/0.1.1/SilverChainApiNoDependenciesIncluded.h",path="dependencies/CSilverChainApiNoDependenciesIncluded.h"},
7+
{url="https://github.com/OUIsolutions/CTextEngine/releases/download/v2.002/CTextEngine.h",path="dependencies/CTextEngine.h"},
8+
{url="https://github.com/OUIsolutions/DoTheWorld/releases/download/v8.002/doTheWorld.h",path="dependencies/doTheWorld.h"},
9+
{url="https://github.com/OUIsolutions/C-Cli-Entry/releases/download/0.001/CliEntry.h",path="dependencies/CliEntry.h"},
10+
}
11+
for _, lib in ipairs(libs) do
12+
local executor = function()
13+
os.execute("curl -L " .. lib.url .. " -o " .. lib.path)
14+
end
15+
local side_effect_verifier = function()
16+
return darwin.dtw.generate_sha_from_file(lib.path)
17+
end
18+
cache_execution({ "download", lib.url, lib.path }, executor, side_effect_verifier)
19+
20+
end
21+
end

build/main.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
function main()
4+
Install_dependencies()
5+
end

darwinconf.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function generate_full_c()
2020
full_clib = full_clib:gsub(SILVER_CHAIN_CODE, "#include")
2121
dtw.write_file("release/silverchain_full.c", full_clib)
2222
end
23+
2324
function generate_darwin_import()
2425
private_darwin.resset_c()
2526
darwin.add_c_file("citerop.c", true, function(import, path)

install_dependencies.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
rm -rf dependencies
22
mkdir dependencies
3-
curl -L https://github.com/OUIsolutions/Darwin/releases/download/0.015/darwin.out -o darwin.out
4-
curl -L https://github.com/OUIsolutions/LuaCEmbed/releases/download/v0.779/LuaCEmbed.h -o dependencies/LuaCEmbed.h
5-
curl -L https://github.com/OUIsolutions/SilverChain/releases/download/0.1.1/SilverChainApiNoDependenciesIncluded.h -o dependencies/CSilverChainApiNoDependenciesIncluded.h
6-
curl -L https://github.com/OUIsolutions/CTextEngine/releases/download/v2.002/CTextEngine.h -o dependencies/CTextEngine.h
7-
curl -L https://github.com/OUIsolutions/DoTheWorld/releases/download/v8.002/doTheWorld.h -o dependencies/doTheWorld.h
83
curl -L https://github.com/OUIsolutions/C-Cli-Entry/releases/download/0.001/CliEntry.h -o dependencies/CliEntry.h
94
sudo chmod +x darwin.out

0 commit comments

Comments
 (0)