Builds necessary assets from sources.
178506
def compile_protos():
  """"""
  # If there's no makefile, we're likely installing from an sdist,
  # so there's no need to compile the protos (they should be already
  # compiled).
  if not os.path.exists(os.path.join(THIS_DIRECTORY, "makefile.py")):
    return

  # Only compile protobufs if we're inside GRR source tree.
  subprocess.check_call(
      ["python", "makefile.py", "--clean"], cwd=THIS_DIRECTORY)
423777
def build(
    root, source_module, output_dir,
    json_dump=False, ignore_modules=None, index_filename='index'
):
    '''
    
    '''
    if root.endswith('/'):
        root = root[:-1]

    if ignore_modules is None:
        ignore_modules = []
    elif isinstance(ignore_modules, str):
        ignore_modules = ignore_modules.split(',')

    # Ensure output_dir format (no / at start, / at end)
    if output_dir.startswith('/'):
        output_dir = output_dir[1:]

    if not output_dir.endswith('/'):
        output_dir = '{}/'.format(output_dir)

    # Apply root to it, make the directory if not exists
    output_dir = '{}/{}'.format(root, output_dir)
    if not path.isdir(output_dir):
            makedirs(output_dir)

    if source_module == '.':
        source_dir = '{}/'.format(root)
    else:
        source_dir = '{}/{}/'.format(root, source_module.replace('.', os.sep))

    # Cd into the source directory
    chdir(source_dir)
    # And build the module list
    module_list = _build_module_list(
        source_module,
        index_filename=index_filename,
        ignore_modules=ignore_modules
    )

    # Cd back to old directory
    chdir(root)
    # And parse all the modules
    _parse_module_list(module_list)

    # Cd inot the target directory
    chdir(output_dir)
    # Finally, write the module list to our output dir
    _write_docs(module_list, output_dir)

    if json_dump:
        print json.dumps(module_list, indent=4)
171748
def sprockets_build(sprocket_assets = [:javascripts, :stylesheets])
      sprocket_assets.each do |asset_type|
        load_path = File.join(@project_root, asset_type.to_s)
        next unless File.exists?(load_path)
        sprockets_env.append_path load_path
        Dir.new(load_path).each do |filename|
          file = File.join(load_path, filename)
          if File.file?(file)
            asset = sprockets_env[filename]
            attributes = sprockets_env.find_asset(asset.pathname)
            # logical_path is the filename
            build_file = File.join(build_path, asset_type.to_s, attributes.logical_path)
            File.open(build_file, 'w') do |f|
              extension = attributes.logical_path.split(".").last
              f.write(minify(asset, extension))
            end
          end
        end
      end
    end
248980
protected static function build_update_source() {
		// We need to copy the latest version of our Phar files.
		$bin_dir = \dirname(\BOB_ROOT_DIR) . '/bin/';
		$out_dir = static::get_plugin_dir() . 'lib/';

		log::print('Copying Phar archives…');

		// TODO: add 'blob-common.phar' to the list below.
		foreach (array('test.phar') as $file) {
			if (\is_file("{$out_dir}{$file}")) {
				\unlink("{$out_dir}{$file}");
			}

			\copy("{$bin_dir}{$file}", "{$out_dir}{$file}");
			\chmod("{$out_dir}{$file}", 0644);
		}
	}
548654
def source_files(self):
        """"""
        if 'srcs' in self.params and self.params['srcs'] is not None:
            return util.flatten(self.params['srcs'])
442364
def cmd_build(conf: Config, run_tests: bool=False):
    """"""
    build_context = BuildContext(conf)
    populate_targets_graph(build_context, conf)
    build_context.build_graph(run_tests=run_tests)
    build_context.write_artifacts_metadata()
573446
def build(context, provider, **kwargs):  # pylint: disable=unused-argument
    """"""
    session = get_session(provider.region)
    options = kwargs.get('options', {})
    context_dict = {}
    context_dict['artifact_key_prefix'] = "%s-%s-" % (options['namespace'], options['name'])  # noqa
    default_param_name = "%shash" % context_dict['artifact_key_prefix']

    if options.get('build_output'):
        build_output = os.path.join(
            options['path'],
            options['build_output']
        )
    else:
        build_output = options['path']

    context_dict['artifact_bucket_name'] = RxrefLookup.handle(
        kwargs.get('artifact_bucket_rxref_lookup'),
        provider=provider,
        context=context
    )

    if options.get('pre_build_steps'):
        run_commands(options['pre_build_steps'], options['path'])

    context_dict['hash'] = get_hash_of_files(
        root_path=options['path'],
        directories=options.get('source_hashing', {}).get('directories')
    )

    # Now determine if the current staticsite has already been deployed
    if options.get('source_hashing', {}).get('enabled', True):
        context_dict['hash_tracking_parameter'] = options.get(
            'source_hashing', {}).get('parameter', default_param_name)

        ssm_client = session.client('ssm')

        try:
            old_parameter_value = ssm_client.get_parameter(
                Name=context_dict['hash_tracking_parameter']
            )['Parameter']['Value']
        except ssm_client.exceptions.ParameterNotFound:
            old_parameter_value = None
    else:
        context_dict['hash_tracking_disabled'] = True
        old_parameter_value = None

    context_dict['current_archive_filename'] = (
        context_dict['artifact_key_prefix'] + context_dict['hash'] + '.zip'
    )
    if old_parameter_value:
        context_dict['old_archive_filename'] = (
            context_dict['artifact_key_prefix'] + old_parameter_value + '.zip'
        )

    if old_parameter_value == context_dict['hash']:
        LOGGER.info("staticsite: skipping build; app hash %s already deployed "
                    "in this environment",
                    context_dict['hash'])
        context_dict['deploy_is_current'] = True
        return context_dict

    if does_s3_object_exist(context_dict['artifact_bucket_name'],
                            context_dict['current_archive_filename'],
                            session):
        context_dict['app_directory'] = download_and_extract_to_mkdtemp(
            context_dict['artifact_bucket_name'],
            context_dict['current_archive_filename'], session
        )
    else:
        if options.get('build_steps'):
            LOGGER.info('staticsite: executing build commands')
            run_commands(options['build_steps'], options['path'])
        zip_and_upload(build_output, context_dict['artifact_bucket_name'],
                       context_dict['current_archive_filename'], session)
        context_dict['app_directory'] = build_output

    context_dict['deploy_is_current'] = False
    return context_dict
469720
def build_deb(ctx, target):
    
    if target not in ('ubuntu-trusty',):
        print('Error: unknown target "{0}"!'.format(target), file=sys.stderr)
        sys.exit(1)

    os.chdir(PROJECT_DIR)
    debbuild_dir = os.path.join(DIST_DIR, 'deb')

    # Create directories layout
    ctx.run('mkdir -p {0}'.format(debbuild_dir))

    # Copy the sources
    build_src(ctx, dest=debbuild_dir)
    src_archive = glob.glob(os.path.join(debbuild_dir, 'mssh-copy-id-*.tar.gz'))[0]
    ctx.run('tar -xvf {0} -C {1}'.format(src_archive, debbuild_dir))
    src_dir = src_archive[:-7]  # uncompressed directory
    ctx.run('cp -r {0} {1}'.format(os.path.join(PROJECT_DIR, 'deb/debian'), src_dir))

    # Build the deb
    ctx.run('docker run -e LOCAL_USER_ID={local_user_id} -v {local}:{cont} {img}'
            .format(local_user_id=os.getuid(),
                    local=debbuild_dir,
                    cont='/deb',
                    img=DOCKER_IMGS[target]['name']))

    ctx.run('mv -f {0} {1}'.format(os.path.join(debbuild_dir, 'mssh-copy-id_*.deb'), DIST_DIR))
1233411
protected function setupAssets()
    {
        $this->mergeConfigFrom($config = __DIR__ . '/config/datatables.php', 'datatables');

        if ($this->app->runningInConsole()) {
            $this->publishes([$config => config_path('datatables.php')], 'datatables');
        }
    }
672985
def generate(env):
    """"""
    SCons.Tool.createSharedLibBuilder(env)
    SCons.Tool.createProgBuilder(env)

    env['LINK']        = '$CC'
    env['LINKFLAGS']   = SCons.Util.CLVar('')
    env['LINKCOM']     = '$LINK -q $LINKFLAGS -e$TARGET $SOURCES $LIBS'
    env['LIBDIRPREFIX']=''
    env['LIBDIRSUFFIX']=''
    env['LIBLINKPREFIX']=''
    env['LIBLINKSUFFIX']='$LIBSUFFIX'
1323560
function BuildAssetsMiddleware (context)
{
  var grunt = context.grunt
    , options = context.options.assets;

  /**
   * Records which files have been already exported.
   * Prevents duplicate asset exports.
   * It's a map of absolute file names to boolean `true`.
   * @type {Object.<string,boolean>}
   */
  var exportedAssets = {};

  //--------------------------------------------------------------------------------------------------------------------
  // PUBLIC API
  //--------------------------------------------------------------------------------------------------------------------

  this.analyze = function (filesArray)
  {
    /* jshint unused: vars */
    // Do nothing
  };

  this.trace = function (module)
  {
    /* jshint unused: vars */
    // Do nothing.
  };

  this.build = function (targetScript)
  {
    if (!options.enabled) return;
    // Import file paths.
    var stylehseets = grunt.config (context.options.requiredStylesheets.exportToConfigProperty);
    if (!stylehseets) return; // No stylesheet sources are configured.
    var targetPath = path.dirname (targetScript);
    stylehseets.forEach (function (filePath)
    {
      var src = grunt.file.read (filePath);
      scan (path.dirname (filePath), targetPath, src);
    });

  };

  //--------------------------------------------------------------------------------------------------------------------
  // PRIVATE
  //--------------------------------------------------------------------------------------------------------------------

  /**
   * Scans a stylesheet for asset URL references and copies the assets to the build folder.
   * @private
   * @param {string} basePath
   * @param {string} targetPath
   * @param {string} sourceCode
   */
  function scan (basePath, targetPath, sourceCode)
  {
    var match;
    while ((match = MATCH_URLS.exec (sourceCode))) {
      var url = match[2];
      if (!url.match (/^http/i) && url[0] !== '/') { // Skip absolute URLs
        var absSrcPath = path.resolve (basePath, url)
          , absDestPath = path.resolve (targetPath, options.targetDir, url)
          , relDestPath = path.relative (targetPath, absDestPath);
        if (relDestPath[0] === '.')
          return util.warn ('Relative asset url falls outside the build folder: <cyan>%</cyan>%', url, util.NL);
        if (exportedAssets[absDestPath]) // skip already exported asset
          continue;
        else exportedAssets[absDestPath] = true;
        var absTargetFolder = path.dirname (absDestPath);
        grunt.file.mkdir (absTargetFolder);
        if (options.symlink)
          fs.symlinkSync (absSrcPath, absDestPath);
        else grunt.file.copy (absSrcPath, absDestPath);
      }
    }
  }

}
797862
public function build(): Source
    {
        $combinedSource = '';

        foreach ($this->filePaths as $filePath) {
            if (!\file_exists($filePath) || !\is_readable($filePath)) {
                throw new FileNotFoundException(sprintf('The file %s cannot be found or is not readable', $filePath));
            }

            $combinedSource .= \file_get_contents($filePath);
        }

        return new Source($combinedSource);
    }
1144276
def build(args):
    """"""

    if len(args) != 1:
        log.error('One target required.')
        app.quit(1)

    target = address.new(args[0])
    log.info('Resolved target to: %s', target)

    try:
        bb = Butcher()
        bb.clean()
        bb.load_graph(target)
        bb.build(target)
    except (gitrepo.GitError,
            error.BrokenGraph,
            error.NoSuchTargetError) as err:
        log.fatal(err)
        app.quit(1)
    except error.OverallBuildFailure as err:
        log.fatal(err)
        log.fatal('Error list:')
        [log.fatal('  [%s]: %s', e.node, e) for e in bb.failure_log]
        app.quit(1)
71255
def build_package_data(self):
        """"""
        for package, src_dir, build_dir, filenames in self.data_files:
            for filename in filenames:
                target = os.path.join(build_dir, filename)
                self.mkpath(os.path.dirname(target))
                srcfile = os.path.join(src_dir, filename)
                outf, copied = self.copy_file(srcfile, target)
                srcfile = os.path.abspath(srcfile)
                if (copied and
                        srcfile in self.distribution.convert_2to3_doctests):
                    self.__doctests_2to3.append(outf)
529934
def build(self, client, pull=False, usecache=True):
        
        stage = staging.StagedFile(self.sourceimage, self.sourcepath, self.destpath,
                                   cache_from=self.cache_from)
        stage.stage(self.baseimage, self.buildname)
901064
public function createAsset()
    {
        $css    = BASE_PATH."/public/css/";
        $js     = BASE_PATH."/public/js/";
        $source = realpath(__DIR__ . '/../assets/');
        $css_file   = file_get_contents($source."/jquery.bootgrid.css");
        $js_file    = file_get_contents($source."/jquery.bootgrid.js");
        $fajs_file  = file_get_contents($source."/jquery.bootgrid.fa.js");
        $fc = fopen($css."jquery.bootgrid.css", "w");
        fwrite($fc, $css_file);
        fclose($fc);
        $fj = fopen($js."jquery.bootgrid.js", "w");
        fwrite($fj, $js_file);
        fclose($fj);
        $fa = fopen($js."jquery.bootgrid.fa.js", "w");
        fwrite($fa, $fajs_file);
        fclose($fa);
    }
321273
def build(ctx, max_revisions, targets, operators, archiver):
    """"""
    config = ctx.obj["CONFIG"]

    from wily.commands.build import build

    if max_revisions:
        logger.debug(f"Fixing revisions to {max_revisions}")
        config.max_revisions = max_revisions

    if operators:
        logger.debug(f"Fixing operators to {operators}")
        config.operators = operators.strip().split(",")

    if archiver:
        logger.debug(f"Fixing archiver to {archiver}")
        config.archiver = archiver

    if targets:
        logger.debug(f"Fixing targets to {targets}")
        config.targets = targets

    build(
        config=config,
        archiver=resolve_archiver(config.archiver),
        operators=resolve_operators(config.operators),
    )
    logger.info(
        "Completed building wily history, run `wily report <file>` or `wily index` to see more."
    )