Skip to content

Commit

Permalink
feat: expose qualified name variant of BeforePass (#109)
Browse files Browse the repository at this point in the history
Closes: #92
  • Loading branch information
bdunderscore authored Jan 6, 2024
1 parent 587071d commit a5d61f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for passing IEnumerable as context objects for inline errors (#106)
- Added support for a custom IErrorContext object to pass multiple context objects (#106)
- Added support for substituting keys in the error title (#106)
- Exposed the qualified name variant of `Sequence.BeforePass` (#109)

### Fixed
- Language selection is not persisted across Unity Editor restarts or domain reloads (#108)
Expand Down
21 changes: 18 additions & 3 deletions Editor/API/Fluent/Sequence/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ internal DeclaringPass(SolverPass pass, SolverContext solverContext, BuildPhase

/// <summary>
/// Declares that the pass you just declared must run before a particular other plugin.
///
/// It's recommended to avoid using this to refer to passes in other plugins, as the internal class names
/// of those plugins may not be a stable API.
/// </summary>
/// <param name="QualifiedName">The qualified name of the other plugin</param>
/// <returns>This DeclaringPass context</returns>
Expand Down Expand Up @@ -82,7 +85,17 @@ public DeclaringPass BeforePlugin<T>(T plugin, [CallerFilePath] string sourceFil
}


private DeclaringPass BeforePass(string qualifiedName, string sourceFile = "", int sourceLine = 0)
/// <summary>
/// Declares that the pass you just declared must run after a particular other pass.
///
/// It's recommended to avoid using this to refer to passes in other plugins, as the internal class names
/// of those plugins may not be a stable API.
/// </summary>
/// <param name="qualifiedName"></param>
/// <param name="sourceFile"></param>
/// <param name="sourceLine"></param>
/// <returns></returns>
public DeclaringPass BeforePass(string qualifiedName, string sourceFile = "", int sourceLine = 0)
{
_solverContext.Constraints.Add(new Constraint()
{
Expand Down Expand Up @@ -124,7 +137,8 @@ public sealed partial class Sequence

private int inlinePassIndex = 0;

internal Sequence(BuildPhase phase, SolverContext solverContext, IPluginInternal plugin, string sequenceBaseName)
internal Sequence(BuildPhase phase, SolverContext solverContext, IPluginInternal plugin,
string sequenceBaseName)
{
_phase = phase;
_solverContext = solverContext;
Expand Down Expand Up @@ -167,7 +181,8 @@ internal Sequence(BuildPhase phase, SolverContext solverContext, IPluginInternal
private SolverPass CreateSequencingPass(string displayName, InlinePass callback, string sourceFile,
int sourceLine)
{
var anonPass = new AnonymousPass(_sequenceBaseName + "/" + displayName + "#" + inlinePassIndex++, displayName,
var anonPass = new AnonymousPass(_sequenceBaseName + "/" + displayName + "#" + inlinePassIndex++,
displayName,
callback);
var pass = new SolverPass(_plugin, anonPass, _phase, _compatibleExtensions, _requiredExtensions);
anonPass.IsPhantom = true;
Expand Down

0 comments on commit a5d61f5

Please sign in to comment.