generate_rbxmx_file.py 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. #!/usr/bin/python
  2. import os
  3. ROBLOX_DIR = os.path.abspath(os.path.join(__file__, '..'))
  4. ROBLOX_GA_DIR = os.path.join(ROBLOX_DIR, "GameAnalyticsSDK")
  5. RBXMX_TMP_FILE = os.path.join(ROBLOX_DIR, "GameAnalyticsSDK.rbxmx.tmp")
  6. RBXMX_RELEASE_FILE = os.path.join(ROBLOX_DIR, "release", "GameAnalyticsSDK.rbxmx")
  7. GAMEANALYTICSSERVER_BODY = 'GameAnalyticsServer_BODY'
  8. GAMEANALYTICSSERVER_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalyticsServer.server.lua")
  9. GAMEANALYTICSSERVERINITUSINGSETTINGS_BODY = 'GameAnalyticsServerInitUsingSettings_BODY'
  10. GAMEANALYTICSSERVERINITUSINGSETTINGS_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalyticsServerInitUsingSettings.server.lua")
  11. INSTALL_BODY = 'INSTALL_BODY'
  12. INSTALL_FILE = os.path.join(ROBLOX_GA_DIR, "INSTALL.txt")
  13. GAMEANALYTICSCLIENT_BODY = 'GameAnalyticsClient_BODY'
  14. GAMEANALYTICSCLIENT_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalyticsClient.client.lua")
  15. GAMEANALYTICS_BODY = 'GameAnalytics_BODY'
  16. GAMEANALYTICS_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "init.lua")
  17. SETTINGS_BODY = 'Settings_BODY'
  18. SETTINGS_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Settings.lua")
  19. HTTPAPI_BODY = 'HttpApi_BODY'
  20. HTTPAPI_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "init.lua")
  21. LOCKBOX_BODY = 'lockbox_BODY'
  22. LOCKBOX_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "init.lua")
  23. STREAM_BODY = 'stream_BODY'
  24. STREAM_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "util", "stream.lua")
  25. QUEUE_BODY = 'queue_BODY'
  26. QUEUE_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "util", "queue.lua")
  27. ARRAY_BODY = 'array_BODY'
  28. ARRAY_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "util", "array.lua")
  29. BASE64_BODY = 'base64_BODY'
  30. BASE64_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "util", "base64.lua")
  31. UTIL_BIT_BODY = 'util_bit_BODY'
  32. UTIL_BIT_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "util", "bit.lua")
  33. HMAC_BODY = 'hmac_BODY'
  34. HMAC_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "mac", "hmac.lua")
  35. SHA2_256_BODY = 'sha2_256_BODY'
  36. SHA2_256_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "lockbox", "digest", "sha2_256.lua")
  37. BIT_BODY = 'bit_BODY'
  38. BIT_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "HttpApi", "Encoding", "bit.lua")
  39. LOGGER_BODY = 'Logger_BODY'
  40. LOGGER_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Logger.lua")
  41. STORE_BODY = 'Store_BODY'
  42. STORE_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Store.lua")
  43. EVENTS_BODY = 'Events_BODY'
  44. EVENTS_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Events.lua")
  45. UTILITIES_BODY = 'Utilities_BODY'
  46. UTILITIES_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Utilities.lua")
  47. VERSION_BODY = 'Version_BODY'
  48. VERSION_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Version.lua")
  49. STATE_BODY = 'State_BODY'
  50. STATE_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "State.lua")
  51. VALIDATION_BODY = 'Validation_BODY'
  52. VALIDATION_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Validation.lua")
  53. THREADING_BODY = 'Threading_BODY'
  54. THREADING_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "Threading.lua")
  55. GAERRORSEVERITY_BODY = 'GAErrorSeverity_BODY'
  56. GAERRORSEVERITY_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "GAErrorSeverity.lua")
  57. GAPROGRESSIONSTATUS_BODY = 'GAProgressionStatus_BODY'
  58. GAPROGRESSIONSTATUS_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "GAProgressionStatus.lua")
  59. GARESOURCEFLOWTYPE_BODY = 'GAResourceFlowType_BODY'
  60. GARESOURCEFLOWTYPE_FILE = os.path.join(ROBLOX_GA_DIR, "GameAnalytics", "GAResourceFlowType.lua")
  61. def main():
  62. print('--- generating rbxmx file ----')
  63. rbxmx_contents = ""
  64. with open(RBXMX_TMP_FILE, 'r') as rbxmx_tmp_file:
  65. rbxmx_contents = rbxmx_tmp_file.read()
  66. file_contents = ""
  67. with open(GAMEANALYTICSSERVER_FILE, 'r') as file:
  68. file_contents = file.read()
  69. rbxmx_contents = rbxmx_contents.replace(GAMEANALYTICSSERVER_BODY, file_contents)
  70. file_contents = ""
  71. with open(GAMEANALYTICSSERVERINITUSINGSETTINGS_FILE, 'r') as file:
  72. file_contents = file.read()
  73. rbxmx_contents = rbxmx_contents.replace(GAMEANALYTICSSERVERINITUSINGSETTINGS_BODY, file_contents)
  74. file_contents = ""
  75. with open(INSTALL_FILE, 'r') as file:
  76. file_contents = file.read()
  77. rbxmx_contents = rbxmx_contents.replace(INSTALL_BODY, file_contents)
  78. file_contents = ""
  79. with open(GAMEANALYTICSCLIENT_FILE, 'r') as file:
  80. file_contents = file.read()
  81. rbxmx_contents = rbxmx_contents.replace(GAMEANALYTICSCLIENT_BODY, file_contents)
  82. file_contents = ""
  83. with open(GAMEANALYTICS_FILE, 'r') as file:
  84. file_contents = file.read()
  85. rbxmx_contents = rbxmx_contents.replace(GAMEANALYTICS_BODY, file_contents)
  86. file_contents = ""
  87. with open(SETTINGS_FILE, 'r') as file:
  88. file_contents = file.read()
  89. rbxmx_contents = rbxmx_contents.replace(SETTINGS_BODY, file_contents)
  90. file_contents = ""
  91. with open(HTTPAPI_FILE, 'r') as file:
  92. file_contents = file.read()
  93. rbxmx_contents = rbxmx_contents.replace(HTTPAPI_BODY, file_contents)
  94. file_contents = ""
  95. with open(LOCKBOX_FILE, 'r') as file:
  96. file_contents = file.read()
  97. rbxmx_contents = rbxmx_contents.replace(LOCKBOX_BODY, file_contents)
  98. file_contents = ""
  99. with open(STREAM_FILE, 'r') as file:
  100. file_contents = file.read()
  101. rbxmx_contents = rbxmx_contents.replace(STREAM_BODY, file_contents)
  102. file_contents = ""
  103. with open(QUEUE_FILE, 'r') as file:
  104. file_contents = file.read()
  105. rbxmx_contents = rbxmx_contents.replace(QUEUE_BODY, file_contents)
  106. file_contents = ""
  107. with open(ARRAY_FILE, 'r') as file:
  108. file_contents = file.read()
  109. rbxmx_contents = rbxmx_contents.replace(ARRAY_BODY, file_contents)
  110. file_contents = ""
  111. with open(BASE64_FILE, 'r') as file:
  112. file_contents = file.read()
  113. rbxmx_contents = rbxmx_contents.replace(BASE64_BODY, file_contents)
  114. file_contents = ""
  115. with open(UTIL_BIT_FILE, 'r') as file:
  116. file_contents = file.read()
  117. rbxmx_contents = rbxmx_contents.replace(UTIL_BIT_BODY, file_contents)
  118. file_contents = ""
  119. with open(HMAC_FILE, 'r') as file:
  120. file_contents = file.read()
  121. rbxmx_contents = rbxmx_contents.replace(HMAC_BODY, file_contents)
  122. file_contents = ""
  123. with open(SHA2_256_FILE, 'r') as file:
  124. file_contents = file.read()
  125. rbxmx_contents = rbxmx_contents.replace(SHA2_256_BODY, file_contents)
  126. file_contents = ""
  127. with open(BIT_FILE, 'r') as file:
  128. file_contents = file.read()
  129. rbxmx_contents = rbxmx_contents.replace(BIT_BODY, file_contents)
  130. file_contents = ""
  131. with open(LOGGER_FILE, 'r') as file:
  132. file_contents = file.read()
  133. rbxmx_contents = rbxmx_contents.replace(LOGGER_BODY, file_contents)
  134. file_contents = ""
  135. with open(STORE_FILE, 'r') as file:
  136. file_contents = file.read()
  137. rbxmx_contents = rbxmx_contents.replace(STORE_BODY, file_contents)
  138. file_contents = ""
  139. with open(EVENTS_FILE, 'r') as file:
  140. file_contents = file.read()
  141. rbxmx_contents = rbxmx_contents.replace(EVENTS_BODY, file_contents)
  142. file_contents = ""
  143. with open(UTILITIES_FILE, 'r') as file:
  144. file_contents = file.read()
  145. rbxmx_contents = rbxmx_contents.replace(UTILITIES_BODY, file_contents)
  146. file_contents = ""
  147. with open(VERSION_FILE, 'r') as file:
  148. file_contents = file.read()
  149. rbxmx_contents = rbxmx_contents.replace(VERSION_BODY, file_contents)
  150. file_contents = ""
  151. with open(STATE_FILE, 'r') as file:
  152. file_contents = file.read()
  153. rbxmx_contents = rbxmx_contents.replace(STATE_BODY, file_contents)
  154. file_contents = ""
  155. with open(VALIDATION_FILE, 'r') as file:
  156. file_contents = file.read()
  157. rbxmx_contents = rbxmx_contents.replace(VALIDATION_BODY, file_contents)
  158. file_contents = ""
  159. with open(THREADING_FILE, 'r') as file:
  160. file_contents = file.read()
  161. rbxmx_contents = rbxmx_contents.replace(THREADING_BODY, file_contents)
  162. file_contents = ""
  163. with open(GAERRORSEVERITY_FILE, 'r') as file:
  164. file_contents = file.read()
  165. rbxmx_contents = rbxmx_contents.replace(GAERRORSEVERITY_BODY, file_contents)
  166. file_contents = ""
  167. with open(GAPROGRESSIONSTATUS_FILE, 'r') as file:
  168. file_contents = file.read()
  169. rbxmx_contents = rbxmx_contents.replace(GAPROGRESSIONSTATUS_BODY, file_contents)
  170. file_contents = ""
  171. with open(GARESOURCEFLOWTYPE_FILE, 'r') as file:
  172. file_contents = file.read()
  173. rbxmx_contents = rbxmx_contents.replace(GARESOURCEFLOWTYPE_BODY, file_contents)
  174. f = open(RBXMX_RELEASE_FILE, "w")
  175. f.write(rbxmx_contents)
  176. f.truncate()
  177. f.close()
  178. print('--- done generating rbxmx file ----')
  179. if __name__ == '__main__':
  180. main()