Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

prepare_sdk.js 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. const fs = require('fs');
  2. const path = require('path');
  3. const androidSourcePath = '../android/sdk/src/main/java/org/jitsi/meet/sdk';
  4. const androidMainSourcePath = '../android/sdk/src/main/res';
  5. const androidTargetPath = './android/src/main/java/org/jitsi/meet/sdk';
  6. const androidMainTargetPath = './android/src/main/res';
  7. const iosSrcPath = '../ios/sdk/src';
  8. const iosDestPath = './ios/src';
  9. /**
  10. * Copies a specified file in a way that recursive copy is possible.
  11. */
  12. function copyFileSync(source, target) {
  13. let targetFile = target;
  14. // If target is a directory, a new file with the same name will be created
  15. if (fs.existsSync(target)) {
  16. if (fs.lstatSync(target).isDirectory()) {
  17. targetFile = path.join(target, path.basename(source));
  18. }
  19. }
  20. fs.copyFileSync(source, targetFile);
  21. }
  22. /**
  23. * Copies a specified directory recursively.
  24. */
  25. function copyFolderRecursiveSync(source, target) {
  26. let files = [];
  27. const targetFolder = path.join(target, path.basename(source));
  28. if (!fs.existsSync(targetFolder)) {
  29. fs.mkdirSync(targetFolder, { recursive: true });
  30. }
  31. if (fs.lstatSync(source).isDirectory()) {
  32. files = fs.readdirSync(source);
  33. files.forEach(file => {
  34. const curSource = path.join(source, file);
  35. if (fs.lstatSync(curSource).isDirectory()) {
  36. copyFolderRecursiveSync(curSource, targetFolder);
  37. } else {
  38. copyFileSync(curSource, targetFolder);
  39. }
  40. });
  41. }
  42. }
  43. copyFolderRecursiveSync(
  44. '../images',
  45. '.'
  46. );
  47. copyFolderRecursiveSync(
  48. '../sounds',
  49. '.'
  50. );
  51. copyFolderRecursiveSync(
  52. '../lang',
  53. '.'
  54. );
  55. copyFolderRecursiveSync(
  56. '../modules',
  57. '.'
  58. );
  59. copyFolderRecursiveSync(
  60. '../react',
  61. '.'
  62. );
  63. copyFolderRecursiveSync(
  64. '../ios/sdk/sdk.xcodeproj',
  65. './ios'
  66. );
  67. copyFolderRecursiveSync(
  68. `${iosSrcPath}/callkit`,
  69. iosDestPath
  70. );
  71. copyFolderRecursiveSync(
  72. `${iosSrcPath}/dropbox`,
  73. iosDestPath
  74. );
  75. fs.copyFileSync(
  76. `${iosSrcPath}/AppInfo.m`,
  77. `${iosDestPath}/AppInfo.m`
  78. );
  79. fs.copyFileSync(
  80. `${iosSrcPath}/AudioMode.m`,
  81. `${iosDestPath}/AudioMode.m`
  82. );
  83. fs.copyFileSync(
  84. `${iosSrcPath}/InfoPlistUtil.m`,
  85. `${iosDestPath}/InfoPlistUtil.m`
  86. );
  87. fs.copyFileSync(
  88. `${iosSrcPath}/InfoPlistUtil.h`,
  89. `${iosDestPath}/InfoPlistUtil.h`
  90. );
  91. fs.copyFileSync(
  92. `${iosSrcPath}/JavaScriptSandbox.m`,
  93. `${iosDestPath}/JavaScriptSandbox.m`
  94. );
  95. fs.copyFileSync(
  96. `${iosSrcPath}/JitsiAudioSession.m`,
  97. `${iosDestPath}/JitsiAudioSession.m`
  98. );
  99. fs.copyFileSync(
  100. `${iosSrcPath}/JitsiAudioSession.h`,
  101. `${iosDestPath}/JitsiAudioSession.h`
  102. );
  103. fs.copyFileSync(
  104. `${iosSrcPath}/JitsiAudioSession+Private.h`,
  105. `${iosDestPath}/JitsiAudioSession+Private.h`
  106. );
  107. fs.copyFileSync(
  108. `${iosSrcPath}/LocaleDetector.m`,
  109. `${iosDestPath}/LocaleDetector.m`
  110. );
  111. fs.copyFileSync(
  112. `${iosSrcPath}/POSIX.m`,
  113. `${iosDestPath}/POSIX.m`
  114. );
  115. fs.copyFileSync(
  116. `${iosSrcPath}/Proximity.m`,
  117. `${iosDestPath}/Proximity.m`
  118. );
  119. copyFolderRecursiveSync(
  120. `${androidSourcePath}/log`,
  121. `${androidTargetPath}/log`
  122. );
  123. copyFolderRecursiveSync(
  124. `${androidMainSourcePath}/values`,
  125. `${androidMainTargetPath}`
  126. );
  127. copyFolderRecursiveSync(
  128. `${androidMainSourcePath}/drawable-hdpi`,
  129. `${androidMainTargetPath}`
  130. );
  131. copyFolderRecursiveSync(
  132. `${androidMainSourcePath}/drawable-mdpi`,
  133. `${androidMainTargetPath}`
  134. );
  135. copyFolderRecursiveSync(
  136. `${androidMainSourcePath}/drawable-xhdpi`,
  137. `${androidMainTargetPath}`
  138. );
  139. copyFolderRecursiveSync(
  140. `${androidMainSourcePath}/drawable-xxhdpi`,
  141. `${androidMainTargetPath}`
  142. );
  143. copyFolderRecursiveSync(
  144. `${androidMainSourcePath}/drawable-xxxhdpi`,
  145. `${androidMainTargetPath}`
  146. );
  147. copyFolderRecursiveSync(
  148. `${androidSourcePath}/net`,
  149. `${androidTargetPath}/log`
  150. );
  151. fs.copyFileSync(
  152. `${androidSourcePath}/AndroidSettingsModule.java`,
  153. `${androidTargetPath}/AndroidSettingsModule.java`
  154. );
  155. fs.copyFileSync(
  156. `${androidSourcePath}/AppInfoModule.java`,
  157. `${androidTargetPath}/AppInfoModule.java`
  158. );
  159. fs.copyFileSync(
  160. `${androidSourcePath}/AudioDeviceHandlerConnectionService.java`,
  161. `${androidTargetPath}/AudioDeviceHandlerConnectionService.java`
  162. );
  163. fs.copyFileSync(
  164. `${androidSourcePath}/AudioDeviceHandlerGeneric.java`,
  165. `${androidTargetPath}/AudioDeviceHandlerGeneric.java`
  166. );
  167. fs.copyFileSync(
  168. `${androidSourcePath}/AudioModeModule.java`,
  169. `${androidTargetPath}/AudioModeModule.java`
  170. );
  171. fs.copyFileSync(
  172. `${androidSourcePath}/ConnectionService.java`,
  173. `${androidTargetPath}/ConnectionService.java`
  174. );
  175. fs.copyFileSync(
  176. `${androidSourcePath}/JavaScriptSandboxModule.java`,
  177. `${androidTargetPath}/JavaScriptSandboxModule.java`
  178. );
  179. fs.copyFileSync(
  180. `${androidSourcePath}/LocaleDetector.java`,
  181. `${androidTargetPath}/LocaleDetector.java`
  182. );
  183. fs.copyFileSync(
  184. `${androidSourcePath}/LogBridgeModule.java`,
  185. `${androidTargetPath}/LogBridgeModule.java`
  186. );
  187. fs.copyFileSync(
  188. `${androidSourcePath}/PictureInPictureModule.java`,
  189. `${androidTargetPath}/PictureInPictureModule.java`
  190. );
  191. fs.copyFileSync(
  192. `${androidSourcePath}/ProximityModule.java`,
  193. `${androidTargetPath}/ProximityModule.java`
  194. );
  195. fs.copyFileSync(
  196. `${androidSourcePath}/RNConnectionService.java`,
  197. `${androidTargetPath}/RNConnectionService.java`
  198. );