Could some sharp eye find what has been bugging me for the last week? I cloned this repo but build fails with this exception:
FAILURE: Build failed with an exception.
Where: Script "C:\Users\MyUser\Desktop\repos\project\Launcher\git.gradle" line: 4
What went wrong: A problem occurred evaluating script. Failed to apply plugin 'com.cinnober.gradle.semver-git'
Cannot run program "git" (in directory "C:\Users\MyUser\Desktop\repos\project\Launcher"): CreateProcess error=2, System cannot find specified file
My build.gradle
:
apply from: "check.gradle"
buildscript {
ext.buildConfig = [
"sdkCompile" : 31,
"sdkMinimum" : 19,
"sdkTarget" : 28,
"tools" : "30.0.2",
"versionCode": 1549,
"versionName": "1.0.14",
]
ext.versions = [
"kotlin" : "1.3.72",
"okhttp" : "3.12.12", // This version is the latest supporting API 19
"retrofit": "2.6.4", // This version is the latest supporting API 19
"room" : "2.2.5",
]
ext.lib = [
"androidx": [
"appcompat" : "androidx.appcompat:appcompat:1.1.0",
"async_inflate": "androidx.asynclayoutinflater:asynclayoutinflater:1.0.0",
"cardview" : "androidx.cardview:cardview:1.0.0",
"constraint" : "androidx.constraintlayout:constraintlayout:1.1.3",
"core" : "androidx.core:core-ktx:1.3.1",
"fragment" : "androidx.fragment:fragment-ktx:1.2.5",
"material" : "com.google.android.material:material:1.1.0",
"multidex" : "androidx.multidex:multidex:2.0.1",
"preference" : "androidx.preference:preference-ktx:1.1.1",
"swipe_refresh": "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
"work" : "androidx.work:work-runtime-ktx:2.4.0",
],
"date" : [
"core": "com.jakewharton.threetenabp:threetenabp:1.2.4",
],
"debug_db": "com.amitshekhar.android:debug-db:1.0.6",
"firebase": [
"analytics": "com.google.firebase:firebase-analytics:17.4.4",
"crash" : "com.google.firebase:firebase-crashlytics:17.1.1@aar",
],
"glide" : "com.github.bumptech.glide:glide:4.11.0",
"viewpage": [
"indicator": "com.romandanylyk:pageindicatorview:1.0.3@aar",
],
"kotlin" : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}",
"kb_event": "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0",
"okhttp" : [
"core" : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
"curl" : "com.github.mrmike:ok2curl:0.4.5",
"logging": "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}",
],
"play" : [
"location": "com.google.android.gms:play-services-location:17.0.0",
],
"retrofit": [
"core": "com.squareup.retrofit2:retrofit:${versions.retrofit}",
"gson": "com.squareup.retrofit2:converter-gson:${versions.retrofit}",
],
"room" : [
"compiler" : "androidx.room:room-compiler:${versions.room}",
"core" : "androidx.room:room-runtime:${versions.room}",
"coroutines": "androidx.room:room-ktx:${versions.room}",
],
"timber" : "com.jakewharton.timber:timber:4.7.1",
]
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "com.google.gms:google-services:4.3.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "com.cinnober.gradle:semver-git:2.5.0"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.2.0"
classpath "com.google.firebase:firebase-appdistribution-gradle:2.0.0"
classpath "com.github.ben-manes:gradle-versions-plugin:0.29.0"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
flatDir {
dirs "${rootProject.rootDir}/libs"
}
maven { url 'https://jitpack.io' }
}
}
task sendHomologToFirebase {
group = "Firebase"
dependsOn "Launcher:assembleHomologRelease"
finalizedBy "Launcher:appDistributionUploadHomologRelease"
}
task sendProductionToFirebase {
group = "Firebase"
dependsOn "Launcher:assembleProductionRelease"
finalizedBy "Launcher:appDistributionUploadProductionRelease"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my git.gradle
:
ext.nextVersion = "patch"
ext.snapshotSuffix = "<count><dirty>"
ext.dirtyMarker = ".d"
apply plugin: "com.cinnober.gradle.semver-git"
task git_count {
def process = ("git rev-list --count HEAD").execute(null, project.rootDir)
process.waitFor()
if (process.exitValue() != 0) {
ext.count = 0
return
}
ext.count = process.text.trim().toInteger()
}
Things I've tried:
Both solutions described in this Gradle semver-git plugin page
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.cinnober.gradle:semver-git:2.5.0"
}
}
apply plugin: "com.cinnober.gradle.semver-git"
And:
plugins {
id "com.cinnober.gradle.semver-git" version "2.5.0"
}
Also tried directly downloading the .pom
file and loading it locally using:
flatDir {
dirs "${rootProject.rootDir}/libs"
}
I even tried this solution from another SO answer:
Including this on my build.gradle
plugins {
id 'com.cinnober.gradle.semver-git'
}
And including this on my settings.gradle
pluginManagement {
buildscript {
repositories {
flatDir {
dirs '/libs'
}
}
dependencies {
classpath ':semver-git:2.5.0'
}
}
}