Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -42,12 +42,12 @@ object McJava {
/**
* The version used to in the build classpath.
*/
const val dogfoodingVersion = "2.0.0-SNAPSHOT.259"
const val dogfoodingVersion = "2.0.0-SNAPSHOT.260"

/**
* The version to be used for integration tests.
*/
const val version = "2.0.0-SNAPSHOT.259"
const val version = "2.0.0-SNAPSHOT.260"

/**
* The ID of the Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -73,7 +73,7 @@ object ProtoData {
* The version of ProtoData dependencies.
*/
val version: String
private const val fallbackVersion = "0.80.1"
private const val fallbackVersion = "0.90.0"

/**
* The distinct version of ProtoData used by other build tools.
Expand Down Expand Up @@ -106,6 +106,9 @@ object ProtoData {
val backend
get() = "$group:protodata-backend:$version"

val params
get() = "$group:protodata-params:$version"

val protocPlugin
get() = "$group:protodata-protoc:$version"

Expand Down
68 changes: 34 additions & 34 deletions dependencies.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions mc-java-annotation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -27,6 +27,7 @@
import io.spine.dependency.lib.Roaster
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Spine
import io.spine.dependency.local.TestLib
import io.spine.dependency.local.ToolBase

plugins {
Expand All @@ -39,7 +40,7 @@ dependencies {
implementation(Logging.lib)

testFixturesImplementation(ToolBase.lib)
testFixturesImplementation(Spine.testlib)
testFixturesImplementation(TestLib.lib)

val guavaGroup = "com.google.guava"
testFixturesImplementation(Roaster.api) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -30,14 +30,20 @@ import com.google.protobuf.Message
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import io.spine.protodata.java.style.JavaCodeStyleFormatterPlugin
import io.spine.protodata.params.Directories
import io.spine.protodata.params.WorkingDirectory
import io.spine.protodata.plugin.Plugin
import io.spine.protodata.render.SourceFile
import io.spine.protodata.render.SourceFileSet
import io.spine.protodata.settings.Format
import io.spine.protodata.util.Format
import io.spine.protodata.settings.SettingsDirectory
import io.spine.protodata.testing.PipelineSetup
import io.spine.protodata.testing.PipelineSetup.Companion.byResources
import io.spine.protodata.testing.pipelineParams
import io.spine.protodata.testing.withRequestFile
import io.spine.protodata.testing.withSettingsDir
import io.spine.tools.code.Java
import io.spine.tools.code.SourceSetName
import io.spine.tools.mc.java.gradle.settings.CodegenSettings
import io.spine.type.toJson
import java.nio.file.Path
Expand Down Expand Up @@ -92,18 +98,27 @@ abstract class PluginTestSetup<S: Message>(
/**
* Creates an instance of [PipelineSetup] with the given parameters.
*
* [settings] will be written to the [settingsDir] before creation of
* a [Pipeline][io.spine.protodata.backend.Pipeline].
* [settings] will be written to the [WorkingDirectory.settingsDirectory] before
* creation of a [Pipeline][io.spine.protodata.backend.Pipeline].
*/
fun setup(outputDir: Path, settingsDir: Path, settings: S): PipelineSetup {
fun setup(projectDir: Path, settings: S): PipelineSetup {
val workingDir = projectDir.resolve("build").resolve(Directories.PROTODATA_WORKING_DIR)
val workingDirectory = WorkingDirectory(workingDir)
val requestFile = workingDirectory.requestDirectory.file(SourceSetName("testFixtures"))
val params = pipelineParams {
withRequestFile(requestFile)
withSettingsDir(workingDirectory.settingsDirectory.path)
}
val outputDir = projectDir.resolve("output")
outputDir.toFile().mkdirs()
val setup = byResources(
listOf(
params = params,
plugins = listOf(
plugin,
// We want to be able to see the code in debug with human eyes. Mercy!..
// We want to be able to see the code in debug formatted for easier reading.
JavaCodeStyleFormatterPlugin()
),
outputDir,
settingsDir
outputRoot = outputDir,
) {
writeSettings(it, settings)
}
Expand All @@ -119,14 +134,14 @@ abstract class PluginTestSetup<S: Message>(
*
* @see createSettings
*/
fun runPipeline(projectDir: Path, outputDir: Path, settingsDir: Path) {
fun runPipeline(projectDir: Path) {
// Clear the cache of previously parsed files to avoid repeated code generation.
SourceFile.clearCache()
val settings = createSettings(projectDir)
val setup = setup(outputDir, settingsDir, settings)
val setup = setup(projectDir, settings)
val pipeline = setup.createPipeline()
pipeline()
this.sourceFileSet = setup.sourceFileSet
this.sourceFileSet = pipeline.sources[0]
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -75,13 +75,9 @@ internal class AddComparatorSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
fun setup(@TempDir projectDir: Path) {
withLoggingMutedIn(AddComparator::class.java.packageName) {
runPipeline(projectDir, outputDir, settingsDir)
runPipeline(projectDir)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -46,11 +46,7 @@ internal class AddCompareToSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) = runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) = runPipeline(projectDir)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -45,11 +45,7 @@ internal class ImplementComparableSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) = runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) = runPipeline(projectDir)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -58,12 +58,8 @@ internal class AddColumnClassSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
runPipeline(projectDir)
val sourceFile = file(Path(DEPARTMENT_JAVA))
entityStateCode = sourceFile.code()
psiFile = sourceFile.psi() as PsiJavaFile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -57,12 +57,8 @@ internal class AddFieldClassSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
runPipeline(projectDir)
val sourceFile = file(Path(DEPARTMENT_JAVA))
entityStateCode = sourceFile.code()
psiFile = sourceFile.psi() as PsiJavaFile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -59,12 +59,8 @@ internal class QueryBuilderClassSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
runPipeline(projectDir)
val sourceFile = file(Path(DEPARTMENT_JAVA))
val psiFile = sourceFile.psi() as PsiJavaFile
entityStateClass = psiFile.topLevelClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -51,12 +51,8 @@ internal class QueryClassSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
runPipeline(projectDir)
val sourceFile = file(Path(DEPARTMENT_JAVA))
val psiFile = sourceFile.psi() as PsiJavaFile
entityStateClass = psiFile.topLevelClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -51,12 +51,8 @@ internal class QueryMethodSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
runPipeline(projectDir)
val sourceFile = file(Path(DEPARTMENT_JAVA))
psiFile = sourceFile.psi() as PsiJavaFile
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -48,12 +48,8 @@ internal class EveryIsOptionRendererSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
generateCode(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
generateCode(projectDir)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -41,12 +41,8 @@ internal class IsOptionRendererSpec {

@BeforeAll
@JvmStatic
fun setup(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
generateCode(projectDir, outputDir, settingsDir)
fun setup(@TempDir projectDir: Path) {
generateCode(projectDir)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, 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.
Expand Down Expand Up @@ -55,11 +55,7 @@ internal abstract class MarkerPluginTestSetup : PluginTestSetup<Empty>(MarkerPlu

override fun createSettings(projectDir: Path): Empty = Empty.getDefaultInstance()

fun generateCode(
@TempDir projectDir: Path,
@TempDir outputDir: Path,
@TempDir settingsDir: Path
) {
runPipeline(projectDir, outputDir, settingsDir)
fun generateCode(@TempDir projectDir: Path) {
runPipeline(projectDir)
}
}
Loading
Loading