Skip to content

Commit

Permalink
[base] fix display of buildInfo section. Fixes #352
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Almiray committed Jun 28, 2020
1 parent 8fb54b4 commit 364ffc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ abstract class AbstractFeature implements Feature {

protected final ProjectConfigurationExtension config
protected final Project project
protected final String pluginId

AbstractFeature(ProjectConfigurationExtension config, Project project, String pluginId) {
this.config = config
this.project = project
this.pluginId = pluginId
doSetEnabled(project.plugins.findPlugin(pluginId) != null)
}

Expand All @@ -61,13 +63,7 @@ abstract class AbstractFeature implements Feature {
}

static void merge(AbstractFeature o1, AbstractFeature o2) {
if (!o1.enabledSet) {
if (o2.enabledSet) {
o1.setEnabled(o2.enabled)
} else {
o1.@enabled = o2.enabled
}
}
o1.@enabled = (boolean) (o1.enabledSet ? o1.enabled : o2.enabled)
}

@CompileDynamic
Expand All @@ -78,7 +74,7 @@ abstract class AbstractFeature implements Feature {
@CompileDynamic
protected boolean isApplied(Project project) {
ExtraPropertiesExtension ext = project.extensions.findByType(ExtraPropertiesExtension)
ext.has('VISITED_' + getClass().PLUGIN_ID.replace('.', '_') + '_' + project.path.replace(':', '#'))
return ext.has('VISITED_' + pluginId.replace('.', '_') + '_' + project.path.replace(':', '#'))
}

void normalize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class BuildInfo extends AbstractFeature {
}
}

@Override
protected void normalizeVisible() {
if (isRoot()) {
setVisible(isApplied())
}
}

@Override
Map<String, Map<String, Object>> toMap() {
if (!isRoot()) return [:]
Expand Down

0 comments on commit 364ffc4

Please sign in to comment.