You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: recipes/applyFusedLibraryPlugin/README.md
+25-21Lines changed: 25 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,9 @@ by other libraries.
34
34
│ :androidLib3 com.google.code.gson:gson* │
35
35
└─────────────────────────────────────────┘
36
36
</pre>
37
-
This diagram shows an overview of the relevant project dependency structure.
38
-
* include dependency of :fusedLibrary
37
+
This diagram shows an overview of the relevant project dependency structure.
38
+
39
+
`*` indicates an `include` dependency of the `:fusedLibrary` module
39
40
40
41
Example usages of classes, resources and other artifacts are demonstrated in the :app module unit
41
42
and instrumentation tests.
@@ -48,29 +49,29 @@ and instrumentation tests.
48
49
49
50
1. Apply the plugin
50
51
gradle/libs.versions.toml append
51
-
```kts
52
+
```toml
52
53
[plugins]
53
-
...
54
54
android-fusedlibrary = { id = "com.android.fusedlibrary", version.ref = "agp" }
55
55
```
56
56
2. Create a new module. `File` > `New Module...` . Then, click `Android Library` and fill out the
57
57
required module metadata. Click `Finish`.
58
58
3. In the new module (let's call it `:fusedLibrary`) open the `build.gradle.kts` file,
59
59
then replace the `plugins` block with
60
-
```
60
+
```kts
61
61
plugins {
62
62
alias(libs.plugins.android.fusedlibrary)
63
63
}
64
64
```
65
65
to apply the Fused Library Plugin
66
66
4. Fused library modules cannot not contain sources such as code or resources, nor does it use
67
67
the typical `implementation` or `api` configurations you may expect to declare as dependencies.
68
+
68
69
Done.
69
70
70
71
Fused library introduces a new configuration `include`, that declares what dependencies will be
71
72
fused in the built/published .aar file.
72
73
73
-
For example, the :fusedLibrary could define the following in the `dependencies` block:
74
+
For example, the `:fusedLibrary` could define the following in the `dependencies` block:
74
75
75
76
```kts
76
77
dependencies {
@@ -91,25 +92,27 @@ dependencies {
91
92
2. Once you are satisfied, you can proceed to build the library using
92
93
`./gradlew :fusedLibrary:assemble`. Assuming dependencies are valid,
93
94
this task produces the .aar fused library at `fusedLibrary/build/bundle/bundle.aar`.
94
-
3. Resync project ctrl+shift+O
95
+
3. Resync project `ctrl+shift+O`
96
+
95
97
Done.
96
98
97
-
At this point you can add the fused library as a dependency from other modules.
99
+
At this point, you can add the fused library as a dependency from other modules.
98
100
99
101
### Running the consumption tests
100
102
101
103
In the :app module there are tests that make use of the classes and resource distributed via
102
-
:fusedLibrary.
104
+
`:fusedLibrary`.
103
105
104
106
Run unit tests: `./gradlew :app:testDebugUnitTest --tests "com.example.fusedlibrarysample.FusedLibraryConsumptionUnitTest"`
107
+
105
108
Run instrumentation tests: `./gradlew :app:connectedDebugAndroidTest`
106
109
107
110
### Publishing the fused library
108
111
109
112
Fused Library Plugin artifacts can be easily configured for publication with Maven publishing
110
113
plugins. The plugin generates it's own POM for distribution that preserves the artifact dependencies.
111
-
We'll provide some typical configurations for publishing that may be useful for most use cases,
112
-
however if your needs are more complex, consult the Maven documentation.
114
+
We'll provide some typical configurations for publishing that may be useful for most use cases
115
+
however, if your needs are more complex, consult the Maven documentation.
113
116
114
117
Generating the fused lib POM
115
118
1. Follow the steps of `Building a fused library`
@@ -143,12 +146,13 @@ Generating a maven repository with the fused library
143
146
}
144
147
145
148
```
146
-
2. Execute the task for creating the repository `./gradlew fusedLibrary:publishReleasePublicationToMyrepoRepository`
149
+
2. Execute the task for creating the repository `./gradlew :fusedLibrary:publishReleasePublicationToMyrepoRepository`
147
150
3. As androidLib3 is a project dependency of the fused library, that also needs to be published to
148
-
the repository`./gradlew androidLib3:publishMavenPublicationToMyrepoRepository`
149
-
4. Note: :app has already configured dependency substitution that prefers the published local repo
150
-
artifacts over the :fusedLibrary project itself, so :app now automatically depends on the correct
151
+
the repository`./gradlew :androidLib3:publishMavenPublicationToMyrepoRepository`
152
+
4. Note: `:app` has already configured dependency substitution that prefers the published local repo
153
+
artifacts over the `:fusedLibrary` project itself, so `:app` now automatically depends on the correct
151
154
artifacts.
155
+
152
156
Done.
153
157
154
158
### Configurations
@@ -162,16 +166,16 @@ Done.
162
166
This plugin remains in early stages, and there may be corner cases that have not been fully tested
163
167
or developed.
164
168
165
-
See open public issues at this link [open issues](https://issuetracker.google.com/issues?q=hotlistid:4053459)
169
+
See open public issues at this link [open issues](https://issuetracker.google.com/components/1692458)
166
170
167
-
Follow the below steps and use this [link to **file new bugs**](https://issuetracker.google.com/createIssue?title=%5Bfused+lib+-+public%5D+%3CIssue+Name+Here%3E&cc=lukeedgar%40google.com%2C+android-gradle%40google.com&description=Please+include+all+of+the+following%3A%0A1.+Steps+to+reproduce%0A2.+A+paste+of+the+exception%0A3.+run+%60.%2Fgradlew+%3A%3Cfused+library+module%5C%3E%3Areport%60+and+paste+the+contents+of+%0A%60%3Cmy+library+module%5C%3Ebuild%2Freports%2Ffused_library_report%2Fsingle%2Freport.json%60%0A4.Also+consider+running+%60gradle+%3A%3Cfused+library+module%3E%3Adependencies%60+if+dependency+information+is+relevant%0A5.%5Boptional%5D+if+the+build+was+successful%2C+provide+a+copy+of+the+.aar&format=MARKDOWN&component=192709&type=BUG&priority=P2&severity=S2&hotlistIds=4053459&assignee=lukeedgar%40google.com)
171
+
Follow the below steps and use this [link to **file new bugs**](https://issuetracker.google.com/issues/new?title=%5Bfused+lib+-+public%5D+%3CIssue+Name+Here%3E&cc=lukeedgar%40google.com%2C+android-gradle%40google.com&description=1.+Steps+to+reproduce%0A2.+A+paste+of+the+exception%0A3.+run+%60.%2Fgradlew+%3A%3Cfused+library+module%3E%3Areport%60+and+paste+the+contents+of+%0A%60%3Cmy+library+module%3Ebuild%2Freports%2Ffused_library_report%2Fsingle%2Freport.json%60%0A4.+Also+consider+running+%60.%2Fgradlew+%3A%3Cfused+library+module%3E%3Adependencies%60+if+dependency+information+is+relevant%0A5.+%5C%5Boptional%5C%5D+if+the+build+was+successful%2C+provide+a+copy+of+the+.aar&format=MARKDOWN&component=192708&type=BUG&priority=P2&severity=S2&hotlistIds=4053459&assignee=lukeedgar%40google.com)
168
172
**or provide suggestions** for the Fused Library Plugin.
169
173
170
174
When filing an issue, please include the following information:
171
175
1. Steps to reproduce
172
176
2. A paste of the exception
173
-
3. run `\gradle :\<fused library module\>:report\` and paste the contents of
Copy file name to clipboardExpand all lines: recipes/applyFusedLibraryPlugin/app/src/androidTest/java/com/example/fusedlibrarysample/FusedLibraryInstrumentationTest.kt
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,9 @@ import org.junit.Assert.*
30
30
*/
31
31
@RunWith(AndroidJUnit4::class)
32
32
classFusedLibraryInstrumentationTest {
33
-
33
+
34
34
@Test
35
-
fun`access resources from fused library`() {
35
+
funaccessResourcesFromFusedLibrary() {
36
36
val appContext =InstrumentationRegistry.getInstrumentation().targetContext
Copy file name to clipboardExpand all lines: recipes/applyFusedLibraryPlugin/app/src/test/java/com/example/fusedlibrarysample/FusedLibraryConsumptionUnitTest.kt
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ import org.junit.Assert.*
29
29
classFusedLibraryConsumptionUnitTest {
30
30
31
31
@Test
32
-
fun`test classes from included dependencies`() {
32
+
funtestClassesFromIncludedDependencies() {
33
33
// Access symbols from local library dependencies
34
34
val androidLib1Class =ClassFromAndroidLib1()
35
35
val androidLib2Class =ClassFromAndroidLib2()
@@ -45,7 +45,7 @@ class FusedLibraryConsumptionUnitTest {
45
45
}
46
46
47
47
@Test
48
-
fun`test local lib jar dependencies are accessible`() {
48
+
funtestLocalLibJarDependenciesAreAccessible() {
49
49
// Access class in local jar from fused library file dependencies
50
50
// A_DoIExist is class from a libs jar file dependency
0 commit comments