Skip to content
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

Removed usage of GrgitServicePlugin #1682

Merged
merged 1 commit into from
Jun 6, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReckonPlugin>()
apply<GrgitServicePlugin>()

// should be provided in the gradle.properties
configure<ReckonExtension> {
setDefaultInferredScope(Scope.MINOR.name)
snapshots()
setScopeCalc(calcScopeFromProp())
setStageCalc(calcStageFromProp())
}

val status = project.extensions.getByType<GrgitServiceExtension>()
.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}"
Expand Down