Skip to content

Amp tasks are registered for sourcesets without amp configuration #109

@vierbergenlars

Description

@vierbergenlars

The AmpPlugin iterates over all amp sourcesets to register amp tasks:

ampBasePlugin.allAmpSourceSetConfigurations(ampSourceSetConfig -> {

It looks like it was intended to only run for sourcesets where an amp {} configuration block is present (given the null-check):

project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets().all(sourceSet -> {
var config = new DslObject(sourceSet).getExtensions().getByType(AmpSourceSetConfiguration.class);
if (config != null) {
configure.execute(config);
}
});

However, the amp configurations are registered for all sourcesets, so AMP tasks are created even when totally unconfigured:

project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets().all(sourceSet -> {
var ampSourceSetConfig = (DefaultAmpSourceSetConfiguration)new DslObject(sourceSet).getExtensions()
.create(AmpSourceSetConfiguration.class, "amp", DefaultAmpSourceSetConfiguration.class, project, sourceSet);

This can be confusing, because even in a default configuration, there is a testAmp task present, which creates an AMP for the test sourceset. The amp is unusable because in the default setup, alfrescoProvided dependencies are also on the runtime classpath and are packaged inside the amp.
An unconfigured AMP is also uninstallable together with the main AMP, because it has the same module id

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions