Skip to content

Commit

Permalink
Release/1.0.1 (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarari authored May 28, 2023
1 parent 66752eb commit cf7be02
Show file tree
Hide file tree
Showing 27 changed files with 259 additions and 133 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ dependencies {
kapt(libs.moshi.codegen)
implementation(libs.commons.io)
implementation(libs.coroutines)
implementation(libs.oshi)
}

tasks.withType<KotlinCompile>().configureEach {
Expand Down
8 changes: 6 additions & 2 deletions detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ complexity:
LongMethod:
active: true
threshold: 75
ComplexMethod:
CyclomaticComplexMethod:
active: true
threshold: 25

Expand All @@ -50,6 +50,8 @@ exceptions:
active: false
TooGenericExceptionCaught:
active: false
InstanceOfCheckForException:
active: false

style:
active: true
Expand All @@ -71,4 +73,6 @@ style:
WildcardImport:
active: true
excludeImports:
- 'java.util.*'
- 'java.util.*'
ExplicitItLambdaParameter:
active: false
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@

# Changelog

## 1.0.1
* [Issue 105](https://github.com/janbarari/gradle-analytics-plugin/issues/105)
* [Issue 121](https://github.com/janbarari/gradle-analytics-plugin/issues/121)
* Upgrade gradle version to `8.0.2`
* Upgrade kotlin and other dependencies

## 1.0.0-beta9
* Fix critical issues

Expand Down
4 changes: 3 additions & 1 deletion docs/donation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
SOFTWARE.
-->

# Donation 🧡
# Donation ❤️
Gradle Analytics Plugin is Open Source and completely free, I spent more than a year analyzing build bottlenecks and finding a way to track them, and finally implemented it into the plugin.

Of course, this project will be continued as a free open-source project. But to give me some energy, you can use either below ways to support me.

<b>The first stage of donation expectation is $1500 and $0 donated till now.</b>

!!! info "Send me Bitcoin"

<strong>bc1q8ecepuax6je6s70j4l76nr978w34msc929sfuf</strong>
Expand Down
4 changes: 2 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Apply the Gradle Plugin to the root of your project.
=== "Kotlin"
``` kotlin
plugins {
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.0-beta9"
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.1"
}
```
=== "Groovy"
``` groovy
plugins {
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.0-beta9'
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.1'
}
```
[For legacy plugin application, see the Gradle Plugin Portal.](https://plugins.gradle.org/plugin/io.github.janbarari.gradle-analytics-plugin)
Expand Down
21 changes: 10 additions & 11 deletions docs/third-party.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
# Third party
All third-party dependencies that are being used in the plugin source:

- <b>Gradle API 7.6</b>
- <b>Kotlin 1.6.20</b>
- <b>Coroutines 1.6.3</b>
- <b>Moshi 1.13.0</b>
- <b>Jetbrains Exposed 0.38.1</b>
- <b>Detekt 1.20.0-RC2</b>
- <b>Mockk 1.12.4</b>
- `mysql:mysql-connector-java:8.0.29`
- `org.xerial:sqlite-jdbc:3.36.0.3`
- `commons-io:commons-io:2.11.0`
- `com.github.oshi:oshi-core:6.4.0`
- <b>Gradle API 8.0.2</b>
- <b>Kotlin 1.8.10</b>
- <b>Coroutines 1.7.1</b>
- <b>Moshi 1.15.0</b>
- <b>Jetbrains Exposed 0.41.1</b>
- <b>Detekt 1.223.0</b>
- <b>Mockk 1.13.5</b>
- `mysql:mysql-connector-java:8.0.33`
- `org.xerial:sqlite-jdbc:3.42.0.0`
- `commons-io:commons-io:2.12.0`
13 changes: 12 additions & 1 deletion docs/upcoming-milestone.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,15 @@
-->

# Upcoming Milestone
Upcoming milestone planning is in progress.
Finally, the first stable version of the plugin, planned for release in `Milestone/1.0.1`, is scheduled to be published during the last week of May 2023.
<br>

<b>Upcoming Changes</b>

- [x] Fix bug report #105
- [x] Fix bug report #121
- [x] Upgrade gradle version to 8.0.2
- [x] Upgrade kotlin and other dependencies

<br>
I'm sorry for the delay in the project. It was caused by unexpected problems, like losing my job and facing personal difficulties, which made it hard for me to contribute effectively. I would really appreciate it if you could donate to support the development of this plugin.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pluginTags = kotlin,plugin,analytics,analysis,gradle,gradle-plugin,gradle-plugin
pluginImplementationClass = io.github.janbarari.gradle.analytics.GradleAnalyticsPlugin
pluginDeclarationName = gradleAnalyticsPlugin
pluginGroupPackageName = io.github.janbarari
pluginVersion = 1.0.0-beta9
pluginVersion = 1.0.1
20 changes: 9 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
# SOFTWARE.

[versions]
kotlin = "1.6.20"
detekt = "1.20.0-RC2"
sqlite_driver = "3.36.0.3"
mysql_driver = "8.0.29"
jetbrains_exposed = "0.38.1"
moshi = "1.13.0"
commons-io = "2.11.0"
mockk = "1.12.4"
coroutines = "1.6.3"
oshi = "6.4.0"
kotlin = "1.8.10"
detekt = "1.23.0"
sqlite_driver = "3.42.0.0"
mysql_driver = "8.0.33"
jetbrains_exposed = "0.41.1"
moshi = "1.15.0"
commons-io = "2.12.0"
mockk = "1.13.5"
coroutines = "1.7.1"

[libraries]
sqlite_driver = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite_driver" }
Expand All @@ -42,7 +41,6 @@ commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
oshi = { module = "com.github.oshi:oshi-core", version.ref = "oshi" }

[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ nav:
- Setup: setup.md
- Getting Report: getting-report.md
- Changelog: changelog.md
- Donation 🧡: donation.md
- Donation ❤️: donation.md
- Privacy & Policy: privacy-policy.md
- Request Feature: request-feature.md
- Report Bug: report-bug.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ import io.github.janbarari.gradle.ExcludeJacocoGenerated
import io.github.janbarari.gradle.analytics.database.MySqlDatabaseConnection
import io.github.janbarari.gradle.analytics.database.SqliteDatabaseConnection
import io.github.janbarari.gradle.analytics.exception.IncompatibleVersionException
import io.github.janbarari.gradle.analytics.exception.GitUnavailableException
import io.github.janbarari.gradle.analytics.exception.PluginConfigInvalidException
import io.github.janbarari.gradle.analytics.reporttask.ReportAnalyticsTask
import io.github.janbarari.gradle.analytics.scanner.BuildScanner
import io.github.janbarari.gradle.extension.isNull
import io.github.janbarari.gradle.extension.whenNotNull
import io.github.janbarari.gradle.extension.whenTrue
import io.github.janbarari.gradle.extension.whenTypeIs
import io.github.janbarari.gradle.utils.GitUtils
import io.github.janbarari.gradle.git.Git
import io.github.janbarari.gradle.git.GitGradleImpl
import io.github.janbarari.gradle.git.GitTerminalImpl
import io.github.janbarari.gradle.utils.ProjectUtils
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.build.event.BuildEventsListenerRegistry
import org.gradle.util.GradleVersion
import javax.inject.Inject

/**
Expand All @@ -54,7 +56,7 @@ class GradleAnalyticsPlugin @Inject constructor(

companion object {
const val PLUGIN_NAME = "gradleAnalyticsPlugin"
const val PLUGIN_VERSION = "1.0.0-beta9"
const val PLUGIN_VERSION = "1.0.1"
const val OUTPUT_DIRECTORY_NAME = "gradle-analytics-plugin"
}

Expand All @@ -63,11 +65,12 @@ class GradleAnalyticsPlugin @Inject constructor(
*/
override fun apply(project: Project) {
ensureGradleCompatibility()
ensureGitAvailable()
val git = provideGitInterface(project)
git.ensureGitAvailable()
val config = setupConfig(project)
validateConfig(config)
registerTasks(config)
BuildScanner.setup(config, registry)
BuildScanner.setup(config, registry, git)
}

/**
Expand All @@ -85,18 +88,6 @@ class GradleAnalyticsPlugin @Inject constructor(
}
}

/**
* The plugin only works on projects which use Git. This function ensures the Git terminal accessible in project directory.
*/
@kotlin.jvm.Throws(GitUnavailableException::class)
private fun ensureGitAvailable() {
try {
GitUtils.currentBranch()
} catch (e: Throwable) {
throw GitUnavailableException()
}
}

/**
* Setups plugin config.
*
Expand Down Expand Up @@ -195,4 +186,12 @@ class GradleAnalyticsPlugin @Inject constructor(
}
}

private fun provideGitInterface(project: Project): Git {
return if (GradleVersion.current() >= GradleVersion.version(ProjectUtils.GradleVersions.V8_1.versionNumber)) {
GitGradleImpl(project)
} else {
GitTerminalImpl()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import io.github.janbarari.gradle.memorycache.MemoryCache
import io.github.janbarari.gradle.utils.DateTimeUtils
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.SqlExpressionBuilder.less
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteAll
import org.jetbrains.exposed.sql.deleteWhere
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class Database(
return transaction(
_database.transactionManager.defaultIsolationLevel,
_database.transactionManager.defaultRepetitionAttempts,
readOnly = false,
_database,
statement
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,24 @@
package io.github.janbarari.gradle.analytics.reporttask

import com.squareup.moshi.Moshi
import io.github.janbarari.gradle.analytics.data.DatabaseRepositoryImp
import io.github.janbarari.gradle.analytics.database.Database
import io.github.janbarari.gradle.analytics.domain.repository.DatabaseRepository
import io.github.janbarari.gradle.analytics.domain.usecase.GetMetricsUseCase
import io.github.janbarari.gradle.ExcludeJacocoGenerated
import io.github.janbarari.gradle.analytics.DatabaseConfig
import io.github.janbarari.gradle.analytics.GradleAnalyticsPlugin.Companion.OUTPUT_DIRECTORY_NAME
import io.github.janbarari.gradle.analytics.data.DatabaseRepositoryImp
import io.github.janbarari.gradle.analytics.data.TemporaryMetricsMemoryCacheImpl
import io.github.janbarari.gradle.analytics.data.V100B6DatabaseResultMigrationStage
import io.github.janbarari.gradle.analytics.database.Database
import io.github.janbarari.gradle.analytics.database.DatabaseResultMigrationPipeline
import io.github.janbarari.gradle.analytics.domain.model.metric.BuildMetric
import io.github.janbarari.gradle.analytics.domain.model.metric.BuildMetricJsonAdapter
import io.github.janbarari.gradle.analytics.domain.model.report.ModulesDependencyGraphReportJsonAdapter
import io.github.janbarari.gradle.analytics.domain.repository.DatabaseRepository
import io.github.janbarari.gradle.analytics.domain.usecase.GetMetricsUseCase
import io.github.janbarari.gradle.analytics.domain.usecase.GetModulesTimelineUseCase
import io.github.janbarari.gradle.extension.isNull
import io.github.janbarari.gradle.logger.Tower
import io.github.janbarari.gradle.logger.TowerImpl
import io.github.janbarari.gradle.memorycache.MemoryCache
import oshi.SystemInfo
import kotlin.io.path.Path

/**
Expand Down Expand Up @@ -95,11 +94,6 @@ fun ReportAnalyticsInjector.provideTower(): Tower {
return tower!!
}

@ExcludeJacocoGenerated
fun ReportAnalyticsInjector.provideSystemInfo(): SystemInfo {
return SystemInfo()
}

@ExcludeJacocoGenerated
fun ReportAnalyticsInjector.provideDatabase(): Database {
return Database(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import io.github.janbarari.gradle.extension.isModuleProject
import io.github.janbarari.gradle.logger.Tower
import kotlinx.coroutines.runBlocking
import org.gradle.api.DefaultTask
import org.gradle.api.JavaVersion
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
Expand Down Expand Up @@ -141,14 +142,9 @@ abstract class ReportAnalyticsTask : DefaultTask() {
excludeModules = excludeModules.get()
)
tower = injector.provideTower()
val systemInfo = injector.provideSystemInfo()

tower.r("report process started")
tower.r("plugin version: ${GradleAnalyticsPlugin.PLUGIN_VERSION}")
tower.r("manufacturer: ${systemInfo.operatingSystem.manufacturer}")
tower.r("os: ${systemInfo.operatingSystem.family} " +
"${systemInfo.operatingSystem.versionInfo.version} " +
"x${systemInfo.operatingSystem.bitness}")
tower.r("jvm: ${JavaVersion.current()}")
tower.r("gradle version: ${GradleVersion.current().version}")
tower.r("requested tasks: $requestedTasksArgument")
tower.r("modules count: ${modules.get().size}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import io.github.janbarari.gradle.extension.getRequestedTasks
import io.github.janbarari.gradle.extension.isModuleProject
import io.github.janbarari.gradle.extension.whenEach
import io.github.janbarari.gradle.extension.whenNotNull
import io.github.janbarari.gradle.git.Git
import io.github.janbarari.gradle.utils.DependencyGraphGenerator
import org.gradle.api.Project
import org.gradle.api.internal.GradleInternal
Expand All @@ -46,18 +47,20 @@ object BuildScanner {

fun setup(
config: GradleAnalyticsPluginConfig,
registry: BuildEventsListenerRegistry
registry: BuildEventsListenerRegistry,
git: Git
) {
setupInitializationService(config.project)
setupDependencyResolutionService(config.project)
setupConfigurationService(config.project)
setupExecutionService(config.project, registry, config)
setupExecutionService(config.project, registry, config, git)
}

private fun setupExecutionService(
project: Project,
registry: BuildEventsListenerRegistry,
configuration: GradleAnalyticsPluginConfig
configuration: GradleAnalyticsPluginConfig,
git: Git
) {
val maximumWorkerCount = project.gradle.startParameter.maxWorkerCount

Expand Down Expand Up @@ -93,6 +96,8 @@ object BuildScanner {
this.modules.set(modules)
this.modulesDependencyGraph.set(modulesDependencyGraph)
this.nonCacheableTasks.set(nonCacheableTasks)
gitCurrentBranch.set(git.getCurrentBranch())
gitHeadCommitHash.set(git.getHeadCommitHash())
}
}
registry.onTaskCompletion(buildExecutionService)
Expand Down
Loading

0 comments on commit cf7be02

Please sign in to comment.