Skip to content

Add 'exportsTo' and 'opensTo' statements to Module Info DSL #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ public void requiresStatic(String moduleName) {
compileClasspathModules.add(moduleName);
add(sourceSet.getCompileOnlyConfigurationName(), moduleName);
}

public void exportsTo(String moduleName) {
exportsToModules.add(moduleName);
}

public void opensTo(String moduleName) {
opensToModules.add(moduleName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public abstract class GradleOnlyDirectives {

protected final List<String> compileClasspathModules = new ArrayList<>();
protected final List<String> runtimeClasspathModules = new ArrayList<>();
protected final List<String> exportsToModules = new ArrayList<>();
protected final List<String> opensToModules = new ArrayList<>();

@Inject
protected abstract DependencyHandler getDependencies();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

import java.util.List;

/**
* Note: These methods are used by the 'java-module-testing' plugin to access information
* defined in the Module Info DSL.
*/
abstract public class AllDirectivesInternal extends AllDirectives {

public AllDirectivesInternal(SourceSet sourceSet, SourceSet mainSourceSet, JavaModuleDependenciesExtension javaModuleDependencies) {
Expand All @@ -35,4 +39,12 @@ public List<String> getCompileClasspathModules() {
public List<String> getRuntimeClasspathModules() {
return runtimeClasspathModules;
}

public List<String> getExportsToModules() {
return exportsToModules;
}

public List<String> getOpensToModules() {
return opensToModules;
}
}