<commit_before># Copyright 2014-2016 The Meson development team

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os, sys
import pickle
from . import backends
from .. import build
from .. import dependencies
from .. import mlog
import xml.etree.ElementTree as ET
import xml.dom.minidom
from ..coredata import MesonException

class RegenInfo():
    def __init__(self, source_dir, build_dir, depfiles, solutionfile):
        self.source_dir = source_dir
        self.build_dir = build_dir
        self.depfiles = depfiles
        self.solutionfile = solutionfile

class Vs2010Backend(backends.Backend):
    def __init__(self, build):
        super().__init__(build)
        self.project_file_version = '10.0.30319.1'
        # foo.c compiles to foo.obj, not foo.c.obj
        self.source_suffix_in_obj = False

    def generate_custom_generator_commands(self, target, parent_node):
        idgroup = ET.SubElement(parent_node, 'ItemDefinitionGroup')
        all_output_files = []
        for genlist in target.get_generated_sources():
            if isinstance(genlist, build.CustomTarget):
                all_output_files += [os.path.join(self.get_target_dir(genlist), i) for i in genlist.output]
            else:
                generator = genlist.get_generator()
                exe = generator.get_exe()
                infilelist = genlist.get_infilelist()
                outfilelist = genlist.get_outfilelist()
                if isinstance(exe, build.BuildTarget):
                    exe_file = os.path.join(self.environment.get_build_dir(), self.get_target_filename(exe))
                else:
                    exe_file = exe.get_command()
                base_args = generator.get_arglist()
                for i in range(len(infilelist)):
                    if len(infilelist) == len(outfilelist):
                        sole_output = os.path.join(self.get_target_private_dir(target), outfilelist[i])
                    else:
                        sole_output = ''
                    curfile = infilelist[i]
                    infilename = os.path.join(self.environment.get_source_dir(), curfile)
                    outfiles = genlist.get_outputs_for(curfile)
                    outfiles = [os.path.join(self.get_target_private_dir(target), of) for of in outfiles]
                    all_output_files += outfiles
                    args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)\
                            for x in base_args]
                    args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", self.get_target_private_dir(target))
                            for x in args]
                    fullcmd = [exe_file] + args
                    cbs = ET.SubElement(idgroup, 'CustomBuildStep')
                    ET.SubElement(cbs, 'Command').text = ' '.join(self.special_quote(fullcmd))
                    ET.SubElement(cbs, 'Inputs').text = infilename
                    ET.SubElement(cbs, 'Outputs').text = ';'.join(outfiles)
                    ET.SubElement(cbs, 'Message').text = 'Generating sources from %s.' % infilename
        pg = ET.SubElement(parent_node, 'PropertyGroup')
        ET.SubElement(pg, 'CustomBuildBeforeTargets').text = 'ClCompile'
        return all_output_files

    def generate(self, interp):
        self.interpreter = interp
        self.platform = 'Win32'<commit_msg>vs2010: fix wrong generator command concatenation<commit_after># Copyright 2014-2016 The Meson development team

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os, sys
import pickle
from . import backends
from .. import build
from .. import dependencies
from .. import mlog
import xml.etree.ElementTree as ET
import xml.dom.minidom
from ..coredata import MesonException

class RegenInfo():
    def __init__(self, source_dir, build_dir, depfiles, solutionfile):
        self.source_dir = source_dir
        self.build_dir = build_dir
        self.depfiles = depfiles
        self.solutionfile = solutionfile

class Vs2010Backend(backends.Backend):
    def __init__(self, build):
        super().__init__(build)
        self.project_file_version = '10.0.30319.1'
        # foo.c compiles to foo.obj, not foo.c.obj
        self.source_suffix_in_obj = False

    def generate_custom_generator_commands(self, target, parent_node):
        idgroup = ET.SubElement(parent_node, 'ItemDefinitionGroup')
        all_output_files = []
        for genlist in target.get_generated_sources():
            if isinstance(genlist, build.CustomTarget):
                all_output_files += [os.path.join(self.get_target_dir(genlist), i) for i in genlist.output]
            else:
                generator = genlist.get_generator()
                exe = generator.get_exe()
                infilelist = genlist.get_infilelist()
                outfilelist = genlist.get_outfilelist()
                if isinstance(exe, build.BuildTarget):
                    exe_file = os.path.join(self.environment.get_build_dir(), self.get_target_filename(exe))
                else:
                    exe_file = exe.get_command()[0]
                base_args = generator.get_arglist()
                for i in range(len(infilelist)):
                    if len(infilelist) == len(outfilelist):
                        sole_output = os.path.join(self.get_target_private_dir(target), outfilelist[i])
                    else:
                        sole_output = ''
                    curfile = infilelist[i]
                    infilename = os.path.join(self.environment.get_source_dir(), curfile)
                    outfiles = genlist.get_outputs_for(curfile)
                    outfiles = [os.path.join(self.get_target_private_dir(target), of) for of in outfiles]
                    all_output_files += outfiles
                    args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)\
                            for x in base_args]
                    args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", self.get_target_private_dir(target))
                            for x in args]
                    fullcmd = [exe_file] + args
                    cbs = ET.SubElement(idgroup, 'CustomBuildStep')
                    ET.SubElement(cbs, 'Command').text = ' '.join(self.special_quote(fullcmd))
                    ET.SubElement(cbs, 'Inputs').text = infilename
                    ET.SubElement(cbs, 'Outputs').text = ';'.join(outfiles)
                    ET.SubElement(cbs, 'Message').text = 'Generating sources from %s.' % infilename
        pg = ET.SubElement(parent_node, 'PropertyGroup')
        ET.SubElement(pg, 'CustomBuildBeforeTargets').text = 'ClCompile'
        return all_output_files

    def generate(self, interp):
        self.interpreter = interp
        self.platform = 'Win32'
{'fraction_non_alphanumeric': 0.09501339114908813, 'fraction_numerical': 0.007524550439994899, 'mean_word_length': 2.297729184188394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5198342', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2124, 'n_words': 538}