Given a TargetAdaptor struct previously parsed from a BUILD file, instantiate a Target.
977336
def _instantiate_target(self, target_adaptor):
    """"""
    target_cls = self._target_types[target_adaptor.type_alias]
    try:
      # Pop dependencies, which were already consumed during construction.
      kwargs = target_adaptor.kwargs()
      kwargs.pop('dependencies')

      # Instantiate.
      if issubclass(target_cls, AppBase):
        return self._instantiate_app(target_cls, kwargs)
      elif target_cls is RemoteSources:
        return self._instantiate_remote_sources(kwargs)
      return target_cls(build_graph=self, **kwargs)
    except TargetDefinitionException:
      raise
    except Exception as e:
      raise TargetDefinitionException(
          target_adaptor.address,
          'Failed to instantiate Target with type {}: {}'.format(target_cls, e))
861326
def start_building (self, main_target_instance):
        
        assert isinstance(main_target_instance, MainTarget)
        if id(main_target_instance) in self.targets_being_built_:
            names = []
            for t in self.targets_being_built_.values() + [main_target_instance]:
                names.append (t.full_name())

            get_manager().errors()("Recursion in main target references\n")

        self.targets_being_built_[id(main_target_instance)] = main_target_instance
487414
private void buildNewInstanceMethodForBuilder( MethodSpec.Builder newInstanceMethodBuilder ) {
        newInstanceMethodBuilder.addStatement( "return new $T(builderDeserializer.deserializeInline(reader, ctx, params, null, null, null, bufferedProperties).build(), bufferedProperties)",
                parameterizedName( Instance.class, beanInfo.getType() ) );
    }
429801
private LocalVariableDefinition buildStruct(MethodDefinition read, Map<Short, LocalVariableDefinition> structData)
    {
        // construct the instance and store it in the instance local variable
        LocalVariableDefinition instance = constructStructInstance(read, structData);

        // inject fields
        injectStructFields(read, instance, structData);

        // inject methods
        injectStructMethods(read, instance, structData);

        // invoke factory method if present
        invokeFactoryMethod(read, structData, instance);

        return instance;
    }
401753
protected void buildConstructorWithFields(ClassVisitor cw,
                                              ClassDefinition classDef,
                                              Collection<FieldDefinition> fieldDefs) {


        Type[] params = new Type[fieldDefs.size()];
        int index = 0;
        for ( FieldDefinition field : fieldDefs ) {
            params[index++] = Type.getType( BuildUtils.getTypeDescriptor( field.getTypeName() ) );
        }

        MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
                "<init>",
                Type.getMethodDescriptor( Type.VOID_TYPE,
                        params ),
                null,
                null );
        mv.visitCode();
        Label l0 = null;
        if ( this.debug ) {
            l0 = new Label();
            mv.visitLabel( l0 );
        }

        fieldConstructorStart( mv, classDef, fieldDefs );

        mv.visitInsn( Opcodes.RETURN );
        Label l1 = null;
        if ( this.debug ) {
            l1 = new Label();
            mv.visitLabel( l1 );
            mv.visitLocalVariable( "this",
                    BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                    null,
                    l0,
                    l1,
                    0 );
            for ( FieldDefinition field : classDef.getFieldsDefinitions() ) {
                Label l11 = new Label();
                mv.visitLabel( l11 );
                mv.visitLocalVariable( field.getName(),
                        BuildUtils.getTypeDescriptor( field.getTypeName() ),
                        null,
                        l0,
                        l1,
                        0 );
            }
        }
        mv.visitMaxs( 0,
                0 );
        mv.visitEnd();

    }
440236
def compute_targets_to_build(self, targets: Iterable[str]) -> Iterable[BuildTarget]:
        
        normalized_targets = set()
        for target in targets:
            normalized_targets.update(self._normalize_target(target))

        targets_to_parse = deque(normalized_targets)
        targets_seen = set(normalized_targets)
        targets_not_found = []
        build_targets = set()

        while targets_to_parse:
            next_target_string = targets_to_parse.popleft()
            next_target = self._parse_target(next_target_string)
            build_file = self.parser.parse_file(next_target.build_file_directory)
            if next_target.name not in build_file.targets:
                targets_not_found.append(next_target_string)
                continue
            target_to_build = build_file.targets[next_target.name]
            build_targets.add(target_to_build)

            new_targets = [
                dependency
                for dependency in target_to_build.dependencies
                if dependency not in targets_seen
            ]
            targets_to_parse.extend(new_targets)
            targets_seen.update(new_targets)

        if targets_not_found and self.fail_on_unbuilt_target:
            raise BuilderException(
                "Target(s) could not be built: {}".format(", ".join(targets_not_found)),
                targets=targets_not_found,
            )
        return build_targets
433351
def target_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/targets.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
793628
def MakeExecutableTemplate(self, output_file=None):
    """"""
    super(DarwinClientBuilder,
          self).MakeExecutableTemplate(output_file=output_file)
    self.SetBuildVars()
    self.MakeBuildDirectory()
    self.BuildWithPyInstaller()
    self.CopyMissingModules()
    self.BuildInstallerPkg(output_file)
    self.MakeZip(output_file, self.template_file)
1239714
def hydrate_target(hydrated_struct):
  target_adaptor = hydrated_struct.value
  """"""
  # Hydrate the fields of the adaptor and re-construct it.
  hydrated_fields = yield [Get(HydratedField, HydrateableField, fa)
                           for fa in target_adaptor.field_adaptors]
  kwargs = target_adaptor.kwargs()
  for field in hydrated_fields:
    kwargs[field.name] = field.value
  yield HydratedTarget(target_adaptor.address,
                        TargetAdaptor(**kwargs),
                        tuple(target_adaptor.dependencies))
716299
def _make_target_adaptor(base_class, target_type):
  """"""
  if not target_type.supports_default_sources() or target_type.default_sources_globs is None:
    return base_class

  globs = _tuplify(target_type.default_sources_globs)
  excludes = _tuplify(target_type.default_sources_exclude_globs)

  class GlobsHandlingTargetAdaptor(base_class):
    @property
    def default_sources_globs(self):
      if globs is None:
        return super(GlobsHandlingTargetAdaptor, self).default_sources_globs
      else:
        return globs

    @property
    def default_sources_exclude_globs(self):
      if excludes is None:
        return super(GlobsHandlingTargetAdaptor, self).default_sources_exclude_globs
      else:
        return excludes

  return GlobsHandlingTargetAdaptor
736631
function createImportTargets(importTargets, targetName, targetDirectory) {
  const importMap = {};
  for (const x in importTargets) {
    importMap['rxjs/' + x] = ('rxjs-compat/' + targetName + importTargets[x]).replace(/\.js$/, '');
  }

  const outputData =
`
"use strict"

var path = require('path');
var dir = path.resolve(__dirname);

module.exports = function() {
  return ${JSON.stringify(importMap, null, 4)};
}
`

  fs.outputFileSync(targetDirectory + 'path-mapping.js', outputData);
}
679636
protected function intoStruct()
    {
        $class = new ReflectionObject($this);
        $this->classname = $class->getName();
        $this->wsdlclassname = str_replace('\\', '.', $class->getName());
        $this->classMethodsIntoStruct();
        $this->classStructDispatch();
    }
617540
private LocalVariableDefinition constructStructInstance(MethodDefinition read, Map<Short, LocalVariableDefinition> structData)
    {
        LocalVariableDefinition instance = read.addLocalVariable(structType, "instance");

        // create the new instance (or builder)
        if (metadata.getBuilderClass() == null) {
            read.newObject(structType).dup();
        }
        else {
            read.newObject(metadata.getBuilderClass()).dup();
        }

        // invoke constructor
        ThriftConstructorInjection constructor = metadata.getConstructorInjection().get();
        // push parameters on stack
        for (ThriftParameterInjection parameter : constructor.getParameters()) {
            read.loadVariable(structData.get(parameter.getId()));
        }
        // invoke constructor
        read.invokeConstructor(constructor.getConstructor())
                .storeVariable(instance);
        return instance;
    }
1008703
private static List<Method> adaptConstructors(List<Method> methods, TypeDef target) {
        List<Method> adapted = new ArrayList<Method>();
        for (Method m : methods) {
            adapted.add(new MethodBuilder(m)
                    .withName(null)
                    .withReturnType(target.toUnboundedReference())
                    .build());
        }
        return adapted;
    }
160440
private void generateInjectAdapter(TypeElement type, ExecutableElement constructor,
      List<Element> fields) throws IOException {
    String packageName = getPackage(type).getQualifiedName().toString();
    TypeMirror supertype = getApplicationSupertype(type);
    if (supertype != null) {
      supertype = processingEnv.getTypeUtils().erasure(supertype);
    }
    ClassName injectedClassName = ClassName.get(type);
    ClassName adapterClassName = adapterName(injectedClassName, INJECT_ADAPTER_SUFFIX);

    boolean isAbstract = type.getModifiers().contains(ABSTRACT);
    boolean injectMembers = !fields.isEmpty() || supertype != null;
    boolean disambiguateFields = !fields.isEmpty()
        && (constructor != null)
        && !constructor.getParameters().isEmpty();
    boolean dependent = injectMembers
        || ((constructor != null) && !constructor.getParameters().isEmpty());

    TypeSpec.Builder result = TypeSpec.classBuilder(adapterClassName.simpleName())
        .addOriginatingElement(type)
        .addModifiers(PUBLIC, FINAL)
        .superclass(ParameterizedTypeName.get(ClassName.get(Binding.class), injectedClassName))
        .addJavadoc("$L", bindingTypeDocs(injectableType(type.asType()), isAbstract,
            injectMembers, dependent).toString());

    for (Element field : fields) {
      result.addField(memberBindingField(disambiguateFields, field));
    }
    if (constructor != null) {
      for (VariableElement parameter : constructor.getParameters()) {
        result.addField(parameterBindingField(disambiguateFields, parameter));
      }
    }
    if (supertype != null) {
      result.addField(supertypeBindingField(supertype));
    }

    result.addMethod(writeInjectAdapterConstructor(constructor, type, injectedClassName));
    if (dependent) {
      result.addMethod(attachMethod(
          constructor, fields, disambiguateFields, injectedClassName, supertype, true));
      result.addMethod(getDependenciesMethod(
          constructor, fields, disambiguateFields, supertype, true));
    }
    if (constructor != null) {
      result.addMethod(
          getMethod(constructor, disambiguateFields, injectMembers, injectedClassName));
    }
    if (injectMembers) {
      result.addMethod(
          membersInjectMethod(fields, disambiguateFields, injectedClassName, supertype));
    }

    JavaFile javaFile = JavaFile.builder(packageName, result.build())
        .addFileComment(AdapterJavadocs.GENERATED_BY_DAGGER)
        .build();
    javaFile.writeTo(processingEnv.getFiler());
  }
673699
def resolve_reference(target_reference, project):
    
    # Separate target name from properties override
    assert isinstance(target_reference, basestring)
    assert isinstance(project, ProjectTarget)
    split = _re_separate_target_from_properties.match (target_reference)
    if not split:
        raise BaseException ("Invalid reference: '%s'" % target_reference)

    id = split.group (1)

    sproperties = []

    if split.group (3):
        sproperties = property.create_from_strings(feature.split(split.group(3)))
        sproperties = feature.expand_composites(sproperties)

    # Find the target
    target = project.find (id)

    return (target, property_set.create(sproperties))
894282
private Object getTarget(Map<String, Command> references) throws Exception
	{
		if (target == null)
		{
			if (isReference())
			{
				Command cmd = references.get(getAttr("idref")); //$NON-NLS-1$
				target = (cmd != null) ? cmd.getResultValue() : null;
			}
			else if (isExecutable())
			{
				String className = null;

				if (isPrimitive())
				{
					className = getPrimitiveClassName(tagName);
				}
				else if (isTag("class")) { //$NON-NLS-1$
					className = getPrimitiveClassName(tagName);
				}
				else if (isConstructor() || isStaticMethod() || isField())
				{
					className = getAttr("class"); //$NON-NLS-1$
				}
				else if (isArray())
				{
					className = getAttr("class"); //$NON-NLS-1$
					Class<?> componentType = isPrimitiveClassName(className) ? getPrimitiveClass(className) : Class.forName(className, true, Thread
							.currentThread().getContextClassLoader());
					className = Array.newInstance(componentType, 0).getClass().getName();
				}

				if (className != null)
				{
					try
					{
						target = Class.forName(className, true, Thread.currentThread().getContextClassLoader());
					}
					catch (ClassNotFoundException e)
					{
						target = Class.forName(className);
					}

					if (isField())
					{
						String fieldName = getAttr("field"); //$NON-NLS-1$
						target = ((Class<?>) target).getField(fieldName);
					}
				}
				else
				{
					throw new Exception(Messages.getString("beans.42", className)); //$NON-NLS-1$
				}
			}
			else if (ctx.isArray())
			{
				// target = ctx.getTarget(references);
				target = Class.forName("java.lang.reflect.Array"); //$NON-NLS-1$
			}
		}
		return target;
	}