Java 类org.gradle.api.plugins.ExtensionContainer 实例源码

项目:gradle-golang-plugin    文件:GolangPluginSupport.java   
@Override
public void apply(Project project) {
    final ConfigurationContainer configurations = project.getConfigurations();
    configurations.maybeCreate("test");
    configurations.maybeCreate("build");
    configurations.maybeCreate("tool");

    final ExtensionContainer extensions = project.getExtensions();
    final ExtensionAware golang = (ExtensionAware) extensions.create("golang", GolangSettings.class, true, project);
    golang.getExtensions().create("build", BuildSettings.class, true, project);
    golang.getExtensions().create("toolchain", ToolchainSettings.class, true, project);
    golang.getExtensions().create("dependencies", DependenciesSettings.class, true, project);
    golang.getExtensions().create("testing", TestingSettings.class, true, project);

    extensions.create(INSTANCE_PROPERTY_NAME, Reference.class, this);

    final TaskContainer tasks = project.getTasks();
    addTasks(tasks);
}
项目:gradle-eclipse-checkstyle    文件:EclipseCheckstyle.java   
public void generate() {
  ExtensionContainer extensions = project.getExtensions();
  EclipseCheckstyleExtension prefs = extensions.getByType(EclipseCheckstyleExtension.class);

  CheckstyleExtension ext = project.getExtensions().getByType(CheckstyleExtension.class);
  if (ext == null) {
    return;
  }

  // Without a checkstyle config file defined, we currently don't do anything.
  File configFile = ext.getConfigFile();
  if (configFile == null || !configFile.exists()) {
    return;
  }

  log.info("eclipse checkstyle: configuring eclipse checkstyle using config {}", configFile);
  String configPath = configFile.toString();
  String projectDir = project.getProjectDir().getAbsolutePath() + File.separator;
  String name = project.getName() + "-checkstyle";
  write(projectDir, CHECKSTYLE_CONFIG, build(name, configPath, prefs));
}
项目:gradle-lazy-credentials    文件:PasswordPromptTest.java   
@Before
public void setUp() {
    project = mock(Project.class);
    // project.getExtensions().getExtraProperties().set(passwordProperty, pass);
    ExtensionContainer extensionContainer = mock(ExtensionContainer.class);
    when(project.getExtensions()).thenReturn(extensionContainer);
    extraProperties = mock(ExtraPropertiesExtension.class);
    when(extensionContainer.getExtraProperties()).thenReturn(extraProperties);
}
项目:gradle-golang-plugin    文件:Settings.java   
public Settings(@Nonnull Project project, @Nonnull ExtensionContainer container) {
    _project = project;
    _golang = container.getByType(GolangSettings.class);
    if (!(_golang instanceof ExtensionAware)) {
        throw new IllegalStateException("golang instance (" + _golang + ") of provided extension container (" + container + ") is not an instance of " + ExtensionAware.class.getName() + ".");
    }
    final ExtensionContainer globalExtensions = ((ExtensionAware) _golang).getExtensions();
    _build = globalExtensions.getByType(BuildSettings.class);
    _toolchain = globalExtensions.getByType(ToolchainSettings.class);
    _dependencies = globalExtensions.getByType(DependenciesSettings.class);
    _testing = globalExtensions.getByType(TestingSettings.class);
}
项目:gradle-golang-plugin    文件:Settings.java   
public Settings(@Nonnull Project project, @Nonnull ExtensionContainer container, boolean init) {
    _project = project;
    _golang = container.create("golang", GolangSettings.class, init, project);
    final ExtensionContainer taskExtensions = ((ExtensionAware) _golang).getExtensions();
    _build = taskExtensions.create("build", BuildSettings.class, init, project);
    _toolchain = taskExtensions.create("toolchain", ToolchainSettings.class, init, project);
    _dependencies = taskExtensions.create("dependencies", DependenciesSettings.class, init, project);
    _testing = taskExtensions.create("testing", TestingSettings.class, init, project);
}
项目:gradle-project-config    文件:ProjectConfigPlugin.java   
/**
 * Create task to update readme file from template
 *
 * @param tasks Task container to create new tasks
 * @param projectConfig Project configuration
 * @param projectContext Project context
 * @param extensions Extension container
 */
@Mutate
public void createReadmeUpdateTasks(ModelMap<Task> tasks, ProjectConfig projectConfig,
        ProjectContext projectContext, ExtensionContainer extensions) {
    // Create task to update the README
    Map<String, Object> context = new HashMap<>();

    extensions.getExtraProperties().getProperties().forEach((name, value) -> {
        context.put(name, value);
    });

    context.put("project", projectContext);
    context.put("projectConfig", projectConfig);

    tasks.create("readmeUpdate", Copy.class, t -> {
        t.setDescription("Update README from template.");
        t.setGroup("documentation");
        t.from("src/doc/templates");
        t.include("README.template.md");
        t.rename(n -> n.replace(".template.", "."));
        t.expand(context);

        ConventionMapping parameters = t.getConventionMapping();
        parameters.map("destinationDir", () -> projectContext.getProjectDir());
    });

    tasks.named("assemble", t -> {
        t.dependsOn("readmeUpdate");
    });
}
项目:ya-cf-app-gradle-plugin    文件:CfPropertiesMapperTest.java   
@Before
public void setUp() {
    this.project = mock(Project.class);
    ExtensionContainer extensionContainer = mock(ExtensionContainer.class);
    this.pluginExtension = sampleExtension(this.project);
    when(extensionContainer.findByType(CfPluginExtension.class)).thenReturn(this.pluginExtension);
    when(this.project.getExtensions()).thenReturn(extensionContainer);
    this.cfPropertiesMapper = new CfPropertiesMapper(this.project);
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
protected RegisterTypeRule(ModelType<? extends T> type, ModelType<? extends U> implementation, ModelRuleDescriptor descriptor, Action<? super RegistrationContext<T, U>> registerAction) {
    this.type = type;
    this.implementation = implementation;
    this.descriptor = descriptor;
    this.registerAction = registerAction;

    subject = ModelReference.of("extensions", ExtensionContainer.class);
    inputs = ImmutableList.<ModelReference<?>>of(ModelReference.of(ProjectIdentifier.class));
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public final void mutate(final ExtensionContainer extensionContainer, final Inputs inputs) {
    RuleContext.inContext(getDescriptor(), new Runnable() {
        public void run() {
            RegistrationContext<T, U> context = new RegistrationContext<T, U>(type, implementation, extensionContainer, inputs.get(0, ModelType.of(ProjectIdentifier.class)).getInstance());
            registerAction.execute(context);
        }
    });
}
项目:Reer    文件:ComponentModelBasePlugin.java   
@Mutate
void registerPlatformExtension(ExtensionContainer extensions, PlatformContainer platforms) {
    extensions.add("platforms", platforms);
}
项目:Reer    文件:PublishingPlugin.java   
@Model
PublishingExtension publishing(ExtensionContainer extensions) {
    return extensions.getByType(PublishingExtension.class);
}
项目:Reer    文件:CoffeeScriptBasePlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(RhinoPlugin.class);

    JavaScriptExtension jsExtension = project.getExtensions().getByType(JavaScriptExtension.class);

    ExtensionContainer extensionContainer = ((ExtensionAware) jsExtension).getExtensions();
    final CoffeeScriptExtension csExtension = extensionContainer.create(CoffeeScriptExtension.NAME, CoffeeScriptExtension.class);
    final Configuration jsConfiguration = addJsConfiguration(project.getConfigurations(), project.getDependencies(), csExtension);

    ConventionMapping conventionMapping = ((IConventionAware) csExtension).getConventionMapping();
    conventionMapping.map("js", new Callable<Configuration>() {
        @Override
        public Configuration call() {
            return jsConfiguration;
        }
    });
    conventionMapping.map("version", new Callable<String>() {
        @Override
        public String call() {
            return CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_VERSION;
        }
    });

    final RhinoExtension rhinoExtension = extensionContainer.getByType(RhinoExtension.class);

    project.getTasks().withType(CoffeeScriptCompile.class, new Action<CoffeeScriptCompile>() {
        @Override
        public void execute(CoffeeScriptCompile task) {
            task.getConventionMapping().map("rhinoClasspath", new Callable<FileCollection>() {
                public FileCollection call() {
                    return rhinoExtension.getClasspath();
                }
            });
            task.getConventionMapping().map("coffeeScriptJs", new Callable<FileCollection>() {
                public FileCollection call() {
                    return csExtension.getJs();
                }
            });
        }
    });
}
项目:Reer    文件:NativeComponentModelPlugin.java   
@Model
NativeToolChainRegistryInternal toolChains(ExtensionContainer extensionContainer) {
    return extensionContainer.getByType(NativeToolChainRegistryInternal.class);
}
项目:Reer    文件:NativeComponentModelPlugin.java   
@Model
BuildTypeContainer buildTypes(ExtensionContainer extensionContainer) {
    return extensionContainer.getByType(BuildTypeContainer.class);
}
项目:Reer    文件:NativeComponentModelPlugin.java   
@Model
FlavorContainer flavors(ExtensionContainer extensionContainer) {
    return extensionContainer.getByType(FlavorContainer.class);
}
项目:Reer    文件:JavaGradlePluginPlugin.java   
@Model
public GradlePluginDevelopmentExtension gradlePluginDevelopmentExtension(ExtensionContainer extensionContainer) {
    return extensionContainer.getByType(GradlePluginDevelopmentExtension.class);
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public ExtensionContainer getExtensions() {
    return convention;
}
项目:Reer    文件:AbstractTask.java   
public ExtensionContainer getExtensions() {
    return getConvention();
}
项目:Reer    文件:DslObject.java   
public ExtensionContainer getExtensions() {
    if (extensionContainer == null) {
        this.extensionContainer = toType(object, ExtensionAware.class).getExtensions();
    }
    return extensionContainer;
}
项目:Reer    文件:PlayApplicationPlugin.java   
@Model
PlayPluginConfigurations configurations(ExtensionContainer extensions) {
    return extensions.getByType(PlayPluginConfigurations.class);
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public RegistrationContext(ModelType<? extends T> type, ModelType<? extends U> implementation, ExtensionContainer extensions, ProjectIdentifier projectIdentifier) {
    this.type = type;
    this.implementation = implementation;
    this.extensions = extensions;
    this.projectIdentifier = projectIdentifier;
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public ExtensionContainer getExtensions() {
    return extensions;
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public ModelReference<ExtensionContainer> getSubject() {
    return subject;
}
项目:Pushjet-Android    文件:ComponentTypeRuleDefinitionHandler.java   
public void execute(final RegistrationContext<ComponentSpec, BaseComponentSpec> context) {
    ExtensionContainer extensions = context.getExtensions();
    ProjectSourceSet projectSourceSet = extensions.getByType(ProjectSourceSet.class);
    ComponentSpecContainer componentSpecs = extensions.getByType(ComponentSpecContainer.class);
    doRegister(context.getType(), context.getImplementation(), projectSourceSet, componentSpecs, context.getProjectIdentifier());
}
项目:Pushjet-Android    文件:ComponentModelBasePlugin.java   
@Model
LanguageRegistry languages(ExtensionContainer extensions) {
    return extensions.getByType(LanguageRegistry.class);
}
项目:Pushjet-Android    文件:ComponentModelBasePlugin.java   
@Mutate
void registerPlatformExtension(ExtensionContainer extensions, PlatformContainer platforms) {
    extensions.add("platforms", platforms);
}
项目:Pushjet-Android    文件:LanguageBasePlugin.java   
@Model
ProjectSourceSet sources(ExtensionContainer extensions) {
    return extensions.getByType(ProjectSourceSet.class);
}
项目:Pushjet-Android    文件:PublishingPlugin.java   
@Model
PublishingExtension publishing(ExtensionContainer extensions) {
    return extensions.getByType(PublishingExtension.class);
}
项目:Pushjet-Android    文件:NativeComponentModelPlugin.java   
@Mutate
public void registerExtensions(ExtensionContainer extensions, BuildTypeContainer buildTypes, FlavorContainer flavors) {
    extensions.add("buildTypes", buildTypes);
    extensions.add("flavors", flavors);
}
项目:Pushjet-Android    文件:DefaultNamedDomainObjectCollection.java   
public ExtensionContainer getExtensions() {
    return convention;
}
项目:Pushjet-Android    文件:AbstractTask.java   
public ExtensionContainer getExtensions() {
    return getConvention();
}
项目:Pushjet-Android    文件:DslObject.java   
public ExtensionContainer getExtensions() {
    if (extensionContainer == null) {
        this.extensionContainer = toType(object, ExtensionAware.class).getExtensions();
    }
    return extensionContainer;
}
项目:Pushjet-Android    文件:DefaultNamedDomainObjectCollection.java   
public ExtensionContainer getExtensions() {
    return convention;
}
项目:Pushjet-Android    文件:AbstractTask.java   
public ExtensionContainer getExtensions() {
    return getConvention();
}
项目:Pushjet-Android    文件:DslObject.java   
public ExtensionContainer getExtensions() {
    if (extensionContainer == null) {
        this.extensionContainer = toType(object, ExtensionAware.class).getExtensions();
    }
    return extensionContainer;
}
项目:graclj    文件:GracljInternalRules.java   
@Model
public GracljInternal gracljInternalDependencies(ExtensionContainer extensions) {
    return extensions.getByType(GracljInternal.class);
}
项目:Reer    文件:Project.java   
/**
 * Allows adding DSL extensions to the project. Useful for plugin authors.
 *
 * @return Returned instance allows adding DSL extensions to the project
 */
ExtensionContainer getExtensions();
项目:gradle-project-config    文件:ProjectConfigPlugin.java   
/**
 * Provide the project context
 *
 * @param extensions Extension container to look up the context
 * @return Project context
 */
@Model
public ProjectContext projectContext(ExtensionContainer extensions) {
    return extensions.getByType(ProjectContext.class);
}
项目:gradle-project-config    文件:EclipseConfigPlugin.java   
/**
 * Provide the Eclipse plugin's configuration
 *
 * @param extensions Container to access extensions
 * @return Eclipse plugin's configuration
 */
@Model
@Hidden
public EclipseModel eclipseModel(ExtensionContainer extensions) {
    return extensions.getByType(EclipseModel.class);
}