gradle: dont copy assets

This commit is contained in:
Hannes Janetzek 2014-03-21 04:06:29 +01:00
parent 53a705ead5
commit 211efc4d5a
3 changed files with 12 additions and 24 deletions

View File

@ -9,28 +9,19 @@ apply plugin: 'application'
mainClassName = 'org.oscim.gdx.GdxMapApp' mainClassName = 'org.oscim.gdx.GdxMapApp'
// need to include themes for the example executable
// TODO should be removed someday
task copyAssets(type: Copy) {
from "${rootDir}/vtm-themes/resources"
into "${buildDir}"
include '**/*'
}
// package vtm native libs into jar // package vtm native libs into jar
task copyLibs(type: Copy) { //task copyLibs(type: Copy) {
from(zipTree("../vtm-ext-libs/gdx/vtm-jni-natives.jar")) // from(zipTree("../vtm-ext-libs/gdx/vtm-jni-natives.jar"))
into("${buildDir}/assets") // into("${buildDir}/assets")
} //}
tasks.withType(JavaCompile) { compileTask -> //tasks.withType(JavaCompile) { compileTask ->
compileTask.dependsOn copyAssets // compileTask.dependsOn copyLibs
compileTask.dependsOn copyLibs //}
}
sourceSets { sourceSets {
main.java.srcDirs = ['src'] main.java.srcDirs = ['src']
main.resources.srcDirs = ["${buildDir}/assets"] //main.resources.srcDirs = ["${buildDir}/assets"]
output.resourcesDir = 'assets' output.resourcesDir = 'assets'
} }
@ -40,11 +31,7 @@ dependencies {
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile 'org.slf4j:slf4j-simple:1.7.5' compile 'org.slf4j:slf4j-simple:1.7.5'
} compile files('../vtm-ext-libs/gdx/vtm-jni-natives.jar')
eclipse.project {
linkedResource name: 'assets', type: '2',
locationUri: 'PARENT-1-PROJECT_LOC/vtm-themes/resources/assets'
} }
run { ignoreExitValue = true } run { ignoreExitValue = true }

View File

@ -28,7 +28,7 @@ public class GdxAssetAdapter extends AssetAdapter {
@Override @Override
public InputStream openFileAsStream(String fileName) { public InputStream openFileAsStream(String fileName) {
FileHandle file = Gdx.files.internal(fileName); FileHandle file = Gdx.files.internal("assets/" + fileName);
if (file == null) if (file == null)
throw new IllegalArgumentException("missing file " + fileName); throw new IllegalArgumentException("missing file " + fileName);

View File

@ -10,6 +10,7 @@ dependencies {
sourceSets { sourceSets {
main.java.srcDirs = ['src'] main.java.srcDirs = ['src']
main.resources.srcDirs = ['resources']
main.compileClasspath += configurations.providedCompile main.compileClasspath += configurations.providedCompile
} }
@ -21,4 +22,4 @@ eclipse.classpath {
classpath.entries.findAll { entry -> classpath.entries.findAll { entry ->
entry.path.contains('annotations') }*.exported = false entry.path.contains('annotations') }*.exported = false
} }
} }