My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

generate_version 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env bash
  2. #
  3. # generate_version
  4. #
  5. # Make a _Version.h file
  6. #
  7. DIR=${1:-"Marlin/src/inc"}
  8. # MRCC3=$( git merge-base HEAD upstream/bugfix-2.0.x 2>/dev/null )
  9. # MRCC2=$( git merge-base HEAD upstream/bugfix-1.1.x 2>/dev/null )
  10. # MRCC1=$( git merge-base HEAD upstream/1.1.x 2>/dev/null )
  11. # BASE='?'
  12. # if [[ -n $MRCC3 && $MRCC3 != $MRCC2 ]]; then
  13. # BASE=bugfix-2.0.x
  14. # elif [[ -n $MRCC2 ]]; then
  15. # BASE=bugfix-1.1.x
  16. # elif [[ -n $MRCC1 ]]; then
  17. # BASE=1.1.x
  18. # fi
  19. BUILDATE=$(date '+%s')
  20. DISTDATE=$(date '+%Y-%m-%d %H:%M')
  21. BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
  22. VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
  23. [ -z "${BRANCH}" ] && BRANCH=$(echo "${TRAVIS_BRANCH}")
  24. [ -z "${VERSION}" ] && VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
  25. SHORT_BUILD_VERSION=$(echo "${BRANCH}")
  26. DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
  27. # Gets some misc options from their defaults
  28. DEFAULT_MACHINE_UUID=$(awk -F'"' \
  29. '/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${DIR}/Version.h")
  30. MACHINE_NAME=$(awk -F'"' \
  31. '/#define MACHINE_NAME/{ print $2 }' < "${DIR}/Version.h")
  32. PROTOCOL_VERSION=$(awk -F'"' \
  33. '/#define PROTOCOL_VERSION/{ print $2 }' < "${DIR}/Version.h")
  34. SOURCE_CODE_URL=$(awk -F'"' \
  35. '/#define SOURCE_CODE_URL/{ print $2 }' < "${DIR}/Version.h")
  36. WEBSITE_URL=$(awk -F'"' \
  37. '/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
  38. cat > "${DIR}/_Version.h" <<EOF
  39. /**
  40. * THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
  41. * IT DOES NOT GET COMMITTED TO THE REPOSITORY.
  42. *
  43. * Branch: ${BRANCH}
  44. * Version: ${VERSION}
  45. */
  46. #define BUILD_UNIX_DATETIME "${BUILDATE}"
  47. #define STRING_DISTRIBUTION_DATE "${DISTDATE}"
  48. #define SHORT_BUILD_VERSION "${SHORT_BUILD_VERSION}"
  49. #define DETAILED_BUILD_VERSION "${DETAILED_BUILD_VERSION}"
  50. #define PROTOCOL_VERSION "${PROTOCOL_VERSION}"
  51. #define MACHINE_NAME "${MACHINE_NAME}"
  52. #define SOURCE_CODE_URL "${SOURCE_CODE_URL}"
  53. #define DEFAULT_MACHINE_UUID "${DEFAULT_MACHINE_UUID}"
  54. #define WEBSITE_URL "${WEBSITE_URL}"
  55. EOF