开发者

Copy sources files into target directory with SBT

I recently decided to use SBT to build an existing project. In th开发者_如何学编程is project I have some .glsl files within the scala packages which I need to copy during the compilation phase.

The project is structured like this :

- myapp.opengl
   - Shader.scala
- myapp.opengl.shaders
   - vertex_shader.glsl
   - fragment_shader.glsl

Is this file structure correct for SBT or do I need to put the .glsl files into an other directory. And do you know a clean way to copy these files into the target folder ?

I would prefer not putting these files into the resources directory since they are (non-compiled) sources files

Thanks


I would not recommend putting those files into src/main/scala as they do not belong there. If you want to keep them separate from your resource files, you can put them in a custom path, e.g. src/main/glsl and add the following lines to your project definition to have them copied into output directory:

val shaderSourcePath = "src"/"main"/"glsl"

// use shaderSourcePath as root path, so directory structure is
// correctly preserved (relative to the source path)
def shaderSources = (shaderSourcePath ##) ** "*.glsl"

override def mainResources = super.mainResources +++ shaderSources
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜