Skip to content

Commit

Permalink
Futureproof the test by not relying on SDK.
Browse files Browse the repository at this point in the history
Bug: N/A
Test: N/A
Change-Id: I1aac29b46905730bf76928e2987bfd3cd02c87e3
  • Loading branch information
Wojciech Fijołek committed Jul 3, 2024
1 parent cebf068 commit 4999378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class CheckMergedManifestTask : DefaultTask() {

val fileContents = mergedManifest.get().asFile.readText()
val gitVersion = gitInfoFile.get().asFile.readText()
if (fileContents.contains("android:targetSdkVersion=\"$gitVersion\"")) {
if (fileContents.contains("android:versionName=\"$gitVersion\"")) {
return
} else {
throw RuntimeException("Merged manifest does not contains transformed data.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ abstract class ManifestTransformerTask: DefaultTask() {

val gitVersion = gitInfoFile.get().asFile.readText()
var manifest = mergedManifest.asFile.get().readText()
manifest = manifest.replace("android:targetSdkVersion=\"34\"", "android:targetSdkVersion=\"$gitVersion\"")
manifest = manifest.replace("package=\"com.example.android.recipes.transformManifest\" >", "" +
"package=\"com.example.android.recipes.transformManifest\"\n" +
"android:versionName=\"$gitVersion\" >")
updatedManifest.get().asFile.writeText(manifest)
}
}

0 comments on commit 4999378

Please sign in to comment.