Skip to content

Commit

Permalink
Add two custom metrics: ProjectFolderMetric and AndroidStudioMetric
Browse files Browse the repository at this point in the history
  • Loading branch information
MyDogTom committed Mar 21, 2020
1 parent 1fbf8a8 commit e469784
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ buildscript {
apply plugin: 'com.cdsap.talaiot'

import com.cdsap.talaiot.metrics.GitBranchMetric
import com.github.mydogtom.talaiot.ProjectFolderMetric
import com.github.mydogtom.talaiot.AndroidStudioMetric
talaiot {
metrics.default()
metrics.performance()
metrics.metrics.add(new GitBranchMetric())
metrics.metrics.add(new ProjectFolderMetric())
metrics.metrics.add(new AndroidStudioMetric())

publishers {
jsonPublisher = true
Expand Down
1 change: 1 addition & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
13 changes: 13 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.70'
}

repositories {
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenLocal()
}

dependencies {
implementation "com.cdsap:talaiot:1.2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.mydogtom.talaiot

import com.cdsap.talaiot.metrics.base.GradleMetric

class ProjectFolderMetric : GradleMetric<String>(
provider = { it.rootDir.absolutePath },
assigner = { report, value -> report.customProperties.buildProperties["projectFolder"] = value }
)

private const val KEY_ANDROID_STUDIO = "android.injected.invoked.from.ide"

class AndroidStudioMetric : GradleMetric<String>(
provider = { it.gradle.rootProject.hasProperty(KEY_ANDROID_STUDIO).toString() },
assigner = { report, value ->
report.customProperties.buildProperties["fromAndroidStudio"] = value
}
)

0 comments on commit e469784

Please sign in to comment.