Skip to content

Commit

Permalink
plugin-development: Support specifying guice module
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Sep 24, 2024
1 parent fb00781 commit 46bd470
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ public void description(final String description) {
this.description.set(description);
}

public void guiceModule(final String guiceModule) {
this.property("guice-module", guiceModule);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.gradle.api.tasks.Optional;

import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;

public abstract class PluginInheritableConfiguration {

Expand All @@ -46,6 +48,8 @@ public abstract class PluginInheritableConfiguration {

private final NamedDomainObjectContainer<PluginDependencyConfiguration> dependencies;

private final Map<String, Object> properties;


@Inject
public PluginInheritableConfiguration(final ObjectFactory objects) {
Expand All @@ -55,6 +59,7 @@ public PluginInheritableConfiguration(final ObjectFactory objects) {

this.contributors = objects.domainObjectContainer(PluginContributorConfiguration.class);
this.dependencies = objects.domainObjectContainer(PluginDependencyConfiguration.class);
this.properties = new HashMap<>();
}

@Input
Expand Down Expand Up @@ -110,4 +115,13 @@ public void dependencies(final Action<? super NamedDomainObjectContainer<PluginD
public void dependency(final String name, final Action<? super PluginDependencyConfiguration> action) {
this.dependencies.register(name, action);
}

@Nested
public Map<String, Object> getProperties() {
return this.properties;
}

public void property(final String key, final Object value) {
this.properties.put(key, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ private <T extends StandardInheritable.AbstractBuilder<?, T>> T populateBuilder(

builder.addDependency(dependencyBuilder.build());
}

builder.properties(src.getProperties());
return builder;
}
}

0 comments on commit 46bd470

Please sign in to comment.