-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'NG_7.0' into fix/multi-project-leaking
- Loading branch information
Showing
17 changed files
with
354 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
common/src/main/java/net/neoforged/gradle/common/extensions/AccessTransformersExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,52 @@ | ||
package net.neoforged.gradle.common.extensions; | ||
|
||
import net.neoforged.gradle.common.CommonProjectPlugin; | ||
import net.neoforged.gradle.common.extensions.base.BaseFilesWithEntriesExtension; | ||
import net.neoforged.gradle.dsl.common.extensions.AccessTransformers; | ||
import org.gradle.api.Action; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.ConfigurablePublishArtifact; | ||
import org.gradle.api.artifacts.Dependency; | ||
import org.gradle.api.artifacts.dsl.ArtifactHandler; | ||
import org.gradle.api.artifacts.dsl.DependencyHandler; | ||
|
||
import javax.inject.Inject; | ||
|
||
public abstract class AccessTransformersExtension extends BaseFilesWithEntriesExtension<AccessTransformers> implements AccessTransformers { | ||
private transient final DependencyHandler projectDependencies; | ||
private transient final ArtifactHandler projectArtifacts; | ||
|
||
@Inject | ||
public AccessTransformersExtension(Project project) { | ||
super(project); | ||
|
||
this.projectDependencies = project.getDependencies(); | ||
this.projectArtifacts = project.getArtifacts(); | ||
} | ||
|
||
@Override | ||
public Dependency consume(Object notation) { | ||
return this.projectDependencies.add(CommonProjectPlugin.ACCESS_TRANSFORMER_CONFIGURATION, notation); | ||
} | ||
|
||
@Override | ||
public Dependency consumeApi(Object notation) { | ||
return this.projectDependencies.add(CommonProjectPlugin.ACCESS_TRANSFORMER_API_CONFIGURATION, notation); | ||
} | ||
|
||
@Override | ||
public void expose(Object path, Action<ConfigurablePublishArtifact> action) { | ||
file(path); | ||
projectArtifacts.add(CommonProjectPlugin.ACCESS_TRANSFORMER_ELEMENTS_CONFIGURATION, path, action); | ||
} | ||
|
||
@Override | ||
public void expose(Object path) { | ||
expose(path, artifacts -> {}); | ||
} | ||
|
||
@Override | ||
public void expose(Dependency dependency) { | ||
projectDependencies.add(CommonProjectPlugin.ACCESS_TRANSFORMER_API_CONFIGURATION, dependency); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.