Repository navigation
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:
Labs-Windows/platforms/CommunityToolkit.Labs.Droid/CommunityToolkit.Labs.Droid.csproj
Lines 4 to 5 in 3b654dd
| <Import Project="$(RepositoryDirectory)common\Labs.SampleRefs.props" /> | |
| <Import Project="$(RepositoryDirectory)common\Labs.Head.props" /> |
Therefore in the Labs.Heads.props file we should have access to the LABS_ALL_SAMPLES constant here:
Labs-Windows/common/Labs.Head.props
Line 4 in 3b654dd
| <Import Project="$(RepositoryDirectory)\common\CommunityToolkit.Labs.Shared\CommunityToolkit.Labs.Shared.projitems" Label="Shared" /> |
(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.
<Choose>
<When Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(
$(DefineConstants), '^(.*;)*LABS_ALL_SAMPLES(;.*)*$'))">
<Import Project="$(RepositoryDirectory)\common\CommunityToolkit.Labs.Shared\CommunityToolkit.Labs.Shared.All.projitems" Label="Shared" />
</When>
<Otherwise>
<Import Project="$(RepositoryDirectory)\common\CommunityToolkit.Labs.Shared\CommunityToolkit.Labs.Shared.Experiment.projitems" Label="Shared" />
</Otherwise>
</Choose>Though we could also just define an MSBuild property and switch on that too or something.
Activity
Arlodotexe commentedon May 17, 2022
Pulling over a conversation from Discord for history:
From @Arlodotexe
From @michael-hawker
From @Arlodotexe