You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.2KB

  1. import glob
  2. import json
  3. import time
  4. import os
  5. def build_mac(slug):
  6. env = f'CC=x86_64-apple-darwin15-clang CXX=x86_64-apple-darwin15-clang++-libc++ STRIP=x86_64-apple-darwin15-strip RACK_DIR=../../Rack-SDK'
  7. make = f'{env} make -j$(nproc) -C repos/{slug}'
  8. if os.system(f'{make} clean'):
  9. raise Exception(f"Could not clean Mac build of {slug}")
  10. if os.system(f'{make} dist'):
  11. raise Exception(f"Could not make Mac build of {slug}")
  12. def build_win(slug):
  13. env = f'CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ STRIP=x86_64-w64-mingw32-strip RACK_DIR=../../Rack-SDK'
  14. make = f'{env} make -j$(nproc) -C repos/{slug}'
  15. if os.system(f'{make} clean'):
  16. raise Exception(f"Could not clean Windows build of {slug}")
  17. if os.system(f'{make} dist'):
  18. raise Exception(f"Could not make Windows build of {slug}")
  19. def build_lin(slug):
  20. env = f'-e RACK_DIR=../../Rack-SDK'
  21. make = f'make -j$(nproc) -C repos/{slug}'
  22. if os.system(f'docker run --rm -v $(pwd):/mnt -u vortico {env} a0b9c87ec456 {make} clean'):
  23. raise Exception(f"Could not clean Linux build of {slug}")
  24. if os.system(f'docker run --rm -v $(pwd):/mnt -u vortico {env} a0b9c87ec456 {make} dist'):
  25. raise Exception(f"Could not make Linux build of {slug}")
  26. def move_package(slug):
  27. os.system('mkdir -p downloads')
  28. if os.system(f'mv repos/{slug}/dist/{slug}-*.zip downloads/'):
  29. raise Exception(f"No package found for {slug}")
  30. for filename in glob.glob("manifests/*"):
  31. slug = os.path.splitext(os.path.basename(filename))[0]
  32. with open(filename, "r") as f:
  33. manifest = json.load(f)
  34. # Skip if update is not needed
  35. if 'repoVersion' not in manifest:
  36. continue
  37. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  38. continue
  39. if not os.path.exists('repos/' + slug):
  40. continue
  41. try:
  42. build_mac(slug)
  43. move_package(slug)
  44. build_win(slug)
  45. move_package(slug)
  46. build_lin(slug)
  47. move_package(slug)
  48. except Exception as e:
  49. print(e)
  50. input("Enter to proceed")
  51. continue
  52. # Update build information
  53. manifest['latestVersion'] = manifest['repoVersion']
  54. manifest['buildTimestamp'] = round(time.time())
  55. manifest['status'] = "available"
  56. with open(filename, "w") as f:
  57. json.dump(manifest, f, indent=" ")