-
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.
Implement support for dynamic runtime dependencies (#52)
* Implement dependency handling for runtime only dependencies. * Fix several issues caused by the latest changes.
- Loading branch information
1 parent
902ae2c
commit 0421559
Showing
12 changed files
with
144 additions
and
52 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
39 changes: 39 additions & 0 deletions
39
...on/src/main/java/net/neoforged/gradle/common/runs/run/ConfigurationRunDependencyImpl.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.neoforged.gradle.common.runs.run; | ||
|
||
import net.neoforged.gradle.dsl.common.runs.run.RunDependency; | ||
import net.neoforged.gradle.dsl.common.util.ConfigurationUtils; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.Configuration; | ||
import org.gradle.api.artifacts.Dependency; | ||
import org.gradle.api.artifacts.ResolvedConfiguration; | ||
import org.gradle.api.file.ConfigurableFileCollection; | ||
import org.gradle.api.provider.Property; | ||
|
||
import javax.inject.Inject; | ||
|
||
public abstract class ConfigurationRunDependencyImpl implements RunDependency { | ||
|
||
private final Project project; | ||
|
||
@Inject | ||
public ConfigurationRunDependencyImpl(Project project, Configuration dependency) { | ||
getIdentity().convention(dependency.toString()); | ||
getDependency().from(project.provider(() -> { | ||
final ResolvedConfiguration resolvedConfiguration = dependency.getResolvedConfiguration(); | ||
final ConfigurableFileCollection files = project.files(); | ||
return files.from(resolvedConfiguration.getFiles()); | ||
})); | ||
this.project = project; | ||
} | ||
|
||
@Override | ||
public Project getProject() { | ||
return project; | ||
} | ||
|
||
@Override | ||
public abstract ConfigurableFileCollection getDependency(); | ||
|
||
@Override | ||
public abstract Property<String> getIdentity(); | ||
} |
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
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
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.
0421559
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #52 (comment)