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

Stateless target properties #2039

Merged
merged 23 commits into from
Oct 16, 2023
Merged

Conversation

lhstrh
Copy link
Member

@lhstrh lhstrh commented Oct 5, 2023

In response to feedback from @cmnrd, this PR simplifies the dealings with target properties further, by eliminating the TargetProperty enum. This will also make it easier in the future to accommodate a plugin architecture where plugins can contribute target properties. It is also a step into the direction of handling options within target properties as target properties themselves.

Tasks remaining:

  • Fix unit tests
  • Split contents of TargetProperty between TargetConfig and AbstractTargetProperty
  • Rename AbstractTargetProperty to TargetProperty

@lhstrh lhstrh changed the base branch from master to enumless-target-properties October 5, 2023 07:30
Copy link
Collaborator

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

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

I like the general direction this takes, but I still feel like we are missing something.

In the current implementation, the TargetConfig class registers all the properties. Then we have to later figure out if they are supported by the target or not and also apply target specific validation (like with the tracing property).

Maybe we should just let the target generators register their supported properties. GenreatorBase could have a method registerTargetProperties that registers all the basic properties that are supported by all the targets. This method could be extended by the target generators to register target specific properties. In consequence, only supported properties are registered. This would fix several of the issues that we have discussed:

core/src/main/java/org/lflang/ast/ASTUtils.java Outdated Show resolved Hide resolved
@oowekyala oowekyala self-requested a review October 5, 2023 09:54
@lhstrh
Copy link
Member Author

lhstrh commented Oct 5, 2023

Maybe we should just let the target generator register their supported properties. GenreatorBare could have a method registerTargetProperties that registers all the basic properties that are supported by all the targets. This method could be extended by the target generators to register target specific properties. In consequence, only supported properties are registered. This would fix several of the issues that we have discussed:

Right. This is what we should do. Thanks for the thoughtful reviews and nudging this refactoring into the right direction, @cmnrd and @oowekyala!

@lhstrh lhstrh changed the base branch from enumless-target-properties to master October 16, 2023 16:17
@lhstrh lhstrh changed the base branch from master to target-properties October 16, 2023 16:20
@lhstrh lhstrh merged commit c5ebef7 into target-properties Oct 16, 2023
41 checks passed
@lhstrh lhstrh deleted the stateless-target-properties branch October 16, 2023 16:40
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.

2 participants