Skip to content

Reorganize Gradle DSL for bootstrap and compiler plugins #554

@alexander-yevsyukov

Description

@alexander-yevsyukov

We need to unify the way we declare various features of Spine SDK in Gradle. Currently, we have multiple extensions like protodata, modelCompiler, etc. We need to configure a user's project under the single block called spine.

Suggested syntax and plugin IDs are given blow:

plugins {
    // This plugin adds the `spine` extension.
    // It is automatically applied by all the plugins, including `bootstrap` and `compiler`.
    id("io.spine.root") version "2.0.0"

    // This is what used to be `protodata`.
    id("io.spine.compiler") version "0.100.0"

    // This is former `io.spine.mc-java`. It adds `coreJvm` extension under `spine`.
    id("io.spine.compiler-jvm") version "2.0.0-SNAPSHOT-100"

    // This is a Gradle plugin separated from McJava for Validation compilation.
    id("io.spine.validation-jvm") version "2.0.0-SNAPSHOT-200"

    // This plugin automatically applies the following plugins:
    //  1. `root`
    //  2. `compiler`
    //  3. `core-jvm`
    //  4. `validation-jvm` 
    id("io.spine.bootstrap") version "2.0.0-SNAPSHOT-100"

    // This is a new plugin which applies `bootstrap` and additional dependencies required 
    // for developing a Spine Compiler Plugin.
    id("io.spine.compiler-plugin") version "2.0.0-SNAPSHOT-10"
}

spine {
    // This is what used to be `protodata` block.
    compiler {
        plugins("org.example:protodata-plugin:1.42")
    }

   // The settings of the Validation Library JVM compiler.
   validationJvm {
      compile {
          enabled.set(false)
      }
   }

    // This is what used to be `modelCompiler/java`.
    coreJvm {
        
        // This is what used to be `modelCompiler/java/codegen/` extension of McJava.
        compile {
            forMessage("spine.tools.column.ProjectName") {
                markFieldsAs("io.spine.tools.mc.java.protoc.given.ProjectNameField")
            }
        }
    }

    // This is what used to be `enableJava().client()`
    // comes as `io.spine.client-jvm` plugin.
    clientJvm {
        // Some settings like gRPC port or whatever.
    }

    // This is what used to be `enableJava().server()`
    // comes as `io.spine.server-jvm` plugin.
    serverJvm {
        // Environment settings may go here.
    }
}

dependencies {
    // This is what used to be `protoData` configuration.
    spineCompiler(project(":my-compiler-plugin))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions