Compiles the project from source files into a distributable
format and copies it to the output (build) folder.
351776
async function build() {
  await run(clean);
  await run(copy);
  await run(bundle);
}
609427
def copy_files_to_target
      COMMON_RAMMER_FILES.each do |file|
        source = File.join("#{@gem_path}/lib/modules/common/",file)
        FileUtils.cp(source,"#{@project_name}")
        $stdout.puts "\e[1;32m \tcreate\e[0m\t#{file}"
      end
    end
1083479
def build_cpp(build_context, target, compiler_config, workspace_dir):
    """"""
    rmtree(workspace_dir)
    binary = join(*split(target.name))
    objects = link_cpp_artifacts(build_context, target, workspace_dir, True)
    buildenv_workspace = build_context.conf.host_to_buildenv_path(
        workspace_dir)
    objects.extend(compile_cc(
        build_context, compiler_config, target.props.in_buildenv,
        get_source_files(target, build_context), workspace_dir,
        buildenv_workspace, target.props.cmd_env))
    bin_file = join(buildenv_workspace, binary)
    link_cmd = (
        [compiler_config.linker, '-o', bin_file] +
        objects + compiler_config.link_flags)
    build_context.run_in_buildenv(
        target.props.in_buildenv, link_cmd, target.props.cmd_env)
    target.artifacts.add(AT.binary, relpath(join(workspace_dir, binary),
                         build_context.conf.project_root), binary)
371414
function transpile() {
        return rollup.rollup({
            entry: path.join(dirs.source, files.main)
        }).then(function (bundle) {
            return bundle.write({
                // output format - 'amd', 'cjs', 'es6', 'iife', 'umd'
                format: 'umd',
                dest: path.join(dirs.build, files.main),
                sourceMap: false,
                banner: grunt.config('banner'),
                intro: 'mx.version = \'' + grunt.config('pkg').version + '\';\n',
                footer: '\n',
                moduleName: 'mx'
            });
        });
    }
1363697
function compileFileSync(
  buildDir /*: string */,
  moduleType /*: BsModuleFormat | 'js' */,
  path /*: string */,
) /*: string */ {
  try {
    runBuildSync(buildDir)
  } catch (e) {
    throw utils.processBsbError(e.output.toString())
  }

  const res = readFileSync(path)
  return utils.transformSrc(moduleType, res.toString())
}
503969
def build(self, outpath, structure=None):
        
        if not os.path.exists(outpath):
            return False

        opts = {'scaffold': self}

        if structure is not None:
            xstruct = structure
        else:
            xstruct = self.structure()

        if zipfile.is_zipfile(self.source()):
            zfile = zipfile.ZipFile(self.source(), 'r')
        else:
            zfile = None
            base = os.path.dirname(self.source())

        # build the structure information
        # noinspection PyShadowingNames
        def build_level(root, xlevel):
            # ignore the entry
            if xlevel.get('enabled', 'True') == 'False':
                return

            # create a folder
            if xlevel.tag == 'folder':
                name = makotext.render(xlevel.get('name'), opts)
                dirname = os.path.join(root, name)
                if not os.path.exists(dirname):
                    os.mkdir(dirname)

                for xchild in xlevel:
                    build_level(dirname, xchild)

            # create a file
            elif xlevel.tag == 'file':
                name = makotext.render(xlevel.get('name'), opts)
                fname = os.path.join(root, name)

                # create from a template
                templ = xlevel.get('templ')
                if templ:
                    if zfile:
                        templ_str = zfile.read('templ/{0}'.format(templ))
                    else:
                        templ_path = os.path.join(base, 'templ', templ)
                        templ_str = open(templ_path, 'r').read()

                    rendered = makotext.render(templ_str, opts)
                    rendered = rendered.replace('\r\n', '\r')

                    f = open(fname, 'w')
                    f.write(rendered)
                    f.close()

                # create a blank file
                else:
                    f = open(fname, 'w')
                    f.close()

        for xlevel in xstruct:
            build_level(outpath, xlevel)

        if zfile:
            zfile.close()
        return True
96745
def build(self, input_path, output_paths):
        """"""
        for output in output_paths:
            shutil.copy(input_path, output_paths)
710827
def create_yaml(directory, project_name, board,output_dir):
    # lay out what the common section a project yaml file will look like
    # The value mapped to by each key are the file extensions that will help us get valid files for each section
    logger.debug("Project name: %s, Target: %s"%(project_name,board))
    common_section = {
        'linker_file': FILES_EXTENSIONS['linker_file'],
        'sources': FILES_EXTENSIONS['source_files_c'] + FILES_EXTENSIONS['source_files_cpp'] +
                   FILES_EXTENSIONS['source_files_s'] + FILES_EXTENSIONS['source_files_obj'],
        'includes': FILES_EXTENSIONS['include_files']
    }

    # will be written to projects.yaml
    root = os.path.relpath(directory)
    projects_yaml = {
        'projects': {
            project_name:
                ['project.yaml']
        },
        'settings': {'export_dir': os.path.relpath(output_dir)}
    }

    # will be written to project.yaml
    project_yaml = {
        'common': {},
        'tool_specific': {}
    }
    # iterate over the common section defined above
    for section, extensions in common_section.items():
        # look for files in this directory that have the defined extensions, and add them to our project file
        project_yaml['common'][section] = _scan(section, directory,extensions)

    project_yaml['common']['target'] = [board] # user passes target in command line

    """"""
    tools = _determine_tool(project_yaml['common']['linker_file'])

    linkers = {}   # dictionary containing all linker files in the project directory

    # exhaust the iterator and add its yielded values to linkers
    for (file,tool) in tools:
        if tool in linkers:
            linkers[tool].append(file)
        else:
            linkers[tool] = [file]

    for tool, linker in linkers.items():
        if len(linker) > 1:
            # The project directory defined more than one linker for a tool
            print("\nMultipe linkers found for " + tool + "\n")
            for i, file in enumerate(linker):
                print(str(i) + ": " + file)
            answer = raw_input('\nWhich file do you want? ')
            while int(answer) not in range(0,len(linker)):
                answer = raw_input('Answer not in list. Which file do you want? ')
            project_yaml['tool_specific'][tool] = {'linker_file': [linkers[tool][int(answer)]]}
        else:
            project_yaml['tool_specific'][tool] = {'linker_file': linker}

    # linker file is now in tool_specific section
    del project_yaml['common']['linker_file']

    ret = _generate_file("projects.yaml", projects_yaml)
    if ret < 0: # make sure the first file generated correctly
        return -1
    ret = _generate_file("project.yaml", project_yaml)
    return ret
1088228
def build(self, filenames, cl_args=None, link_args=None,
              x64=False, out_dir=''):
        
        if not cl_args:
            cl_args = []
        if not link_args:
            link_args = []
        msvc, lib = self.vc.get_bin_and_lib(x64)
        lib = self.make_lib(lib)
        if out_dir:
            cl_args.append('/Fo:' + out_dir + '\\')
        include = self.make_inc(self.vc.inc + self.sdk.inc)
        cl_args.extend(include + filenames)
        try:
            msvc.run_cl('/c', *cl_args)
        except CalledProcessError as error:
            logging.error(_('failed to compile: %s'), filenames)
            logging.error(_('cl.exe returned:\n%s'), error.output)
            return False
        link_args.extend(lib + self.make_objs(filenames, out_dir))
        try:
            msvc.run_link(*link_args)
        except CalledProcessError as error:
            logging.error(_('failed to link: %s'), filenames)
            logging.error(_('link.exe returned:\n%s'), error.output)
            return False
        return True
558584
function compile(source) {
    var module = assemblyscript_1.Compiler.compileString(source, {
        target: assemblyscript_1.CompilerTarget.WASM32,
        memoryModel: assemblyscript_1.CompilerMemoryModel.MALLOC,
        silent: true
    });
    var wasmFile;
    if (!module) {
        throw Error('compilation failed');
    }
    module.optimize();
    if (!module.validate()) {
        throw Error('validation failed');
    }
    wasmFile = module.emitBinary();
    module.dispose();
    return new Buffer(wasmFile);
}
272098
protected function buildCopy() {
    $exclude_list_file = $this->getExcludeListFile();
    $source = $this->getConfigValue('repo.root');
    $dest = $this->deployDir;

    $this->setMultisiteFilePermissions(0777);
    $this->say("Rsyncing files from source repo into the build artifact...");
    $this->taskExecStack()->exec("rsync -a --no-g --delete --delete-excluded --exclude-from='$exclude_list_file' '$source/' '$dest/' --filter 'protect /.git/'")
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->stopOnFail()
      ->dir($this->getConfigValue('repo.root'))
      ->run();
    $this->setMultisiteFilePermissions(0755);

    // Remove temporary file that may have been created by
    // $this->getExcludeListFile().
    $this->taskFilesystemStack()
      ->remove($this->excludeFileTemp)
      ->copy(
        $this->getConfigValue('deploy.gitignore_file'),
        $this->deployDir . '/.gitignore', TRUE
      )
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();

  }
670168
def projectEmitter(target, source, env):
    """"""

    # todo: Not sure what sets source to what user has passed as target,
    # but this is what happens. When that is fixed, we also won't have
    # to make the user always append env['MSVSPROJECTSUFFIX'] to target.
    if source[0] == target[0]:
        source = []

    # make sure the suffix is correct for the version of MSVS we're running.
    (base, suff) = SCons.Util.splitext(str(target[0]))
    suff = env.subst('$MSVSPROJECTSUFFIX')
    target[0] = base + suff

    if not source:
        source = 'prj_inputs:'
        source = source + env.subst('$MSVSSCONSCOM', 1)
        source = source + env.subst('$MSVSENCODING', 1)

        # Project file depends on CPPDEFINES and CPPPATH
        preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', []))))
        includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None)
        includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
        source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath)

        if 'buildtarget' in env and env['buildtarget'] != None:
            if SCons.Util.is_String(env['buildtarget']):
                source = source + ' "%s"' % env['buildtarget']
            elif SCons.Util.is_List(env['buildtarget']):
                for bt in env['buildtarget']:
                    if SCons.Util.is_String(bt):
                        source = source + ' "%s"' % bt
                    else:
                        try: source = source + ' "%s"' % bt.get_abspath()
                        except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
            else:
                try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
                except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")

        if 'outdir' in env and env['outdir'] != None:
            if SCons.Util.is_String(env['outdir']):
                source = source + ' "%s"' % env['outdir']
            elif SCons.Util.is_List(env['outdir']):
                for s in env['outdir']:
                    if SCons.Util.is_String(s):
                        source = source + ' "%s"' % s
                    else:
                        try: source = source + ' "%s"' % s.get_abspath()
                        except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
            else:
                try: source = source + ' "%s"' % env['outdir'].get_abspath()
                except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")

        if 'name' in env:
            if SCons.Util.is_String(env['name']):
                source = source + ' "%s"' % env['name']
            else:
                raise SCons.Errors.InternalError("name must be a string")

        if 'variant' in env:
            if SCons.Util.is_String(env['variant']):
                source = source + ' "%s"' % env['variant']
            elif SCons.Util.is_List(env['variant']):
                for variant in env['variant']:
                    if SCons.Util.is_String(variant):
                        source = source + ' "%s"' % variant
                    else:
                        raise SCons.Errors.InternalError("name must be a string or a list of strings")
            else:
                raise SCons.Errors.InternalError("variant must be a string or a list of strings")
        else:
            raise SCons.Errors.InternalError("variant must be specified")

        for s in _DSPGenerator.srcargs:
            if s in env:
                if SCons.Util.is_String(env[s]):
                    source = source + ' "%s' % env[s]
                elif SCons.Util.is_List(env[s]):
                    for t in env[s]:
                        if SCons.Util.is_String(t):
                            source = source + ' "%s"' % t
                        else:
                            raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
                else:
                    raise SCons.Errors.InternalError(s + " must be a string or a list of strings")

        source = source + ' "%s"' % str(target[0])
        source = [SCons.Node.Python.Value(source)]

    targetlist = [target[0]]
    sourcelist = source

    if env.get('auto_build_solution', 1):
        env['projects'] = [env.File(t).srcnode() for t in targetlist]
        t, s = solutionEmitter(target, target, env)
        targetlist = targetlist + t

    # Beginning with Visual Studio 2010 for each project file (.vcxproj) we have additional file (.vcxproj.filters)
    version_num = 6.0
    if 'MSVS_VERSION' in env:
        version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
    if version_num >= 10.0:
        targetlist.append(targetlist[0] + '.filters')

    return (targetlist, sourcelist)
897361
def build!
      create_output_directory
      spec.source_directories.each { |d| simple_compile_directory(d) }
      compile_files(spec.all_javascript_paths)
      compile_files(spec.all_stylesheet_paths)
      write_manifest
    end
1354074
def regenerateSourceFromOutput(outFile, pathComponents)
      #puts "regenerateSourceFromOutput, outFile = #{outFile}, pathComponents = #{pathComponents.inspect}"
      subPath = pathComponents.join("/")
      srcFile = File.join(@sourceTypeDirs[:source], subPath)
      #puts "  srcFile = #{srcFile}"
      ensureDirectoryExists(File.dirname(srcFile))
      extension = File.extname(outFile).downcase
      #puts "  extension = #{extension}"
      if REGENERATE_EXTENSIONS.include? extension
        raise "Regeneration from output not yet implemented."
      else
        okToCopyBack = true
        if SOURCE_EXTENSIONS.has_key? extension
          srcExtensions = SOURCE_EXTENSIONS[extension]
          srcNameWithoutExtension = srcFile.chomp(extension)
          possibleSrcFiles = srcExtensions.map{|srcExtension| srcNameWithoutExtension + srcExtension}
          for possibleSrcFile in possibleSrcFiles
            if File.exist? possibleSrcFile
              puts "NOT COPYING #{outFile} back to source because source file #{possibleSrcFile} exists"
              okToCopyBack = false
            end
          end
        end
        if okToCopyBack
          copySrcToOutputFile(outFile, srcFile, true)
        end
      end
    end
789383
def compile_folder(self, directory, write=True, package=True, *args, **kwargs):
        """"""
        if not isinstance(write, bool) and os.path.isfile(write):
            raise CoconutException("destination path cannot point to a file when compiling a directory")
        filepaths = []
        for dirpath, dirnames, filenames in os.walk(directory):
            if isinstance(write, bool):
                writedir = write
            else:
                writedir = os.path.join(write, os.path.relpath(dirpath, directory))
            for filename in filenames:
                if os.path.splitext(filename)[1] in code_exts:
                    with self.handling_exceptions():
                        destpath = self.compile_file(os.path.join(dirpath, filename), writedir, package, *args, **kwargs)
                        if destpath is not None:
                            filepaths.append(destpath)
            for name in dirnames[:]:
                if not is_special_dir(name) and name.startswith("."):
                    if logger.verbose:
                        logger.show_tabulated("Skipped directory", name, "(explicitly pass as source to override).")
                    dirnames.remove(name)  # directories removed from dirnames won't appear in further os.walk iterations
        return filepaths
1267929
function createMozBuildFiles() {
  const builds = {};

  getFiles()
    .filter(file => file.match(/.js$/))
    .filter(file => {
      if (file.match(/\/workers\.js/)) {
        return true;
      }

     // We exclude worker files because they are bundled and we include
     // worker/index.js files because are required by the debugger app in order
     // to communicate with the worker.
     if (file.match(/\/workers/)) {
       return file.match(/workers\/(\w|-)*\/index.js/);
     }

     return !file.match(/(test|types|packages)/)

   })
    .forEach(file => {
      // console.log(file)
      let dir = path.dirname(file);
      builds[dir] = builds[dir] || { files: [], dirs: [] };

      // Add the current file to its parent dir moz.build
      builds[dir].files.push(path.basename(file));

      // There should be a moz.build in every folder between the root and this
      // file. Climb up the folder hierarchy and make sure a each folder of the
      // chain is listing in its parent dir moz.build.
      while (path.dirname(dir) != ".") {
        const parentDir = path.dirname(dir);
        const dirName = path.basename(dir);

        builds[parentDir] = builds[parentDir] || { files: [], dirs: [] };
        if (!builds[parentDir].dirs.includes(dirName)) {
          builds[parentDir].dirs.push(dirName);
        }
        dir = parentDir;
      }
    });

  Object.keys(builds).forEach(build => {
    const { files, dirs } = builds[build];

    const buildPath = path.join(mcDebuggerPath, build);
    shell.mkdir("-p", buildPath);

    // Files and folders should be alphabetically sorted in moz.build
    const fileStr = files
      .sort((a, b) => (a.toLowerCase() < b.toLowerCase() ? -1 : 1))
      .map(file => `    '${file}',`)
      .join("\n");

    const dirStr = dirs
      .sort((a, b) => (a.toLowerCase() < b.toLowerCase() ? -1 : 1))
      .map(dir => `    '${dir}',`)
      .join("\n");

    const src = MOZ_BUILD_TEMPLATE.replace("__DIRS__", dirStr).replace(
      "__FILES__",
      fileStr
    );

    fs.writeFileSync(path.join(buildPath, "moz.build"), src);
  });
}
1247146
def compile(self, source, options={}):
    
    options = dict(options)
    if "paths" in options:
      options["paths"] += self.paths
    else:
      options["paths"] = self.paths

    if "compress" not in options:
      options["compress"] = self.compress

    return self.context.call("compiler", source, options, self.plugins, self.imports)