This document describes standard structure of a Spine-based project. It assumes that you are familiar with Gradle.

Spine uses Gradle for project model definition and as the build tool. It follows the standard structure of the Gradle project with extensions related to the code generation done by Protobuf Compiler and Spine Model Compiler.

Handcrafted code

Following standard Gradle conventions a manually written code is created under the src/main/ directory with subdirectories proto, java, etc. for corresponding languages.

After a project is defined in Gradle, a work on a module usually starts in the
the proto directory.

Generated code

The generated code is placed under the generated directory under the module root. The sub-directories are:

  • java — the code generated by Protobuf Compiler
  • resources — mappings generated by Spine Model Compiler
  • spine — the code generated by Spine Model Compiler

Example

Here’s how a typical project structure would look like:

myproject/
  gradle/
  module-one/
    generated/
       main/
         java/
         resources/
         spine/
         ...
       test/
         java/
         resources/
         spine/
         ...   
    src/
       main/
         java/
         proto/
       test/
         java/
         proto/
    ...     
    build.gradle
  module-two/
    generated/
      ...
    src/
      ...
    build.gradle
  ...
  build.gradle
  gradlew
  gradlew.bat
  settings.gradle