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

Reorganize bin/lein and bin/lein-pkg to make coordination easier #1996

Open
hypirion opened this issue Sep 26, 2015 · 7 comments
Open

Reorganize bin/lein and bin/lein-pkg to make coordination easier #1996

hypirion opened this issue Sep 26, 2015 · 7 comments
Labels

Comments

@hypirion
Copy link
Collaborator

We've had some changes in lein that haven't been moved over to lein-pkg.

@TrangPham
Copy link

What are the changes that need to be moved over?
Would this involve making the lein-pkg pass in Tiered in the LEIN_JVM_OPTS? https://github.com/technomancy/leiningen/blob/master/bin/lein-pkg#L107

@hypirion
Copy link
Collaborator Author

Hi!

I have noted down the patch #1918 mostly, but yes, the Tiered stuff in LEIN_JVM_OPTS would be good to have fixed too. There also seems to be a command line argument mismatch – lein-pkg has for example -client -XX:+TieredCompilation as arguments when calling LEIN_JAVA_CMD, and lein proper has an additional -Dmaven.wagon.rto=10000. I believe those arguments should be identical.

Happy to take patches for this, they don't have to fix all the differences between lein-pkg and lein.

@TrangPham
Copy link

lein-pkg and lein seem to have a lot of similar code. Is there a reason why a common included bash script is not used? This would help keep it DRY.

@hypirion
Copy link
Collaborator Author

Yeah, it's unfortunate that lein and lein-pkg doesn't share code. One of the issues is that people need to be able to download lein standalone from the git repo, whereas some downstream package managers (like Homebrew) uses lein-pkg directly from the repo. Consequently lein and lein-pkg must be standalone scripts.

I'd love some way to have the shared code in a single file and some script that regenerates lein and lein-pkg, but that may be harder to understand. Happy to take suggestions on how to make this better though, maybe it's not as bad as I expect it would be.

@TrangPham
Copy link

Option 1:
One solution is to use bash to source a common file: http://stackoverflow.com/questions/192292/bash-how-best-to-include-other-scripts

Though this may not work if downstream package managers don't grab any of the other files.

Option 2:
A simple generation technique would to have a common file, a gen file for lein and a gen file for lein-pkg. The gen files would contain the unique code for lein and lein-pkg respectively. Then use a simple script that copies the common file over to lein and lein-pkg and appends the corresponding gen file to it.

ie.

cp common lein
cat gen_lein >> lein

Option 3:
Just reorganize the code in lein and lein-pkg such that the common code is at the top and commented as common code. Ideally this section would be the same line for line such that we could use git diff to ensure they are the same.

This would be like option 2 but with out the script to generate. This would keep the files completely separate, but increase the maintainability.

@hypirion
Copy link
Collaborator Author

Option 1 would not work – it would make lein installation more difficult than described at http://leiningen.org. That leaves us with option 2 and 3.

From experience, option 2 tends to create somewhat confusing scripts. But if it's done properly and is well documented that is likely to be the best way to ensure that lein-pkg and lein is synced.

I think option 3 would be the most realistic one if possible.

@hypirion
Copy link
Collaborator Author

I'm happy with the current situation for 2.6.0, but I'm keeping this open to consider options to automatically sync changes.

@hypirion hypirion removed this from the 2.6.0 milestone Jan 18, 2016
@technomancy technomancy changed the title Add changes in lein to lein-pkg Reorganize bin/lein and bin/lein-pkg to make coordination easier Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants