Skip to content
Closed
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 @@ -187,6 +187,17 @@ public void automaticModule(Provider<MinimalExternalModuleDependency> alias, Str
automaticModule(alias.get().getModule().toString(), moduleName, conf);
}

/**
* Remove a Jar that is not a module and is not required at all.
* For example when it only contains metadata irrelevant for Java itself.
*
* @param identifier group:name coordinates _or_ Jar file name
* @param representedModuleName the Module Name of the Module that this Jar represents, needed for 'requireAllDefinedDependencies'
*/
public void remove(String identifier, String representedModuleName) {
getModuleSpecs().put(identifier, new Remove(identifier, representedModuleName));
}

/**
* Let the plugin know about an existing module on the module path.
* This may be needed when 'requiresDirectivesFromMetadata(true)' is used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,13 @@ public void transform(TransformOutputs outputs) {

ModuleSpec moduleSpec = findModuleSpec(originalJar);

if (moduleSpec instanceof Remove) { // No output if the Jar is removed
return;
}
if (willBeMerged(originalJar, moduleSpecs.values())) { // No output if this Jar will be merged
return;
}

boolean realModule = isModule(originalJar);
if (moduleSpec instanceof ModuleInfo) {
if (realModule && !((ModuleInfo) moduleSpec).patchRealModule) {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/gradlex/javamodule/moduleinfo/Remove.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright the GradleX team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gradlex.javamodule.moduleinfo;

public class Remove extends ModuleSpec {

Remove(String identifier, String representedModuleName) {
super(identifier, representedModuleName);
}
}
Loading