How do I include assets folder into gradle dist builds?

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

How do I include assets folder into gradle dist builds?

Postby Dev909 » Sat Jul 01, 2017 2:32 pm

Hey all,

I followed the guide to setup an assets folder here https://github.com/libgdx/libgdx/wiki/Creating-a-Separate-Assets-Project-in-Eclipse. Building within eclipse works fine, however when I was trying a build:dist, I noticed the app crashes because there's no assets folder included within the dist build. I thought that adding the folder as a source folder would include the assets folder into all builds, but I guess I was wrong. As a newcomer to gradle, how do I tell gradle to include my assets folder?

Also as a side question. is there anyway to edit my username? I'm working on my laptop and not fully used to typing on it, and I made a typo in my name...
Dev909
 
Posts: 3
Joined: Sat Jul 01, 2017 2:18 pm

Re: How do I include assets folder into gradle dist builds?

Postby evilentity » Sat Jul 01, 2017 4:06 pm

Check dist task in desktop/build.gradle , Im sure it can be added to other backends somehow. Feels like more trouble then its worth.

I can change your name if you want.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4019
Joined: Wed Aug 24, 2011 11:37 am

Re: How do I include assets folder into gradle dist builds?

Postby Dev909 » Sun Jul 02, 2017 2:21 pm

I tried to manually place the assets folder into the jar, but it didn't work either. When I'm home I'll check the dist task.

And yeah if you could change it from "Dev90" to "Dev909" it would be perfect. I know its not a big change, but after having the name for 10+ years....you know lol.
Dev909
 
Posts: 3
Joined: Sat Jul 01, 2017 2:18 pm

Re: How do I include assets folder into gradle dist builds?

Postby RafaSKB » Sun Jul 02, 2017 11:24 pm

I believe you just have to edit your desktop's build.gradle file so the project.ext.assetsDir variable points to the right path. This line should be at the top of your file and look somewhat like this:
Code: Select all
project.ext.assetsDir = new File("../assets/assets");


(The first "assets" in the path is for the project's name, the second one is for the directory where the stuff is inside. Not super smart I admit, but it works haha)
Junk E.T. - A garbage-themed roguelike where you travel through the galaxy to collect mankind's waste and turn into a profit.
- http://www.junketgame.com
RafaSKB
 
Posts: 90
Joined: Sat Aug 01, 2015 5:14 am
Location: São Paulo, Brazil

Re: How do I include assets folder into gradle dist builds?

Postby Dev909 » Sat Jul 08, 2017 12:13 am

RafaSKB wrote:I believe you just have to edit your desktop's build.gradle file so the project.ext.assetsDir variable points to the right path. This line should be at the top of your file and look somewhat like this:
Code: Select all
project.ext.assetsDir = new File("../assets/assets");


(The first "assets" in the path is for the project's name, the second one is for the directory where the stuff is inside. Not super smart I admit, but it works haha)


Sorry for the late reply. Accidentally deleted my git repo, and had to setup the project again. I just tested some things with the default assets folder and it seems to work just fine for me. In the future I'll try adding the quoted to my gradle build files to see what thats like.
Dev909
 
Posts: 3
Joined: Sat Jul 01, 2017 2:18 pm


Return to General Development

Who is online

Users browsing this forum: No registered users and 3 guests