Skip to content

Commit

Permalink
Merge pull request #866 from unoplatform/dev/nr/templateext
Browse files Browse the repository at this point in the history
feat: Updating Extensions Template
  • Loading branch information
nickrandolph authored Nov 1, 2022
2 parents 97f9cca + c5a6128 commit 1bedf9a
Show file tree
Hide file tree
Showing 49 changed files with 917 additions and 679 deletions.
135 changes: 1 addition & 134 deletions src/Uno.Extensions.Templates/Uno.Extensions.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,16 @@
</ItemGroup>

<Target Name="ReplaceTemplateCode" BeforeTargets="BeforeBuild">
<!-- <ItemGroup>
<MyTemplateSourceUIFiles Include="content\unoapp-extensions-net6\MyExtensionsApp.UI\**\*" />
</ItemGroup>
<Copy SourceFiles="@(MyTemplateSourceUIFiles)" DestinationFiles="@(MyTemplateSourceUIFiles->'content\unoapp-extensions\MyExtensionsApp.UI\%(RecursiveDir)%(Filename)%(Extension)')" />
<ItemGroup>
<MyTemplateSourceFiles Include="content\unoapp-extensions-net6\MyExtensionsApp\**\*" />
</ItemGroup>
<Copy SourceFiles="@(MyTemplateSourceFiles)" DestinationFiles="@(MyTemplateSourceFiles->'content\unoapp-extensions\MyExtensionsApp\%(RecursiveDir)%(Filename)%(Extension)')" /> -->


<ItemGroup>
<!-- <Content Include="content\unoapp-extensions\**" KeepDuplicates="False">
<PackagePath>content\unoapp-extensions</PackagePath>
<Pack>true</Pack>
</Content> -->
<Content Include="content\unoapp-extensions\**" KeepDuplicates="False">
<PackagePath>content\unoapp-extensions</PackagePath>
<Pack>true</Pack>
</Content>
<Content Remove="content\unoapp-extensions\MyExtensionsApp.Debugging.sln" />
</ItemGroup>
</Target>

<Target Name="ReplaceVersions" BeforeTargets="BeforeBuild">
<!-- Condition="'$(PackageVersion)'!='255.255.255.255'" -->
<!-- <ItemGroup>
<MySourceFiles Include="..\..\samples\Commerce\Commerce.Shared\**\*" />
</ItemGroup> -->

<!-- <Copy SourceFiles="@(MySourceFiles)" DestinationFiles="@(MySourceFiles->'content\unoapp-samples-commerce\MyExtensionsApp.Shared\%(RecursiveDir)%(Filename)%(Extension)')" />
<RenameFiles SourcePath="content\unoapp-samples-commerce\MyExtensionsApp.Shared" SourceName="Commerce" TargetName="MyExtensionsApp" /> -->

<PropertyGroup>
<MSBuildDeveloperNamespace>
<Namespace Prefix="x" Uri="http://schemas.microsoft.com/developer/msbuild/2003" />
Expand All @@ -90,115 +65,7 @@
<XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)" Query="//PackageVersion[@Version='255.255.255.255']/@Version" Value="$(PackageVersion)" Namespaces="" />
<XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)" Query="//PackageReference[@Version='255.255.255.255']/@VersionOverride" Value="$(PackageVersion)" Namespaces="" />

<!-- <XmlPeek XmlInputPath="..\..\samples\Commerce\Commerce.Wasm\Commerce.Wasm.csproj" Query="//PackageReference[@Include='Uno.Toolkit.WinUI']/@Version">
<Output TaskParameter="Result" ItemName="Uno_Toolkit_WinUI_Version" />
</XmlPeek>
<XmlPeek XmlInputPath="..\..\samples\Commerce\Commerce.Wasm\Commerce.Wasm.csproj" Query="//PackageReference[@Include='Uno.Toolkit.WinUI.Material']/@Version">
<Output TaskParameter="Result" ItemName="Uno_Toolkit_WinUI_Material_Version" />
</XmlPeek>
<XmlPeek XmlInputPath="..\..\samples\Commerce\Commerce.Wasm\Commerce.Wasm.csproj" Query="//PackageReference[@Include='Uno.Material.WinUI']/@Version">
<Output TaskParameter="Result" ItemName="Uno_Material_WinUI_Version" />
</XmlPeek> -->

<!-- Uno_Toolkit_WinUI_Version -->
<!-- <XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//x:PackageReference[@Include='Uno.Toolkit.WinUI']/@Version"
Value="@(Uno_Toolkit_WinUI_Version)"
Namespaces="$(MSBuildDeveloperNamespace)" />
<XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//PackageReference[@Include='Uno.Toolkit.WinUI']/@Version"
Value="@(Uno_Toolkit_WinUI_Version)"
Namespaces="" /> -->

<!-- Uno_Toolkit_WinUI_Material_Version -->
<!-- <XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//x:PackageReference[@Include='Uno.Toolkit.WinUI.Material']/@Version"
Value="@(Uno_Toolkit_WinUI_Material_Version)"
Namespaces="$(MSBuildDeveloperNamespace)" />
<XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//PackageReference[@Include='Uno.Toolkit.WinUI.Material']/@Version"
Value="@(Uno_Toolkit_WinUI_Material_Version)"
Namespaces="" /> -->

<!-- Uno_Material_WinUI_Version -->
<!-- <XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//x:PackageReference[@Include='Uno.Material.WinUI']/@Version"
Value="@(Uno_Material_WinUI_Version)"
Namespaces="$(MSBuildDeveloperNamespace)" />
<XmlPoke XmlInputPath="%(_AllCSProjFiles.Identity)"
Query="//PackageReference[@Include='Uno.Material.WinUI']/@Version"
Value="@(Uno_Material_WinUI_Version)"
Namespaces="" /> -->

<!-- <ItemGroup>
<Content Include="content\unoapp-samples-commerce\**" KeepDuplicates="False">
<PackagePath>content\unoapp-samples-commerce</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup> -->
</Target>

<UsingTask TaskName="RenameFiles" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<SourcePath ParameterType="System.String" Required="True" Output="False" />
<SourceName ParameterType="System.String" Required="True" Output="False" />
<TargetName ParameterType="System.String" Required="True" Output="False" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Using Namespace="System" />
<Using Namespace="System.Linq" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
string[] filters = new[] { "*.cs", "*.xml", "*.xaml", "*.plist", "*.js", "*.config", "*.appxmanifest", "*.projitems", "*.shproj", "*.csproj", "*.sln" };
foreach (var file in filters.SelectMany(f => Directory.EnumerateFiles(SourcePath, f, SearchOption.AllDirectories)))
{
Log.LogMessage("Converting file: " + file);
var s = File.ReadAllText(file);
s = s
.Replace(SourceName, TargetName)
;
if(Path.GetExtension(file).ToLower() == ".cs" && !s.StartsWith("//-:cnd:noEmit"))
{
// Disable conditionals for all imported files
s = "//-:cnd:noEmit\r\n" + s;
}
var fileName = Path.GetFileName(file);
var filePath = Path.GetDirectoryName(file);
var updatedFileName = fileName.Replace(SourceName, TargetName);
File.WriteAllText(file, s);
if(updatedFileName != fileName)
{
File.Delete(Path.Combine(filePath, updatedFileName));
Log.LogMessage("Move file: " + file + " to " + Path.Combine(filePath, updatedFileName));
File.Move(file, Path.Combine(filePath, updatedFileName));
}
}
Func<string[]> getFolders = () => Directory.GetDirectories(SourcePath, "*.*", SearchOption.AllDirectories);
var folders = getFolders();
for (int i = 0; i < folders.Length; i++)
{
var dir = folders[i];
if(!Directory.Exists(dir)) continue;
var dirName = Path.GetFileName(dir);
var path = Path.GetDirectoryName(dir);
var updatedDirName = dirName.Replace(SourceName, TargetName);
if(updatedDirName != dirName)
{
i = 0;
folders = getFolders();
var target = Path.Combine(path, updatedDirName);
Log.LogMessage("Moving: " + dir + " to " + target);
Directory.Move(dir, target);
}
}
]]>
</Code>
</Task>
</UsingTask>

</Project>
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"WebAssembly": {
"wasm": {
"longName": "webassembly",
"shortName": "wasm"
},
"iOS": {
"ios": {
"longName": "ios",
"shortName": "ios"
},
"Android": {
"android": {
"longName": "android",
"shortName": "android"
"shortName": "droid"
},
"macOS": {
"macos": {
"longName": "macos",
"shortName": "macos"
},
"maccatalyst": {
"longName": "maccatalyst",
"shortName": "catalyst"
},
"skia-wpf": {
"longName": "skia-wpf",
"shortName": "skia-wpf"
"shortName": "wpf"
},
"skia-gtk": {
"longName": "skia-gtk",
"shortName": "skia-gtk"
"shortName": "gtk"
},
"skia-linux-fb": {
"longName": "skia-linux-fb",
"shortName": "linux"
},
"winAppSdk": {
"longName": "windowsAppSdk",
"shortName": "win"
},
"tests": {
"longName": "tests",
"shortName": "tests"
},
"wasm-pwa-manifest": {
"longName": "wasm-pwa-manifest",
"shortName": "pwa"
},
"vscode": {
"longName": "vscode",
"shortName": "vscode"
},
"skipRestore": {
"longName": "skipPackageRestore",
"shortName": "skipRestore"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"$schema": "http://json.schemastore.org/ide.host",
"name": {
"text": "Multi-Platform App (Uno.Extensions)"
},
"description": {
"text": "Solution template for creating a multi-platform C# & XAML application targeting Windows App SDK, Android, iOS, macOS, WebAssembly, Skia/WPF and Skia/GTK for Linux."
},
"order": 610,
"icon": "uno-logo.png",
"learnMoreLink": "https://github.com/unoplatform/uno",
"symbolInfo": [
{
"id": "wasm",
"name": {
"text": "Web - WebAssembly"
},
"description":
{
"text": "Enables the WebAssembly platform support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "ios",
"name": {
"text": "Mobile - iOS"
},
"description":
{
"text": "Enables the iOS platform in the Mobile support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "android",
"name": {
"text": "Mobile - Android"
},
"description":
{
"text": "Enables the Android platform in the Mobile support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "winAppSdk",
"name": {
"text": "Desktop - WinUI (Windows App SDK)"
},
"description":
{
"text": "Enables the Widnows App SDK platform support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "skia-gtk",
"name": {
"text": "Desktop - Gtk (Linux, macOS, Windows 7 or later)"
},
"description":
{
"text": "Enables the Skia/GTK platform support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "macos",
"name": {
"text": "Desktop - macOS (AppKit)"
},
"description":
{
"text": "Enables the macOS (AppKit) platform in the Mobile support project"
},
"defaultValue": "false",
"isVisible":true
},
{
"id": "maccatalyst",
"name": {
"text": "Desktop - macOS (Catalyst)"
},
"description":
{
"text": "Enables the macOS (Catalyst) platform in the Mobile support project"
},
"defaultValue": "true",
"isVisible":true
},
{
"id": "skia-wpf",
"name": {
"text": "Desktop - WPF (Windows 7 or later)"
},
"description":
{
"text": "Enables the Skia/WPF platform support project"
},
"defaultValue": "false",
"isVisible":true
},
{
"id": "skia-linux-fb",
"name": {
"text": "Desktop - Linux Framebuffer"
},
"description":
{
"text": "Enables the Skia/Linux Framebuffer platform support project"
},
"defaultValue": "false",
"isVisible":true
},
{
"id": "tests",
"name": {
"text": "Testing - Unit and UI Tests"
},
"description":
{
"text": "Includes projects for unit and UI tests"
},
"defaultValue": "true",
"isVisible":true
}
]
}
Loading

0 comments on commit 1bedf9a

Please sign in to comment.