-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpremake5.lua
More file actions
149 lines (134 loc) · 3.68 KB
/
premake5.lua
File metadata and controls
149 lines (134 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
if os.ishost "windows" then
-- Windows
newaction
{
trigger = "solution",
description = "Open the solution",
execute = function ()
os.execute "start freetds.net.sln"
end
}
newaction
{
trigger = "native",
description = "Build the native library",
execute = function ()
os.execute "mkdir _build64 & pushd _build64 \z
&& cmake -G \"Visual Studio 15 2017 Win64\" -DBITNESS=\"x64\" ..\\ \z
&& popd \z
&& cmake --build _build64 --config Release \z
&& copy _build64\\Release\\tds.dll tds.net\\x64 \z
&& copy _vcpkg\\packages\\openssl-windows_x64-windows\\bin\\*.dll tds.net\\x64"
end
}
newaction
{
trigger = "native_",
description = "Build the native library",
execute = function ()
os.execute "mkdir _build32 & pushd _build32 \z
&& cmake -G \"Visual Studio 15 2017\" -DBITNESS=\"x86\" ..\\ \z
&& popd \z
&& mkdir _build64 & pushd _build64 \z
&& cmake -G \"Visual Studio 15 2017 Win64\" -DBITNESS=\"x64\" ..\\ \z
&& popd \z
&& cmake --build _build32 --config Release \z
&& copy _build32\\Release\\tds.dll Tds.Net\\x86 \z
&& copy _vcpkg\\packages\\openssl-windows_x86-windows\\bin\\*.dll Tds.Net\\x86 \z
&& cmake --build _build64 --config Release \z
&& copy _build64\\Release\\tds.dll Tds.Net\\x64 \z
&& copy _vcpkg\\packages\\openssl-windows_x64-windows\\bin\\*.dll Tds.Net\\x64"
end
}
else
-- MacOSX and Linux.
newaction
{
trigger = "solution",
description = "Open the FreeTds.Net solution",
execute = function ()
end
}
newaction
{
trigger = "loc",
description = "Count lines of code",
execute = function ()
os.execute "wc -l *.cs"
end
}
end
newaction
{
trigger = "build",
description = "Build tds.net",
execute = function ()
os.execute "dotnet build tds.net/tds.net.csproj"
end
}
newaction
{
trigger = "test",
description = "Build and run all unit tests",
execute = function ()
-- os.execute "premake5 build"
os.execute "dotnet test tds.tests/tds.tests.csproj"
end
}
newaction
{
trigger = "pack",
description = "Package and run all unit tests",
execute = function ()
os.execute "dotnet pack tds.net/tds.net.csproj --output ../nupkgs --include-source"
end
}
newaction
{
trigger = "publish",
description = "Package and publish nuget package",
execute = function ()
apikey = os.getenv('NUGET_APIKEY')
os.execute "premake5 pack"
os.execute( "dotnet nuget push nupkgs/**/tds.*.nupkg --api-key " .. apikey .. " --source https://api.nuget.org/v3/index.json" )
end
}
newaction
{
trigger = "clean",
description = "Clean all build files and output",
execute = function ()
files_to_delete =
{
"*.make",
"*.zip",
"*.tar.gz",
"*.db",
"*.opendb"
}
directories_to_delete =
{
"obj",
"ipch",
"bin",
"nupkgs",
".vs",
"Debug",
"Release",
"release"
}
for i,v in ipairs( directories_to_delete ) do
os.rmdir( v )
end
if not os.ishost "windows" then
os.execute "find . -name .DS_Store -delete"
for i,v in ipairs( files_to_delete ) do
os.execute( "rm -f " .. v )
end
else
for i,v in ipairs( files_to_delete ) do
os.execute( "del /F /Q " .. v )
end
end
end
}