Skip to content

Commit 7d4936b

Browse files
committed
Added 'createrelease' source
1 parent 891d017 commit 7d4936b

1 file changed

Lines changed: 309 additions & 0 deletions

File tree

src/createrelease/createrelease.wx

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
2+
#Import "<libc>"
3+
#Import "<std>"
4+
5+
Using libc..
6+
Using std..
7+
8+
Const WONKEY_VERSION:="2021.04"
9+
10+
Const WAKE_VERSION:="1.0.0"
11+
12+
Const RELEASE_SUFFIX:=""
13+
14+
#if __TARGET__="windows"
15+
Const TARGET:= "windows"
16+
#elseif __TARGET__="macos"
17+
Const TARGET:= "macos"
18+
#elseif __TARGET__="linux"
19+
Const TARGET:= "linux"
20+
#elseif __TARGET__="raspbian"
21+
Const TARGET:= "raspbian"
22+
#else
23+
Const TARGET:= "???"
24+
#endif
25+
26+
Const OUTPUT:="wonkey_"+TARGET+"_"+WONKEY_VERSION+RELEASE_SUFFIX
27+
28+
Const IGNORE:="
29+
.gitignore
30+
src/createrelease
31+
bin/windows/wide.state.json
32+
bin/windows/wide/wide.state.json
33+
bin/linux/wide.state.json
34+
bin/linux/wide/wide.state.json
35+
bin/macos/wide.state.json
36+
bin/macos/wide.app/Contents/MacOS/state.json
37+
bin/raspbian/wide.state.json
38+
bin/raspbian/wide/wide.state.json
39+
"
40+
41+
Global desktop:String
42+
Global output:String
43+
44+
Function Copy( file:String )
45+
46+
Print "Copy file: " + file + " ==> " + output + "/" + file
47+
48+
CopyFile( file,output+"/"+file )
49+
End
50+
51+
Function CopyFiles( dir:String )
52+
53+
'Print "in directory: " + dir
54+
55+
'CreateDir( output+"/"+dir )
56+
57+
For Local file:=Eachin LoadDir( dir )
58+
59+
Local src:=dir+"/"+file
60+
61+
If IGNORE.Contains( "~n"+src+"~n" ) Continue
62+
63+
If dir.Contains( "bin/experimental" ) Continue
64+
65+
#if __TARGET__="windows"
66+
If dir.Contains( "bin/macos" ) Continue
67+
If dir.Contains( "bin/linux" ) Continue
68+
If dir.Contains( "bin/raspbian" ) Continue
69+
#elseif __TARGET__="macos"
70+
If dir.Contains( "bin/windows" ) Continue
71+
If dir.Contains( "bin/linux" ) Continue
72+
If dir.Contains( "bin/raspbian" ) Continue
73+
#elseif __TARGET__="linux"
74+
If dir.Contains( "bin/macos" ) Continue
75+
If dir.Contains( "bin/windows" ) Continue
76+
If dir.Contains( "bin/raspbian" ) Continue
77+
#elseif __TARGET__="raspbian"
78+
If dir.Contains( "bin/macos" ) Continue
79+
If dir.Contains( "bin/windows" ) Continue
80+
If dir.Contains( "bin/linux" ) Continue
81+
#Endif
82+
83+
Select GetFileType( src )
84+
Case FileType.Directory
85+
86+
If file=".wx" Or file=".DS_Store" Or file=".git" Or file="__PAGES__" Or file="__MANPAGES__"
87+
88+
Continue
89+
90+
Else If file.EndsWith( ".products" ) Or file.EndsWith( "-mx2" )
91+
92+
Continue
93+
94+
Else If dir.EndsWith( "/openvr-sdk/bin" )
95+
96+
#If __TARGET__="windows"
97+
If Not file.EndsWith( "win32" ) And Not file.EndsWith( "win64" ) Continue
98+
#else
99+
Continue
100+
#endif
101+
Else If dir.EndsWith( "/openvr-sdk/lib" )
102+
103+
#If __TARGET__="windows"
104+
If Not file.EndsWith( "win32" ) And Not file.EndsWith( "win64" ) Continue
105+
#else
106+
Continue
107+
#endif
108+
Else If file.Contains( ".buildv" )
109+
110+
If ExtractDir( dir )<>"modules/" Or Not file.EndsWith( ".buildv"+WAKE_VERSION ) Continue
111+
112+
Else If dir.Contains( ".buildv" )
113+
114+
If Not src.Contains( "_mx" ) And Not src.EndsWith( "_mx" ) Continue
115+
116+
If file.StartsWith( "emscripten_" ) Continue
117+
If file.StartsWith( "android_" ) Continue
118+
If file.StartsWith( "ios_" ) Continue
119+
'If file.Contains( "_msvc" ) Continue
120+
'If file.Contains( "_x64" ) Continue
121+
If file="build" Continue
122+
If file="src" Continue
123+
124+
#if __TARGET__="windows"
125+
If file.StartsWith( "macos_" ) Continue
126+
If file.StartsWith( "linux_" ) Continue
127+
If file.StartsWith( "raspbian_" ) Continue
128+
#elseif __TARGET__="macos"
129+
If file.StartsWith( "windows_" ) Continue
130+
If file.StartsWith( "linux_" ) Continue
131+
If file.StartsWith( "raspbian_" ) Continue
132+
#elseif __TARGET__="linux"
133+
If file.StartsWith( "windows_" ) Continue
134+
If file.StartsWith( "macos_" ) Continue
135+
If file.StartsWith( "raspbian_" ) Continue
136+
#elseif __TARGET__="raspbian"
137+
If file.StartsWith( "windows_" ) Continue
138+
If file.StartsWith( "linux_" ) Continue
139+
If file.StartsWith( "macos_" ) Continue
140+
#Endif
141+
142+
End
143+
144+
Print "In directory: " + src
145+
CreateDir( output+"/"+dir )
146+
CopyFiles( src )
147+
148+
Case FileType.File
149+
150+
If file=".gitignore" Continue
151+
152+
' ignore scripts
153+
If dir = "scripts"
154+
155+
If file.EndsWith("_fast.sh") Continue
156+
If file.EndsWith("_fastest.sh") Continue
157+
If file.EndsWith("_slow.sh") Continue
158+
159+
#if __TARGET__="windows"
160+
If file.EndsWith(".sh") Continue
161+
#else
162+
If file.EndsWith(".bat") Continue
163+
#end
164+
End
165+
If file.EndsWith("-mx2") Continue
166+
If file.EndsWith("-bak") Or file.EndsWith("-bak.exe") Continue
167+
168+
Local dst:=output+"/"+dir+"/"+file
169+
170+
CreateDir( output+"/"+dir )
171+
CopyFile( src,dst )
172+
End
173+
Next
174+
End
175+
176+
Function CopyRelease()
177+
178+
DeleteDir( output,True )
179+
CreateDir( output )
180+
181+
'CreateDir( output+"/devtools" )
182+
'CreateDir( output+"/tmp" )
183+
184+
CopyFiles( "bin" )
185+
CopyFiles( "docs" )
186+
CopyFiles( "examples" )
187+
CopyFiles( "modules" )
188+
CopyFiles( "products" )
189+
CopyFiles( "scripts" )
190+
CopyFiles( "src" )
191+
192+
Copy( "LICENSE.txt" )
193+
Copy( "README.md" )
194+
Copy( "MODULES.md" )
195+
196+
'Copy( "ducks-scene.mojo3d" )
197+
'Copy( "shapes-scene.mojo3d" )
198+
'Copy( "sprites-scene.mojo3d" )
199+
'Copy( "test-scene.mojo3d" )
200+
201+
'Copy( "xmas-lights.png" )
202+
203+
#If __TARGET__="windows"
204+
Copy( "Wonkey (windows).exe" )
205+
#Else if __TARGET__="macos"
206+
CopyFiles("Wonkey (macos).app" )
207+
#Else if __TARGET__="linux"
208+
Copy( "Wonkey (linux)" )
209+
#Else if __TARGET__="raspbian"
210+
Copy( "Wonkey (raspbian)" )
211+
#Endif
212+
213+
End
214+
215+
Function MakeInno()
216+
217+
Local iss:=New StringStack
218+
iss.Push( "[Setup]" )
219+
iss.Push( "OutputDir="+desktop )
220+
iss.Push( "OutputBaseFilename="+OUTPUT )
221+
iss.Push( "AppName="+OUTPUT )
222+
iss.Push( "AppVerName="+OUTPUT )
223+
iss.Push( "DefaultGroupName="+OUTPUT )
224+
iss.Push( "DefaultDirName={sd}\"+OUTPUT )
225+
iss.Push( "UninstallFilesDir={app}\bin\windows" )
226+
iss.Push( "[Icons]" )
227+
iss.Push( "Name: ~q{group}\"+OUTPUT+"~q; Filename: ~q{app}\Wonkey (windows).exe~q; WorkingDir: ~q{app}~q" )
228+
iss.Push( "Name: ~q{group}\Uninstall "+OUTPUT+"~q; Filename: ~q{uninstallexe}~q" )
229+
iss.Push( "[FILES]" )
230+
iss.Push( "Source: ~q"+output+"\*~q; DestDir: {app}; Flags: ignoreversion recursesubdirs" )
231+
iss.Push( "[RUN]" )
232+
iss.Push( "Filename: ~q{app}\Wonkey (windows).exe~q; Description: ~qLaunch "+OUTPUT+"~q; Flags: postinstall nowait skipifsilent" )
233+
234+
Local isspath:=output+".iss"
235+
236+
SaveString( iss.Join("~n"),isspath )
237+
End
238+
239+
Function MakeMacosPkg()
240+
241+
libc.system( "chmod -R 777 "+output )
242+
243+
libc.system( "pkgbuild --install-location /Applications/"+OUTPUT+" --identifier "+OUTPUT+" --ownership preserve --root "+output+" "+output+".pkg" )
244+
End
245+
246+
Function MakeLinuxTargz()
247+
248+
libc.system( "chmod -R 777 "+output )
249+
250+
libc.system( "tar czf "+output+".tgz -C "+desktop+" "+OUTPUT )
251+
End
252+
253+
Function Main()
254+
255+
Print "Creating release..."
256+
257+
ChangeDir( AppDir() )
258+
259+
While GetFileType( "bin" )<>FileType.Directory
260+
If IsRootDir( CurrentDir() )
261+
libc.exit_( -1 )
262+
Endif
263+
ChangeDir( ExtractDir( CurrentDir() ) )
264+
Wend
265+
266+
'#if __TARGET__="windows"
267+
' desktop=(String.FromCString( getenv( "HOMEDRIVE" ) )+String.FromCString( getenv( "HOMEPATH" ) )+"\Desktop").Replace( "\","/" )+"/"
268+
'#else
269+
' desktop=String.FromCString( getenv( "HOME" ) )+"/Desktop/"
270+
'#endif
271+
272+
#if __TARGET__="windows"
273+
Local outdir:= "releases/windows/"
274+
#elseif __TARGET__="macos"
275+
Local outdir:= "releases/macos/"
276+
#elseif __TARGET__="linux"
277+
Local outdir:= "releases/linux/"
278+
#elseif __TARGET__="raspbian"
279+
Local outdir:= "releases/raspbian/"
280+
#else
281+
Local outdir:= "releases/unknown/"
282+
#endif
283+
284+
285+
286+
DeleteDir(outdir,True )
287+
CreateDir(outdir)
288+
289+
output=outdir+OUTPUT
290+
291+
CopyRelease()
292+
293+
#if __TARGET__="windows"
294+
295+
MakeInno()
296+
297+
#else if __TARGET__="macos"
298+
299+
MakeMacosPkg()
300+
301+
#else if __TARGET__="linux" or __TARGET__="raspbian"
302+
303+
MakeLinuxTargz()
304+
305+
#endif
306+
307+
Print "~nFinished!!!!!"
308+
309+
End

0 commit comments

Comments
 (0)