createrelease.monkey2 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #Import "<libc>"
  2. #Import "<std>"
  3. Using libc..
  4. Using std..
  5. Const MONKEY2_VERSION:="2018.06"
  6. Const MX2CC_VERSION:="1.1.14"
  7. Const RELEASE_SUFFIX:=""
  8. Const OUTPUT:="Monkey2-v"+MONKEY2_VERSION+RELEASE_SUFFIX
  9. Const IGNORE:="
  10. .gitignore
  11. src/c2mx2
  12. src/ted2go-github
  13. src/createrelease
  14. bin/ted2.state.json
  15. bin/ted2_windows/state.json
  16. bin/ted2_macos.app/Contents/MacOS/state.json
  17. bin/ted2_linux/state.json
  18. "
  19. Global desktop:String
  20. Global output:String
  21. Function Copy( file:String )
  22. Print file
  23. CopyFile( file,output+"/"+file )
  24. End
  25. Function CopyFiles( dir:String )
  26. Print dir
  27. CreateDir( output+"/"+dir )
  28. For Local file:=Eachin LoadDir( dir )
  29. Local src:=dir+"/"+file
  30. If IGNORE.Contains( "~n"+src+"~n" ) Continue
  31. If file.Contains( "_raspbian" ) Continue
  32. #if __TARGET__="windows"
  33. If file.Contains( "_macos" ) Continue
  34. If file.Contains( "_linux" ) Continue
  35. #elseif __TARGET__="macos"
  36. If file.Contains( "_windows" ) Continue
  37. If file.Contains( "_linux" ) Continue
  38. #elseif __TARGET__="linux"
  39. If file.Contains( "_windows" ) Continue
  40. If file.Contains( "_macos" ) Continue
  41. #Endif
  42. Select GetFileType( src )
  43. Case FileType.Directory
  44. If file="__PAGES__" Or file="__MANPAGES__"
  45. Continue
  46. Else If file.EndsWith( ".products" )
  47. Continue
  48. Else If dir.EndsWith( "/openvr-sdk/bin" )
  49. #If __TARGET__="windows"
  50. If Not file.EndsWith( "win32" ) And Not file.EndsWith( "win64" ) Continue
  51. #else
  52. Continue
  53. #endif
  54. Else If dir.EndsWith( "/openvr-sdk/lib" )
  55. #If __TARGET__="windows"
  56. If Not file.EndsWith( "win32" ) And Not file.EndsWith( "win64" ) Continue
  57. #else
  58. Continue
  59. #endif
  60. Else If file.Contains( ".buildv" )
  61. If ExtractDir( dir )<>"modules/" Or Not file.EndsWith( ".buildv"+MX2CC_VERSION ) Continue
  62. Else If dir.Contains( ".buildv" )
  63. If file.StartsWith( "emscripten_" ) Continue
  64. If file.StartsWith( "android_" ) Continue
  65. If file.StartsWith( "ios_" ) Continue
  66. If file.EndsWith( "_msvc" ) Continue
  67. If file.EndsWith( "_x64" ) Continue
  68. If file="build" Continue
  69. If file="src" Continue
  70. Endif
  71. CopyFiles( src )
  72. Case FileType.File
  73. Local dst:=output+"/"+dir+"/"+file
  74. CopyFile( src,dst )
  75. End
  76. Next
  77. End
  78. Function CopyRelease()
  79. DeleteDir( output,True )
  80. CreateDir( output )
  81. CreateDir( output+"/devtools" )
  82. CreateDir( output+"/tmp" )
  83. CopyFiles( "bananas" )
  84. CopyFiles( "bin" )
  85. CopyFiles( "docs" )
  86. CopyFiles( "modules" )
  87. CopyFiles( "products" )
  88. CopyFiles( "scripts" )
  89. CopyFiles( "src" )
  90. Copy( "ABOUT.HTML" )
  91. Copy( "VERSIONS.TXT" )
  92. Copy( "LICENSE.TXT" )
  93. Copy( "README.TXT" )
  94. Copy( "ducks-scene.mojo3d" )
  95. Copy( "shapes-scene.mojo3d" )
  96. Copy( "sprites-scene.mojo3d" )
  97. Copy( "test-scene.mojo3d" )
  98. #If __TARGET__="windows"
  99. Copy( "Monkey2 (Windows).exe" )
  100. #Else if __TARGET__="macos"
  101. CopyFiles( "Monkey2 (Macos).app" )
  102. #Else if __TARGET__="linux"
  103. Copy( "Monkey2 (Linux)" )
  104. #Endif
  105. End
  106. Function MakeInno()
  107. Local iss:=New StringStack
  108. iss.Push( "[Setup]" )
  109. iss.Push( "OutputDir="+desktop )
  110. iss.Push( "OutputBaseFilename="+OUTPUT )
  111. iss.Push( "AppName="+OUTPUT )
  112. iss.Push( "AppVerName="+OUTPUT )
  113. iss.Push( "DefaultGroupName="+OUTPUT )
  114. iss.Push( "DefaultDirName={sd}\"+OUTPUT )
  115. iss.Push( "UninstallFilesDir={app}\bin" )
  116. iss.Push( "[Icons]" )
  117. iss.Push( "Name: ~q{group}\"+OUTPUT+"~q; Filename: ~q{app}\Monkey2 (Windows).exe~q; WorkingDir: ~q{app}~q" )
  118. iss.Push( "Name: ~q{group}\Uninstall "+OUTPUT+"~q; Filename: ~q{uninstallexe}~q" )
  119. iss.Push( "[FILES]" )
  120. iss.Push( "Source: ~q"+output+"\*~q; DestDir: {app}; Flags: ignoreversion recursesubdirs" )
  121. iss.Push( "[RUN]" )
  122. iss.Push( "Filename: ~q{app}\Monkey2 (Windows).exe~q; Description: ~qLaunch "+OUTPUT+"~q; Flags: postinstall nowait skipifsilent" )
  123. Local isspath:=output+".iss"
  124. SaveString( iss.Join("~n"),isspath )
  125. End
  126. Function MakeMacosPkg()
  127. libc.system( "chmod -R 777 "+output )
  128. libc.system( "pkgbuild --install-location /Applications/"+OUTPUT+" --identifier "+OUTPUT+" --ownership preserve --root "+output+" "+output+".pkg" )
  129. End
  130. Function MakeLinuxTargz()
  131. libc.system( "chmod -R 777 "+output )
  132. libc.system( "tar czf "+output+".tgz -C "+desktop+" "+OUTPUT )
  133. End
  134. Function Main()
  135. Print "Creating release..."
  136. ChangeDir( AppDir() )
  137. While GetFileType( "bin" )<>FileType.Directory
  138. If IsRootDir( CurrentDir() )
  139. libc.exit_( -1 )
  140. Endif
  141. ChangeDir( ExtractDir( CurrentDir() ) )
  142. Wend
  143. #if __TARGET__="windows"
  144. desktop=(String.FromCString( getenv( "HOMEDRIVE" ) )+String.FromCString( getenv( "HOMEPATH" ) )+"\Desktop").Replace( "\","/" )+"/"
  145. #else
  146. desktop=String.FromCString( getenv( "HOME" ) )+"/Desktop/"
  147. #endif
  148. output=desktop+OUTPUT
  149. CopyRelease()
  150. #if __TARGET__="windows"
  151. MakeInno()
  152. #else if __TARGET__="macos"
  153. MakeMacosPkg()
  154. #else if __TARGET__="linux"
  155. MakeLinuxTargz()
  156. #endif
  157. Print "~nFinished!!!!!"
  158. End