CasperSecurity
o
p.a � @ s, d Z ddlZddlmZ G dd� de�ZdS )z$Visual Studio project reader/writer.� Nc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �Writerz#Visual Studio XML tool file writer.c C s || _ || _dg| _dS )zzInitializes the tool file.
Args:
tool_file_path: Path to the tool file.
name: Name of the tool file.
�RulesN)�tool_file_path�name�
rules_section)�selfr r � r �2/usr/lib/python3/dist-packages/gyp/MSVSToolFile.py�__init__ s zWriter.__init__c C s8 d|||d� |�d� |�d� |�d�g}| j�|� dS )a9 Adds a rule to the tool file.
Args:
name: Name of the rule.
description: Description of the rule.
cmd: Command line of the rule.
additional_dependencies: other files which may trigger the rule.
outputs: outputs of the rule.
extensions: extensions handled by the rule.
�CustomBuildRule�;)�Name�ExecutionDescription�CommandLine�Outputs�FileExtensions�AdditionalDependenciesN)�joinr �append)r r �cmd�description�additional_dependencies�outputs�
extensions�ruler r r �AddCustomBuildRule s
�� zWriter.AddCustomBuildRulec C s* dd| j d�| jg}tj|| jdd� dS )zWrites the tool file.�VisualStudioToolFilez8.00)�Versionr
zWindows-1252)�encodingN)r r �easy_xml�WriteXmlIfChangedr )r �contentr r r �WriteIfChanged1 s ��
�zWriter.WriteIfChangedN)�__name__�
__module__�__qualname__�__doc__r
r r"