Skip to content

Commit dbf3a78

Browse files
committed
Added support for "provides ... with..." directive.
1 parent 92957ef commit dbf3a78

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/org/gradlex/javamodule/moduleinfo/ModuleInfo.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class ModuleInfo extends ModuleSpec {
2727
final Set<String> requiresStaticTransitive = new LinkedHashSet<>();
2828
final Map<String, Set<String>> ignoreServiceProviders = new LinkedHashMap<>();
2929
final Set<String> uses = new LinkedHashSet<>();
30+
final Map<String, Set<String>> providers = new LinkedHashMap<>();
3031

3132
boolean exportAllPackages;
3233
boolean requireAllDefinedDependencies;
@@ -92,6 +93,22 @@ public void requiresStaticTransitive(String requiresStaticTransitive) {
9293
addOrThrow(this.requiresStaticTransitive, requiresStaticTransitive);
9394
}
9495

96+
/**
97+
* @param provides corresponds to the directive in a 'module-info.java' file
98+
* @param with specifys the package(s) containing provided service classes
99+
*/
100+
public void provides(String provides, String... with) {
101+
addOrThrow(this.providers, provides, with);
102+
}
103+
104+
/**
105+
* Getter for the providers map (needed for the transformation logic)
106+
* @return
107+
*/
108+
public Map<String, Set<String>> getProviders() {
109+
return providers;
110+
}
111+
95112
/**
96113
* @param uses corresponds to the directive in a 'module-info.java' file
97114
*/

0 commit comments

Comments
 (0)