Skip to content

Commit

Permalink
add backward compatibility if Gradle version is below version 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sullyAL committed Sep 7, 2023
1 parent fd1fb79 commit 17ae8b4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,21 @@ buildscript {
}
}

// Check the Gradle version
def gradleVersion = GradleVersion.current()
def requiredGradleVersion = GradleVersion.version('8.0')

// Creating sources with comments
task androidSourcesJar(type: Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
if (gradleVersion < requiredGradleVersion) {
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
} else {
task androidSourcesJar(type: Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
}

afterEvaluate {
Expand Down

0 comments on commit 17ae8b4

Please sign in to comment.