Neffarion 485 Share Posted June 4, 2021 25 minutes ago, likeablePanda said: OVER. MY. DEAD. BODY!!!! I found a solution for my needs. I'll share it here. I refuse to manually manage 10+ util folders! Here's how my folders are now setup ZodiacFighter/ src/ Fighter.java Utils/ fancyAntiBan.java whatever.java ZodiacHerblore/ src/ Herblore.java Utils/ fancyAntiBan.java whatever.java ZodiacUtils src/ Utils/ fancyAntiBan.java whatever.java Notice I have BOTH a utils module AND Util package in each other module. In intellij, tell intellij to "Mark directory as excluded" every Utils folder in every module that isn't the Utils module. Then, I add a hook to the git pre-commit so in ProjectFolder/.git/hook/pre-commit I have the code: #!/usr/bin/env python import argparse import os import shutil def parse_args(): pass def main(args=None): files = os.listdir(os.getcwd()) for file in files: if(os.path.isdir(file)): print("directory " + file); if( not "ZodiacUtils" in file and "Zodiac" in file): print("ZodiacUtils/src/Utils",file+"/src/Utils") shutil.rmtree(file+"/src/Utils"); shutil.copytree("ZodiacUtils/src/Utils",file+"/src/Utils") os.system("git add " + file+"/src/Utils"); pass if __name__ == "__main__": args = parse_args() main(args) This replaces every src/Utils folder that contains the word "Zodiac" with the Utils folder in ZodiacUtils/src/Utils So now whenever you commit, it'll automatically copy those folders and add them to the repo. Note this is NOT a copy paste solution! it'd have to be personalized @Neffarion I wrote this before you posted this proposed solution. If I understand (which I may not), wouldn't this only work locally? Once you push it to the SDN the SDN has no knowledge of the module dependency as @Pandemic said in his previous post in this forum topic. Or am I missing something that'd be simpler than my silly yet effective solution Well yeah the SDN doesnt know about the dependency but what matters is what you have to deal with locally. You'd only have to deal with your script project + the module's which are shared Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Share Posted June 5, 2021 In general i run a repo per project, havent found an elegent way to utilize a common lib across multiple scripts on SDN yet either Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.