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

versions set plugin equivalent to maven #766

Open
gokgozf opened this issue Dec 29, 2020 · 7 comments
Open

versions set plugin equivalent to maven #766

gokgozf opened this issue Dec 29, 2020 · 7 comments

Comments

@gokgozf
Copy link

gokgozf commented Dec 29, 2020

Hi
Maybe i missed but I could not see the availability to set the project version from the command line.
I saw -P option for setting properties but is there a way to directly update the version in the build.py
as equivalent to maven

https://www.mojohaus.org/versions-maven-plugin/set-mojo.html

@gokgozf
Copy link
Author

gokgozf commented Jan 22, 2021

@arcivanov
Do you accept pull requests for plugins?

@arcivanov
Copy link
Member

Yes I do. You can set version dynamically, it's all Python based so you can literally specify a version: https://pybuilder.io/documentation/manual#project-version-attribute

@gokgozf
Copy link
Author

gokgozf commented Jan 23, 2021

If I did not understand wrong, setting via command line parameters is for one time in-memory operation and not persisted on the file right?

I would like to update the build.py file with the new version

@arcivanov
Copy link
Member

That's fine. FYI, you don't have to submit a plugin into PyBuilder to create a plugin. You can create and host your own plugin at an arbitrary location.

@arcivanov
Copy link
Member

arcivanov commented Jan 24, 2021

I would like just to warn you, that because "version" can be set dynamically through code, you have to implement a proper parser and evaluator to update the version attribute. And since some expressions in Python are only deterministic at runtime it may not be possible to guarantee proper code modification at all (since Python code can be deterministically only executed at runtime). That is, I would likely not accept a plugin that blindly searches for ^\s*version\s*=\s* regexp and modifies whatever follows.

@gokgozf
Copy link
Author

gokgozf commented Jan 26, 2021

Yes, you are right. That is why I would like to implement into two stages as an analogy to the maven plugin, in the first stage let say "update_minor", "update_patch" or "set_version" commands to generate build.py.next after that "commit" to change to build.py to next one.
Is it an acceptable strategy for you?

@arcivanov
Copy link
Member

Again. You don't need to rely on the plugin to be accepted in the core to be able to develop and publish it. I can't tell you whether I'd be willing to put it in the core until I see exactly what and how you're trying to do. 😄 If you have a prototype/mockup you'd like me to review, I'll be happy to do so.

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

No branches or pull requests

2 participants