-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite assets loading mechanism (#995)
- Loading branch information
Showing
31 changed files
with
211 additions
and
54 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
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
Binary file added
BIN
+1.07 KB
...-plugin/src/test/projects/open-assets-legacy-asset-loading-off/consumer/libs/external.aar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...rojects/open-assets-legacy-asset-loading-off/consumer/src/main/assets/consumer/secret.txt
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 @@ | ||
consumer |
27 changes: 27 additions & 0 deletions
27
...sset-loading-off/consumer/src/test/java/app/cash/paparazzi/plugin/test/AssetAccessTest.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,27 @@ | ||
package app.cash.paparazzi.plugin.test | ||
|
||
import app.cash.paparazzi.Paparazzi | ||
import com.google.common.truth.Truth.assertThat | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class AssetAccessTest { | ||
@get:Rule | ||
val paparazzi = Paparazzi() | ||
|
||
@Test | ||
fun testViews() { | ||
val pairs = mapOf( | ||
"consumer/secret.txt" to "consumer", | ||
"producer1/secret.txt" to "producer1", | ||
"producer2/secret.txt" to "producer2", | ||
"external/secret.txt" to "external" | ||
) | ||
|
||
pairs.forEach { (key, value) -> | ||
val contents = | ||
paparazzi.context.assets.open(key).bufferedReader().use { it.readText() } | ||
assertThat(contents).isEqualTo(value) | ||
} | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
...jects/open-assets-legacy-asset-loading-off/producer1/src/main/assets/producer1/secret.txt
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 @@ | ||
producer1 |
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
1 change: 1 addition & 0 deletions
1
...jects/open-assets-legacy-asset-loading-off/producer2/src/main/assets/producer2/secret.txt
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 @@ | ||
producer2 |
3 changes: 2 additions & 1 deletion
3
...ts/open-transitive-assets/settings.gradle → ...-legacy-asset-loading-off/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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
apply from: '../test.settings.gradle' | ||
|
||
include ':consumer' | ||
include ':producer' | ||
include ':producer1' | ||
include ':producer2' |
27 changes: 27 additions & 0 deletions
27
...gradle-plugin/src/test/projects/open-assets-legacy-asset-loading-on/consumer/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,27 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'kotlin-android' | ||
id 'app.cash.paparazzi' | ||
} | ||
|
||
android { | ||
namespace 'app.cash.paparazzi.plugin.test.consumer' | ||
compileSdk libs.versions.compileSdk.get() as int | ||
defaultConfig { | ||
minSdk libs.versions.minSdk.get() as int | ||
} | ||
compileOptions { | ||
sourceCompatibility = libs.versions.javaTarget.get() | ||
targetCompatibility = libs.versions.javaTarget.get() | ||
} | ||
kotlinOptions { | ||
jvmTarget = libs.versions.javaTarget.get() | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation files('libs/external.aar') | ||
implementation project(':producer1') | ||
implementation project(':producer2') | ||
testImplementation libs.truth | ||
} |
Binary file added
BIN
+1.07 KB
...e-plugin/src/test/projects/open-assets-legacy-asset-loading-on/consumer/libs/external.aar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...projects/open-assets-legacy-asset-loading-on/consumer/src/main/assets/consumer/secret.txt
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 @@ | ||
consumer |
27 changes: 27 additions & 0 deletions
27
...asset-loading-on/consumer/src/test/java/app/cash/paparazzi/plugin/test/AssetAccessTest.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,27 @@ | ||
package app.cash.paparazzi.plugin.test | ||
|
||
import app.cash.paparazzi.Paparazzi | ||
import com.google.common.truth.Truth.assertThat | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class AssetAccessTest { | ||
@get:Rule | ||
val paparazzi = Paparazzi() | ||
|
||
@Test | ||
fun testViews() { | ||
val pairs = mapOf( | ||
"consumer/secret.txt" to "consumer", | ||
"producer1/secret.txt" to "producer1", | ||
"producer2/secret.txt" to "producer2", | ||
"external/secret.txt" to "external" | ||
) | ||
|
||
pairs.forEach { (key, value) -> | ||
val contents = | ||
paparazzi.context.assets.open(key).bufferedReader().use { it.readText() } | ||
assertThat(contents).isEqualTo(value) | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...zzi-gradle-plugin/src/test/projects/open-assets-legacy-asset-loading-on/gradle.properties
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 @@ | ||
android.useAndroidX=true | ||
app.cash.paparazzi.legacy.asset.loading=true |
19 changes: 19 additions & 0 deletions
19
...radle-plugin/src/test/projects/open-assets-legacy-asset-loading-on/producer1/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,19 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
namespace 'app.cash.paparazzi.plugin.test.producer1' | ||
compileSdk libs.versions.compileSdk.get() as int | ||
defaultConfig { | ||
minSdk libs.versions.minSdk.get() as int | ||
} | ||
compileOptions { | ||
sourceCompatibility = libs.versions.javaTarget.get() | ||
targetCompatibility = libs.versions.javaTarget.get() | ||
} | ||
kotlinOptions { | ||
jvmTarget = libs.versions.javaTarget.get() | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ojects/open-assets-legacy-asset-loading-on/producer1/src/main/assets/producer1/secret.txt
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 @@ | ||
producer1 |
19 changes: 19 additions & 0 deletions
19
...radle-plugin/src/test/projects/open-assets-legacy-asset-loading-on/producer2/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,19 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
namespace 'app.cash.paparazzi.plugin.test.producer2' | ||
compileSdk libs.versions.compileSdk.get() as int | ||
defaultConfig { | ||
minSdk libs.versions.minSdk.get() as int | ||
} | ||
compileOptions { | ||
sourceCompatibility = libs.versions.javaTarget.get() | ||
targetCompatibility = libs.versions.javaTarget.get() | ||
} | ||
kotlinOptions { | ||
jvmTarget = libs.versions.javaTarget.get() | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ojects/open-assets-legacy-asset-loading-on/producer2/src/main/assets/producer2/secret.txt
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 @@ | ||
producer2 |
5 changes: 5 additions & 0 deletions
5
...razzi-gradle-plugin/src/test/projects/open-assets-legacy-asset-loading-on/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,5 @@ | ||
apply from: '../test.settings.gradle' | ||
|
||
include ':consumer' | ||
include ':producer1' | ||
include ':producer2' |
1 change: 0 additions & 1 deletion
1
paparazzi-gradle-plugin/src/test/projects/open-assets/src/main/assets/secret.txt
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
.../src/test/projects/open-assets/src/test/java/app/cash/paparazzi/sample/AssetAccessTest.kt
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
...ransitive-assets/consumer/src/test/java/app/cash/paparazzi/plugin/test/AssetAccessTest.kt
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...radle-plugin/src/test/projects/open-transitive-assets/producer/src/main/assets/secret.txt
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.