-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(manager): Adds Unity3D #28189
base: main
Are you sure you want to change the base?
feat(manager): Adds Unity3D #28189
Conversation
packageRules: [ | ||
{ | ||
groupName: 'Unity Editor', | ||
matchPackageNames: ['m_EditorVersion', 'm_EditorVersionWithRevision'], | ||
}, | ||
], |
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.
This should be rather part of a preset, as it is hard to find out what is happening if the config is set here.
If we are talking about the same version in different places you can set depName
to the same value. This will by default result too in a single PR
return null; | ||
} | ||
|
||
if (version !== version.trim()) { |
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.
Why is this necessary? 🤔
'm_EditorVersion', | ||
]; | ||
const parseLine = (line: string): PackageDependency | null => { | ||
const matches = regEx(/^(?<depName>.+): (?<currentValue>.+)/g).exec(line); |
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.
Move the regex definition to the module scope.
if (!fileMatchRegex.every((regex: string) => regEx(regex).test(fileName))) { | ||
return { deps: [] }; | ||
} |
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.
This isn't necessary, extractPackageFile
will only be called on fitting file names
autoReplaceStringTemplate: | ||
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}', | ||
currentDigest: undefined, | ||
currentValue: version, | ||
datasource: 'unity3d', | ||
depName: key, | ||
depType: 'final', | ||
replaceString: matches[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.
autoReplaceStringTemplate: | |
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}', | |
currentDigest: undefined, | |
currentValue: version, | |
datasource: 'unity3d', | |
depName: key, | |
depType: 'final', | |
replaceString: matches[0], | |
currentValue: version, | |
datasource: 'unity3d', | |
depName: key, | |
depType: 'final', |
These vales are set by default.
Also why final
as depType
, if there is only one?
deps: content | ||
.split('\n') | ||
.map((line) => line.trim()) | ||
.filter((line) => line.length > 0) | ||
.map(parseLine) | ||
.filter((dep) => dep !== null) as PackageDependency[], | ||
}; |
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.
Chaining these makes it hard to debug it, please use a for each loop.
https://github.com/renovatebot/renovate/blob/main/docs/development/best-practices.md#iterating-objects--containers
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.
and return null for empty deps
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.
☝️
@@ -24,6 +24,7 @@ const Categories = [ | |||
'rust', | |||
'swift', | |||
'terraform', | |||
'unity3d', |
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.
🤔 is it really worth to have an own category? 🤔
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.
Unity has a different package manager (Unity Package Manager) for its sub-dependencies and while I've read #19300, I haven't got it working using the proposed NPM workaround: There's a lock file different from normal NPM lock files that would have to be generated and currently isn't. This might be something worth adding under the unity3d
umbrella.
Let me know if you find any existing ones more appropriate.
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.
Makes sense to add the category then, if support for this manager is added too.
Please remove it for now.
@@ -0,0 +1,2 @@ | |||
m_EditorVersion: 2023.3.0b5 |
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.
please inline those small fixtures, use codeBlock
string template helper for indention
deps: content | ||
.split('\n') | ||
.map((line) => line.trim()) | ||
.filter((line) => line.length > 0) | ||
.map(parseLine) | ||
.filter((dep) => dep !== null) as PackageDependency[], | ||
}; |
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.
and return null for empty deps
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
]); | ||
}); | ||
|
||
it('skips if casing is incorrect', () => { |
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.
Should Renovate raise a warning about the malformed casing? Or should Unity warn about malformed files?
expect(res).toBeEmpty(); | ||
}); | ||
|
||
it('skips abnormal spacing', () => { |
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.
Same question about Renovate warning or Unity warning here.
@@ -0,0 +1,10 @@ | |||
Handles version numbers inside `ProjectSettings/ProjectVersion.txt` files used by the Unity game engine. |
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 see two ways to read this:
- Renovate can read
ProjectSettings.txt
andProjectVersion.txt
files - Renovate can read a
ProjectVersion.txt
file if its in theProjectSettings
directory
I don't know which interpretation is correct, as I don't use Unity.
Please update the text so it explains precisely what Renovate can update. 🙂
@@ -0,0 +1,10 @@ | |||
Handles version numbers inside `ProjectSettings/ProjectVersion.txt` files used by the Unity game engine. | |||
|
|||
`ProjectSettings/ProjectVersion.txt` always contains two version references in a yml-like syntax; one with and one without a hash, both of which are updated: |
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.
`ProjectSettings/ProjectVersion.txt` always contains two version references in a yml-like syntax; one with and one without a hash, both of which are updated: | |
`ProjectSettings/ProjectVersion.txt` always have two version references in a yml-like syntax; one with and one without a hash, both are updated: |
Also, is it YML-like syntax or YAML-syntax? I lean towards YAML-syntax, but not sure. 🙂
m_EditorVersionWithRevision: 2020.3.15f2 (6cf78cb77498) | ||
``` | ||
|
||
Relies on the corresponding `unity3d` datasource and versioning. |
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 don't see any changes to a datasource directory in this PR? Maybe that was added in a different PR? Or I'm misunderstanding something here. 🙃
In any case, please check if this sentence is correct.
@ViMaSter do you have time to address the PR review comments? |
Changes
Adds a manager for updating the runtime of a project using the Unity game engine.
Context
See #27219, closes #27295.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: