From 1a8bc653567807a1faf674f5d1fc170a4193bcba Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Tue, 2 May 2023 11:17:32 +0300 Subject: [PATCH] supported changes from new reckon plugin version --- .../buildutils/VersioningConfiguration.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt index 0fd6b60073..efeb4c8467 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt @@ -4,33 +4,38 @@ package org.cqfn.diktat.buildutils -import org.ajoberstar.grgit.gradle.GrgitServiceExtension -import org.ajoberstar.grgit.gradle.GrgitServicePlugin +import org.ajoberstar.reckon.core.Scope import org.ajoberstar.reckon.gradle.ReckonExtension import org.ajoberstar.reckon.gradle.ReckonPlugin +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.internal.storage.file.FileRepository +import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.gradle.api.Project import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.getByType /** * Configures reckon plugin for [this] project, should be applied for root project only */ fun Project.configureVersioning() { apply() - apply() // should be provided in the gradle.properties configure { + setDefaultInferredScope(Scope.MINOR.name) snapshots() setScopeCalc(calcScopeFromProp()) setStageCalc(calcStageFromProp()) } - val status = project.extensions.getByType() - .service - .map { it.grgit.repository.jgit.status().call() } - .get() + val status = FileRepositoryBuilder() + .findGitDir(project.rootDir) + .setup() + .let(::FileRepository) + .let(::Git) + .status() + .call() + if (!status.isClean) { logger.warn("git tree is not clean; " + "Untracked files: ${status.untracked}, uncommitted changes: ${status.uncommittedChanges}"