public DomainObjectSet<NativeLibraryBinary> getBinaries(NativeLibraryRequirement requirement) { ModelRegistry projectModel = projectModelResolver.resolveProjectModel(requirement.getProjectPath()); NamedDomainObjectSet<PrebuiltLibraries> repositories = projectModel.realize("repositories", Repositories.class).withType(PrebuiltLibraries.class); if (repositories.isEmpty()) { return null; } PrebuiltLibrary prebuiltLibrary = getPrebuiltLibrary(repositories, requirement.getLibraryName()); return prebuiltLibrary != null ? prebuiltLibrary.getBinaries() : null; }
/** Invoked by transformed DSL creation rules */ public <T> void create(String modelPathString, Class<T> type, Closure<?> closure) { SourceLocation sourceLocation = ruleLocationExtractor.transform(closure); ModelPath modelPath = ModelPath.path(modelPathString); ModelRuleDescriptor descriptor = toDescriptor(sourceLocation, modelPath); try { NodeInitializerRegistry nodeInitializerRegistry = modelRegistry.realize( DefaultNodeInitializerRegistry.DEFAULT_REFERENCE.getPath(), DefaultNodeInitializerRegistry.DEFAULT_REFERENCE.getType()); NodeInitializer nodeInitializer = nodeInitializerRegistry.getNodeInitializer(ModelType.of(type)); modelRegistry.create( ModelCreators.of(modelPath, nodeInitializer).descriptor(descriptor).build()); } catch (ModelTypeInitializationException e) { throw new InvalidModelRuleDeclarationException(descriptor, e); } registerAction(modelPath, type, descriptor, ModelActionRole.Initialize, closure); }