Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • SDN best practices


    likeablePanda

    Recommended Posts

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.