Advertisement
iamcreasy

GFrameEngine & GameProject Update 24th June, 2016

Jun 24th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. :: STEP 1 ::
  2. // GFrameEngine Project Directory
  3. src
  4. GFrameEngine
  5. GFrame.java
  6. GameResource.java
  7. build.gradle
  8.  
  9. // Game Engine's project build.gradle file contains
  10. apply plugin : "java"
  11.  
  12. sourceSets{
  13. main.java.srcDir "src"
  14. }
  15.  
  16. // After running Engine's build.gradle, the src folder is compiled into GFrameEngine.jar
  17.  
  18. :: STEP 2 ::
  19. Now I'll place the GFrameEngine.jar into Game Project's library(lib) directory
  20.  
  21. // Game project directory structure
  22. lib
  23. GFrameEngine.jar
  24. src
  25. MyGamePkg
  26. MyGame.java
  27. MyGameResource.java
  28. build.gradle
  29.  
  30. // Game project build.gradle file contains
  31. apply plugin : "java"
  32.  
  33. dependencies {
  34. compile fileTree(dir: 'lib', include: ['*.jar'])
  35. }
  36.  
  37. sourceSets{
  38. main.java.srcDir "src"
  39. }
  40.  
  41. jar {
  42. from configurations.compile.collect { zipTree it }
  43. manifest.attributes "Main-Class":"MyGamePkg.MyGame"
  44. }
  45.  
  46.  
  47. // After you run the game project build.gradle, it combines the engine jar and game project into one single jar.
  48. // and the finally created jar file is a standalone executable file
  49.  
  50. YEEE!
  51.  
  52. :: Next STEPS ::
  53. Upload GFrameEninge to a Github repo.
  54.  
  55. And then adding the remote repository as a dependency in my local game project. Game project's build.gradle file would always fetch the latest engine's code from github and import it as jar using jitpack.io
  56.  
  57. The reason I moved from Apache Ant to Gradle is the easy of maintaining remote dependency.
  58.  
  59. Q : Is it compiling the engine source and game source into one single monolithic jar file?
  60. A : Yes.
  61. Q : Isn't it bad practice?
  62. A : Depends. Mostly yes, but since the engine source and game source is small enough - currently it's easier that way. Right now ~ 400 LoC is only taking up 6KB using default compression specified in Gradle.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement