move-artifacts.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
  3. BUILD_TYPE="win"
  4. elif [ "`uname`" == "Darwin" ]; then
  5. if [ -z "$MAS_BUILD" ]; then
  6. BUILD_TYPE="darwin"
  7. else
  8. BUILD_TYPE="mas"
  9. fi
  10. elif [ "`uname`" == "Linux" ]; then
  11. BUILD_TYPE="linux"
  12. else
  13. echo "Unsupported platform"
  14. exit 1
  15. fi
  16. GENERATED_ARTIFACTS="generated_artifacts_${BUILD_TYPE}_${TARGET_ARCH}"
  17. echo Creating $GENERATED_ARTIFACTS...
  18. rm -rf $GENERATED_ARTIFACTS
  19. mkdir $GENERATED_ARTIFACTS
  20. SRC_ARTIFACTS="src_artifacts_${BUILD_TYPE}_${TARGET_ARCH}"
  21. echo Creating $SRC_ARTIFACTS...
  22. rm -rf $SRC_ARTIFACTS
  23. mkdir $SRC_ARTIFACTS
  24. mv_if_exist() {
  25. if [ -f "$1" ] || [ -d "$1" ]; then
  26. echo Storing $1
  27. mv $1 $GENERATED_ARTIFACTS
  28. else
  29. echo Skipping $1 - It is not present on disk
  30. fi
  31. }
  32. cp_if_exist() {
  33. if [ -f "$1" ] || [ -d "$1" ]; then
  34. echo Storing $1
  35. cp $1 $GENERATED_ARTIFACTS
  36. else
  37. echo Skipping $1 - It is not present on disk
  38. fi
  39. }
  40. move_src_dirs_if_exist() {
  41. mkdir src_artifacts
  42. dirs=("src/out/Default/gen/node_headers" \
  43. "src/out/Default/overlapped-checker" \
  44. "src/out/Default/ffmpeg" \
  45. "src/out/Default/hunspell_dictionaries" \
  46. "src/third_party/electron_node" \
  47. "src/third_party/nan" \
  48. "src/cross-arch-snapshots" \
  49. "src/buildtools/mac" \
  50. "src/buildtools/third_party/libc++" \
  51. "src/buildtools/third_party/libc++abi" \
  52. "src/third_party/libc++" \
  53. "src/third_party/libc++abi" \
  54. "src/out/Default/obj/buildtools/third_party" \
  55. "src/v8/tools/builtins-pgo")
  56. # Only do this for linux build type, this folder
  57. # exists for windows builds on linux hosts but we do
  58. # not need it
  59. if [ "$BUILD_TYPE" == "linux" ]; then
  60. dirs+=('src/build/linux')
  61. fi
  62. # llvm-build is the host toolchain, for windows we need
  63. # a different toolchain so no point copying this one
  64. if [ "$BUILD_TYPE" != "win" ]; then
  65. dirs+=('src/third_party/llvm-build')
  66. fi
  67. # On windows we should clean up two symlinks that aren't
  68. # compatible with the windows test runner
  69. if [ "$BUILD_TYPE" == "win" ]; then
  70. rm -f src/third_party/electron_node/tools/node_modules/eslint/node_modules/eslint
  71. rm -f src/third_party/electron_node/tools/node_modules/eslint/node_modules/.bin/eslint
  72. rm -f src/third_party/electron_node/out/tools/bin/python
  73. # Also need to copy electron.lib to node.lib for native module testing purposes
  74. mkdir -p src/out/Default/gen/node_headers/Release
  75. cp src/out/Default/electron.lib src/out/Default/gen/node_headers/Release/node.lib
  76. fi
  77. for dir in "${dirs[@]}"
  78. do
  79. if [ -d "$dir" ]; then
  80. mkdir -p src_artifacts/$(dirname $dir)
  81. cp -r $dir/ src_artifacts/$dir
  82. fi
  83. done
  84. tar -C src_artifacts -cf src_artifacts.tar .
  85. echo Storing src_artifacts.tar
  86. mv src_artifacts.tar $SRC_ARTIFACTS
  87. }
  88. # Generated Artifacts
  89. mv_if_exist src/out/Default/dist.zip
  90. mv_if_exist src/out/Default/gen/node_headers.tar.gz
  91. mv_if_exist src/out/Default/symbols.zip
  92. mv_if_exist src/out/Default/mksnapshot.zip
  93. mv_if_exist src/out/Default/chromedriver.zip
  94. mv_if_exist src/out/ffmpeg/ffmpeg.zip
  95. mv_if_exist src/out/Default/hunspell_dictionaries.zip
  96. mv_if_exist src/cross-arch-snapshots
  97. cp_if_exist src/out/electron_ninja_log
  98. cp_if_exist src/out/Default/.ninja_log
  99. move_src_dirs_if_exist