Skip to content
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

Indirect build scheme overrides #16

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ruccho
Copy link
Collaborator

@ruccho ruccho commented Dec 13, 2024

Closes #4

Pipeline

  • Running from CLI
  • Running from UI

UI

  • Left pane TreeView for build scheme list
  • List of derived configurations
    • Excluding configurations overridden by the child scheme
image

@ruccho ruccho marked this pull request as ready for review December 25, 2024 08:35
@ruccho ruccho requested review from yucchiy and hkmt-mmy December 25, 2024 08:35

foreach (var scheme in treeFromLeafToRoot)
{
if (typeof(TContext).IsAssignableFrom(typeof(IPreBuildContext)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeofも多少のコストがあったはずだから、ループの外でキャッシュしておいてもいいかも

そもそもループの外で targetConfigurations を PreBuildConfigurations / InternalPrepareConfigurations / PostBuildConfigurationsから選出してしまえばループ内もシンプルになりそうな

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

見た目長くなってしまう感はあるので、ちょっと迷ってます

public static IEnumerable<IBuildConfiguration> EnumerateComposedConfigurations<TContext>(
    IEnumerable<IBuildScheme> treeFromLeafToRoot) where TContext : IBuildContext
{
    HashSet<Type> taskTypes = new();
    var configurationsByScheme = treeFromLeafToRoot.Select(s =>
    {
        var t = typeof(TContext);
        if (t.IsAssignableFrom(typeof(IPreBuildContext)))
        {
            return s.PreBuildConfigurations;
        }

        if (t.IsAssignableFrom(typeof(IInternalPrepareContext)))
        {
            return s.InternalPrepareConfigurations;
        }

        if (t.IsAssignableFrom(typeof(IPostBuildContext)))
        {
            return s.PostBuildConfigurations;
        }

        return Enumerable.Empty<IBuildConfiguration>();
    });

    foreach (var configurations in configurationsByScheme)
    {
        foreach (var configuration in configurations)
            if (taskTypes.Add(configuration.TaskType))
                yield return configuration;
    }
}

@@ -42,7 +42,10 @@ public void Dispose()

public void Bind(SerializedObject so)
{
_rootVisualElement.Unbind();
_rightPaneView.OnBind(so);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rightのOnBindが実際のBindより前にあるけどいいのかな

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bindされた状態のままbindingPathなどをいじるとたまにバグるので、Unbind入れた上で順番を変えてます…

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あとOnBindだと自身がBindされたときなのか親階層がBindされたときなのか分かりづらいなともレビューしてて思ったり

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indirect build scheme overrides
2 participants