Bläddra i källkod

🔨 Update build/CI scripts

Scott Lahteine 2 år sedan
förälder
incheckning
d816c1b38d
3 ändrade filer med 33 tillägg och 25 borttagningar
  1. 24
    22
      buildroot/bin/build_all_examples
  2. 8
    3
      buildroot/bin/restore_configs
  3. 1
    0
      buildroot/bin/use_example_configs

+ 24
- 22
buildroot/bin/build_all_examples Visa fil

@@ -2,14 +2,14 @@
2 2
 #
3 3
 # Usage:
4 4
 #
5
-#  build_all_examples [-b|--branch=<branch>]
6
-#                     [-c|--continue]
7
-#                     [-d|--debug]
8
-#                     [-i|--ini]
9
-#                     [-l|--limit=#]
10
-#                     [-n|--nobuild]
11
-#                     [-r|--resume=<path>]
12
-#                     [-s|--skip]
5
+#  build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
6
+#                     [-c|--continue]        - Continue the paused build
7
+#                     [-d|--debug]           - Print extra debug output
8
+#                     [-i|--ini]             - Archive ini/json/yml files in the temp config folder
9
+#                     [-l|--limit=#]         - Limit the number of builds in this run
10
+#                     [-n|--nobuild]         - Don't actually build anything.
11
+#                     [-r|--resume=<path>]   - Start at some config in the filesystem order
12
+#                     [-s|--skip]            - Do the thing
13 13
 #
14 14
 # build_all_examples [...] branch [resume-from]
15 15
 #
@@ -40,7 +40,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
40 40
     r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
41 41
     c) CONTINUE=1           ; bugout "Continue" ;;
42 42
     s) CONTSKIP=1           ; bugout "Continue, skipping" ;;
43
-    i) CREATE_INI=1         ; bugout "Generate an INI file" ;;
43
+    i) COPY_INI=1           ; bugout "Archive INI/JSON/YML files" ;;
44 44
     h) EXIT_USAGE=1 ; break ;;
45 45
     l) LIMIT=$OPTARG        ; bugout "Limit to $LIMIT build(s)" ;;
46 46
   d|v) DEBUG=1              ; bugout "Debug ON" ;;
@@ -52,7 +52,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
52 52
      continue) CONTINUE=1   ; bugout "Continue" ;;
53 53
          skip) CONTSKIP=2   ; bugout "Continue, skipping" ;;
54 54
         limit) LIMIT=$OVAL  ; bugout "Limit to $LIMIT build(s)" ;;
55
-          ini) CREATE_INI=1 ; bugout "Generate an INI file" ;;
55
+          ini) COPY_INI=1   ; bugout "Archive INI/JSON/YML files" ;;
56 56
          help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
57 57
         debug) DEBUG=1      ; bugout "Debug ON" ;;
58 58
       nobuild) DRYRUN=1     ; bugout "Dry Run" ;;
@@ -136,19 +136,21 @@ for CONF in $CONF_TREE ; do
136 136
   # ...if skipping, don't build this one
137 137
   compgen -G "${CONF}Con*.h" > /dev/null || continue
138 138
 
139
-  # Remember where we are in case of failure
140
-  echo "${BRANCH}*${DIR}" >"$STAT_FILE"
141
-
142
-  # Build or pretend to build
139
+  # Build or print build command for --nobuild
143 140
   if [[ $DRYRUN ]]; then
144
-    echo "[DRYRUN] build_example internal \"$TMP\" \"$DIR\""
141
+    echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
145 142
   else
146
-    # Build folder is unknown so delete all "config.ini" files
147
-    [[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec rm "{}" \;
148
-    ((DEBUG)) && echo "\"$HERE/build_example\" \"internal\" \"$TMP\" \"$DIR\""
149
-    "$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
150
-    # Build folder is unknown so copy any "config.ini"
151
-    [[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \;
143
+    # Remember where we are in case of failure
144
+    echo "${BRANCH}*${DIR}" >"$STAT_FILE"
145
+    # Build folder is unknown so delete all report files
146
+    if [[ $COPY_INI ]]; then
147
+      IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
148
+      $IFIND -exec rm "{}" \;
149
+    fi
150
+    ((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\""
151
+    "$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
152
+    # Build folder is unknown so copy all report files
153
+    [[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \;
152 154
   fi
153 155
 
154 156
   ((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
@@ -160,7 +162,7 @@ done
160 162
 
161 163
 # Delete the temp folder if not preserving generated INI files
162 164
 if [[ -e "$TMP/config/examples" ]]; then
163
-  if [[ $CREATE_INI ]]; then
165
+  if [[ $COPY_INI ]]; then
164 166
     OPEN=$( which gnome-open xdg-open open | head -n1 )
165 167
     $OPEN "$TMP"
166 168
   elif [[ ! $PAUSE ]]; then

+ 8
- 3
buildroot/bin/restore_configs Visa fil

@@ -1,6 +1,11 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
-git checkout Marlin/Configuration.h 2>/dev/null
4
-git checkout Marlin/Configuration_adv.h 2>/dev/null
5
-git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
6 3
 rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip
4
+
5
+if [[ $1 == '-d' || $1 == '--default' ]]; then
6
+  use_example_configs
7
+else
8
+  git checkout Marlin/Configuration.h 2>/dev/null
9
+  git checkout Marlin/Configuration_adv.h 2>/dev/null
10
+  git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
11
+fi

+ 1
- 0
buildroot/bin/use_example_configs Visa fil

@@ -3,6 +3,7 @@
3 3
 # use_example_configs [repo:]configpath
4 4
 #
5 5
 # Examples:
6
+#   use_example_configs
6 7
 #   use_example_configs Creality/CR-10/CrealityV1
7 8
 #   use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
8 9
 #

Laddar…
Avbryt
Spara