-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust perf testing variants to only have a single debug variant, and…
… properly generate tasks for app variants (#85) * Add support for product flavors for Perf testing * Adjust to use single perf project variant, add test to verify * Adjust sample * Fixes
- Loading branch information
Showing
11 changed files
with
214 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...st/kotlin/com/emergetools/android/gradle/MultiProjectFlavorsBuildTypesEmergePluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.emergetools.android.gradle | ||
|
||
import com.emergetools.android.gradle.base.EmergeGradleRunner | ||
import com.emergetools.android.gradle.mocks.assertSuccessfulUploadRequests | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
|
||
class MultiProjectFlavorsBuildTypesEmergePluginTest : EmergePluginTest() { | ||
|
||
@Test | ||
fun multiProjectUpload() { | ||
EmergeGradleRunner.create("multi-project-with-flavors-buildtypes") | ||
.withArguments("emergeUploadMinApi24DemoStagingAab") | ||
.withDefaultServer() | ||
.assert { result, server -> | ||
assertSuccessfulUploadRequests(server) | ||
result.assertSuccessfulTask(":app:emergeUploadMinApi24DemoStagingAab") | ||
} | ||
.build() | ||
} | ||
|
||
@Test | ||
fun multiProjectUploadPerfBundle() { | ||
EmergeGradleRunner.create("multi-project-with-flavors-buildtypes") | ||
.withArguments("emergeUploadMinApi21FullReleasePerfBundle") | ||
.withDefaultServer() | ||
.assert { result, server -> | ||
assertSuccessfulUploadRequests(server) | ||
result.assertSuccessfulTask(":app:emergeUploadMinApi21FullReleasePerfBundle") | ||
} | ||
.build() | ||
} | ||
|
||
@Test | ||
fun multiProjectGeneratePerformanceProjectMissing() { | ||
EmergeGradleRunner.create("multi-project-with-flavors-buildtypes") | ||
.withArguments(":app:emergeGeneratePerformanceProject") | ||
.withDefaultServer() | ||
.assert { result, _ -> | ||
assertTrue( | ||
result.output.contains( | ||
"task 'emergeGeneratePerformanceProject' not found in project ':app'" | ||
) | ||
) | ||
} | ||
.buildAndFail() | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...Test/resources/gradle-project-dirs/multi-project-with-flavors-buildtypes/app/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'com.emergetools.android' | ||
} | ||
|
||
android { | ||
namespace 'com.example.myapplication' | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId 'com.example.myapplication' | ||
minSdk 23 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
|
||
buildTypes { | ||
staging { | ||
initWith debug | ||
applicationIdSuffix ".debugStaging" | ||
} | ||
release { | ||
initWith release | ||
applicationIdSuffix ".release" | ||
} | ||
} | ||
|
||
flavorDimensions "api", "mode" | ||
|
||
productFlavors { | ||
demo { | ||
dimension "mode" | ||
applicationIdSuffix ".demo" | ||
versionNameSuffix "-demo" | ||
} | ||
|
||
full { | ||
dimension "mode" | ||
applicationIdSuffix ".full" | ||
versionNameSuffix "-full" | ||
} | ||
|
||
minApi24 { | ||
dimension "api" | ||
minSdkVersion 24 | ||
} | ||
|
||
minApi21 { | ||
dimension "api" | ||
minSdkVersion 21 | ||
} | ||
} | ||
} | ||
|
||
emerge { | ||
apiToken = 'abcdef123' | ||
|
||
performance { | ||
projectPath = ':performance' | ||
} | ||
|
||
vcs { | ||
sha = 'testSha' | ||
baseSha = 'testBaseSha' | ||
branchName = 'testBranchName' | ||
gitHub { | ||
repoOwner = 'repoOwner' | ||
repoName = 'repoName' | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...radle-project-dirs/multi-project-with-flavors-buildtypes/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.example.myapplication" /> |
3 changes: 3 additions & 0 deletions
3
...onalTest/resources/gradle-project-dirs/multi-project-with-flavors-buildtypes/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id 'com.android.test' apply false | ||
} |
3 changes: 3 additions & 0 deletions
3
...ources/gradle-project-dirs/multi-project-with-flavors-buildtypes/performance/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id 'org.jetbrains.kotlin.android' | ||
} |
2 changes: 2 additions & 0 deletions
2
...oject-dirs/multi-project-with-flavors-buildtypes/performance/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.example.myapplication.performance" /> |
17 changes: 17 additions & 0 deletions
17
...lTest/resources/gradle-project-dirs/multi-project-with-flavors-buildtypes/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
google() | ||
} | ||
} | ||
|
||
include(":app") | ||
include(":performance") | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters