Skip to content

Add an extension point to ComponentRuntime. #3967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2022

Conversation

vkryachko
Copy link
Member

It allows augmenting/replacing components as they are requested from
ComponentRegistrars.

The motivation is to be able to measure initialization time of
certain components and at the same time not to introduce this
measurement logic directly to the components framework.

It allows augmenting/replacing components as they are requested from
ComponentRegistrars.

The motivation is to be able to measure initialization time of
certain components and at the same time not to introduce this
measurement logic directly to the components framework.
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 4, 2022

Size Report 1

Affected Products

  • firebase-components

    TypeBase (381bf87)Merge (d96bcd7)Diff
    aar41.4 kB42.5 kB+1.15 kB (+2.8%)
    apk (release)29.5 kB30.0 kB+508 B (+1.7%)

Test Logs

Notes

  • Commit (d96bcd7) is created by Prow via merging PR base commit (381bf87) and head commit (b1cdc39).

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/Tha55qrhEa.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 4, 2022

Coverage Report 1

Affected Products

  • firebase-components

    Overall coverage changed from 57.45% (381bf87) to 56.91% (d96bcd7) by -0.54%.

    FilenameBase (381bf87)Merge (d96bcd7)Diff
    Component.java70.31%67.14%-3.17%
    ComponentRegistrarProcessor.java?100.00%?
    ComponentRuntime.java74.56%72.32%-2.24%

Test Logs

Notes

  • Commit (d96bcd7) is created by Prow via merging PR base commit (381bf87) and head commit (b1cdc39).
  • Run gradle <product>:checkCoverage to produce HTML coverage reports locally. After gradle commands finished, report files can be found under <product-build-dir>/reports/jacoco/.

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/wdquD8yZgd.html

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

Unit Test Results

   346 files   -   45     346 suites   - 45   14m 29s ⏱️ - 2m 15s
4 376 tests  - 321  4 350 ✔️  - 324  22 💤 ±0  4 +3 
4 388 runs   - 325  4 362 ✔️  - 328  22 💤 ±0  4 +3 

For more details on these failures, see this check.

Results for commit b1cdc39. ± Comparison against base commit 381bf87.

♻️ This comment has been updated with latest results.

Comment on lines +171 to +176
/** Creates a copy of the component with {@link ComponentFactory} replaced. */
public Component<T> withFactory(ComponentFactory<T> factory) {
return new Component<>(
name, providedInterfaces, dependencies, instantiation, type, factory, publishedEvents);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for testing only? Looks like the purpose of ComponentFactory is only for product teams to implement. Once a product defined its factory in its registrars (and supply it via the component builder), it never needs to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intended to be used outside of tests, for existing use example see:

cmp.withFactory(
wrap(
libraryVersion.getLibraryName(),
libraryVersion.getVersion(),
cmp.getFactory()));

@vkryachko vkryachko merged commit 54e2b0c into master Aug 4, 2022
@vkryachko vkryachko deleted the vk.components_processor branch August 4, 2022 19:18
lfkellogg pushed a commit that referenced this pull request Aug 5, 2022
* Add an extension point to ComponentRuntime.

It allows augmenting/replacing components as they are requested from
ComponentRegistrars.

The motivation is to be able to measure initialization time of
certain components and at the same time not to introduce this
measurement logic directly to the components framework.

* add license.
@firebase firebase locked and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants