HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991111/cwd/usr/lib/python3/dist-packages/gyp/generator/__pycache__/
Upload File :
Current File : //proc/1991111/cwd/usr/lib/python3/dist-packages/gyp/generator/__pycache__/msvs.cpython-311.pyc
�

�"Kb����ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlZddl
mZddlmcmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ej#d��Z$idd�d	d
�dd�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d'd(��Z%d)d*gZ&gd+�Z'da(d,d-gZ)da*da+d.�Z,da-d/�Z.d0�Z/d1�Z0		d�d3�Z1d�d5�Z2d�d6�Z3d7�Z4d8�Z5d9�Z6d:�Z7d;�Z8d<�Z9d=�Z:d>�Z;d?�Z<d@�Z=dA�Z>dB�Z?dC�Z@dD�ZAdE�ZBdF�ZCdG�ZDej#dH��ZEdI�ZFej#dJ��ZGdK�ZHdL�ZIej#dM��ZJdN�ZKdO�ZLdP�ZMdQ�ZNdR�ZOdS�ZPdT�ZQdU�ZRdV�ZSdW�ZTdX�ZUdY�ZVdZ�ZWd[�ZXd\�ZYd]�ZZd^�Z[d_�Z\d`�Z]da�Z^db�Z_dc�Z`dd�Zade�Zbdf�Zcdg�Zddh�Zedi�Zfdj�Zgdk�Zhdl�Zidm�Zjdn�Zkdo�Zldp�Zmdq�Zndr�Zods�Zpdt�Zqdu�Zrdv�Zsdw�Ztdx�Zudy�Zvdz�Zwd{�Zxd|�Zyd}�Zzd~�Z{d�Z|d��Z}d��Z~d��Zd��Z�d��Z�d��Z�Gd��d�e���Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�ej#d���Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�dS)��)�print_functionN)�collections_abc)�GypError)�
OrderedSetz
^[A-F0-9\-]+$�
DRIVER_PREFIX��
DRIVER_SUFFIX�.sys�EXECUTABLE_PREFIX�EXECUTABLE_SUFFIX�.exe�STATIC_LIB_PREFIX�SHARED_LIB_PREFIX�STATIC_LIB_SUFFIX�.lib�SHARED_LIB_SUFFIX�.dll�INTERMEDIATE_DIR�	$(IntDir)�SHARED_INTERMEDIATE_DIRz $(OutDir)obj/global_intermediate�OS�win�PRODUCT_DIR�	$(OutDir)�LIB_DIRz$(OutDir)lib�RULE_INPUT_ROOT�$(InputName)�RULE_INPUT_DIRNAME�$(InputDir)�RULE_INPUT_EXT�$(InputExt)�RULE_INPUT_NAME�$(InputFileName)�$(InputPath)z$(ConfigurationName))�RULE_INPUT_PATH�CONFIGURATION_NAME�msvs_cygwin_dirs�
msvs_props)r'�msvs_cygwin_shell�msvs_large_pdb�
msvs_shard�msvs_external_builder�msvs_external_builder_out_dir�msvs_external_builder_build_cmd�msvs_external_builder_clean_cmd�#msvs_external_builder_clcompile_cmd�msvs_enable_winrt�msvs_requires_importlibrary�msvs_enable_winphone�msvs_application_type_revision�msvs_target_platform_version�msvs_target_platform_minversion�msvs_precompiled_header�msvs_precompiled_sourcec��tjdvrdStrt�stj�d��}tj�d��}|r|s�tjgd�tj	���}|�
��d}tjdtj
��}|�|��}|r|�d	��}tjd
tj
��}|�|��}|r|�d	��}|a|attfS)N)�win32�cygwin)�DOMAIN�USERNAME�
USERDOMAINr=)�net�config�Workstation)�stdoutrz^User name\s+(\S+)�z^Logon domain\s+(\S+))�sys�platform�
cached_domain�cached_username�os�environ�get�
subprocess�Popen�PIPE�communicate�re�compile�	MULTILINE�search�group)�domain�username�callr@�username_re�username_match�	domain_re�domain_matchs        �4/usr/lib/python3/dist-packages/gyp/generator/msvs.py�_GetDomainAndUserNamer\ms0���\�,�,�,�!�!�
��o��
�Z�^�^�L�
)�
)�F��z�~�~�j�)�)�H��'��'�
�
�>�>�>�%/�_�6�6�6�d����!�!�!�$�f��J�4�b�l�C�C�k�"�)�)�&�1�1�n�	�+�!�'�'��*�*���*�5�r�|�D�D�i��%�%�f�-�-�l�	�'��#�#�A�&�&���M��O�
��	)�)�c��tj�|��}|�d��|�d��kr|}|S)z�Normalize the path.

  But not if that gets rid of a variable, as this may expand to something
  larger than one directory.

  Arguments:
      source: The path to be normalize.d

  Returns:
      The normalized path.
  �$)rH�path�normpath�count)�source�
normalizeds  r[�_NormalizedSourcere�sH���w����'�'�*��\�\�#���*�*�*�3�/�/�/�/�
�F�	�-r]c�2�trR|rPtj�|��s1|ddks%tj�t|��}|�dd��}t
|��}|r|ddkr
|dd�}|S)z�Convert paths to a form that will make sense in a vcproj file.

  Arguments:
    path: The path to convert, may contain / etc.
  Returns:
    The path with all slashes made into backslashes.
  rr_�/�\���N)�fixpath_prefixrHr`�isabs�join�replacere�r`s r[�_FixPathro�s����.��.�R�W�]�]�4�%8�%8�.��a��C���
�7�<�<���-�-�D�	
���c�4�	 �	 �$�	�4�	 �	 �$�	��d�2�h�$�������9�D�	
�+r]c��d�|D��S)z"Fix each of the paths of the list.c�,�g|]}t|����S��ro��.0�is  r[�
<listcomp>z_FixPaths.<locals>.<listcomp>�s��	%�	%�	%�!�(�1�+�+�	%�	%�	%r]rr)�pathss r[�	_FixPathsry�s��	%�	%�u�	%�	%�	%�%r]Tc��|sg}g}g}tj��}|D�])}t|��dkrUtd�||z����}	|	|vr|�|	���U|�|	���k|rd|���sP|�|d��sg||d<||d�|dd�����t|dd�g||dgz|||���}
tj
|d|
���}
|�|
����+|r-|r+tj
d|���}|�|��|r|���r|S|D]K}t||||gz|||���}
tj
||
���}
|�|
���L|S)	a�Converts a list split source file paths into a vcproj folder hierarchy.

  Arguments:
    sources: A list of source file paths split.
    prefix: A list of source file path layers meant to apply to each of sources.
    excluded: A set of excluded files.
    msvs_version: A MSVSVersion object.

  Returns:
    A hierarchy of filenames and MSVSProject.Filter objects that matches the
    layout of the source tree.
    For example:
    _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']],
                                     prefix=['joe'])
    -->
    [MSVSProject.Filter('a', contents=['joe\a\bob1.c']),
     MSVSProject.Filter('b', contents=['joe\b\bob2.c'])]
  rCrhrN��excluded�
list_excluded�msvs_version��contents�_excluded_files)�prefixr|r}r~)r�OrderedDict�lenrerl�append�UsesVcxprojrJ� _ConvertSourcesToFilterHierarchy�MSVSProject�Filter)
�sourcesr�r|r}r~�result�excluded_result�folders�s�filenamer��excluded_folder�fs
             r[r�r��s:��(
��"��
�&��/��'�)�)�'����a�
�1�v�v��{�{�"�4�9�9�V�a�Z�#8�#8�9�9�h�	�X�	�	����x�(�(�(�(��
�
�h�����	��l�6�6�8�8���[�[��1��
�
�����!��
�
�a��d�m���1�Q�R�R�5�!�!�!�!�1�1�Q�R�R�5�'�6�Q�q�T�F�?�;C�@M�?K�M�M�M�h��#�A�a�D�8�<�<�<�h��m�m�H������#��#�!�(�):�2A�C�C�C�O�
�M�M�/�"�"�"���l�.�.�0�0���M����a�/���
�6�Q�C�<�9A�>K�=I�K�K�K�H��!�!�h�7�7�7�H�
�M�M�(�����	�-r]Fc�4�|sdSt|||||��dS�N)�_ToolSetOrAppend)�tools�	tool_name�setting�value�
only_if_unsets     r[�_ToolAppendr��s(��	�����5�)�W�e�]�C�C�C�C�Cr]c
� �d|vsd|vr;t|��tkr|�dd��}nd�|D��}|�|��st	��||<||}d|krdS|�|��rz|rdSt||��t
kr*t|��t
kr||xx|z
cc<dSt
d|�d|�d	|�d
t||�������|||<dS)N�Directories�Dependenciesrgrhc�:�g|]}|�dd����S)rgrh�rmrts  r[rwz$_ToolSetOrAppend.<locals>.<listcomp>�s&��3�3�3��q�y�y��d�#�#�3�3�3r]�CompileAsWinRTzAppending "z" to a non-list setting "z" for tool "z"" is not allowed, previous value: )�type�strrmrJ�dict�list�	TypeError)r�r�r�r�r��tools      r[r�r��s9���g����7�!:�!:��E�{�{�c����m�m�C��&�&�e�e�3�3�U�3�3�3�e�	���9�	�	���v�v�E�)��	�y�	�$��� � �
�F�	�X�X�g���
���f�f��D��M���d�"�"�t�E�{�{�d�':�':�
�7�m�m�m�u��m�m�m�m�m��I��e�e�W�W�W�i�i�i��T�'�]�);�);�);�=�
>�
>�>�
�D��M�M�Mr]c�.�|�dd��S)N�msvs_target_version�Windows7�rJ��config_datas r[�_ConfigTargetVersionr�s��	���.�
�	;�	;�;r]c�.�|�dd��S)N�msvs_configuration_platform�Win32r�r�s r[�_ConfigPlatformr�s��	���6��	@�	@�@r]c�l�|�d|z��r|dt|��dz
�S|S)N�_rrC)�endswithr�)�config_name�
platform_names  r[�_ConfigBaseNamer�sC�����#�
�-�.�.���q�#�m�,�,�,�q�0�0�1�1��r]c�J�t|��}t||���d|��S)N�|)r�r�)r�r�r�s   r[�_ConfigFullNamer�s,��!�+�.�.�-�#�K��?�?�?�?���	O�Or]c���|�d��}|r|gn�j}|D]�}dD]�}tj||zd��}|s�tj||zd��pd�d|z}t	�fd�t
j�|��rtj|��ngD��d�	��}|r|d
ccStd�z������dS)N�msvs_windows_sdk_version)z1HKLM\Software\Microsoft\Microsoft SDKs\Windows\%sz=HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s�InstallationFolder�ProductVersionrz
%s\includec�>��g|]}|�����|��Srr)�
startswith)ru�x�versions  �r[rwz7_ConfigWindowsTargetPlatformVersion.<locals>.<listcomp>0s;���0�0�0�A����g�.�.�	0�a�0�0�0r]T)�reverserzCWarning: No include files found for detected Windows SDK version %s)
rJ�compatible_sdks�MSVSVersion�_RegistryGetValue�sortedrHr`�isdir�listdir�print)	r�r��
config_ver�vers�ver�key�sdk_dir�expected_sdk_dir�namess	 `       r[�#_ConfigWindowsTargetPlatformVersionr�#sH������9�:�:�*�#�	@�*����)@�$�
�=�=�c�H�=�=���-�c�C�i�9M�N�N�g�
����-�c�C�i�9I�J�J�P�b�g�$�w�.���0�0�0�0�%'�W�]�]�3C�%D�%D�#*�"�*�-=�">�">�">�')�0�0�0�:>�	?�?�?�e�

�=��Q�x������
�0�3:�<�	=�	=�	=�	=�#=�=�=r]c��d�|D��rd}nd}|�rt|�ddg��d��}|}d�|D��}d�|D��}d	�|D��}|rd
�|D��}d�|D��}d�|��}d}|r|d
z
}|dz
}|�d��dkr|dz
}|�d��dkr|dz
}|�d��dkr|dz
}|r|�d��dkr|dz
}|dz
}|||d�z}||zS|ddkrdg}	n|d�dd��g}	|	�dd��d�|dd�D��}
d �|
D��}
d!�|
D��}
|rd"�|
D��}
|d�|	|
z��zS)#Nc��g|]}d|v�|��	S)rrr)rur�s  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>?s"��+�+�+�A�
��*�*�a�*�*�*r]z_set INPUTDIR=$(InputDir)
if NOT DEFINED INPUTDIR set INPUTDIR=.\
set INPUTDIR=%INPUTDIR:~0,-1%
rr'�.rc�:�g|]}|�dd����S)rz`cygpath -m "${INTDIR}"`r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>M�A��M�M�M�<=��)�)�K�6�8�8�M�M�Mr]c�:�g|]}|�dd����S)rz`cygpath -m "${OUTDIR}"`r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>Or�r]c�:�g|]}|�dd����S)rz`cygpath -m "${INPUTDIR}"`r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>QsA��O�O�O�>?��)�)�M�8�:�:�O�O�Or]c�:�g|]}|�dd����S)r$z`cygpath -m "${INPUTPATH}"`r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>Ts;��)�)�)���I�I�n�;�=�=�)�)�)r]c�@�g|]}d|�dd��z��S)z\"%s\"�"z\\\"r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>Ws+��M�M�M�Q�*�q�y�y��i�8�8�8�M�M�Mr]� z4call "$(ProjectDir)%(cygwin_dir)s\setup_env.bat" && zset CYGWIN=nontsec&& �NUMBER_OF_PROCESSORSz@set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& �INTDIRzset INTDIR=$(IntDir)&& �OUTDIRzset OUTDIR=$(OutDir)&& �	INPUTPATHzset INPUTPATH=$(InputPath) && zbash -c "%(cmd)s")�
cygwin_dir�cmd�catr�rgrhrVc�H�g|]}|dd�dvr|nt|���� S)NrCz/-rsrts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>{s2��H�H�H�1�q��!��u��}�}���8�A�;�;�H�H�Hr]rCc�:�g|]}|�dd����S)rz
%INPUTDIR%r�rts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>|s&��K�K�K�A����=�,�7�7�K�K�Kr]c�6�g|]}tj|����Srr)�MSVSSettings�FixVCMacroSlashesrts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>}s#��F�F�F�q��/��2�2�F�F�Fr]c��g|]}d|z��S�z"%s"rrrts  r[rwz/_BuildCommandLineForRuleRaw.<locals>.<listcomp>�s��1�1�1�!�6�A�:�1�1�1r])rorJrl�findrm�insert)�specr��cygwin_shell�has_input_path�	quote_cmd�do_setup_env�input_dir_preambler��
direct_cmd�command�	argumentss           r[�_BuildCommandLineForRuleRawr�<s���,�+��+�+�+��(������<>��$�(�(�#5��u�=�=�a�@�A�A�J��J�M�M�AK�M�M�M�J�M�M�AK�M�M�M�J�O�O�CM�O�O�O�J��)�)�)�'�)�)�)�j�N�M�*�M�M�M�J����*�%�%�J�
�C��E�	�
D�D�c��"�"�C����-�.�.�!�3�3�	�
O�O�c����x� � �A�%�%�	�
&�&�c����x� � �A�%�%�	�
&�&�c��.�*�/�/�+�6�6�!�;�;�	�
-�-�c����C�

�z�"�$�$�$�C���#�#��1�v������g�g��Q�����T�*�*�+�g�
�N�N�1�f����I�H��A�B�B��H�H�H�I�K�K��K�K�K�I�F�F�I�F�F�F�I��2�2�1�y�1�1�1�i������9�)<� =� =�=�=r]c�<�|�d��}|�$t|�dd����}n$t|t��rt|��}t|�dd����}t	||d||||���S)Nr)rC�msvs_quote_cmd�action)r�)rJ�int�
isinstancer�r�)r��ruler�r��mcsr�s      r[�_BuildCommandLineForRuler��s���
	
���$�%�%�#��[�

�d�h�h�*�A�.�.�
/�
/�C�C��#�s����

�c�(�(�C��$�(�(�+�Q�/�/�0�0�)�	$�T�4��>�3��%.�\�
K�
K�
K�Kr]c�t�|sJ�||||d�}|d}||vrg||<||�|��dS)a�Merge action into an existing list of actions.

  Care must be taken so that actions which have overlapping inputs either don't
  get assigned to the same input, or get collapsed into one.

  Arguments:
    actions_dict: dictionary keyed on input name, which maps to a list of
      dicts describing the actions attached to that input file.
    inputs: list of inputs
    outputs: list of outputs
    description: description of the action
    command: command line to execute
  ��inputs�outputs�descriptionr�rN�r�)�actions_dictrrrr�r��chosen_inputs       r[�_AddActionStepr�sh��
�-�-�-��� ��	��&����,���%�%�!#�L����|��#�#�F�+�+�+�+�+r]c�j�t|��}t|��}tjd|d�|��d�|��|d���}|d���D]9\}}	|�t
|��t||	��|g����:dS)a8Add a custom build tool to execute something.

  Arguments:
    p: the target project
    spec: the target project dict
    primary_input: input file to attach the build tool to
    inputs: list of inputs
    outputs: list of outputs
    description: description of the action
    cmd: command line to execute
  �VCCustomBuildTool�;)�Description�AdditionalDependencies�Outputs�CommandLine�configurations�r�N)ryr��Toolrl�items�
AddFileConfigror�)
�pr��
primary_inputrrrr�r�r��c_datas
          r[�_AddCustomBuildToolForMSVSr�s����V���&��g���'�	�	��!�!$���&�!1�!1��(�(�7�#�#����
	�
	�$�"�"2�3�9�9�;�;�H�H��k�6��O�O�H�]�+�+�#�K��8�8����H�H�H�H�H�Hr]c
���|D]�}t��}t��}g}g}||D]�}|�t|d����|�t|d����|�|d��|�|d����d�|��}	d�|��}
t	||||||	|
�����dS)	aAdd actions accumulated into an actions_dict, merging as needed.

  Arguments:
    p: the target project
    spec: the target project dict
    actions_dict: dictionary keyed on input name, which maps to a list of
        dicts describing the actions attached to that input file.
  rrrr��, and also �
)rrrrr�N)r�updater�rlr)rr�rrrr�descriptions�commandsr�rr�s           r[�_AddAccumulatedActionsToMSVSr�s��$�,�,�m�
�\�\�F��l�l�G��L��H��}�-�)�)���m�m�J�v�h�/�0�0�1�1�1�
�n�n�Z��y� 1�2�2�3�3�3����&��/�0�0�0��o�o�f�Y�'�(�(�(�(��$�$�\�2�2�K��k�k�(�#�#�G��q�$�-:�&,�'.�+6�#*�,�,�,�,�,�,�,r]c�z�|�dtj�tj�|��d��d��}|�dtj�|����}|�dtj�tj�|��d��d��}|�dtj�|��d��}|�d|��}|S)z�Given the input file to which a rule applied, string substitute a path.

  Arguments:
    path: a path to string expand
    input_file: the file to which the rule applied.
  Returns:
    The string substituted path.
  rrCrrr!r#r$)rmrHr`�splitext�split�dirname)r`�
input_files  r[�_RuleExpandPathr%�s���
���n��g�&�&�r�w�}�}�Z�'@�'@��'C�D�D�Q�G�
I�
I�$�	
���m�R�W�_�_�Z�%@�%@�	A�	A�$�	
���m��g�&�&�r�w�}�}�Z�'@�'@��'C�D�D�Q�G�
I�
I�$�	
���(�"�'�-�-�
�*C�*C�A�*F�	G�	G�$�	
���n�j�	1�	1�$�	
�+r]c�.�|�dg��S)z�Find the list of files which a particular rule applies to.

  Arguments:
    rule: the rule in question
    sources: the set of all known source files for this project
  Returns:
    The list of sources that trigger a particular rule.
  �rule_sourcesr�)r�r�s  r[�_FindRuleTriggerFilesr(s��
���.�"�	%�	%�%r]c��t|�dg����}t|�dg����}t��}t��}|�|��|D]%}|�t	||�����&|D]%}|�t	||�����&||fS)z�Find the inputs and outputs generated by a rule.

  Arguments:
    rule: the rule in question.
    trigger_file: the main trigger for this rule.
  Returns:
    The pair of (inputs, outputs) involved in this rule.
  rr)ryrJr�addr%)r��trigger_file�
raw_inputs�raw_outputsrrrv�os        r[�_RuleInputsAndOutputsr/s�������(�B�/�/�0�0�*��$�(�(�9�b�1�1�2�2�+��<�<�&��L�L�'��*�*�\�����1�1�a�
�J�J��q�,�/�/�0�0�0�0��2�2�a��K�K���<�0�0�1�1�1�1�
�'�	�r]c	�`�|d�|j�d�}tjtj�||��|d��}|D]�}|d}|d}	t
|�dg����}
t
|�dg����}d|vr|�dg��s�st||d	d	�
��}|�	||�d|��|	g|
||�����|�
��|�|��d
S)z�Generate a native rules file.

  Arguments:
    p: the target project
    rules: the set of rules to include
    output_dir: the directory in which the project/gyp resides
    spec: the project dict
    options: global generator options
  �target_namez.rules�	rule_name�	extensionrrr�r'T�r�r��message)�namer�
extensions�additional_dependenciesrr�N)�suffix�MSVSToolFile�WriterrHr`rlryrJr��AddCustomBuildRule�WriteIfChanged�AddToolFile)
r�rules�
output_dirr��options�rules_filename�
rules_file�rr2�rule_extrrr�s
             r[�_GenerateNativeRulesForMSVSrF'sS��$(�
�#6�#6�#*�>�>�>�3�.��"�2�7�<�<�
�N�#K�#K�#'�
�#6�8�8�*��+�+�a��+��I���~�H�
�q�u�u�X�r�*�*�
+�
+�F�����i��,�,�-�-�G��q������~�r�!:�!:���
"�4��4�04�6�6�6�C��!�!�y�./�e�e�I�y�.I�.I�.6�Z�:@�*1�&)�"�+�+�+�+�
�������-�-������r]c�^�|�dd��}|�dd��}|S)Nrz$(OutDirCygwin)rz$(IntDirCygwin)r�rns r[�
_CygwinifyrHMs/��	
���k�#4�	5�	5�$�	
���k�#4�	5�	5�$�	
�+r]c	���|d�d|j�d�}tj�tj�||����}|�d��|�d��t��}t��}	t��}
g}|D]�}t||��}
|
D]��t|���\}}|�t|����|	�t|����|�t|��d��d�|D��}|D]}|
�|�������d�|D��}|�d	d
�|��z��|
D]}|r|�d|z���|�d��|D]�}t||��}
|
D]��t|���\}}d
�|D��}d�|D��}�fd�|dD��}d�|D��}d
�|��}|�d
�|���dd
�|���d���|�d|z������|���|�|��dddddd|g}t!||dddd��}t|��}|�d|��t%|t'|��t'|	��d|dz|���dS)aGGenerate an external makefile to do a set of rules.

  Arguments:
    rules: the list of rules to include
    output_dir: path containing project and gyp files
    spec: project specification data
    sources: set of sources known
    options: global generator options
    actions_to_add: The list of actions we will add to.
  r1�_rulesz.mkz.OutDirCygwin:=$(shell cygpath -u "$(OutDir)")
z.IntDirCygwin:=$(shell cygpath -u "$(IntDir)")
rc�X�g|]'}tj�|��d��(S�r)rHr`r"rts  r[rwz*_GenerateExternalRules.<locals>.<listcomp>ss+��:�:�:�Q�R�W�]�]�1�%�%�a�(�:�:�:r]c�,�g|]}t|����Srr�rHrts  r[rwz*_GenerateExternalRules.<locals>.<listcomp>vs��<�<�<��z�!�}�}�<�<�<r]zall: %s
r�z	mkdir -p `cygpath -u "%s"`
�
c�,�g|]}t|����SrrrNrts  r[rwz*_GenerateExternalRules.<locals>.<listcomp>�s��.�.�.�!�
�1�
�
�.�.�.r]c�,�g|]}t|����SrrrNrts  r[rwz*_GenerateExternalRules.<locals>.<listcomp>�s��0�0�0�1��A���0�0�0r]c�0��g|]}t|�����Srr)r%)ru�c�tfs  �r[rwz*_GenerateExternalRules.<locals>.<listcomp>�s#���<�<�<��_�Q��
#�
#�<�<�<r]r�c��g|]}d|z��Sr�rrrts  r[rwz*_GenerateExternalRules.<locals>.<listcomp>�s��%�%�%�A�V�a�Z�%�%�%r]�: z	%s

�makezOutDir=$(OutDir)zIntDir=$(IntDir)z-jz${NUMBER_OF_PROCESSORS_PLUS_1}z-fTFzRunning external rules for %srN)r9�gyp�common�WriteOnDiffrHr`rl�writerr(r/rr�r�r*�closer�r�rry)r?r@r�r�rA�actions_to_addr��mk_file�
all_inputs�all_outputs�all_output_dirs�
first_outputsr��
trigger_filesrr�output_dirs�od�first_outputs_cygr�rTs                    @r[�_GenerateExternalRulesrgSs����!%�]� 3� 3� 3�W�^�^�^�
D�(��J�"�"�2�7�<�<�
�H�#E�#E�F�F�'�	�-�-�A�B�B�B�	�-�-�A�B�B�B��|�|�*����+��L�L�/��-�� � �d�)�$��8�8�M��
 �
 ��-�d�B�7�7�o�f�g����
�6�*�*�+�+�+�����G�,�,�-�-�-����4��=�=��+�,�,�,�:�:�'�:�:�:�k�� � �"����B����� �
 �=�<�m�<�<�<��	�-�-��c�h�h�'8�9�9�9�:�:�:��;�;�b�	�;�
�m�m�4�r�9�:�:�:��	�-�-������
&�
&�d�)�$��8�8�M��&�&��-�d�B�7�7�o�f�g�.�.�v�.�.�.�f�0�0��0�0�0�g�<�<�<�<�T�(�^�<�<�<�c�%�%��%�%�%�c��H�H�S�M�M�c�
�m�m�#�(�(�7�"3�"3�"3�"3�S�X�X�f�5E�5E�5E�5E�F�G�G�G�
�m�m�J��$�%�%�%�%�&�
�-�-�/�/�/�
�+�+�h����	�	�	�	
�/�	
�x�		�#�
	$�D�#�t�U�D�$�G�G�#��J���*����A�x� � � ���!�*�-�-�"�;�/�/�<��-�(�)�������r]c�2�|�dd��}|S)a�Escapes % characters.

  Escapes any % characters so that Windows-style environment variable
  expansions will leave them alone.
  See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
  to understand why we have to do this.

  Args:
      s: The string to be escaped.

  Returns:
      The escaped string.
  �%z%%r��r�s r[�#_EscapeEnvironmentVariableExpansionrk�s���i�i��T���!�	
�(r]z(\\*)"c�R�d�}t�||��}d|zdz}|S)awEscapes a Windows command-line argument.

  So that the Win32 CommandLineToArgv function will turn the escaped result back
  into the original string.
  See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
  ("Parsing C++ Command-Line Arguments") to understand why we have to do
  this.

  Args:
      s: the string to be escaped.
  Returns:
      the escaped string.
  c�8�d|�d��zdzS)N�rC�\"�rS��matchs r[�_Replacez3_EscapeCommandLineArgumentForMSVS.<locals>._Replace�s��
�u�{�{�1�~�~���%�%r]r�)�quote_replacer_regex�sub�r�rss  r[�!_EscapeCommandLineArgumentForMSVSrw�s:��&�&�&����x��+�+�!�	�A�g��m�!�	
�(r]z(\\*)([,;]+)c�R�d�}|�d��}tdt|��d��D]&}t�|||��||<�'d�|��}t|��dzdkrt
d|ztj���|S)a�Escapes command line arguments for MSVS.

  The VCProj format stores string lists in a single string using commas and
  semi-colons as separators, which must be quoted if they are to be
  interpreted literally. However, command-line arguments may already have
  quotes, and the VCProj parser is ignorant of the backslash escaping
  convention used by CommandLineToArgv, so the command-line quotes and the
  VCProj quotes may not be the same quotes. So to store a general
  command-line argument in a VCProj list, we need to parse the existing
  quoting according to VCProj's convention and quote any delimiters that are
  not already quoted by that convention. The quotes that we add will also be
  seen by CommandLineToArgv, so if backslashes precede them then we also have
  to escape those backslashes according to the CommandLineToArgv
  convention.

  Args:
      s: the string to be escaped.
  Returns:
      the escaped string.
  c�j�d|�d��zdz|�d��zdzS)NrnrCr�rprqs r[rsz5_EscapeVCProjCommandLineArgListItem.<locals>._Replace�s2��
�u�{�{�1�~�~���#�e�k�k�!�n�n�4�s�:�:r]r�rrnz;Warning: MSVS may misinterpret the odd number of quotes in )�file)	r"�ranger��delimiters_replacer_regexrurlr�rD�stderr)r�rs�segmentsrvs    r[�#_EscapeVCProjCommandLineArgListItemr�s���,;�;�;��W�W�S�\�\�(���C��M�M�1�%�%�G�G�a�+�/�/��(�1�+�F�F�H�Q�K�K�	�h�h�x���!���]�]�Q��!���
�'�)*�+�25�*�>�>�>�>�	
�(r]c��t|��}t|��}t|��}|�ddt	d��z��}|S�zBEscapes a CPP define so that it will reach the compiler unaltered.�#z\%03o)rkrwrrm�ordrjs r[�_EscapeCppDefineForMSVSr�sN��)�!�,�,�!�'��*�*�!�)�!�,�,�!��i�i��X��C���(�)�)�!�	
�(r]z(\\+)"c�B�d�}t�||��}|S)z;Escapes a Windows command-line argument for use by MSBuild.c�^�t|�d����dzdzdzdzS)NrCrn�rhro)r�rSrqs r[rsz6_EscapeCommandLineArgumentForMSBuild.<locals>._Replaces.������A�����!�#�a�'�4�/�%�7�7r])�quote_replacer_regex2rurvs  r[�$_EscapeCommandLineArgumentForMSBuildr�s-��8�8�8�����!�,�,�!�	
�(r]c�^��dddddddd��d	��fd
�|D����}|S)Nz%25z%24z%40z%27z%3Bz%3Fz%2A)rir_�@�'r�?�*rc�<��g|]}��||����Srrr�)rurS�escape_dictionarys  �r[rwz3_EscapeMSBuildSpecialCharacters.<locals>.<listcomp>*s*���;�;�;�A�%�)�)�!�Q�/�/�;�;�;r])rl)r�r�r�s  @r[�_EscapeMSBuildSpecialCharactersr� sR��������������7�7�;�;�;�;��;�;�;�<�<�&�	�-r]c��t|��}t|��}t|��}|�ddt	d��z��}|Sr�)rkr�r�rmr�rjs r[�_EscapeCppDefineForMSBuildr�.sN��)�!�,�,�!�*�1�-�-�!�%�a�(�(�!��i�i��X��C���(�)�)�!�	
�(r]c���|�dg��}d�|D��}d�|D��}	|rt|||||��|	rt|	|||||��t|||d��dS)a�Generate all the rules for a particular project.

  Arguments:
    p: the project
    output_dir: directory to emit rules to
    options: global options passed to the generator
    spec: the specification for this project
    sources: the set of all known source files in this project
    excluded_sources: the set of sources excluded from normal processing
    actions_to_add: deferred list of actions to add in
  r?c�X�g|]'}t|�dd�����%|��(S��msvs_external_ruler�r�rJ�rurDs  r[rwz)_GenerateRulesForMSVS.<locals>.<listcomp>H�4��N�N�N��#�a�e�e�4H�!�.L�.L�*M�*M�N�!�N�N�Nr]c�X�g|]'}t|�dd�����%|��(Sr�r�r�s  r[rwz)_GenerateRulesForMSVS.<locals>.<listcomp>I�4��L�L�L�!��A�E�E�2F��,J�,J�(K�(K�L�A�L�L�Lr]FN)rJrFrg�_AdjustSourcesForRules)
rr@rAr�r��excluded_sourcesr]r?�rules_native�rules_externals
          r[�_GenerateRulesForMSVSr�9s����(�(�7�B�
�
�%�N�N�U�N�N�N�,�L�L�u�L�L�L�.��L���<��T�7�K�K�K��=��>�:�t�"�G�^�=�=�=����)9�5�A�A�A�A�Ar]c�$�|D�]}t||��}|D]�}|�t|����t|�dd����r�t||��\}}t
t|����}t
t|����}|�t|����|�	|��|s|�	|��|�	|������
dS)N�process_outputs_as_sourcesF)
r(�discardror�rJr/rry�remover)	r?r�r��
is_msbuildr�rcr+rrs	         r[r�r�Vs��� � �d�)�$��8�8�M�%� � �����x��5�5�6�6�6�	�T�X�X�2�E�
:�
:�	;�	;� �/��l�C�C�����I�f�-�-�.�.���Y�w�/�/�0�0���
�
�h�|�,�,�-�-�-����v�����	*�
�
!�
!�&�
)�
)�
)����w����� � � r]c�|��tt|���������fd�|D��S)a*Take inputs with actions attached out of the list of exclusions.

  Arguments:
    excluded_sources: list of source files not to be built.
    actions_to_add: dict of actions keyed on source file they're attached to.
  Returns:
    excluded_sources with files that have actions attached removed.
  c���g|]}|�v�|��	Srrrr)rur��	must_keeps  �r[rwz._FilterActionsFromExcluded.<locals>.<listcomp>vs#���	<�	<�	<���)�);�);�!�);�);�);r])rry�keys)r�r]r�s  @r[�_FilterActionsFromExcludedr�lsA�����>�#6�#6�#8�#8�9�9�:�:�)�	<�	<�	<�	<�%�	<�	<�	<�<r]c�*�|d|dS)Nr�default_configurationrr)r�s r[�_GetDefaultConfigurationr�ys��	
��	��%<� =�	>�>r]c��t|��}|�d��}|r?t�|��� t	d|�dtj�d����d|z}|pt
j|��}|S)aGet the guid for the project.

  Arguments:
    proj_path: Path of the vcproj or vcxproj file to generate.
    spec: The target dictionary containing the properties of the target.
  Returns:
    the guid.
  Raises:
    ValueError: if the specified GUID is invalid.
  �	msvs_guidNzInvalid MSVS guid: "z".  Must match regex: "z".z{%s})r�rJ�VALID_MSVS_GUID_CHARSrr�
ValueError�pattern�MSVSNew�MakeGuid)�	proj_pathr��default_config�guids    r[�_GetGuidOfProjectr�}s���,�D�1�1�.�	�	�	�K�	(�	(�$�	���"�"�4�(�(�0��J����3�;�;�;�=�
>�
>�>��D�=�D�	
�	,��!�)�,�,�$�	
�+r]c��t|��}|�d��}|s(|���r|���}|ddkrd}|S)aGet the platform toolset for the project.

  Arguments:
    proj_path: Path of the vcproj or vcxproj file to generate.
    spec: The target dictionary containing the properties of the target.
    version: The MSVSVersion object.
  Returns:
    the platform toolset string or None.
  �msbuild_toolsetr��windows_driverzWindowsKernelModeDriver10.0)r�rJ�DefaultToolset)r�r�r�r��toolsets     r[�_GetMsbuildToolsetOfProjectr��sk��,�D�1�1�.����0�1�1�'�	�'�W�+�+�-�-�'��$�$�&�&�G�	�&�\�%�%�%�+�G�	�.r]c���t|j��}|�d��rgS|���rt	||||��St||||��S)aGenerates a vcproj file.

  Arguments:
    project: the MSVSProject object.
    options: global generator options.
    version: the MSVSVersion object.
    generator_flags: dict of generator-specific flags.
  Returns:
    A list of source files that cannot be found on disk.
  �msvs_existing_vcproj)r�r�rJr��_GenerateMSBuildProject�_GenerateMSVSProject)�projectrAr��generator_flagsr�s     r[�_GenerateProjectr��sn��,�G�L�9�9�.����.�/�/��
�I������L�"�7�G�W�o�N�N�N����'�?�K�K�Kr]c�|�|���rJ�|�dd��dvrdS|�dg��}i}|D]s}tj�|��\}}|dv}|s�+tj�|��}|�|g���|���td}	|���D]7\}}
t|
��dkr|	d|�d	d
�
|
���d�z
}	�8|	r-td|d
z|	zdz��td���dS)z�Makes sure if duplicate basenames are not specified in the source list.

  Arguments:
    spec: The target dictionary containing the properties of the target.
    version: The VisualStudioVersion object.
  r�N)�static_library�shared_libraryr�)�.c�.cc�.cpp�.cxxz.mz.mmz.sz.SrrCz  rVr�rOz<static library %s has several files with the same basename:
r1zMSVC08 cannot handle that.z6Duplicate basenames in sources section, see list above)
r�rJrHr`r!�basename�
setdefaultr�rr�rlr�r)r�r�r��	basenamesrcr6�ext�is_compiled_filer��error�filess           r[�_ValidateSourcesForMSVSProjectr��s����
 �
 �
"�
"�"�"�"�
�X�X�f�d���#G�G�G�
�F��H�H�Y��#�#�'��)��6�6�f��� � ��(�(�I�D�#��>�>������w����%�%�H�
����2�&�&�-�-�f�5�5�5�5�
�%�"���*�*�:�:�o�h��
�5�z�z�A�~�~��e�x�x�x����%�����9�9�e��
�M�	�
I�
�}�
�� %�&�(D�E�F�F�F�
�K�
L�
L�L�M�Mr]c	���|j}tj�|j��t|��}t
j|j||d|j|��}tj�
|j��d}t|j��}tj�
||��}	t||j��}
|d���D]\}}t!|||
||���t#||��tj�
|j��d}
t%|||
��\}}i}t'|||||||��|�dd��}t+|||||||��\}}}t-||��}|�|��t1||��t3|||��t5|||	��t7||��t9|j||��t;||��}t=|||||��t?|||��|� ��|S)a-Generates a .vcproj file.  It may create .rules and .user files too.

  Arguments:
    project: The project object we will generate the file for.
    options: Global options passed to the generator.
    version: The VisualStudioVersion object.
    generator_flags: dict of generator-specific flags.
  r1rrrC�msvs_list_excluded_filesT)!r�rXrY�EnsureDirExistsr`�_GetUniquePlatformsr�r;r�rHr"re�
build_file�RelativePath�_GetMSVSConfigurationTyper�_AddConfigurationToMSVSProjectr��_PrepareListOfSourcesr�rJ�)_AdjustSourcesAndConvertToFilterHierarchy�_VerifySourcesExist�AddFiles�_AddToolFilesToMSVS�_HandlePreCompiledHeaders�_AddActions�
_AddCopies�_WriteMSVSUserFiler��_ExcludeFilesFromBeingBuiltrr=)r�rAr�r�r��	platformsr�project_dir�gyp_path�relative_path_of_gyp_file�config_typer�r@�gyp_filer�r�r]r}�excluded_idl�missing_sourcess                    r[r�r��s���
��$��*���W�\�*�*�*�!�$�'�'�)�����w��]�0C� ��y�2�2�!���
�
�g�l�+�+�A�.�+�
�w�1�
2�
2�(�!�j�5�5�h��L�L��)�$��0B�C�C�+�!�"2�3�9�9�;�;�N�N��k�6�"�1�d�K��f�M�M�M�M�
!��w�/�/�/��W�]�]�7�-�
.�
.�q�
1�(�3�D�/�4<�>�>��'���.���;����!1�&�(�(�(�"�%�%�&@�$�G�G�-�/��g�{�07�9I�0=�w�H�H�*�'��\�(���=�=�/��*�*�W�����a������A�w��-�-�-�
�n�d�$=�>�>�>��^�T�"�"�"��W�\�7�D�1�1�1�0���(�(���a��'7��+�-�-�-��q�$��7�7�7�������	�r]c��t��}|dD]0}|�t|d|�����1t|��}|S)z�Returns the list of unique platforms for this spec, e.g ['win32', ...].

  Arguments:
    spec: The target dictionary containing the properties of the target.
  Returns:
    The MSVSUserFile object created.
  r)rr*r�r�)r�r��
configurations   r[r�r�*s]���l�l�)��,�-�J�J�m�
�M�M�/�$�'7�"8��"G�H�H�I�I�I�I��9�o�o�)�	�r]c��t��\}}d�|||dg��}tj|||d��}|S)a�Generates a .user file for the user running this Gyp program.

  Arguments:
    proj_path: The path of the project file being created.  The .user file
               shares the same path (with an appropriate suffix).
    version: The VisualStudioVersion object.
    spec: The target dictionary containing the properties of the target.
  Returns:
    The MSVSUserFile object created.
  r��userr1)r\rl�MSVSUserFiler;)r�r�r�rTrU�vcuser_filename�	user_files       r[�_CreateMSVSUserFiler�:sR��-�.�.��6�8��H�H�i���6�B�C�C�/��!�/�7�"&�}�"5�7�7�)�	�r]c
��	ddddddd�|d}nd#t$rW|�d��r%td|d�d	|d
�d|�d����td
|d
�d|�d����wxYw|S)a(Returns the configuration type for this project.

  It's a number defined by Microsoft.  May raise an exception.

  Args:
      spec: The target dictionary containing the properties of the target.
      build_file: The path of the gyp file.
  Returns:
      An integer, the configuration type.
  �1�2�4�5�10)�
executabler��loadable_moduler�r��noner�zTarget type z' is not a valid target type for target r1z in r�zMissing type field for target )�KeyErrorrJr)r�r�r�s   r[r�r�Ls���8�������

�
��v�,��K�K��
�8�8�8��x�x����8��H��6�l�l�l�D��$7�$7�$7����E�
F�
F�F�
�H��=�)�)�)�:�:�:�7�
8�
8�8�
8����
�s
��A!A9c	�z�t|��\}}}t|��}t|��}	t|d���\}
}}t	|��}
d�|
D��}
t|��}|�d��}|�d��}t|��}|�d��}t��}|�di��}tj
|��t|dd	d
g��|D]-}|d|}|D]}t|||||����.t|dd|��t|d
d|��t|dd|��t|dd	|��t|dd|	��|
rt||d|
d���t|dd|
��t|dd|
��t|dddd���t|dd|��t|dd|��t|dd|��|r[tj
�|��d}t|ddd��t|dd|��t|dd|��|dd krt|dd!d"��|rt|dd#|��t||||||��d$S)%a+Adds a configuration to the MSVS project.

  Many settings in a vcproj file are specific to a configuration.  This
  function the main part of the vcproj file that's configuration specific.

  Arguments:
    p: The target project being generated.
    spec: The target dictionary containing the properties of the target.
    config_type: The configuration type, a number as defined by Microsoft.
    config_name: The name of the configuration.
    config: The dictionary that defines the special processing to be done
            for this configuration.
  F��msbuildc�,�g|]}t|����Srr)r��ru�ds  r[rwz2_AddConfigurationToMSVSProject.<locals>.<listcomp>�s!��9�9�9�A�
$�Q�
'�
'�9�9�9r]�
msvs_prebuild�msvs_postbuildr7�
msvs_settings�VCLinkerToolr
�$(NOINHERIT)�VCCLCompilerTool�AdditionalIncludeDirectories�
VCMIDLTool�VCResourceCompilerTool�AdditionalLibraryDirectories�
OutputFileT�r��PreprocessorDefinitions�ProgramDataBaseFileNamez $(IntDir)$(ProjectName)\vc80.pdb�DisableSpecificWarnings�VCPreBuildEventToolr�VCPostBuildEventToolrC�UsePrecompiledHeaderr��PrecompiledHeaderThrough�ForcedIncludeFilesr�r��IgnoreImportLibrary�true�ModuleDefinitionFileN)�_GetIncludeDirs�
_GetLibraries�_GetLibraryDirs�_GetOutputFilePathAndTool�_GetDefines�_GetDisabledWarningsrJ�_GetModuleDefinitionr�r��ValidateMSVSSettingsr�rHr`r"�_AddConfigurationToMSVS)rr�r�r�r@�include_dirs�midl_include_dirs�resource_include_dirs�	libraries�library_dirs�out_file�vc_toolr��defines�disabled_warnings�prebuild�	postbuild�def_file�precompiled_headerr�r
r��settingsr�s                        r[r�r�ks��� �f���9�,�!�#8��D�!�!�)� ��(�(�,�2�4��G�G�G��(�G�Q�����'�9�9��9�9�9�'�*�6�2�2��
�Z�Z��
(�
(�(��j�j�)�*�*�)�
!�$�
'�
'�(��z�z�";�<�<���&�&�%��*�*�_�b�1�1�-��#�M�2�2�2��e�^�%=��?O�P�P�P��;�;�d��o�&�t�,�H��;�;���%��w���(9�:�:�:�:�;��e�'�,�l�<�<�<�
�e�\�,�.?�A�A�A�
�e�-�,�.C�E�E�E��e�^�%=�y�I�I�I�
�e�^�%C�����
�L���w��h�d�K�K�K�K�
�e�'�)B�G�L�L�L�
�e�-�/H������e�'�)B�1��G�G�G�G��e�'�'�):�<�<�<��e�*�M�8�D�D�D�
�e�+�]�I�F�F�F��:�����'9�:�:�1�=����)�+A�3�G�G�G���)�*�,>�@�@�@���)�$�&8�:�:�:�
�&�\�&�&�&���~�'<�f�E�E�E�
�I���~�'=�x�H�H�H��!�T�5�&�+�{�K�K�K�K�Kr]c�F�|�dg��|�dg��z}|�dg��|�dg��z}|�d|��}t|��}t|��}t|��}|||fS)z�Returns the list of directories to be used for #include directives.

  Arguments:
    config: The dictionary that defines the special processing to be done
            for this configuration.
  Returns:
    The list of directory paths.
  r(�msvs_system_include_dirsr)r*�rJry)r@r(r)r*s    r[rr�s���
�j�j���$�$��j�j�+�R�0�0�1��
�j�j�$�b�)�)��j�j�+�R�0�0�1��!�*�*�%<�l�K�K���<�(�(�,�� 1�2�2��#�$9�:�:��	�(�*?�	?�?r]c�P�|�dg��}t|��}|S)z�Returns the list of directories to be used for library search paths.

  Arguments:
    config: The dictionary that defines the special processing to be done
            for this configuration.
  Returns:
    The list of directory paths.
  r,r8)r@r,s  r[r!r!�s*�����N�B�/�/�,��<�(�(�,�	�r]c�z�|�dg��}t��}g}t|��D]p}tjdd|��}t
j�|��ds|dz
}||vr*|�|��|�	|���q|�
��|S)z�Returns the list of libraries for this configuration.

  Arguments:
    spec: The target dictionary containing the properties of the target.
  Returns:
    The list of directory paths.
  r+z^\-lrrCr)rJr�reversedrOrurHr`r!r*r�r�)r�r+�found�unique_libraries_list�entry�librarys      r[r r �s����h�h�{�B�'�'�)�
�,�,�%����	�"�"�,�,�e��f�W�b�%�(�(�G�
�7���G�$�$�Q�'��
���g��e����i�i������"�"�7�+�+�+�����!�!�!�	�r]c���d}d}d}dddddd�}|�|d��}|r�t|�dd	����r�|\}}}}|�d
d��rd}|�d
|��}|�d��}	|	rd|	z}n|rd}|�dd��}
|�dd��}tj||
|z|z��}|||fS)aNReturns the path and tool to use for this target.

  Figures out the path of the file this spec will create and the name of
  the VC tool that will create it.

  Arguments:
    spec: The target dictionary containing the properties of the target.
  Returns:
    A triple of (file path, name of the vc tool, name of the msbuild tool)
  r)r�Linkrr
)rrArr)rrArr
)�VCLibrarianTool�Libz
$(OutDir)lib\r�r�r�r�r�r�r��msvs_auto_output_filerC�standalone_static_libraryrr�product_dir�product_extensionr�z$(TargetExt)�product_prefix�product_name�$(ProjectName))rJr��ntpathrl)r�rr-r.�msbuild_tool�output_file_map�output_file_props�out_dirr9rHr�rJs            r[r"r"s2���(��'��,�A�E�F�E�L���/�&�)�)�$�v�,�7�7���D�3�t�x�x�(?��C�C�D�D�D�->�*�G�\�7�F��x�x�+�Q�/�/���g��h�h�}�g�.�.�G����!4�5�5�����&�&�f�f�	���f�
�X�X�&��
+�
+�F��8�8�N�,<�=�=�L��{�7�F�\�$9�F�$B�C�C�H�	�7�L�	(�(r]c�>�|�d��}|rd|zSdS)aqReturns the extension for this target, including the dot

  If product_extension is specified, set target_extension to this to avoid
  MSB8012, returns None otherwise. Ignores any target_extension settings in
  the input files.

  Arguments:
    spec: The target dictionary containing the properties of the target.
  Returns:
    A string with the extension, or None
  rHr�Nr�)r��target_extensions  r[�_GetOutputTargetExtrS*s0���X�X�1�2�2���"��!�!�!�	
�r]c���g}|�dg��D]^}t|��tkr d�d�|D����}nt	|��}|�|���_|S)z�Returns the list of preprocessor definitions for this configuation.

  Arguments:
    config: The dictionary that defines the special processing to be done
            for this configuration.
  Returns:
    The list of preprocessor definitions.
  r/�=c�,�g|]}t|����Srr�r�)ru�dparts  r[rwz_GetDefines.<locals>.<listcomp>Hs��/�/�/�E�S��Z�Z�/�/�/r])rJr�r�rlr�r�)r@r/r�fds    r[r#r#<s|��
�'��:�:�i��$�$���a��A�w�w�$����8�8�/�/�Q�/�/�/�0�0�b�b��q�6�6�b��N�N�2�����	�.r]c�B�d�|�dg��D��S)Nc�,�g|]}t|����SrrrWrts  r[rwz(_GetDisabledWarnings.<locals>.<listcomp>Ps��	C�	C�	C�Q�#�a�&�&�	C�	C�	Cr]�msvs_disabled_warningsr�)r@s r[r$r$Os%��	C�	C�&�*�*�%=�r�B�B�	C�	C�	C�Cr]c��d}|ddvryd�|�dg��D��}t|��dkrt|d��}n0|r.td|d	�d
d�|�������|S)Nrr�)r�r�r�r�c�<�g|]}|�d���|��S)z.def�r��rur�s  r[rwz(_GetModuleDefinition.<locals>.<listcomp>Ws)��J�J�J�q�q�z�z�&�7I�7I�J��J�J�Jr]r�rCrz7Multiple module definition files in one target, target r1z lists multiple .def files: r�)rJr�ror�rl)r�r3�	def_filess   r[r%r%Ss���
�(�	�&�\�(�(�(�J�J�D�H�H�Y��3�3�J�J�J�I�
�9�~�~�����)�A�,�'�'�h�h�	�9��J��=�!�!�!�3�8�8�I�#6�#6�#6�8�
9�
9�9�
�/r]c��g}|���D]�\}}i}|���D]f\}}t|��tkrD|dkr|dks|dkrd�|��||<�Hd�|��||<�a|||<�g|�tj||������|S)z�Convert tools to a form expected by Visual Studio.

  Arguments:
    tools: A dictionary of settings; the tool name is the key.
  Returns:
    A list of Tool objects.
  rr
�AdditionalOptionsr�r)rr�r�rlr�r�r)r��	tool_listr�r5�settings_fixedr�r�s       r[�_ConvertToolsToExpectedFormrfbs����)����
�
�=�=�n�d�H��N�"�.�.�*�*�	(�	(����	
�e����	�	�
�^�
#�
#�
�0�
0�
0��*�*�*�$'�H�H�U�O�O�.��
!�
!�$'�H�H�U�O�O�.��
!�
!�"'��w���
���[�%�d�N�;�;�<�<�<�<�	�r]c��t|||��}t|��}|�t||��||���dS)a�Add to the project file the configuration specified by config.

  Arguments:
    p: The target project being generated.
    spec: the target project dict.
    tools: A dictionary of settings; the tool name is the key.
    config: The dictionary that defines the special processing to be done
            for this configuration.
    config_type: The configuration type, a number as defined by Microsoft.
    config_name: The name of the configuration.
  )�attrsr�N)�_GetMSVSAttributesrf�	AddConfigr�)rr�r�r@r�r��
attributesrds        r[r'r'}sX��"�$���<�<�*�)�%�0�0�)��+�+�o�k�6�2�2��i��1�1�1�1�1r]c���i}|�di��}|D]
}||||<�|�dg��}t|��}|rd�|��|d<||d<|�dd��}t|��dz|d<d	|vrd
}t|��dz|d	<n1t|d	��dz}t	j|��}||d	<|S)N�msvs_configuration_attributesr(r�InheritedPropertySheets�ConfigurationType�OutputDirectoryz"$(SolutionDir)$(ConfigurationName)rh�IntermediateDirectoryz'$(ConfigurationName)\obj\$(ProjectName))rJryrlror�r�)	r�r@r��prepared_attrs�source_attrs�a�vsprops_dirsr@�intermediates	         r[riri�s���.����;�R�@�@�,��(�(�a�$�Q��N�1������L�"�-�-�,��<�(�(�,��G�03����0F�0F�N�,�-�(3�.�$�%��!�!�"3�"F�H�H�*�&.�z�&:�&:�T�&A�.�"�#��N�2�2�>�L�.6�|�.D�.D�t�.K�N�*�+�+��N�+B�C�D�D�t�K�L��1�,�?�?�L�.:�N�*�+�	�r]c�D�|�d�|D����dS)Nc3�4K�|]}t|��V��dSr��rer`s  r[�	<genexpr>z(_AddNormalizedSources.<locals>.<genexpr>�s+����A�A�a�&�q�)�)�A�A�A�A�A�Ar])r)�sources_set�
sources_arrays  r[�_AddNormalizedSourcesr}�s+��
���A�A�=�A�A�A�A�A�A�A�Ar]c���t��}t||�dg����t��}|�d��s|�|��|�dg��D]�}|d}d�|D��}t|��}|�|��|�d��s|�|��t|�dd����r$t||�d	g������|�d
g��D]&}t||�dg�����'||fS)a.Prepare list of sources and excluded sources.

  Besides the sources specified directly in the spec, adds the gyp file so
  that a change to it will cause a re-compile. Also adds appropriate sources
  for actions and copies. Assumes later stage will un-exclude files which
  have custom build steps attached.

  Arguments:
    spec: The target dictionary containing the properties of the target.
    gyp_file: The name of the gyp file.
  Returns:
    A pair of (list of sources, list of excluded sources).
    The sources will be relative to the gyp file.
  r��
standalone�actionsrc�,�g|]}t|����Srrryrts  r[rwz)_PrepareListOfSources.<locals>.<listcomp>�s!��
3�
3�
3�q���"�"�
3�
3�
3r]r,r�Fr�copiesr�)rr}rJr*rr�)r�r�r�r�r�rtr�cpys        r[r�r��sh��
�L�L�'������)�R�!8�!8�9�9�9��\�\��	�	�	�\�	*�	*���K�K������8�8�I�r�"�"�	;�	;�a�
�x�[�F�
3�
3�F�
3�
3�
3�F�
��
�
�F��N�N�6�����8�8�+�,�,�&����f�%�%�%�
�1�5�5�-�u�5�5�6�6�;��G�Q�U�U�9�b�%9�%9�:�:�:��
�X�X�h��
#�
#�9�9�c��'�3�7�7�7�B�#7�#7�8�8�8�8�
�#�	$�$r]c���	�|�t|�dg������|�|��t|��}t|��}t	||��}t|���	�	fd�|D��}d�|D��}t
||||���}|���r�td�|D����r�ttd�|D������dkrjtd�|D����sJ�d	�|D��}td�|D����r*ttd�|D������dk�jnst|��dkr`t|d
tj
��r@|d
j}t|��dkr t|d
tj
���@|||fS)a&Adjusts the list of sources and excluded sources.

  Also converts the sets to lists.

  Arguments:
    spec: The target dictionary containing the properties of the target.
    options: Global generator options.
    gyp_dir: The path to the gyp file being processed.
    sources: A set of sources to be included for this project.
    excluded_sources: A set of sources to be excluded for this project.
    version: A MSVSVersion object.
  Returns:
    A trio of (list of sources, list of excluded sources,
               path of excluded IDL file)
  �sources_excludedc���g|]}|�v�|��	Srrrr)rurv�precompiled_relateds  �r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>�s$���P�P�P�!�1�<O�3O�3O�A�3O�3O�3Or]c�8�g|]}|�d����S)rh)r"rts  r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>�s"��,�,�,�q�Q�W�W�T�]�]�,�,�,r]r{c�B�g|]}t|tj����Srr)r�r�r�r`s  r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>s%��B�B�B�Q�z�!�[�/�0�0�B�B�Br]c��g|]	}|j��
Srr)r6r`s  r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>s��-�-�-��Q�V�-�-�-r]rCc�>�g|]}t|j��dk��S)rC)r�r�r`s  r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>s%��8�8�8�1�#�a�j�/�/�Q�&�8�8�8r]c�(�g|]}|jd��SrLrr`s  r[rwz=_AdjustSourcesAndConvertToFilterHierarchy.<locals>.<listcomp>s��0�0�0�1���A��0�0�0r]r)rrrJry�_IdlFilesHandledNonNatively�_GetPrecompileRelatedFilesr�r��allr��setr�r�r�r�)
r�rA�gyp_dirr�r�r}r�r��fully_excludedr�s
         @r[r�r��s���$���*�T�X�X�.@�"�%E�%E�F�F�G�G�G�	�.�.�!�"�"�"�
�g���'��/�0�0��,�T�7�;�;�,�2�4�8�8��P�P�P�P�/�P�P�P�.�
-�,�G�,�,�,�'�,�W�~�;H�:A�
C�
C�
C�'�
�����$�

�B�B�'�B�B�B�
C�
C�1���-�-�W�-�-�-�.�.�/�/�1�4�4�
�8�8��8�8�8�
9�
9�9�9�9�0�0��0�0�0�g��B�B�'�B�B�B�
C�
C�1���-�-�W�-�-�-�.�.�/�/�1�4�4���g�,�,�!�
�
�
�7�1�:�{�7I� J� J�
���
�#�g��g�,�,�!�
�
�
�7�1�:�{�7I� J� J�
�
�"�L�	0�0r]c���d}|�dg��D]5}|ddkr't|�dd����rd}n�6|r
d�|D��}ng}|S)	NFr?r3�idlr�rTc�<�g|]}|�d���|��S)�.idlr_rts  r[rwz/_IdlFilesHandledNonNatively.<locals>.<listcomp>s)��=�=�=�!�!�*�*�V�*<�*<�=�A�=�=�=r])rJr�)r�r��	using_idlr�r�s     r[r�r�s����)��h�h�w��#�#���d��K��E�!�!�c�$�(�(�3G��*K�*K�&L�&L�!��i��e����=�=�w�=�=�=�L�L��L�	�r]c���g}|d���D]H\}}tD];}|�|��}|r"|�t	|�����<�I|S)Nr)r�precomp_keysrJr�ro)r�r�r�r@�kr�s      r[r�r�s{�����(�)�/�/�1�1�0�0�i�a��
�0�0��
�*�*�Q�-�-�a�	
�0��"�"�8�A�;�;�/�/�/��0�
�r]c	��t|||��}|���D]]\}}|s't|��t|d��kr�.|D],\}}	|�|t	||	��ddi���-�^dS)Nr�ExcludedFromBuildr)�_GetExcludedFilesFromBuildrr�rr�)
rr�r�r�r}�
exclusions�	file_name�excluded_configsr�r@s
          r[r�r�%s���)�$�0@�,�O�O�*�%/�%5�%5�%7�%7�	7�	7�!�i�!��7�� �!�!�S��.>�)?�%@�%@�@�@��!1�7�7�
�+�v�	���	�?�;��#G�#G�,�f�5�	7�	7�	7�	7�7�	7�	7r]c�F��i}|D]W}g}|d���D]3\}��fd�tD��}||vr|�|�f���4|||<�X|D]@}g}|d���D]\}�|�|�f���|||<�A|S)Nrc�V��g|]%}t��|d������&S)r)rorJ)rurvr@s  �r[rwz._GetExcludedFilesFromBuild.<locals>.<listcomp>:s/���E�E�E�1�8�F�J�J�q�"�-�-�.�.�E�E�Er])rr�r�)	r�r�r�r�r�r�r��	precompedr@s	        @r[r�r�4s�����*��%�%�a���#�$4�5�;�;�=�=�7�7���V�E�E�E�E��E�E�E�i�	
�)�	�	�����f� 5�6�6�6��$�J�q�M�M��%�%�a���#�$4�5�;�;�=�=�5�5���V����{�F�3�4�4�4�4�$�J�q�M�M�	�r]c���t��}|d���D]3\}}|�dg��D]}|�|����4|D]}|�|���dS)Nr�msvs_tool_files)rrrJr*r>)rr��
tool_filesr�r@r�s      r[r�r�Is����|�|�*��(�)�/�/�1�1���i�a��
�Z�Z�)�2�
.�
.�����n�n�Q���������a��M�M�!������r]c����	�
�g�
�d���D]�\}}|�d��}|r~t|��}tjdddi��}��|t
||��i|g���tj�	|��\}}|dkrgd��
��dg�
���	�
��fd	��	�
r
�	|��dSdS)
Nrr8r
rr�rr��r�r�r�c	���|D]�}t|tj��r�|j���-tj�|��\}}|�vrm�
d���D]R\}}tjdddd���}�	�	t|��t||��i|g����S��dS)Nrr
�0r)rrr)r�r�r�r�rHr`r!rrrror�)�source_treercr�r3r�r@r��DisableForSourceTree�#extensions_excluded_from_precompilerr�s       ����r[r�z7_HandlePreCompiledHeaders.<locals>.DisableForSourceTreegs�����.�.��	�F�K�.�	/�	/�.���V�_�-�-�-�-� �g�.�.�v�6�6���)��;�;�;�%)�*:�%;�%A�%A�%C�%C�.�.�!�k�6��#�$6�=@�;I�%K�%K�L�L�D�
�O�O�H�V�,�,�+�K��@�@��t�f�
�
.�
.�
.�
.��.�.r])
rrJror�rrr�rHr`r!)rr�r�r�r@rcr�r�r3r�r�s` `      @@r[r�r�Ss8������
)+�%�!�"2�3�9�9�;�;�
5�
5��k�6�
�Z�Z�1�
2�
2�F�
�5�����f�
�
�0�5�s�;�=�=�d��o�o�f�o�k�6�B�B�����(�(�(��G�,�,�V�4�4��h�	�	�d�	�	�.E�.E�.E�+�+�/3�f�+��
.�
.�
.�
.�
.�
.�
.�
.�)�"����!�!�!�!�!�"�"r]c�t�|�dg��}t��}|D]�}|�d��p|g}|d}||v}t||d|���}	|�|��t	|||�dg��|�d|d��|	�	����dS)
Nr�rrFr4rr5�action_namer)rJr�r�r*r)
r]r�r�r��have_setup_envrtr�attached_to�need_setup_envr�s
          r[r�r�zs����H�H�Y��#�#�'�
�5�5�.��
 �
 �a�
�U�U�8�_�_�
;�!:� ;�F���)�K� ��6�N�
"�4��5�0>�@�@�@�C����{�#�#�#��>� ��5�5��B�/�/� �u�u�Y��-�0@�A�A��	 � � � � �
 �
 r]c���d|vrK|d}|�dg��}|�dg��}|�dd��}n.t|�dd����r	dd	g}g}d}ndSt|||��}|d
���D]+\}}	|�t||	��|||���,|���dS)N�run_asr��environment�working_directoryr��testrz
$(TargetPath)z--gtest_print_timer)rJr�r�r�AddDebugSettingsr�r=)
�project_pathr�r�r�r�r�r�r�r�rs
          r[r�r��s��
����
�(�^�F�
�Z�Z��"�
%�
%�F��*�*�]�B�/�/�K��
�
�#6��<�<���
�4�8�8�F�A�������3�
4�F��K����
�F�!�,���>�>�)�!�"2�3�9�9�;�;�G�G��k�6�
����{�F�C�C�%�{�4E�G�G�G�G��������r]c�`�t|��}|D]\}}}}t|||||����dS)Nr)�
_GetCopiesr)r]r�r�rrr�rs       r[r�r��sX���d���&�+1�9�9�'�f�g�s�K��>�&�'�*�C�9�9�9�9�9�9�9r]c��g}|�dg��D�]f}|�dg��D�]K}tj�|dtj�|����}|�d��r�|dd�}t
j|��d}t
j|��d}t|��}d|�d	|�d
�}	d|	�dt|���d
|�d|	��}
|�	|gd|g|
d|�d|��f����t|d��}d|�dt|���dt|���d�}
|�	|g|g|
d|�d|��f����M��h|S)Nr�r��destinationrgrirrCr�rhrozmkdir z
 2>nul & cd "z" && xcopy /e /f /y "z" �dummy_copieszCopying z to zmkdir "z&" 2>nul & set ERRORLEVEL=0 & copy /Y "z" ")
rJrHr`rlr�r��	posixpathr"ror�)r�r�r��src�dst�src_bare�base_dir�	outer_dir�	fixed_dst�full_dstr��fix_dsts            r[r�r��s���
�&�
�X�X�h��
#�
#�P�P�c��w�w�w��#�#�P�P���G�L�L��]�+�R�W�-=�-=�c�-B�-B�C�C�c�

���c�	�	�P��s��s�8���?�8�,�,�Q�/���O�H�-�-�a�0�	��S�M�M�	�	�#,�9�9�i�i�i�8����H�H�h�x�(�(�(�(�)�)�)�X�X�?���
�
��u�~�s�3�S�S�-0�S�S�)�)�<�>�	?�	?�	?�	?��3�}�-�.�.����G�G�X�c�]�]�]�]�H�S�M�M�M�M�3���
�
��u�s�e�S�S����W�W�*M�N�O�O�O�O�%P�&
�-r]c���|r|�tj��r|Stj�|��\}}t||��}||vrt
��||<||Sr�)r�rH�sepr`r"�_GetPathDictr�)�rootr`�parent�folder�parent_dicts     r[r�r��sp��
�����r�v�&�&���K��7�=�=��&�&�.�&�&��T�6�*�*�+��;����&�&�K���	�V�	�r]c��g}|���D]�\}}t|��tkr�ttj�||��||��}|r||z
}�Ttjtj�||��d|zdz|���}|�	|����|�	|����|S)N�(�))r6�entries)
rr�r��_DictsToFoldersrHr`rlr��
MSVSFolderr�)�	base_path�bucket�flat�childrenr�r��folder_childrens       r[r�r��s���
�(� �,�,�.�.� � ��f�h��H�~�~����'�����Y��(G�(G�(0�$�8�8�o�	
�)��O�#���!�,�R�W�\�\�)�V�-L�-L�25��,��2D�5D�F�F�F��	����(�(�(�(��o�o�h�����	�/r]c�V�t|��tkrXt|��dkrEtt	|����|dzkr"|tt	|����St|��tkr|S|D]}t|||��||<�|S)NrC�.vcproj)r�r�r��next�iter�_CollapseSingles)r��node�childs   r[r�r��s����4�j�j�D���	�$�i�i�1�n�n�
�4��:�:���&�9�,�,�,���T�$�Z�Z� � �!�!�	�$�Z�Z�4����K��7�7�e�"�5�$�u�+�6�6�D��K�K�	
�+r]c��i}|D]i}tj�|��dd�\}}tj�|��}t
||��}||||dz<�jt|��dkr�t|tt|������tkrm|tt|����}t|��dkr8t|tt|������tk�mtd|��}td||��S)Nrrnr�rCr)rXrY�ParseQualifiedTargetrHr`r#r�r�r�r�r�r�r�r�)	�sln_projects�project_objectsr�r�rr��targetr��	path_dicts	         r[�_GatherSolutionFoldersr��s��	�$��7�7�a��z�6�6�q�9�9�!�A�#�>��H�f��g�o�o�h�'�'�G��T�7�+�+�I�$3�A�$6�I�f�y� �!�!�	�D�	�	�Q���4��T�$�t�*�*�%5�%5� 6�7�7�4�?�?���T�$�Z�Z� � �!�D�	�D�	�	�Q���4��T�$�t�*�*�%5�%5� 6�7�7�4�?�?�
�"�d�	#�	#�$�	��T�4�	(�	(�(r]c��t|��}|�d��}|s%|d|jz|���z}tj�|��}tj�	tj�
|��|��}d}|jr�tj�
tj�|����}	tj�	|j|��}tj�
|	tj�
|����}||fS)Nr�r1)r�rJr9�ProjectExtensionrXrY�	BuildFilerHr`rlr#�generator_output�abspathr�)
�qualified_targetr�rAr~r��
proj_filenamer�r��
fix_prefix�project_dir_paths
          r[�_GetPathOfProjectr�	s��+�D�1�1�.� �$�$�%;�<�<�-�	�6��-�(�7�>�9�!�2�2�4�4�5�M��z�#�#�$4�5�5�*��g�l�l�2�7�?�?�:�6�6�
�F�F�)��*���E��w���r�w���y�'A�'A�B�B������W�5�y�A�A�I���(�(�)9�)+�����)C�)C�E�E�J�	�J�	�r]c��i}|d���D]_\}}t||��}|�dt|����}t	|t|�����d|��}|||<�`|S)Nr�msvs_target_platformr�)rr�rJr�r�)r��config_platform_overridesr�rS�config_fullnamerE�fixed_config_fullnames       r[�_GetPlatformOverridesOfProjectr�s���!���-�.�4�4�6�6�G�G�n�k�1�%�k�1�5�5�O��u�u�+�_�Q�-?�-?�@�@�H���_�Q�%7�%7�8�8�8�8�(�(�D��1F��o�.�.�	"�"r]c
��
�i�
|D]�}||}|ddkrtd|z���t||||��\}at||��}t	|��}t
j�|��}	tj	||d|||	|t���}
|�
��r$|
�t|||����|
�
|<�߉
�
��D]Z}|j�d��s>|j�dg��}�
fd�|D��}|�|���[�
S)	aXCreate a MSVSProject object for the targets found in target list.

  Arguments:
    target_list: the list of targets to generate project objects for.
    target_dicts: the dictionary of specifications.
    options: global generator options.
    msvs_version: the MSVSVersion object.
  Returns:
    A set of created projects, keyed by target.
  r�r�z9Multiple toolsets not supported in msvs build (target %s)r1)r6r�r�r�r�rjr,�dependenciesc� ��g|]
}�|��Srrrr)rur�projectss  �r[rwz)_CreateProjectObjects.<locals>.<listcomp>Ts���
(�
(�
(�a�h�q�k�
(�
(�
(r])rr�rjr�r�rXrYr�r�r�r��set_msbuild_toolsetr��valuesr�rJ�set_dependencies)�target_list�target_dictsrAr~r�r�r�r��	overridesr��objr��depsr�s             @r[�_CreateProjectObjectsr(s�����(�%�%�%���(�)�D��I��(�"�"��
E�
��
�
��!2�2B�D�29�<�!I�!I��I�~��Y��-�-�D�.�t�4�4�I���%�%�&6�7�7�J�
�
��
�-�
 �
�
��"+�%�'�'�'�C����!�!�F�	���
%�i��|�
D�
D�F�F�F�!$�H�
������"�"�%�%�g��<���3�4�4�%�
�\�
�
�n�b�
1�
1�d�
(�
(�
(�
(�4�
(�
(�
(�d�
���t�$�$�$��	�/r]c��|D�]O}||}|�d��r�!|�dd��}d|d<|�d��s�tj�|��\}}}tj�|��}d}	|�d��dkr|	d	z
}	tj�tj�|d
j	|��tj|��|	��|d<|�d��s	|dd
dg|d<|�d��s
|dd
ddg|d<��QdS)a�Initialize targets for the ninja flavor.

  This sets up the necessary variables in the targets to generate msvs projects
  that use ninja as an external builder. The variables in the spec are only set
  if they have not been set. This allows individual specs to override the
  default values initialized here.
  Arguments:
    params: Params provided to the generator.
    target_list: List of target pairs: 'base/base.gyp:base'.
    target_dicts: Dict of target properties keyed on target pair.
  r,�msvs_path_to_ninjaz	ninja.exe�ninjar-�$(Configuration)�target_arch�x64�_x64rAr.z-CrrKr/z-tcleanN)rJrXrYr�rHr`r#rlr��toplevel_dir�ninja_generator�ComputeOutputDir)
�paramsr�rr�r��
path_to_ninjar�r�r�r�s
          r[�_InitNinjaFlavorrYsw��&�!�!���(�)�D��x�x�'�(�(����H�H�1�;�?�?�M�$+�D�	 �!��8�8�3�4�4�	��z�6�6�7G�H�H�n�h��1������)�)�g�(�m�	���M�	"�	"�e�	+�	+����
�.0�g�l�l�

�*�
!�
!�&��"3�"@�'�
J�
J�
�
*�6�
2�
2�
�/�/�d�*�+��8�8�5�6�6������	1�d�,�-��8�8�5�6�6�������1�d�,�-��7!�!r]c��|�di��}tj|�dd����}||d<|���|d<tj�dd���d��dks7tj�d	d���d��dkrd
|d<nd|d<tj�	|��d
krd|d<dSdS)z4Generated variables that require params to be known.r�r~�auto�MSVS_VERSION�PROCESSOR_ARCHITECTUREr�64r�PROCESSOR_ARCHITEW6432�@�MSVS_OS_BITS� rz$(OutDir)genrN)
rJr��SelectVisualStudioVersion�	ShortNamerHrIr�rXrY�	GetFlavor)�default_variablesrr�r~s    r[�CalculateVariablesr�s���J�J�0�"�5�5�/��6����.�&�1�1�3�3�,�(�&���'3�&<�&<�&>�&>��N�#�	�j�n�n�-�r�2�2�7�7��=�=��B�B��j�n�n�-�r�2�2�7�7��=�=��B�B�(*��n�%�%�(*��n�%��Z���&�!�!�W�,�,�3A��/�0�0�0�-�,r]c���|d}|d}tj�|jddd��}|���D]g\}}tj�|��\}}	|	dkr�.||jzdz}
|jr%tj�|j|
��}
�h|D]1}||
d|g}td	|�d
|����tj	|��}
�2dS)NrAr~�Common7�IDEz
devenv.com�.gyp�.slnz/Buildz
Building [z]: )
rHr`rlrr!r9r�r�rK�
check_call)�datarrrAr~�devenvr��build_file_dict�build_file_root�build_file_ext�sln_pathr@r��rtns              r[�PerformBuildr-�s���9��'���'�,�
�7�<�<��)�9�e�\�J�J�&�%)�Z�Z�\�\�B�B�!�j�/�(*��(8�(8��(D�(D�%�_�n���������/�&�8�H���B�����g�6��A�A�h���+�+�f���8�V�4�I�	�E������
3�4�4�4�
�
�	�
*�
*�C�C�+�+r]c��|�d��dkrd|dj}tj�tj�|t
j|��d����}||d�adSdS)N�flavorrrAzgypfiles-msvs-ninja)�toplevel�qualified_out_dir)	rJrrHr`rarlr
r�generator_filelist_paths)rr0r1s   r[�CalculateGeneratorInputInfor3�s����Z�Z����W�$�$��i� �-�H���(�(������/�2�6�:�:��*�*� � ���.� � ����%�$r]c	�x�|d}|d}|�di��}tj||��\}}tj||t��\}}|�d��dkrt|||��t
��}|D]M}||}	|	d���D](\}
}|�t|
|�����)�Nt|��}t||||��}g}
|���D].}|j
a
|
�t||||�����/da
|D�]	}|�d��s�t"j�|��d	|jzd
z}|jr%t"j�|j|��}t.j�||��}|t.j�||��z
}t7|||������}t;j|||d|�
��}|�����|
r^dd�t
|
����z}|�dd��rtA|���tCd|z��dSdS)a
Generate .sln and .vcproj files.

  This is the entry point for this generator.
  Arguments:
    target_list: List of target pairs: 'base/base.gyp:base'.
    target_dicts: Dict of target properties keyed on target pair.
    data: Dictionary containing per .gyp data.
  rAr~r�r/rrNr#rr$)r�F)r��variants�websitePropertiesr�zMissing input files:
rO�msvs_error_on_missing_sourcesz	Warning: )"rJ�MSVSUtil�ShardTargets�InsertLargePdbShims�generator_default_variablesrr�rr*r�r�rr�rj�extendr�r�rHr`r!r9r�rlrXrY�BuildFileTargets�DeepDependencyTargetsr��FlatSolutionr��MSVSSolution�Writerr�)r�rr&rrAr~r��configsr�r�r�r@r�r�r�r�r+r��root_entries�sln�
error_messages                     r[�GenerateOutputrF�s��
�9��'���'�,��J�J�0�"�5�5�/�!)� 5�k�<� P� P��;��!)� <��\�#>�!@�!@��;���Z�Z����W�$�$��V�[�,�7�7�7�
�E�E�'�%�8�8���(�)�D�#�$4�5�;�;�=�=�8�8���V�
�k�k�/�+�v�6�6�7�7�7�7�8���M�M�'�*�+�|�W�*6�8�8�/��/� �'�'�)�)�>�>�g��+�N����+�G�W�l�,;�=�=�>�>�>�>��.����j����v�&�&����w���
�+�+�A�.���?�&�H�H���B�����g�6��A�A�h��:�.�.�{�J�G�G�L��C�J�4�4�\�<�P�P�P�L�)��o�L�,E�,E�,G�,G�I�I�I�L��
�x�'3�(/�16�'3�	5�5�5�C�
�I�I�K�K�K�K��)�,��I�I�c�/�2�2�3�3�4�M����:�E�B�B�)��]�#�#�#��K�-�'�(�(�(�(�(�
)�)r]c��g}g}td|||||��|r+dddd�dg|zdg|zg}tj||dd���d	Stj�|��rtj|��d	Sd	S)
aVGenerate the filters file.

  This file is used by Visual Studio to organize the presentation of source
  files into folders.

  Arguments:
      filters_path: The path of the file to be created.
      source_files: The hierarchical structure of all the sources.
      extension_to_rule_name: A dictionary mapping file extensions to rules.
  r�Projectz4.0�3http://schemas.microsoft.com/developer/msbuild/2003)�ToolsVersion�xmlns�	ItemGroupT��prettyr:N)�_AppendFiltersForMSBuild�easy_xml�WriteXmlIfChangedrHr`�exists�unlink)�filters_path�source_files�rule_dependencies�extension_to_rule_name�filter_group�source_group�contents       r[�_GenerateMSBuildFiltersFiler[s����,��,��2�|�->�1�<��O�O�O���� %�N����}�|�+��}�|�+��G�
��w��T��N�N�N�N�N�N�	�w�~�~�l�#�#���I�l�������r]c	��|D]�}t|tj��rc|s|j}n|�d|j��}|�dd|idtj|j��gg��t||j||||���t|||��\}}	|	d|ig}
|r|
�d|g��|�|
����dS)a�Creates the list of filters and sources to be added in the filter file.

  Args:
      parent_filter_name: The name of the filter under which the sources are
          found.
      sources: The hierarchy of filters and sources to process.
      extension_to_rule_name: A dictionary mapping file extensions to rules.
      filter_group: The list to which filter entries will be appended.
      source_group: The list to which source entries will be appeneded.
  rhr��Include�UniqueIdentifierN)
r�r�r�r6r�r�r�rOr��_MapFileToMsBuildSourceType)�parent_filter_namer�rVrWrXrYrc�filter_namer��element�source_entrys           r[rOrO4s)���(�(�f��&�+�,�-�-�(�
�C��k���"4�"4�"4�f�k�k�B������i��-��� 0��� =� =�>�@�A�A�A��{�F�O�0�2H�+�\�;�;�;�;�
/�v�7H�/E�G�G�j�a���	�6�2�3�l�	�<����X�'9�:�;�;�;����,�'�'�'�'�/(�(r]c���tj�|��\}}||vrd}||}n@|dvrd}d}n7|dvrd}d}n.|dkrd	}d
}n#|dkrd}d
}n|dkrd}d}n
||vrd}d}nd}d}||fS)aReturns the group and element type of the source file.

  Arguments:
      source: The source file name.
      extension_to_rule_name: A dictionary mapping file extensions to rules.

  Returns:
      A pair of (group this file should be part of, the label of element)
  r�)r�r�r�r�rP�	ClCompile)z.hz.hxx�include�	ClIncludez.rc�resource�ResourceCompilez.asm�masm�MASMr��midl�Midl�rule_dependency�CustomBuildr�None)rHr`r!)rcrVrWr�r�rSrbs       r[r_r_[s����7���F�#�#�&�!�S��"�"�"��E�$�S�)�G�G�
�+�+�+��E��G�G�
�n����E��G�G�
�e�|�|��E��G�G�
�f�}�}��E��G�G�
�f�}�}��E��G�G�
�"�"�"��E��G�G��E��G�
��	�r]c
�n�|�dg��}
d�|
D��}d�|
D��}g}
|D]~}d|vr|�dg��s�t||��}|
�|��|�|j�d����|j|	|j<�|
r�|d|jz}|dz}|d	z}|d
z}|�	|��|�	|��tj�||��}tj�||��}tj�||��}t||
��t||
��t||
��|rt!||||||��t#|
||d��dS)Nr?c�X�g|]'}t|�dd�����%|��(Sr�r�r�s  r[rwz,_GenerateRulesForMSBuild.<locals>.<listcomp>�r�r]c�X�g|]'}t|�dd�����%|��(Sr�r�r�s  r[rwz,_GenerateRulesForMSBuild.<locals>.<listcomp>�r�r]r�r'rr1z.propsz.targetsz.xmlT)rJ�MSBuildRuler�rr8r"r2r3r9r*rHr`rl�_GenerateMSBuildRulePropsFile�_GenerateMSBuildRuleTargetsFile�_GenerateMSBuildRuleXmlFilergr�)r@rAr�r�r��props_files_of_rules�targets_files_of_rulesr]rVrWr?r�r��
msbuild_rulesr��msbuild_rule�base�
props_name�targets_name�xml_name�
props_path�targets_path�xml_paths                       r[�_GenerateRulesForMSBuildr��s����(�(�7�B�
�
�%�N�N�U�N�N�N�,�L�L�u�L�L�L�.��-��L�L�d��t���D�H�H�^�R�$@�$@����t�T�*�*�L�����&�&�&����\�A�G�G��L�L�M�M�M�5A�5K��<�1�2�2��9��
����/�D����J��*�$�L��f�}�H����Z�(�(�(����|�,�,�,�����j�*�5�5�J��7�<�<�
�L�9�9�L��w�|�|�J��1�1�H�!�*�m�<�<�<�#�L�-�@�@�@���-�8�8�8��=��>�:�t�"�G�^�=�=�=����)9�4�@�@�@�@�@r]c��eZdZdZd�ZdS)rta-Used to store information used to generate an MSBuild rule.

  Attributes:
    rule_name: The rule name, sanitized to use in XML.
    target_name: The name of the target.
    after_targets: The name of the AfterTargets element.
    before_targets: The name of the BeforeTargets element.
    depends_on: The name of the DependsOn element.
    compute_output: The name of the ComputeOutput element.
    dirs_to_make: The name of the DirsToMake element.
    inputs: The name of the _inputs element.
    tlog: The name of the _tlog element.
    extension: The extension this rule applies to.
    description: The message displayed when this rule is invoked.
    additional_dependencies: A string listing additional dependencies.
    outputs: The outputs of this rule.
    command: The command used to run the rule.
  c��|d|_tjdd|j��|_d|jz|_|jdz|_|jdz|_|jdz|_d|jz|_|jdz|_	|jd	z|_
|jd
z|_|d|_|j�
d��sd|jz|_tj|�d
|j����|_t%|�dg����}d�d�|D����|_t%|�dg����}d�d�|D����|_t-||dd���}tj|��|_dS)Nr2z\Wr��AfterTargets�
BeforeTargets�	DependsOnzCompute%sOutput�
DirsToMake�_inputs�_tlogr3r�r5rrc�6�g|]}tj|����Srr�r��ConvertVCMacrosToMSBuildrts  r[rwz(MSBuildRule.__init__.<locals>.<listcomp>�s3��8�8�8���7��:�:�8�8�8r]rc�6�g|]}tj|����Srrr�rts  r[rwz(MSBuildRule.__init__.<locals>.<listcomp>�s3��3�3�3�!"�*�B�1�E�E�3�3�3r]Tr4)�display_namerOrur2r1�
after_targets�before_targets�
depends_on�compute_output�dirs_to_maker�tlogr3r�r�r�rJrryrlr8rr�r�)�selfr�r��old_additional_dependencies�old_outputs�old_commands      r[�__init__zMSBuildRule.__init__�s����[�)�D���V�E�3��(9�:�:�D�N��T�^�+�D����.�8�D���.�?�:�D���n�{�2�D�O�+�d�n�<�D�����5�D���.�9�,�D�K����(�D�I��+�&�D�N��>�$�$�S�)�)�,��T�^�+�d�n�#�<�����D�N�+�+�-�-�D��"+�D�H�H�X�r�,B�,B�"C�"C�����8�8�6�8�8�8�	9�	9�	� ��D�H�H�Y��3�3�4�4�K��8�8�3�3�&1�3�3�3�4�4�D�L�*�4��d�8<�>�>�>�K��8��E�E�D�L�L�Lr]N)�__name__�
__module__�__qualname__�__doc__r�rrr]r[rtrt�s2��������&F�F�F�F�Fr]rtc�>�dddig}|D]{}|�ddd|j�d|j�d�i|jd	g|jd
ggd|jddid|jzggd
|jd|jgd|jgd|jgd|jgggg���|tj
||dd���dS)zGenerate the .props file.rHrKrI�
PropertyGroup�	Conditionz'$(z)' == '' and '$(z1)' == '' and '$(ConfigurationType)' != 'Makefile'rmroz$'$(ConfigurationType)' != 'Makefile'z_SelectedFiles;$(%s)�ItemDefinitionGroup�CommandLineTemplater�ExecutionDescriptionr
TrMN)r<r�r�r�r2r�rrr8rPrQ)r�rzrZr�s    r[ruru�s��
��L�
M�
O�'����d��N�N�	�
�+�48�4G�4G�4G�48�4F�4F�4F�H�
��
�v�	&�
�
�m�	,�
	
�
�
�/��>�
?�
 �4�?�
2�
�	
�
�
�.� �$�,�
/��d�l�
#�!�4�#3�
4�#�T�%A�
B�	
�	
������0��W�j��T�J�J�J�J�J�Jr]c�p�dddig}ddddigg}|D](}|�dd|jid	|jgg���)|�|��|D]%}|�d
|jddd
�ddgg���&|D�]�}|j}d|z}d|�d|�d�}d|z}d}	dddi|d|zdd�gg}
d|jdd|zigg}d|jd|zd|�d|�d�d�dd |zgd!d"|jzggg}d#d$d%|zd&�g}
d'd(|j�d)|j�d�d*d+|j�d,|j�d-�d.�g}d'd(|j�d)|j�d�d/d+|j�d0|j�d1�d.�g}|d(|�d)|�d�d2d$d$d3|zd4|z|d5�g}|�d6|jd7|jzd7|jzd8|zd9|j�d:|j	��||d;�|
|||
|||g	d<d=d>d?|j	zgd@dAd?|j	zggd6|j	d8|zdB�d|j
d(|�d)|�d�d|zdC�gdDd|j
z|	d�gdEd|j
z|	d�gdFd|j
z|	d�ggdGdHdI|j
ziggg�����tj||dJdJ�K��dLS)MzGenerate the .targets file.rHrKrIrL�PropertyPageSchemar]z5$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml�AvailableItemName�Targets�	UsingTask�XamlTaskFactoryzMicrosoft.Build.Tasks.v4.0)�TaskName�TaskFactory�AssemblyName�Taskz%%(%s.Outputs)z%(z
.Identity);%(z..AdditionalDependencies);$(MSBuildProjectFile)z%%(%s.Identity)zd'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'r�z'@(SelectedFiles)' != ''z@(%s)z#'%(Identity)' != '@(SelectedFiles)')�Remover�z%%(%s.AdditionalDependencies)z'%(z.Outputs)' != '' and '%(z.ExcludedFromBuild)' != 'true')r]r��Sourcez
@(%s, '|')�Inputsz@(%s -> '%%(Fullpath)', ';')�Message�Highz%%(%s.ExecutionDescription))�
Importance�Text�WriteLinesToFilez'@(z)' != '' and '%(z$$(IntDir)$(ProjectName).write.1.tlogz^%(z.Source);@(z->'%(Fullpath)'))r��File�Linesz#$(IntDir)$(ProjectName).read.1.tlogz.Source);%(z.Inputs)rz%%(%s.CommandLineTemplate)z%%(%s.AdditionalOptions))r��EchoOff�StandardOutputImportance�StandardErrorImportancer�rcr��Targetz$(%s)z
'@(%s)' != ''z$(z);)�Namer�r�r��DependsOnTargetsrr�r��ComputeLinkInputsTargetsz$(ComputeLinkInputsTargets);z%s;�ComputeLibInputsTargetsz$(ComputeLibInputsTargets);)r�r�)r�r]rArC�ImpLib�MakeDirr�z!@(%s->'%%(RootDir)%%(Directory)')TrMN)
r�r2r1rr�r<r�r�r�r�r�rPrQ)r�rzrZ�
item_groupr�r2�target_outputs�
target_inputs�rule_inputs�extension_condition�remove_section�inputs_section�logging_section�message_section�write_tlog_section�read_tlog_section�command_and_input_sections                 r[rvrv	s���
��L��
�'�
���J�K���*����d����	�
�T�^�	$�
�T�%�	&�	
�����

�.�.��������d��N�N�	��n�*�6�
�
��I�	J�	
������D�D�d���I�%�	�1�N�N�1:���I�I�I�G�M�#�i�/�K�4��
	�	�0�1�	��i�'�<�
�
�	
��N�	�	
��y�"A�I�"M�N�O��N�
	�	
��%�	�1�1�#���I�I�I�/�
�
�
�L�9�,�	-�
�2�T�[�@�	A�	
��O�	��.��:�	
�	
��O�	���Y�Y�Y��	�	�	�+�7�7�<@�I�I�I�<@�I�I�I�G�	
�	
���	���Y�Y�Y��	�	�	�+�6�6�48�I�I�I�t�y�y�y�I�	
�	
���	�	��Y�Y�	�	�	�+��%+�$*� <�y� H�8�9�D��	
�	
�!���N�N�	��"�"�T�%8�8�!�D�$6�6�&��2�2�,0�O�O�O�,0�,?�,?�A�#�!�
�
�
�	�	�	�	�	�	"�!	
�$
�
$�
(�
�$�%�
%�
�$�
'�
�$�%�
%�
�		
�
��%�&��2�
�
�����6?�i�i����L�'�)�3�
�
���(�4�+<�<�,�
�
��
�(�4�+<�<�,�
�
��
�(�4�+<�<�,�
�
��#
�.��>��,�-��
�7 	
�;>�>�>�>�>�~��W�l�4�t�L�L�L�L�L�Lr]c��dddddd�g}|D�](}|�d|jd|jd	d
�ddd
|jd�ggddddidddgggdddd�dddggggdddddd�ddd
|jdd�gggd d!dd"d"d#�gd$|jdd%d"d&�d'dd(ggd)dd*ggd+d,d-d.|jzd/�ggd0dd
dd1�gggd$|jdd%d"d&�d'dd2ggd)dd3ggd+d,d-d.|jzd/�ggd0dd
d4dd5�gggdd6d6d"d"d#�gd d7d8d"d"d#�gdd9d:d"d;d<�gd d=d=dd>�d?dd@ggdAdd@ggggdB|j|jdC�gdDdE|jz|jdF�gdG|jd4|jdH�gg����*t
j||dIdI�J��dS)KN�ProjectSchemaDefinitionszTclr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Frameworkz,http://schemas.microsoft.com/winfx/2006/xamlz&clr-namespace:System;assembly=mscorlibz+Microsoft.Cpp.Dev10.ConvertPropertyCallback)rKzxmlns:xz	xmlns:syszxmlns:transformCallback�Ruler��200)r��PageTemplate�DisplayName�OrderzRule.DataSource�
DataSource�ProjectFile)�Persistence�ItemTypezRule.Categories�Categoryr��GeneralzCategory.DisplayNamez
sys:StringzCommand Liner)r��Subtype�StringListPropertyr�rr�)r�r��
IsRequired�SwitchzStringListProperty.DataSource�Item)r�r��
SourceType�StringPropertyr��False)r�r��Visible�IncludeInCommandLine�DynamicEnumPropertyr�)r�r��EnumProviderr�zDynamicEnumProperty.DisplayNamezExecute BeforezDynamicEnumProperty.Descriptionz@Specifies the targets for the build customization to run before.z$DynamicEnumProperty.ProviderSettings�
NameValuePair�Excludez^%s|^Compute)r��ValuezDynamicEnumProperty.DataSource)r��HasConfigurationConditionz
Execute Afterz?Specifies the targets for the build customization to run after.r)r�r�r�rr�zExecution Descriptionr
zAdditional Dependencies�false)r�r�r�r�rc)r�r�r�zStringProperty.DisplayNamezAdditional OptionszStringProperty.Descriptionr�)r�r��
FileExtensionr�)r��ContentTyper�)r�r�r�TrM)r<r2r�r�r�r3rPrQ)r�rzrZr�s    r[rwrw�	s���!�6�@�<�4���	
�'��b�b�d��N�N�	��.� ��*��
�
�
��(���
�
��
����I��"�
�9�%�
���"�$�
�
�
#�
�>�*�
�	�
� ��%�����
+��)���!�
�
�
��

��(�(��#*���
� ��&� �$�#*���
-��*�+��-���
��
2���$�t�':�:�
�
�
��,��)�*0�
�
�
��+
�: ��%� �$�#*���
-��/�*��-��,�
��
2���$�t�'9�9�
�
�
��,��)��*0�
�
�
��+
�<��#��#*���
��)�1��#*���
��+�3�#*����
��)�&�%���(��.�/��(��.�/��
�GO	
�`
��.��*�
�
�	
�

����&���
�
�	
�

��.���n�
�
�	
�wa�a�a�a�a�D��W�h�t�4�H�H�H�H�H�Hr]c�n�|�dd��d}|�dd��}||fS)Nr�rCrr�r�)�rsplitrJ)r6r5r�rEs    r[�_GetConfigurationAndPlatformr�[
s9���+�+�c�1�%�%�a�(�-�
�\�\�7��
A�
A�(�
��	"�"r]c�(�dt||��zS)Nz''$(Configuration)|$(Platform)'=='%s|%s')r�)r6r5s  r[�_GetConfigurationConditionr�a
s��
4�
&�t�X�
6�
6�7�8r]c���dddig}t|�����D]>\}}t||��\}}|�d|��}|�dd|id|gd|gg���?|gS)	NrL�Label�ProjectConfigurationsr��ProjectConfigurationr]�
Configuration�Platform)r�rr�r�)rrSr6r5r�rE�designations       r[� _GetMSBuildProjectConfigurationsr�f
s�����"9�:�
;�%� ��!5�!5�!7�!7�8�8�"�"��t�X�:�4��J�J��M�8�*�]�]�H�H�5�K�	�L�L�	�)�[�!9�
�=�	)�
�h�	�	!�"�"�"�"���.r]c��tj�|��d}dddid|gddgd|gd	d
ggg}tj�d��dks#tj�d
��dkr|d�ddg��|�d��r�|�d��}|d�d|g��|�d��r3|�d��}|d�d|g��n|d�d|g��|�d��r�|d�ddg��|d�dd
g��|�d��r3|�d��}|d�d|g��n|d�ddg��|�d��r|d�ddg��n|d�ddg��d}	d}
|d���D]+}|	pt|��}	|
pt||��}
|	r|
rn�,|
r+|d�dt|
��g��n&|j
rt|j�d |j
�d!����|	d"kr|d�d#d
g��|S)$Nrr�r��Globals�ProjectGuid�Keyword�	Win32Proj�
RootNamespace�#IgnoreWarnCompileDuplicatedFilenamerr�AMD64r�PreferredToolArchitecturer
r5�WindowsTargetPlatformVersionr6�WindowsTargetPlatformMinVersionr1�DefaultLanguagezen-US�AppContainerApplicationr4�ApplicationTypeRevisionz8.1r3�ApplicationTypez
Windows Phonez
Windows Storerz requires any SDK of z version, but none were found�ARM�WindowsSDKDesktopARMSupport)
rHr`r!rIrJr�r�r�r�r�r�rr)r�r�r��
gyp_file_name�	namespace�
properties�target_platform_version�target_platform_minversion�app_type_revisionr�r�r�s            r[�_GetMSBuildGlobalPropertiesrr
s����g���}�-�-�a�0�)���)�,�	���	�K� �	�)�$�	.��7�	��*��Z�^�^�,�-�-��8�8��Z�^�^�,�-�-��8�8��q�M���5�u�=�>�>�>�	�X�X�,�-�-�
6�"�h�h�'E�F�F���q�M���8�1�3�4�4�4��x�x�1�2�2�6�#'�8�8�,M�#N�#N� ���m���=�6�8�9�9�9�9���m���=�3�5�6�6�6�
�X�X�!�"�"�A��q�M���+�W�5�6�6�6��q�M���3�V�<�=�=�=��x�x�0�1�1�?��(�(�#C�D�D����m���5�7H�I�J�J�J�J���m���5�u�=�>�>�>��x�x�&�'�'�A���m���-��?�@�@�@�@���m���-��?�@�@�@��-�!���,�-�4�4�6�6���m�!�C�_�]�%C�%C�M� 8�!N�5�m�W�M�M����1���e���C��q�M���8��6�7�7�9�:�:�:�:���C�
��'�'�'��)@�)@�)@�B�C�C�C��e����q�M���7��@�A�A�A�	�r]c	��i}|d���D]�\}}t|||��}t||��}|�d��}|�d��}t	||d|��|dkr1t	||dd��t	||dt|����|rd|vrt	||d|����t
|d	|��S)
Nr�CharacterSetro�Driver�
DriverType�WDM�
TargetVersionr1r�)r�_GetMSBuildAttributesr�rJ�_AddConditionalPropertyr��_GetMSBuildPropertyGroup)	r�r�rr6r5�msbuild_attributes�	condition�
character_setr�s	         r[�_GetMSBuildConfigurationDetailsr!�
s���*��-�.�4�4�6�6�/�/�n�d�H�.�t�X�z�J�J��*�4��:�:�I�&�*�*�>�:�:�M�$�(�(�)<�=�=�K��J�	�3F�'�)�)�)��h����j�)�\�5�I�I�I��j�)�_�2�8�<�<�>�>�>��/�	�D�	(�	(��
�I�~� -�	/�	/�	/��	!�$���	D�	D�Dr]c�"�i}|r
dddid|ggg}|S)Nr�r��Locals�PlatformToolsetrr)r�rs  r[�_GetMSBuildLocalPropertiesr%�
s5���*���	�7�H�-��o�
.�	
��J�

�r]c��d}i}d}t|�����D]9\}}t||��}d|vrt|d��||<d}�4d||<�:|sdddid	|d
|zdd�gggSg}|���D]I\}}	dd|d
�d	|d
|zdd�gg}
|	D]}|
�d	d|ig���|�|
���J|S)Nz3$(UserRootDir)\Microsoft.Cpp.$(Platform).user.propsF�
msbuild_propsTr�ImportGroupr��PropertySheets�Importzexists('%s')�LocalAppDataPlatform)rHr�r�)r�r�rH)r�rr�ryr�)r�
user_props�additional_props�props_specifiedr6r5r��sheetsr�props�import_group�
props_files            r[�_GetMSBuildPropertySheetsr3�
st��E�*����/��~�3�3�5�5�6�6�*�*�n�d�H�.�t�X�>�>�M��(�"�"�(1�(�?�2K�(L�(L��}�%��o�o�')��m�$�$�	��	�
�#�	$�
� �&��3�*���
�	
�
�
��F�,�2�2�4�4�"�"��	�5��"��	
�	
�
��%�
�2�)�
�
�	
��l��@�@�*����X�	�*�'=�>�?�?�?�?��m�m�L�!�!�!�!��Mr]c�r�t||��}t|||��}i}|D]�}|dvr:tj||��}|�d��s|dz
}|||<�@|dkrt||��||<�_|dkrt
||��||<�~td|z����|S)N)rqrprhrroz3Warning: Do not know how to convert MSVS attribute )r�rir�r�r��_ConvertMSVSCharacterSet�_ConvertMSVSConfigurationTyper�)r�r@r�r��msvs_attributesrrt�	directorys        r[�_ConvertMSVSBuildAttributesr9�
s���)�$�
�;�;�+�&�t�V�[�A�A�/����G�G�a��8�8�8��7���8J�K�K�i�
�
�
��
%�
%���T��	�'�����	
�n�	�	�6��q�7I�J�J�����	
�!�	!�	!�;�O�A�<N�O�O������A�A�E�F�F�F�F�	�r]c�F�|���rdddd�|}|S)N�	MultiByte�Unicode)r�r�r���isdigit)�char_sets r[r5r5s<��
������
�
�
����	�H�

�/r]c�J�|���rdddddd�|}|S)N�Application�DynamicLibrary�
StaticLibraryr�Utility)r�r�r�r�r�r=)r�s r[r6r6sC��������
�
�
�
�����
�K�
�r]c���d|vrt|||��}n�t||��}t|��}|�di��}|�d|��|�dd��}t|��dz|d<d|vrtd��dz}||d<d|vrt
|d��|d<d	|vr6|�d
d��}|�dd
��}||z}	|	|d	<d|vr!d|vr|�d��}
d|
z|d<|�d��r+|�dd��}t|��dz|d<dddddd�}|�|d��}
|
rY|d}||
�d��}|rt|��|d<||
�d��}|r||d<|S)N� msbuild_configuration_attributesrorpz$(SolutionDir)$(Configuration)rhrqrr�
TargetNamerIrrJrK�	TargetExtrHr�r,r-rArCrDr��finalized_msbuild_settingsr�
TargetPath)r9r�r6rJr�ror5)r�r@r�rr�r@rvr�rJr1r��external_out_dir�msbuild_tool_maprM�msbuild_settingsr-�
target_exts                 r[rr$sk��'�v�5�5�4�T�6�:�N�N���,�D�*�=�=�K�/��<�<�K����$F��K�K���!�!�"5�{�C�C�C�#�'�'�(9�&F�H�H�J�,4�Z�,@�,@�4�,G��(�)��&8�8�8��0�1�1�D�8�l�4@��0�1��+�+�+�+C�
�^�
,�,.�,.���(��+�+�+�
�X�X�&��
+�
+�F��8�8�N�,<�=�=�L��<�'�K�'2��|�$��*�*�*�/B�d�/J�/J�
�(�(�&�
'�
'�C�&)�C�i��{�#�	�X�X�%�&�&�N��x�x� ?��E�E��,4�5E�,F�,F��,M��(�)�
��������"�%�%�d�6�l�3�3�,��3��:�;����-�1�1�,�?�?�H��<�)1�(�);�);���&�!�,�/�3�3�K�@�@�J��3�(2���%�	�r]c�J�g}|�ddg��d}|rldt|��z}|�|��|�dd��}|�|��|rdd�|��z}i}t|�����D�]a\}}	t||	��}
t||	|��}|	d	}t||
d
|d��t||
d|d
��t||
d|d��d|vrt||
d|d��|�d��rt||
d|d��|�d��rt||
d|d��|rt||
d|��|�di��}
t|
�����D](\}}td||��}t||
||���)��ct|d|��S)Nr'r�rz"$(MSBuildProjectDirectory)\%s\bin\z
cygwin\bin�	python_26z$(ExecutablePath);rrI�IntDirrq�OutDirrprGrHrJ�ExecutablePathr)rJror�rmrlr�rr�rr�_GetValueFormattedForMSBuildr)r�rr��	new_paths�cygwin_dirs�cyg_path�python_pathrr6r�rrkrM�
tool_settingsr��formatted_values                r[�(_GetMSBuildConfigurationGlobalPropertiesr[Ys����)����+�c�U�3�3�A�6�+��=�6��+�9N�9N�N�H�
���X�����"�"�=�+�>�>�K�
���[�!�!�!��=�&����)�)<�)<�<�i��*�%�n�&:�&:�&<�&<�=�=�L�L��t�]�*�4��?�?�I�&�t�]�J�G�G�J�$�%A�B���J�	�8�&�'>�?�A�A�A��J�	�8�&�'8�9�;�;�;��J�	�<�&�|�4�6�6�6��j� � ��j�)�[�(��5�7�7�7��~�~�l�#�#�8��j�)�\�(��6�8�8�8��~�~�k�"�"�7��j�)�[�(��5�7�7�7��)��j�)�5E�'�)�)�)�$�(�(��R�0�0�M��m�1�1�3�3�4�4�L�L���e�4�R��u�E�E�o��j�)�T�?�K�K�K�K�L�
"�$��j�	9�	9�9r]c�t�||vri||<||}||vrg||<||}|�|��dS)a�Adds a property / conditional value pair to a dictionary.

  Arguments:
    properties: The dictionary to be modified.  The key is the name of the
        property.  The value is itself a dictionary; its key is the value and
        the value a list of condition for which this value is true.
    condition: The condition under which the named property has the value.
    name: The name of the property.
    value: The value of the property.
  Nr)rrr6r�r��
conditionss      r[rr�sZ��
�����J�t���d��&�
�&����F�5�M��e�}�*����I�����r]z\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)c����dg}|r|�d|i��t|d��}�fd�}tj�����|��}t
|��D]{}�|}t|�����D]O\}	}
t|
��|kr|�||	g���0|
D]}|�|d|i|	g����P�||gS)a�Returns a PropertyGroup definition for the specified properties.

  Arguments:
    spec: The target project dict.
    label: An optional label for the PropertyGroup.
    properties: The dictionary to be converted.  The key is the name of the
        property.  The value is itself a dictionary; its key is the value and
        the value a list of condition for which this value is true.
  r�r�rc	����t��}t�������D]I}|�t��fd�t�|��D�������J|S)Nc�(��g|]}|�v�|�k�|��Srrrr)ru�vr�rs  ��r[rwz>_GetMSBuildPropertyGroup.<locals>.GetEdges.<locals>.<listcomp>�s1���:�:�:�a��
�?�?�q�D�y�y��/8�y�yr])r�r�r�r�MSVS_VARIABLE_REFERENCE�findall)r��edgesr�rs`  �r[�GetEdgesz*_GetMSBuildPropertyGroup.<locals>.GetEdges�s�����
�E�E�E��
�4�(�-�-�/�/�0�0�
<�
<���l�l�3�:�:�:�:�:�#:�#B�#B�5�#I�#I�:�:�:�;�;�<�<�<�<��Lr]r�)	r�r�rXrY�TopologicallySortedr�r;r�r)r��labelrrS�num_configurationsre�properties_orderedr6r�r�r]rs  `         r[rr�sB����
�%�
�#�	�L�L�'�5�!�"�"�"��4� 0�1�2�2�������"�z�5�5��o�o����#�#���)�*�*�	@�	@�d�
��
�F�#�F�L�L�N�N�3�3�@�@���z�	�Z���.�	.�	.�	���d�E�]�#�#�#�#�#�	@�	@�I�
�,�,��{�I�6��>�
?�
?�
?�
?�	@�
@���.r]c���g}t|�����D]�\}}|d}ddt||��ig}t|�����D]p\}}|ri|rg|g}	t|�����D]-\}}
t|||
��}|	�||g���.|�|	���q|�|����|S)NrIr�r�)r�rr�rTr�)r�r�groupsr6r�rMrSr�rYr�r�rZs            r[�_GetMSBuildToolSettingsSectionsrl�s"��
�&�%�n�&:�&:�&<�&<�=�=����t�]�$�%A�B��
"��5�d�M�J�J�
K�
�E�%+�+;�+A�+A�+C�+C�$D�$D�
�
� �	�=�
���	���$�#�M�$7�$7�$9�$9�:�:�1�1�k�d�E�:�9�d�;@�B�B�O��K�K���/�0�0�0�0�
�,�,�t�
�
�
��
�M�M�%�����	�-r]c	�j�d|vrd}|d}tj|��n,d}|�di��}tj|��}t	|��\}}}t|��}t
|��}	t|d���\}
}}t|��}
t|��}|rMd�|D��}dg}|D];}|�|��}|r"td|�d	t|�������<d
�|D��}t|��}|�d��}|�d��}t|��}|�d
��}t|dd|��t|dd|��t|dd|��t|dd|��t|dd|	��|
rt||d|
d���|
rt||d|
d���t|dd|��t|dd|��t|dd|��|r]t j�|��d}t|ddd��t|dd|��t|dd|g��nt|ddd��t|dd d!��|�d"��rt|d#d$d!��|d%d&krt|d#d$d'��|rt|dd(|��||d)<|rt|d*d+|��|rt|d,d+|��dSdS)-NrMFTr
rc��g|]
}|dk�|��S)z
_HAS_TR1=0rrrs  r[rwz,_FinalizeMSBuildSettings.<locals>.<listcomp>�s"��7�7�7�Q�Q�,�%6�%6�q�%6�%6�%6r]r�z=Warning: The automatic conversion to MSBuild does not handle z.  Ignoring setting of c�,�g|]}t|����Srr)r�rs  r[rwz,_FinalizeMSBuildSettings.<locals>.<listcomp>s!��<�<�<�q�
'��
*�
*�<�<�<r]rr	r7rerrmrirAr
rrrrHrrrC�PrecompiledHeader�Use�PrecompiledHeaderFiler�NotUsingr�r�r2rrr�r�rrrI�
PreBuildEvent�Command�PostBuildEvent)r��ValidateMSBuildSettingsrJ�ConvertToMSBuildSettingsrr r!r"rSr#r�r�r$r%r�r�rHr`r")r�r��	convertedrMr
r(r)r*r+r,r-r�rMrNr/�ignored_settings�ignored_settingr�r0r1r2r3r4s                       r[�_FinalizeMSBuildSettingsr|�ss���=�(�(��I�$�%7�8���(�)9�:�:�:�:��I�!�%�%�o�r�:�:�M�#�<�]�K�K���m�$�$�9�,�!�#8��D�!�!�)� ��/�/�,�7��d�K�K�K��(�A�|�"�4�(�(�*��
�&�&�'��	M�7�7�'�7�7�7�G�)�*��+�M�M������0�0�e�	�M�
��/>����E�
�
�
�L�	M�	M�	M��
=�<�G�<�<�<�'�*�=�9�9��
�
�
��
/�
/�(���� 0�1�1�)�
!�$�
'�
'�(�$�(�(�)B�C�C�����,�l�<�<�<�
���,�.?�A�A�A�
�� 1�,�.C�E�E�E��#�V�-E�����
���(F�����
�$�� �,��h�"�$�$�$�$��$�� �,��Z�"�$�$�$�$����'��2�2�2�
�� 1�'��2�2�2����'�):�<�<�<��P�����'9�:�:�1�=��� �+�/B�E�J�J�J�� �+�'�);�=�=�=�� �+�$�'9�&:�<�<�<�<�� �+�/B�J�O�O�O�
���-=�w�G�G�G�	�X�X�+�,�,�E����%:�G�D�D�D�
�&�\�&�&�&�� �"�&;�V�D�D�D�
�L�� �&�*@�(�K�K�K�0@�-�,�-�
�H�� �/�9�h�G�G�G��J�� �"2�I�y�I�I�I�I�I�J�Jr]c��t|��tkrX|dvr|�d|z��dgdgdgd�}||vr
|||vrd}nd}|�d�|D����}nt	j|��}|S)N)rrrc�
DelayLoadDLLsrrz%%(%s)rc)rerArCr�rc�6�g|]}tj|����Srrr�rts  r[rwz0_GetValueFormattedForMSBuild.<locals>.<listcomp>\s#��A�A�A�a��	.�q�	1�	1�A�A�Ar])r�r�r�rlr�r�)r�r6r��
exceptions�charrZs      r[rTrTFs���	�%�[�[�D����+�+�+��l�l�8�d�?�#�#�#�*�*�$�%�#�$�&�&�J��J���4�:�i�+@�#@�#@�
�d�d�
�d��i�i�A�A�5�A�A�A�C�C�O�O�#�;�E�B�B�O�	�r]c�J�g}|D]�}t|tj��r)|�t	|j|�����Ed|vrTtj�||��}tj�	|��s|�
|����|S)a�Verifies that all source files exist on disk.

  Checks that all regular source files, i.e. not created at run time,
  exist on disk.  Missing files cause needless recompilation but no otherwise
  visible errors.

  Arguments:
    sources: A recursive list of Filter/file names.
    root_dir: The root directory for the relative path names.
  Returns:
    A list of source files that cannot be found on disk.
  r_)r�r�r�r<r�r�rHr`rlrRr�)r��root_dirr�rc�	full_paths     r[r�r�bs����/��,�,�f��&�+�,�-�-�,����0���(�K�K�L�L�L�L�	�F�	�	��G�L�L��6�2�2�	��w�~�~�i�(�(�	,�
�
 �
 ��
+�
+�
+��	�r]c
���gd�}i}	|D]}
g|	|
<�t||||	||||��g}|D])}
|	|
r|�dg|	|
z���*|r|�dg|z��|S)N)rrjrlrfrPrhr�rnrL)�_AddSources2r�)r�r�r�rVrW�actions_spec�sources_handled_by_actionr}rk�grouped_sources�gs           r[�_GetMSBuildSourcesr�{s������&��/����a��O�A����t�W�j�/� �"8�(�-�9�9�9�
�'��9�9�a��q��9�
�n�n�k�]�_�Q�%7�7�8�8�8���1��N�N�K�=�<�/�0�0�0�	�.r]c��g}|D�]�}	t|	tj��rt||	j||||||���9|	|v�r�g}
|�|	g��}t
|��t
|d��kr|
�ddg��n?t|��D]/\}}
t||
��}|
�dd|idg���0|d�
��D]�\}}
|
�dd��}|dkrAt|��}|s0tj
�|��\}}|dkrgd�}ndg}||	kr+t||
��}|
�d	d|id
g����|D]E}|	�|��r.|
�d	dg��|
�ddg���F��t!|	||��\}}||�|d|	ig|
z����dS)
Nrr�rr�r8rr�r�rp�Createrr])r�r�r�r�r�rJr�r�r�r�rrorHr`r!r�r_)r�r�r�r�rVrWr�r}r�rc�detail�excluded_configurationsr�r�r�precompiled_sourcer�r3rSrbs                    r[r�r��s���)+�%��1O�1O�f��&�+�,�-�-�0O��4���*�o�$�&<�,� �"�"�"�"�
�0�
0�
0���",�.�.���"<�"<���&�'�'�3�t�4D�/E�+F�+F�F�F�
�-�-�,�f�5�
6�
6�
6�
6�,2�3J�,K�,K�$�$�(�k�=�2�;�
�N�N�I��M�M�.�'��3�!�#�
$�
$�
$�
$�+/�/?�*@�*F�*F�*H�*H�	:�	:�&�K��,�0�0�1J�B�O�O�
�
�2�
%�
%�!)�*<�!=�!=��6�
=�%'�G�$4�$4�5G�$H�$H�!�h�	��d�"�"�6M�6M�6M�3�3�7;�f�3�
�6�
)�
)�2�;�
�N�N�I��M�M�.�'��3�#��
�
�
�
�A�
:�
:�	�����+�+�:��
�
�2�B�7�8�8�8��
�
�3�R�8�9�9�9��
:�
5�V�=N�5K�M�M���w����%�%�w��F�0C�&D�v�&M�N�N�N��c1O�1Or]c�l�g}|j�r)dg}|jD�]}|j}tj�|j��d}t
j�|j|��}dd|id|gddgg}|j�	di���
��D]`}|�	d	d��r|�d
dg��n0|�	dd��r|�d
dg��n�a|�|����
|�|��|S)
NrLr�ProjectReferencer]rH�ReferenceOutputAssemblyr�r�"msvs_use_library_dependency_inputs�UseLibraryDependencyInputsr�&msvs_2010_disable_uldi_when_referenced)r�r�rHr`r"rXrYr�r�rJr�r�)	r��
referencesrS�
dependencyr�r��
relative_path�project_refr@s	         r[�_GetMSBuildProjectReferencesr��sY���*����
�M�E��*� � �
�
�_�d��G�M�M�'�,�/�/��2�k��j�-�-�j�o�{�K�K�m�'��m�
$��d�
�$�g�
.��k�
�O�'�'�(8�"�=�=�D�D�F�F���&��:�:�:�A�>�>�	�
�
�
�:�F�C�
D�
D�
D�
�%��:�:�>��B�B�	�
�
�
�:�G�D�
E�
E�
E�
�%�	��l�l�;��������e����	�r]c���|j}|d}tj�|j��\}}tj�|j��t|j��}tj�	||��}	tj�|j��d}
t|||
��\}}i}
t��}t��}t��}i}|�dd��}|�d��st||||||||
||�
�
n(|�dg��}t|||d��t|||||||��\}}}|�d��s6t!|
||j��t#|
|��t%||
��}t'|||��}t)||
��\}}t+|jdz|||��t-||��}|���D]}t1||���dd	d
igg}dd	digg}dd	digg}dd	d
igg}dd	digg}dddigg}d	d|���dd�g} | t5|��z
} | t7|||j|��z
} | |z
} | t;||j��z
} |�d��r| t=d��z
} n| t=|j��z
} | |z
} | |z
} | tA|��z
} | tC|��z
} | |z
} | tE|||j��z
} | tG||��z
} | tI||||||||��z
} | tK|��z
} | |z
} | |z
} | tM|��z
} |�d��r| tO|��z
} tQj)| |jdd���|S)NrrCr�Tr,r?z.filtersr*rHz,$(VCTargetsPath)\Microsoft.Cpp.Default.propsz$$(VCTargetsPath)\Microsoft.Cpp.propsz&$(VCTargetsPath)\Microsoft.Cpp.targetsz/$(VCTargetsPath)\BuildCustomizations\masm.propsz1$(VCTargetsPath)\BuildCustomizations\masm.targetsr�r��
UserMacrosrI�Build)rKrJ�DefaultTargetsr3�	v120_wp81rM)*r�rHr`r"rXrYr�rer�r�r�r�rJr�r�r�r�r�r�r��_GenerateActionsForMSBuildr[r�r�r|�ProjectVersionr�rr�r!r%r��_GetMSBuildExtensionsr3r[rlr�r��_GetMSBuildExtensionTargets�!_GetMSBuildExternalBuilderTargetsrPrQ)!r�rAr�r�r�rr��project_file_namer�r�r�r�r�r]rxryrVrWr}r?r�r�r�r�r�r��import_default_section�import_cpp_props_section�import_cpp_targets_section�import_masm_props_section�import_masm_targets_section�
macro_sectionrZs!                                 r[r�r��s��	��$��(�)�.�#%�7�=�=���#>�#>� �+� ��*���W�\�*�*�*�
�w�1�
2�
2�(�!�j�5�5�h��L�L��
�W�]�]�7�-�
.�
.�q�
1�(�3�D�/�4<�>�>��'���.������5�5���e�e����!�%�%�&@�$�G�G�-�
���)�	*�	*�C��[�'�4�$�&6�1�3I�+�->�3�	5�5�5�5�
�H�H�W�b�!�!�E��5�'�+;�T�B�B�B�0��g�0;�W�0@�0=�w�H�H�*�'��\�
���)�	*�	*�*����g�&8�9�9�9��~�t�$�$�$�2��.�*�*��*�$�0@�,�O�O�*�,F�
�N�-�-�)�,�)��g�l�Z�7��/�4�6�6�6�(���=�=�/�%�,�,�.�.�2�2�m��T�=�1�1�1�1�
�)�L�M�N�P���)�D�E�F�H���)�F�G�H� J���	�F�G�I�J���	�H�I�K�!L��$�g�|�%<�=�>�-��E��-�-�/�/� ���
	�'�
�
-�n�
=�
=�=�'�	�
(��w���):�<�<�<�'�	�
#�#�'�	�
,�T�7�3E�
F�
F�F�'�	�X�X�$�%�%�B�
�(��5�5�5�7�7�
�(��)@�A�A�A�7�	�
%�%�'�	�
&�&�'�	�
"�#7�
8�
8�8�'�	�
&�~�
6�
6�6�'�	�]��'�	�
5�d�N�6=�6H�J�J�J�'�	�
,�T�>�
B�
B�B�'�	�
�
�G�Z�!2�4J��-�}�>�>�>�'�
�
)�'�
2�
2�2�'�	�
'�'�'�	�
(�(�'�	�
(�)?�
@�
@�@�'�	�X�X�%�&�&�7��0��6�6�6�G�
��W�g�l�4�t�L�L�L�L�	�r]c��t||ddddd��}dddig}|�dd|ig��t||ddddd��}ddd	ig}|�dd|ig��||g}|�d
��rNt||d
dddd��}dddig}|�dd|ig��|�|��|S)anReturn a list of MSBuild targets for external builders.

  The "Build" and "Clean" targets are always generated.  If the spec contains
  'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also
  be generated, to support building selected C/C++ files.

  Arguments:
    spec: The gyp target spec.
  Returns:
    List of MSBuild 'Target' specs.
  r.Fr�r�r��Execrur/�Cleanr0re)r�r�rJ)r��	build_cmd�build_target�	clean_cmd�clean_target�targets�
clcompile_cmd�clcompile_targets        r[r�r�Y
s2��*�
�D�2�3��U�E�5�"�"�)��V�W�-�.�,����v�	�9�5�6�7�7�7�)�
�D�2�3��U�E�5�"�"�)��V�W�-�.�,����v�	�9�5�6�7�7�7�
�<�(�'�	�X�X�3�4�4�%�/��d�8�9�
�u�e�U�$�$�M�!�6�;�"7�8�����V�i��%?�@�A�A�A��N�N�#�$�$�$�	�.r]c�P�dddig}|D]}|�dd|ig���|gS)Nr(r��ExtensionSettingsr*rHr)rxr7r2s   r[r�r�~
sJ����)<�=�>�*�(�;�;�j����x�)�Z�!8�9�:�:�:�:�
��r]c�j�dddig}t|��D]}|�dd|ig���|gS)Nr(r��ExtensionTargetsr*rH)r�r�)ry�targets_node�targets_files   r[r�r��
sS���'�+=�!>�?�,��3�4�4�?�?�l�����I�|�#<�=�>�>�>�>�
��r]c��t��}g}|���D�]\}}t��}t��}g}g}	|D]�}
|�t|
d����|�t|
d����|�|
d��|
d}|
�dd��rd|z}|	�|����d�|��}d	�d
�|	D����}
t
|||||
|||����||fS)aYAdd actions accumulated into an actions_to_add, merging as needed.

  Arguments:
    spec: the target project dict
    actions_to_add: dictionary keyed on input name, which maps to a list of
        dicts describing the actions attached to that input file.

  Returns:
    A pair of (action specification, the sources handled by this action).
  rrrr��msbuild_use_callTzcall rrc��g|]}|dz��S)z,
if %errorlevel% neq 0 exit /b %errorlevel%rr)rurSs  r[rwz._GenerateActionsForMSBuild.<locals>.<listcomp>�
s.��.�.�.� ��O�O�.�.�.r])rrrr�rJrl�_AddMSBuildAction)r�r]r�r�rr�rrrrr�r�rr�s              r[r�r��
sv��)�l�l���,� .� 4� 4� 6� 6�!$�!$��m�W�
�\�\�F��l�l�G��L��H������m�m�J�v�h�/�0�0�1�1�1�
�n�n�Z��y� 1�2�2�3�3�3����&��/�0�0�0��9��c�

���&��	-�	-����m���o�o�c������$�$�\�2�2�K��k�k�.�.�$,�.�.�.�/�/�G��d�#����!�/�"�$�$�$�$�
�0�	0�0r]c����tj|��}t����t|��}	t|��}
d��fd�|	D����}d�|
��}|����dd�ig}|�ddgd|gd|gd	|gg��|r|�d
|g��|�|��dS)Nrc� ��g|]
}|�k�|��Srrrr)rurvrs  �r[rwz%_AddMSBuildAction.<locals>.<listcomp>�
s-��� 7� 7� 7�a�#$�
�#5�#5�!"�#5�#5�#5r]ror]�FileType�Documentrur�r�AdditionalInputs)r�r�roryrlr*r<r�)
r�rrrr�rr�r�r��inputs_array�
outputs_array�additional_inputs�action_specs
 `           r[r�r��
s$����1�#�6�6�'��=�)�)�-��6�"�"�,��G�$�$�-��h�h� 7� 7� 7� 7�<� 7� 7� 7�8�8���H�H�]�#�#�'����
�.�.�.���M� :�;�+�
����J���7���;���7���	�	�	��@����*�,=�>�?�?�?����k�"�"�"�"�"r])NNTN)F)��
__future__r�copyrLrHr�rOrKrD�	six.movesr�
gyp.commonrX�gyp.easy_xmlrP�gyp.generator.ninja�	generatorrr
�gyp.MSVSNewr��gyp.MSVSProjectr��gyp.MSVSSettingsr��gyp.MSVSToolFiler:�gyp.MSVSUserFiler��gyp.MSVSUtilr8�gyp.MSVSVersionr�rrrPr�r;�"generator_additional_path_sections�+generator_additional_non_configuration_keysr2r�rGrFr\rjreroryr�r�r�r�r�r�r�r�r�r�rrrr%r(r/rFrHrgrkrtrwr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr!r r"rSr#r$r%rfr'rir}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr-r3rFr[rOr_r��objectrtrurvrwr�r�r�rr!r%r3r9r5r6rr[rrbrrlr|rTr�r�r�r�r�r�r�r�r�r�rrr]r[�<module>r�sU
��
&�%�%�%�%�%�����
�
�
�
�	�	�	�	�����	�	�	�	�����
�
�
�
�%�%�%�%�%�%�����������-�-�-�-�-�-�-�-�-�������%�%�%�%�%�%�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�������%�%�%�%�%�%�������!�!�!�!�!�!�#��
�#3�4�4����R���V�������	�
�����
�����������A��	�%���;���~���~���-�� �m�!�"�)�#�$&�0�'����2��&�"�/�/�/�+�$ ���������
�*�*�*�0�����$���"&�&�&�
EI�FJ�>�>�>�>�BD�D�D�D�
����2<�<�<�A�A�A����P�P�P�
=�=�=�2H>�H>�H>�VK�K�K� ,� ,� ,�FH�H�H�8,�,�,�<���&	&�	&�	&����*# �# �# �L���N�N�N�b���$"�r�z�)�,�,�����8'�B�J��7�7��,�,�,�^���#��
�9�-�-�����������B�B�B�: � � �,
=�
=�
=�?�?�?����0���(L�L�L�0 M� M� M�FC�C�C�L
�
�
� ���$���>TL�TL�TL�n@�@�@�0������4$)�$)�$)�N���$���&D�D�D�������61�1�1�&���4B�B�B�$%�$%�$%�N31�31�31�l������7�7�7����*���$"�$"�$"�N � � �0���*9�9�9����4	�	�	����&���)�)�)�&���$
#�
#�
#�.�.�.�b-�-�-�`B�B�B�8+�+�+�&���N)�N)�N)�b���<$(�$(�$(�N$�$�$�N*A�*A�*A�Z2F�2F�2F�2F�2F�&�2F�2F�2F�jK�K�K�@bM�bM�bM�JoI�oI�oI�d#�#�#�8�8�8�
	�	�	�:�:�:�zE�E�E�(	�	�	�*�*�*�X���&���	�	�	�2�2�2�j-:�-:�-:�`���*%�"�*�%F�G�G��/�/�/�d���,ZJ�ZJ�ZJ�z���8���2���*6O�6O�6O�r���4s�s�s�l"�"�"�J������/1�/1�/1�d#�#�#�#�#r]