diff --git a/README.md b/README.md index f39b60b..4595805 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle. **Groovy** + ```groovy def sentinelVersion = "1.4.1" debugImplementation "com.infinum.sentinel:sentinel:$sentinelVersion" diff --git a/sentinel/build.gradle b/sentinel/build.gradle index e1b405f..66e3807 100644 --- a/sentinel/build.gradle +++ b/sentinel/build.gradle @@ -125,4 +125,8 @@ project.gradle.taskGraph.whenReady { connectedDebugAndroidTest { ignoreFailures = true } -} \ No newline at end of file +} + +apply from: '../tasks.gradle' +preBuild.dependsOn ':sentinel:generateReadme' + diff --git a/tasks.gradle b/tasks.gradle new file mode 100644 index 0000000..70c23a8 --- /dev/null +++ b/tasks.gradle @@ -0,0 +1,13 @@ +apply from: '../config.gradle' + +private void replaceVersionsInFile(File file) { + def content = file.text + content = content.replaceAll(~/sentinelVersion\s*=\s*".*"/, "sentinelVersion = \"${releaseConfig.version}\"") + file.setText(content) +} + +tasks.register('generateReadme') { + doFirst { + replaceVersionsInFile(new File("${rootDir}/README.md")) + } +} \ No newline at end of file