CommunityToolkit / CommunityToolkit/Labs-Windows

Split Sample App Shared Infrastructure between Experiment / All

Open
#122 1 comment 0 reactions 0 assignees View on GitHub
dev loop ➰ enhancement sample app 🖼
Dominant language
C#
Stars
482
Forks
89
PR merge metrics
No merged PRs in 30d

Description

## Current Infrastructure

Right now when we run an experiment or run the whole sample app, the same `CommunityToolkit.Labs.Shared` project is used to generate the application shell itself. In it's `App.xaml.cs` file we detect with a build constant `LABS_ALL_SAMPLES` from the generated `Labs.SampleRefs.props` file to see if we should pick the `TabbedPage` or the `NavigationPage` to display whichever pages/docs we want to see based on the rest of the included dependencies.

## Potential Performance Problem

As we expand the scope of the all-up sample app, we may include more source generators or components like search indexers or the like that aren't needed when developing a single experiment's samples and docs. If this becomes and issue we may want to separate these things out when building an experiment.

## Solution

We should be able to do this later, as all the infrastructure is shared and abstracted away from the experiments already.

In each of the all solutions heads we reference the generated `Labs.SampleRefs.props` file first then the `Labs.Head.props` file:

https://github.com/CommunityToolkit/Labs-Windows/blob/3b654dd6e4049fb4ed9ca67c42bd1fe33a00394d/platforms/CommunityToolkit.Labs.Droid/CommunityToolkit.Labs.Droid.csproj#L4-L5

Therefore in the `Labs.Heads.props` file we should have access to the `LABS_ALL_SAMPLES` constant here:

https://github.com/CommunityToolkit/Labs-Windows/blob/3b654dd6e4049fb4ed9ca67c42bd1fe33a00394d/common/Labs.Head.props#L4

(The source generators are referenced lower down as well, so if we have different sets, I think similar logic will apply.)

So, instead of having a single `CommunityToolkit.Labs.Shared.projitems` we create two files a `CommunityToolkit.Labs.Shared.Experiment` and a `CommunityToolkit.Labs.Shared.All` for instance. These two projects may share some common components (like our Renderers) on disk, but be able to include only the components needed for each experience.

```xml






```

[Regex from docs here](https://docs.microsoft.com/visualstudio/msbuild/msbuild-conditional-constructs)

Though we could also just define an MSBuild property and switch on that too or something.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.