-
Notifications
You must be signed in to change notification settings - Fork 14
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
[FEATURE] Introduce SpecificationVersion class #431
Conversation
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.
LGTM. But as discussed, let's not merge this yet and wait for the consuming part to be implemented.
ba83402
to
5d3e8d7
Compare
5d3e8d7
to
9fc52ee
Compare
9fc52ee
to
8d5273a
Compare
ba1fce7
to
f01bb21
Compare
I changed the implementation towards a "SpecVersionComparator" class, which is instantiated with a given Specification Version and can be used to compare that to other versions or ranges. Instances of the class can then be provided directly by project-instances ( |
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.
Maybe not a [FEATURE], as this is (currently) just used internally, right?
The Specification.js |
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.
Okay, true
Introduce a utility module which handles SpecVersion comparators for an easier SpecVersion maintainance within the UI5 Tooling source code. This utility is a kind of semver compatibility layer which allows using semver functions with the SpecVersion typical format "Major.Minor". JIRA: CPOUI5FOUNDATION-224
Add factory function to Specification class
Static methods now create an instance and always throw for unsupported versions (except isSupportedSpecVersion)
ef871e8
to
8074615
Compare
Rebased onto main |
… specVersion string
Co-authored-by: Günter Klatt <57760635+KlattG@users.noreply.github.com>
3d105ba
to
e4c2433
Compare
lib/specifications/Specification.js
Outdated
@@ -151,6 +143,17 @@ class Specification { | |||
return this._specVersion; | |||
} | |||
|
|||
/** | |||
* Returns an instance of a helper class allowing for convenient comparison | |||
* operations against this instance's Specification Version |
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.
Does everybody know what a Specification Version is? I'm wondering if this whole versioning business is explained somewhere in the documentation.
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.
We have a chapter in our documentation regarding that: https://sap.github.io/ui5-tooling/pages/Configuration/#specification-versions
0dbaae6
to
22f62de
Compare
lib/build/TaskRunner.js
Outdated
@@ -309,12 +309,13 @@ class TaskRunner { | |||
params.dependencies = dependencies; | |||
} | |||
|
|||
if (task.getSpecVersion() === "3.0") { | |||
const specVersion = task.getSpecVersionComparator(); |
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.
I struggle a bit with the naming of both the class and the getter. Here it's used with specVersion
as local variable which reads fine (specVersion is greater then or equal to 3.0). But specVersionComparator.gte("3.0")
would be strange.
But I also don't have a better idea, also as getSpecVersion()
already returns the string. My only idea is to combine both to have getSpecVersion().toString()
and getSpecVersion().gte("3.0")
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.
I'm not happy with the naming either.
I guess we could make this a SpecificationVersion
class and have getSpecVersion() always return an instance of it. Indeed that might make things a bit simpler in the end.
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.
Yes, that sounds good 👍🏻
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.
Done in latest commit. I think this is way better, since the main use of a project's spec version is to compare it anyways 👍
Use it as the main representation of a specification version (instead of the raw string as before). This also helps motivate the use of the helper functions to compare the version. Which is the most common use of the specification version anyways.
With the latest changes in SAP/ui5-project#431, the method now returns an instance of a "SpecificationVersion" class. This would require an additional specVersion-dependent interface. Since use cases in custom tasks and -middelare are not clear, we should rather keep it simple for now and do not provide this method.
With the latest changes in SAP/ui5-project#431, the method now returns an instance of a "SpecificationVersion" class. This would require an additional specVersion-dependent interface. Since use cases in custom tasks and -middelare are not clear, we should rather keep it simple for now and do not provide this method.
Introduce a helper class representing a Specification Version. It provides methods for comparing versions, which simplifies version checks across the UI5 Tooling source code. The methods act as a kind of semver-adapter which ultimately allows executing specific semver functions on the SpecVersion format "Major.Minor". Co-authored-by: Günter Klatt <57760635+KlattG@users.noreply.github.com> Co-authored-by: Merlin Beutlberger <m.beutlberger@sap.com>
Introduce a utility module which handles SpecVersion
comparators for an easier SpecVersion maintainance
within the UI5 Tooling source code.
This utility is a kind of semver compatibility layer which
allows using semver functions with the SpecVersion
typical format "Major.Minor".
JIRA: CPOUI5FOUNDATION-224