on-create-command.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. set -eo pipefail
  3. buildtools=$HOME/.electron_build_tools
  4. gclient_root=/workspaces/gclient
  5. buildtools_configs=/workspaces/buildtools-configs
  6. export PATH="$PATH:$buildtools/src"
  7. # Create the persisted buildtools config folder
  8. mkdir -p $buildtools_configs
  9. mkdir -p $gclient_root/.git-cache
  10. rm -f $buildtools/configs
  11. ln -s $buildtools_configs $buildtools/configs
  12. # Write the gclient config if it does not already exist
  13. if [ ! -f $gclient_root/.gclient ]; then
  14. echo "Creating gclient config"
  15. echo "solutions = [
  16. { \"name\" : \"src/electron\",
  17. \"url\" : \"https://github.com/electron/electron\",
  18. \"deps_file\" : \"DEPS\",
  19. \"managed\" : False,
  20. \"custom_deps\" : {
  21. },
  22. \"custom_vars\": {},
  23. },
  24. ]
  25. " >$gclient_root/.gclient
  26. fi
  27. # Write the default buildtools config file if it does
  28. # not already exist
  29. if [ ! -f $buildtools/configs/evm.testing.json ]; then
  30. echo "Creating build-tools testing config"
  31. write_config() {
  32. echo "
  33. {
  34. \"root\": \"/workspaces/gclient\",
  35. \"remotes\": {
  36. \"electron\": {
  37. \"origin\": \"https://github.com/electron/electron.git\"
  38. }
  39. },
  40. \"gen\": {
  41. \"args\": [
  42. \"import(\\\"//electron/build/args/testing.gn\\\")\",
  43. \"use_remoteexec = true\"
  44. ],
  45. \"out\": \"Testing\"
  46. },
  47. \"env\": {
  48. \"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
  49. \"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
  50. },
  51. \"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\",
  52. \"configValidationLevel\": \"strict\",
  53. \"reclient\": \"$1\",
  54. \"preserveXcode\": 5
  55. }
  56. " >$buildtools/configs/evm.testing.json
  57. }
  58. write_config remote_exec
  59. e use testing
  60. else
  61. echo "build-tools testing config already exists"
  62. fi