
    7j                        d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
Z
ddlmZ ddlmZmZmZ dd	lmZmZ dd
lmZmZ ddlmZ dee   dededededefdZ e	j8                  dddd       e	j8                  ddddd       e	j8                  ddedd !       e	j8                  d"d#ddd$       e	j8                  d%d&ddd'       e	j8                  d(d)ddd*       e	j8                  d+d,dd-g d./       e	j8                  d0d1ed2d3!       e	j8                  d4d5dd-g d6/       e	j<                  d7e	j>                  j@                  jB                  rd8nd9      d:                                                                       Z"y);zXCompile all keyboards.

This will compile everything in parallel, for testing purposes.
    N)ListPath)DEVNULL)cli)QMK_FIRMWARE)	find_makeget_make_parallel_argsbuild_environment)search_keymap_targetssearch_make_targets)BuildTargetJsonKeymapBuildTarget)maybe_exit_configtargetscleandry_runno_tempparallelprint_failuresc                    t        |       dk(  ry t        j                  j                  dd       t	               }t        t              dz  }|dz  }	|rt        j                  j                  d       t        | d       D ]  }
d	j                  |
j                  j                         D cg c]"  \  }}d
t        j                  | d|        $ c}}      }t        j                  j                  d|
j                    d|
j"                   d	| d        y |rt        j$                  |dgdt&               |j)                  dd       t+        |	d      5 }|j-                  d       |r'|j-                  dt        j.                          d       t        | d       D ]  }
|
j                   }|
j"                  }|j1                  dd      } |
j2                  d>i |}|
j5                  d        |
j6                  d>i |  |
j8                  d>i |}d|d<   dj                  |
j                  j                         D cg c]  \  }}| d|  c}}      }t         dt        j.                          d| d| }t         d t        j.                          d| d| }d!}t        |      dkD  r|d| z  }|d| z  }d| }|j-                  d!j                  g d"| | d#| | d$| | d%| d&| d'| d(| d)d	j                  |       d*| d+| d,| d-| d.| d'| d/| d0| d'| d1| d'| d2| d3             |r0|j-                  d4t         d5| d6t         d5| d7t         d8| d3       |j-                  d9       
 	 d d d        t        j$                  t	               gt;        |      d:|	j=                         d;dt&               |j?                  d<t        j.                          d=      D cg c]  }| }}t        |      dkD  ryy c c}}w c c}}w # 1 sw Y   xY wc c}w )?Nr   SKIP_SCHEMA_VALIDATION1z.buildzparallel_kb_builds.mkzCompilation targets:c                 2    | j                   | j                  fS Nkeyboardkeymapts    M/home/hanthebot/chat/keyboard/qmk_firmware/lib/python/qmk/cli/mass_compile.py<lambda>z&mass_compile_targets.<locals>.<lambda>   s    QZZ4J     )key z-e =z{fg_cyan}qmk compile -kb z -km z
{fg_reset}r   F)capture_outputstdinT)parentsexist_okwz# This file is auto-generated by qmk mass-compile
# Do not edit this file directly.
all: print_failures
.PHONY: all_targets print_failures
print_failures: all_targets
z#	@for f in $$(ls .build/failed.log.aE  .* 2>/dev/null | sort); do \
		echo; \
		echo "======================================================================================"; \
		echo "Failed build log: $$f"; \
		echo "------------------------------------------------------"; \
		cat $$f; \
		echo "------------------------------------------------------"; \
	done
c                 2    | j                   | j                  fS r   r   r   s    r!   r"   z&mass_compile_targets.<locals>.<lambda>@   s    QXX8N r#   /_   )r   z	+@$(MAKE)z/.build/build.log..z/.build/failed.log. z.PHONY: z_binary
all_targets: z_binary
z_binary:
	@rm -f "z6" || true
	@echo "Compiling QMK Firmware for target: ':z	'..." >>"z"
	z \
		>>"z" 2>&1 \
		|| cp "z" "z"
	@{ grep '\[ERRORS\]' "zC" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\n" "z$" ; } \
		|| { grep '\[WARNINGS\]' "zE" >/dev/null 2>&1 && printf "Build %-64s \e[1;33m[WARNINGS]\e[0m\n" "z7" ; } \
		|| printf "Build %-64s \e[1;32m[OK]\e[0m\n" "z"
	@rm -f "z
" || true
z
	@rm -rf "z/.build/z$.elf" 2>/dev/null || true
	@rm -rf "z$.map" 2>/dev/null || true
	@rm -rf "z/.build/obj_
-fallzfailed.log.z.* ) lenosenviron
setdefaultr	   r   r   r   loginfosortedjoin
extra_argsitemsshlexquoter   r   runr   mkdiropenwritegetpidreplacetarget_name	configureprepare_buildcompile_commandr
   as_posixglob)r   r   r   r   r   r   envmake_cmdbuilddirmakefiletargetkvr?   fkeyboard_namekeymap_namekeyboard_safetarget_filenamecommand	build_log
failed_logtarget_suffixfailuress                           r!   mass_compile_targetsr`      s   
7|qJJ2C8{HL!H,H11H+,W*JK 	wFvO`O`OfOfOh"itq!Ss!A3Z)@(A#B"ijJGGLL6v6GuV]]O[\]g\hhtuv	w GGXw'WMtd3(C  G	AGG $$&IIK= 1	 !.NO . &$mm - 5 5c3 ?"4&"4"4";s";  ! ,$$$+s+0&00737(
 XXf>O>O>U>U>W&Xda!AaSz&XY
+n,>ryy{m1]O[\]h\ij	 ,~-@Q}o]^_j^kl
 "z?Q&1ZL!11IAj\"22J&'
|$4M  	 	'),o.    !
 	-	
 .;O
 <=
 >IM
 JS
 T]R]
^ ((7 [
   #|$ %+ &l mzkz {| }H  |II  !*{ +s tA  sB BC DO  CPP3 4A/ BC DO-P
 $ GG. 1 2. 1 2._$5 6 ].3G	R 	b5h?bbxGXGXGZb\absx  AH  	I  (}}{299;-r-JKL!ALLx=1 i #jR 'YEG	 G	X Ms,   +'P>C,Q
QEQ
#	QQ

Qbuilds*Tz}List of builds in form <keyboard>:<keymap> to compile in parallel. Specifying this overrides all other target search options.)nargsarg_onlyhelpz-tz	--no-temp
store_truez$Remove temporary files during build.)rd   actionre   z-jz
--parallelr/   z8Set the number of parallel make jobs; 0 means unlimited.)typedefaultre   z-cz--cleanz%Remove object files before compiling.z-nz	--dry-runz7Don't actually build, just show the commands to be run.z-pz--print-failureszPrint failed builds.r4   z--filterappenda  Filter the list of keyboards based on the supplied value in rules.mk. Matches info.json structure, and accepts the formats 'features.rgblight=true' or 'exists(matrix_pins.direct)'. May be passed multiple times, all filters need to match. Value may include wildcards such as '*' and '?'.)rd   rg   ri   re   z-kmz--keymapri   z/The keymap name to build. Default is 'default'.z-ez--envzBSet a variable to be passed to make. May be passed multiple times.z'Compile QMK Firmware for all keyboards.F)hiddenc                 r   t        dd       t        | j                  j                        dkD  rt	        t        d | j                  j                        D cg c]  }t        |       c}      t	        t        fd| j                  j                              }t        |      }|j                  D cg c]  }t        |       c}       nAt        d| j                  j                  j                  fg| j                  j
                        }t        || j                  j                  | j                  j                   | j                  j"                  | j                  j                  j$                  | j                  j&                  fi t)        | j                  j*                        S c c}w c c}w )z0Compile QMK Firmware against all keyboards.
    FT)should_exitshould_reraiser   c                 h    t        |       j                         xr t        |       j                  dk(  S )Nz.json)r   existssuffix)es    r!   r"   zmass_compile.<locals>.<lambda>   s)    DGNNDTDrY]^_Y`YgYgkrYr r#   c                     t        |       vS r   r   )rr   json_like_targetss    r!   r"   zmass_compile.<locals>.<lambda>   s    $q'AR2R r#   r5   )r   r7   argsra   listfilterr   r   extendr   r   configmass_compiler   r`   r   r   r   r   r   r   rO   )r   pmake_like_targetsr   rr   rt   s        @r!   rz   rz   x   s   * %=
388??a 6:rtwt|t|  uD  uD  4E  "Fa$q'  "F  G (RTWT\T\TcTc!de%&78:KLQ-a0LM'%1H1H1O1O)P(QSVS[S[SbSbc9I9I388K[K[]`]g]g]t]t]}]}  @C  @H  @H  @W  @W  {  [l  mp  mu  mu  my  my  [z  {  { "F Ms   F/8F4)#__doc__r8   typingr   pathlibr   
subprocessr   milcr   rA   qmk.constantsr   qmk.commandsr	   r
   r   
qmk.searchr   r   qmk.build_targetsr   r   qmk.utilr   boolintr`   argumentstr
subcommandry   user	developerrz   r6   r#   r!   <module>r      s   
      & M M A @ &b${"3 bD b4 bZ^ bjm b  @D bJ hcD  8w  xdK$|JpqdLsA<vwdI\HopdK$|  KD  Ed&lQgh e eZc9CtudGd8R  OS  T93::??KdKd%jno{ p T v i E q x r x${r#   