Explorar el Código

Script to download & build Configurations (#20992)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
X-Ryl669 hace 3 años
padre
commit
d86910ce94
No account linked to committer's email address
Se han modificado 3 ficheros con 97 adiciones y 0 borrados
  1. 62
    0
      buildroot/bin/build_all_examples
  2. 35
    0
      buildroot/bin/build_example
  3. 0
    0
      buildroot/bin/mftest

+ 62
- 0
buildroot/bin/build_all_examples Ver fichero

@@ -0,0 +1,62 @@
1
+#!/usr/bin/env bash
2
+
3
+echo "This script will attempt to build Marlin for all known configurations."
4
+echo "In case of failure, the current configuration remains in your repository."
5
+echo "To revert to your current version, run 'git checkout -f'."
6
+
7
+self=`basename "$0"`
8
+HERE=`dirname "$0"`
9
+
10
+# Check dependencies
11
+which curl 1>/dev/null 2>&1 || { echo "curl not found, please install it"; exit ; }
12
+which git 1>/dev/null 2>&1 || { echo "git not found, please install it"; exit ; }
13
+if [ -z "$1" ]; then
14
+  echo ""
15
+  echo "ERROR: "
16
+  echo "  Expected parameter: $self base_branch [resume_point]"
17
+  echo "  with:"
18
+  echo "         base_branch              The branch in the Configuration repository to use"
19
+  echo "         resume_point             If not empty, resume building from this board"
20
+
21
+  exit
22
+fi
23
+
24
+# Check if called in the right folder
25
+if [ ! -e "Marlin/src" ]; then
26
+  echo "This script must be called from the root folder of a Marlin repository, please navigate to this folder and call:"
27
+  echo "buildroot/ci-check/$self $1"
28
+  exit
29
+fi
30
+
31
+# Check if the current repository has unmerged changes
32
+if [ -z "$2" ]; then
33
+  git diff --quiet || { echo "Your current repository is not clean. Either commit your change or stash them, and re-run this script"; exit ; }
34
+else
35
+  echo "Resuming from $2"
36
+fi
37
+
38
+TMPDIR=`mktemp -d`
39
+
40
+# Ok, let's do our stuff now
41
+# First extract the current temporary folder
42
+echo "Fetching configuration repository"
43
+if [ ! -e "$TMPDIR/README.md" ]; then
44
+  git clone --single-branch --branch "$1" https://github.com/MarlinFirmware/Configurations.git "$TMPDIR" || { echo "Failed to clone the configuration repository"; exit ; }
45
+  rm -r $TMPDIR/.git
46
+fi
47
+
48
+echo
49
+echo "Start building now..."
50
+echo "====================="
51
+shopt -s nullglob
52
+for config in $TMPDIR/config/examples/*/; do
53
+  [ -d "${config}" ] || continue
54
+  base=`basename "$config"`
55
+  if [ ! -z "$2" ] && [ "$2" != "$base" ]; then
56
+    echo "Skipping $base..."
57
+    continue
58
+  fi
59
+  "$HERE/build_example" "internal" "$TMPDIR" "$base" || { echo "Failed to build $base"; exit ; }
60
+done
61
+
62
+rm -r "$TMPDIR"

+ 35
- 0
buildroot/bin/build_example Ver fichero

@@ -0,0 +1,35 @@
1
+#!/usr/bin/env bash
2
+
3
+if [ "$1" != "internal" ]; then
4
+  echo "Don't call this script directly, use build_all_examples instead."
5
+  exit 1
6
+fi
7
+
8
+SED=$(which gsed || which sed)
9
+HERE=`dirname "$0"`
10
+
11
+echo "Testing $3:"
12
+
13
+shopt -s nullglob
14
+for sub in find $2/config/examples/$3 -type d; do
15
+  [[ -d $sub ]] || continue
16
+  base=`basename "$sub"`
17
+
18
+  if [[ ! -f $sub/Configuration.h ]] && [[ ! -f $sub/Configuration_adv.h ]]; then
19
+    echo "No configuration files found in $sub"
20
+    continue
21
+  fi
22
+
23
+  echo "Getting configuration files from $sub"
24
+  cp "$2/config/default"/*.h    Marlin/
25
+  cp "$sub"/Configuration.h     Marlin/ 2>/dev/null
26
+  cp "$sub"/Configuration_adv.h Marlin/ 2>/dev/null
27
+  cp "$sub"/_Bootscreen.h       Marlin/ 2>/dev/null
28
+  cp "$sub"/_Statusscreen.h     Marlin/ 2>/dev/null
29
+
30
+  echo "Building the firmware now..."
31
+  echo "$HERE/mftest" -a || exit 1
32
+done
33
+
34
+echo "Success"
35
+exit 0

buildroot/share/git/mftest → buildroot/bin/mftest Ver fichero


Loading…
Cancelar
Guardar