-
Notifications
You must be signed in to change notification settings - Fork 2
Add kotlin protoc built-in when Java or Kotlin are enabled in a project
#87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
3a7246d
Update config
alexander-yevsyukov 6a16306
Add `core` dependencies
alexander-yevsyukov be4f9df
Simplify dependencies
alexander-yevsyukov be44f8f
Bump version -> `0.2.19`
alexander-yevsyukov 668b0a6
Bump version -> `0.2.19`
alexander-yevsyukov 321761e
Remove redundant property
alexander-yevsyukov e2e0554
Add Kotlin proto codegen
alexander-yevsyukov 7dc8a26
Simplify dependencies
alexander-yevsyukov a763c06
Update numbers
alexander-yevsyukov 3697570
Add `kotlin` built-in
alexander-yevsyukov 9308579
Extract variables
alexander-yevsyukov 698ced8
Extract conventions
alexander-yevsyukov 1c91481
Make `it` clear
alexander-yevsyukov 5f5399c
Bump `base` -> `2.0.0-SNAPSHOT.114`
alexander-yevsyukov 76840a0
Remove redundant configuration
alexander-yevsyukov 12a7c8f
Document default values
alexander-yevsyukov 8b0023b
Open access to source root properties
alexander-yevsyukov 2769cce
Do not handle non-Java source roots
alexander-yevsyukov 1fcb1d4
Force configurations
alexander-yevsyukov 68b88e0
Update numbers
alexander-yevsyukov ba9ca28
Bump Jackson -> `2.13.4.2`
alexander-yevsyukov 3c310ee
Do not process non-Java files
alexander-yevsyukov f785e89
Update version numbers
alexander-yevsyukov ce63e43
Add `kotlin` built-in conditionally
alexander-yevsyukov 7f48651
Optimise imports
alexander-yevsyukov be148ed
Improve checking for Kotlin plugins
alexander-yevsyukov bff303b
Extract variables
alexander-yevsyukov 1f79bdb
Document checking for Kotlin in a project
alexander-yevsyukov 89d57d2
Improve dependency name
alexander-yevsyukov 18a7b87
Improve dependency names
alexander-yevsyukov 59640ef
Improve test project name
alexander-yevsyukov da5dcdb
Disable Android library test
alexander-yevsyukov 76c457c
Update config
alexander-yevsyukov 554c5d8
Force the task dependency
alexander-yevsyukov ca18c4d
Improve documentation language
alexander-yevsyukov d8ae325
Document commented out blocks
alexander-yevsyukov 2c31bfc
Fix typo
alexander-yevsyukov c698979
Add test for java and kotlin dirs
alexander-yevsyukov 7ac2097
Use Kotlin proto DSL
alexander-yevsyukov da9744f
Fix directory refs.
alexander-yevsyukov 4715195
Use `NoOpRenderer`
alexander-yevsyukov 523ae4b
Update build time
alexander-yevsyukov 8465151
Add properties for checking the source set size
alexander-yevsyukov 55fb593
Do not quit the printing iteration when file not found
alexander-yevsyukov c7862a5
Do not render sources for empty source file sets
alexander-yevsyukov b6e227a
Remove the empty set check
alexander-yevsyukov 18aedeb
Improve test name
alexander-yevsyukov b7c6dcb
Refer to issue
alexander-yevsyukov ac97675
Fix wording in KDoc
alexander-yevsyukov 9acc605
Add nested `.gitignore`
alexander-yevsyukov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
217 changes: 217 additions & 0 deletions
217
buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,217 @@ | ||
| /* | ||
| * Copyright 2022, TeamDev. All rights reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Redistribution and use in source and/or binary forms, with or without | ||
| * modification, must retain the above copyright notice and the following | ||
| * disclaimer. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
|
|
||
| package io.spine.internal.dependency | ||
|
|
||
| import org.gradle.api.plugins.ExtensionAware | ||
| import org.gradle.kotlin.dsl.extra | ||
|
|
||
| /** | ||
| * Dependencies on Spine modules. | ||
| * | ||
| * @constructor | ||
| * Creates a new instance of `Spine` taking the property values | ||
| * of versions from the given project's extra properties. | ||
| */ | ||
| @Suppress("unused") | ||
| class Spine(p: ExtensionAware) { | ||
|
|
||
| /** | ||
| * Default versions for the modules of Spine, unless they are | ||
| * configured in `versions.gradle.kts`. | ||
| */ | ||
| object DefaultVersion { | ||
|
|
||
| /** | ||
| * The default version of `base` to use. | ||
| * @see [Spine.base] | ||
| */ | ||
| const val base = "2.0.0-SNAPSHOT.114" | ||
|
|
||
| /** | ||
| * The default version of `core-java` to use. | ||
| * @see [Spine.CoreJava.client] | ||
| * @see [Spine.CoreJava.server] | ||
| */ | ||
| const val core = "2.0.0-SNAPSHOT.114" | ||
|
|
||
| /** | ||
| * The version of `model-compiler` to use. | ||
| * @see [Spine.modelCompiler] | ||
| */ | ||
| const val mc = "2.0.0-SNAPSHOT.90" | ||
|
|
||
| /** | ||
| * The version of `mc-java` to use. | ||
| */ | ||
| const val mcJava = "2.0.0-SNAPSHOT.102" | ||
|
|
||
| /** | ||
| * The version of `base-types` to use. | ||
| * @see [Spine.baseTypes] | ||
| */ | ||
| const val baseTypes = "2.0.0-SNAPSHOT.110" | ||
|
|
||
| /** | ||
| * The version of `time` to use. | ||
| * @see [Spine.time] | ||
| */ | ||
| const val time = "2.0.0-SNAPSHOT.109" | ||
|
|
||
| /** | ||
| * The version of `tool-base` to use. | ||
| * @see [Spine.toolBase] | ||
| */ | ||
| const val toolBase = "2.0.0-SNAPSHOT.111" | ||
|
|
||
| /** | ||
| * The version of `validation` to use. | ||
| * @see [Spine.validation] | ||
| */ | ||
| const val validation = "2.0.0-SNAPSHOT.32" | ||
| } | ||
|
|
||
| companion object { | ||
| const val group = "io.spine" | ||
| const val toolsGroup = "io.spine.tools" | ||
|
|
||
| /** | ||
| * The version of ProtoData to be used in the project. | ||
| * | ||
| * We do it here instead of `versions.gradle.kts` because we later use | ||
| * it in a `plugins` section in a build script. | ||
| * | ||
| * @see [ProtoData] | ||
| */ | ||
| const val protoDataVersion = "0.2.18" | ||
| } | ||
|
|
||
| val base = "$group:spine-base:${p.baseVersion}" | ||
| val testlib = "$toolsGroup:spine-testlib:${p.baseVersion}" | ||
|
|
||
| @Deprecated("Please use `validation.runtime`", replaceWith = ReplaceWith("validation.runtime")) | ||
| val validate = "$group:spine-validate:${p.baseVersion}" | ||
|
|
||
| val baseTypes = "$group:spine-base-types:${p.baseTypesVersion}" | ||
|
|
||
| val time = "$toolsGroup:spine-testlib:${p.timeVersion}" | ||
|
|
||
| val toolBase = "$toolsGroup:spine-tool-base:${p.toolBaseVersion}" | ||
| val pluginBase = "$toolsGroup:spine-plugin-base:${p.toolBaseVersion}" | ||
| val pluginTestlib = "$toolsGroup:spine-plugin-testlib:${p.toolBaseVersion}" | ||
|
|
||
| val modelCompiler = "$toolsGroup:spine-model-compiler:${p.mcVersion}" | ||
|
|
||
| val mcJavaPlugin = "io.spine.tools:spine-mc-java-plugins:${p.mcJavaVersion}:all" | ||
|
|
||
| val validation = Validation(p) | ||
|
|
||
| val coreJava = CoreJava(p) | ||
| val client = coreJava.client // Added for brevity. | ||
| val server = coreJava.server // Added for brevity. | ||
|
|
||
| private val ExtensionAware.baseVersion: String | ||
| get() = "baseVersion".asExtra(this, DefaultVersion.base) | ||
|
|
||
| private val ExtensionAware.baseTypesVersion: String | ||
| get() = "baseTypesVersion".asExtra(this, DefaultVersion.baseTypes) | ||
|
|
||
| private val ExtensionAware.timeVersion: String | ||
| get() = "timeVersion".asExtra(this, DefaultVersion.time) | ||
|
|
||
| private val ExtensionAware.mcVersion: String | ||
| get() = "mcVersion".asExtra(this, DefaultVersion.mc) | ||
|
|
||
| private val ExtensionAware.mcJavaVersion: String | ||
| get() = "mcJavaVersion".asExtra(this, DefaultVersion.mcJava) | ||
|
|
||
| private val ExtensionAware.toolBaseVersion: String | ||
| get() = "toolBaseVersion".asExtra(this, DefaultVersion.toolBase) | ||
|
|
||
| /** | ||
| * Dependencies on Spine validation modules. | ||
| * | ||
| * See [`SpineEventEngine/validation`](https://github.com/SpineEventEngine/validation/). | ||
| */ | ||
| class Validation(p: ExtensionAware) { | ||
|
|
||
| companion object { | ||
| const val group = "io.spine.validation" | ||
| } | ||
|
|
||
| val runtime = "$group:spine-validation-java-runtime:${p.validationVersion}" | ||
| val java = "$group:spine-validation-java:${p.validationVersion}" | ||
| val model = "$group:spine-validation-model:${p.validationVersion}" | ||
| val config = "$group:spine-validation-configuration:${p.validationVersion}" | ||
|
|
||
| private val ExtensionAware.validationVersion: String | ||
| get() = "validationVersion".asExtra(this, DefaultVersion.validation) | ||
| } | ||
|
|
||
| /** | ||
| * Dependencies on ProtoData modules. | ||
| * | ||
| * See [`SpineEventEngine/ProtoData`](https://github.com/SpineEventEngine/ProtoData/). | ||
| */ | ||
| object ProtoData { | ||
|
|
||
| const val pluginId = "io.spine.protodata" | ||
|
|
||
| const val version = protoDataVersion | ||
| const val pluginLib = "$group:protodata:$version" | ||
| } | ||
|
|
||
| /** | ||
| * Dependencies on `core-java` modules. | ||
| * | ||
| * See [`SpineEventEngine/core-java`](https://github.com/SpineEventEngine/core-java/). | ||
| */ | ||
| class CoreJava(p: ExtensionAware) { | ||
| val core = "$group:spine-core:${p.coreVersion}" | ||
| val client = "$group:spine-client:${p.coreVersion}" | ||
| val server = "$group:spine-server:${p.coreVersion}" | ||
| val testUtilServer = "$toolsGroup:spine-testutil-server:${p.coreVersion}" | ||
|
|
||
| private val ExtensionAware.coreVersion: String | ||
| get() = "coreVersion".asExtra(this, DefaultVersion.core) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Obtains the value of the extension property named as this string from the given project. | ||
| * | ||
| * @param p the project declaring extension properties | ||
| * @param defaultValue | ||
| * the default value to return, if the project does not have such a property. | ||
| * If `null` then rely on the property declaration, even if this would cause an error. | ||
| */ | ||
| private fun String.asExtra(p: ExtensionAware, defaultValue: String? = null): String { | ||
| return if (p.extra.has(this) || defaultValue == null) { | ||
| p.extra[this] as String | ||
| } else { | ||
| defaultValue | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.