From 6d5bcfc6ed456035539232f12d0c22c411ccc099 Mon Sep 17 00:00:00 2001 From: Leigh Pointer Date: Tue, 17 Dec 2024 10:35:14 +0100 Subject: [PATCH] Implement Dynamic ProjectName Parameter Across Build Process This pull request introduces a dynamic ProjectName parameter across our build process, enhancing flexibility and reducing hardcoding in our module and theme development workflow. The changes affect the project file, NuSpec file, command scripts. --- .../[Owner].Module.[Module].Package.csproj | 10 ++-- .../Package/[Owner].Module.[Module].nuspec | 60 +++++++++---------- .../Templates/External/Package/debug.cmd | 15 ++--- .../Templates/External/Package/debug.sh | 15 ++--- .../Templates/External/Package/release.cmd | 6 +- .../Templates/External/Package/release.sh | 5 +- .../[Owner].Theme.[Theme].Package.csproj | 8 +-- .../Package/[Owner].Theme.[Theme].nuspec | 52 ++++++++-------- .../Templates/External/Package/debug.cmd | 5 +- .../Templates/External/Package/debug.sh | 7 ++- .../Templates/External/Package/release.cmd | 5 +- .../Templates/External/Package/release.sh | 5 +- 12 files changed, 100 insertions(+), 93 deletions(-) diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].Package.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].Package.csproj index 2ab09d748..211d1eeec 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].Package.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].Package.csproj @@ -20,10 +20,10 @@ - - - - + + + + - + \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].nuspec b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].nuspec index 09d5bed5e..67af38992 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].nuspec +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].Module.[Module].nuspec @@ -1,32 +1,32 @@ - - [Owner].Module.[Module] - 1.0.0 - [Owner] - [Owner] - [Module] - [Description] - [Owner] - false - MIT - https://github.com/oqtane/oqtane.framework - icon.png - oqtane module - - - - - - - - - - - - - - - - - + + $projectname$ + 1.0.0 + [Owner] + [Owner] + [Module] + [Description] + [Owner] + false + MIT + https://github.com/oqtane/oqtane.framework + icon.png + oqtane module + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd index 282b14232..af7654c7f 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd @@ -1,10 +1,11 @@ @echo off set TargetFramework=%1 +set ProjectName=%2 -XCOPY "..\Client\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Client\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Server\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Server\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Shared\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Shared\bin\Debug\%TargetFramework%\[Owner].Module.[Module].Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Server\wwwroot\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\" /Y /S /I +XCOPY "..\Client\bin\Debug\%TargetFramework%\%ProjectName%.Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Client\bin\Debug\%TargetFramework%\%ProjectName%.Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Server\bin\Debug\%TargetFramework%\%ProjectName%.Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Server\bin\Debug\%TargetFramework%\%ProjectName%.Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Shared\bin\Debug\%TargetFramework%\%ProjectName%.Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Shared\bin\Debug\%TargetFramework%\%ProjectName%.Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Server\wwwroot\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\" /Y /S /I \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.sh b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.sh index be6b21f7d..bcdee757f 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.sh +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.sh @@ -1,11 +1,12 @@ #!/bin/bash TargetFramework=$1 +ProjectName=$2 -cp -f "../Client/bin/Debug/$TargetFramework/[Owner].Module.[Module].Client.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Client/bin/Debug/$TargetFramework/[Owner].Module.[Module].Client.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Server/bin/Debug/$TargetFramework/[Owner].Module.[Module].Server.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Server/bin/Debug/$TargetFramework/[Owner].Module.[Module].Server.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Shared/bin/Debug/$TargetFramework/[Owner].Module.[Module].Shared.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Shared/bin/Debug/$TargetFramework/[Owner].Module.[Module].Shared.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -rf "../Server/wwwroot/"* "../../oqtane.framework/Oqtane.Server/wwwroot/" +cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.dll" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.pdb" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName$.Server.Oqtane.dll" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName$.Server.Oqtane.pdb" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName$.Shared.Oqtane.dll" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName$.Shared.Oqtane.pdb" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -rf "../Server/wwwroot/"* "../../[RootFolder]/Oqtane.Server/wwwroot/" \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd index cd959168f..1785fa666 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd @@ -1,7 +1,7 @@ @echo off set TargetFramework=%1 +set ProjectName=%2 del "*.nupkg" -"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].Module.[Module].nuspec -Properties targetframework=%TargetFramework% -XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\Packages\" /Y - +"..\..\[RootFolder]\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% +XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\Packages\" /Y \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.sh b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.sh index 0ee45ad4c..1334e6a78 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.sh +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.sh @@ -1,4 +1,5 @@ TargetFramework=$1 +ProjectName=$2 -"..\..\oqtane.framework\oqtane.package\nuget.exe" pack [Owner].Module.[Module].nuspec -Properties targetframework=$TargetFramework -cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\" \ No newline at end of file +"..\..\[RootFolder]\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% +cp -f "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\Packages\" \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].Package.csproj b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].Package.csproj index 5db99463b..0e454decb 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].Package.csproj +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].Package.csproj @@ -18,10 +18,10 @@ - - - - + + + + diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].nuspec b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].nuspec index 6663fdf1e..40f5f3b34 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].nuspec +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/[Owner].Theme.[Theme].nuspec @@ -1,28 +1,28 @@ - - [Owner].Theme.[Theme] - 1.0.0 - [Owner] - [Owner] - [Theme] - [Description] - [Owner] - false - MIT - https://github.com/oqtane/oqtane.framework - icon.png - oqtane theme - - - - - - - - - - - - - + + $projectname$ + 1.0.0 + [Owner] + [Owner] + [Theme] + [Description] + [Owner] + false + MIT + https://github.com/oqtane/oqtane.framework + icon.png + oqtane theme + + + + + + + + + + + + + \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.cmd b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.cmd index 9aa2ba3f7..196fb9165 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.cmd +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.cmd @@ -1,6 +1,7 @@ @echo off set TargetFramework=%1 +set ProjectName=%2 -XCOPY "..\Client\bin\Debug\%TargetFramework%\[Owner].Theme.[Theme].Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y -XCOPY "..\Client\bin\Debug\%TargetFramework%\[Owner].Theme.[Theme].Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Client\bin\Debug\%TargetFramework%\%ProjectName%.Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y +XCOPY "..\Client\bin\Debug\%TargetFramework%\%ProjectName%.Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\%TargetFramework%\" /Y XCOPY "..\Client\wwwroot\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\" /Y /S /I \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.sh b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.sh index 65afc951e..0caca3593 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.sh +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/debug.sh @@ -1,7 +1,8 @@ #!/bin/bash TargetFramework=$1 +ProjectName=$2 -cp -f "../Client/bin/Debug/$TargetFramework/[Owner].Theme.[Theme].Client.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -f "../Client/bin/Debug/$TargetFramework/[Owner].Theme.[Theme].Client.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/" -cp -rf "../Server/wwwroot/"* "../../oqtane.framework/Oqtane.Server/wwwroot/" \ No newline at end of file +cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.dll" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.pdb" "../../[RootFolder]/Oqtane.Server/bin/Debug/$TargetFramework/" +cp -rf "../Server/wwwroot/"* "../../[RootFolder]/Oqtane.Server/wwwroot/" \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.cmd b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.cmd index e024b91da..08f5286c6 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.cmd +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.cmd @@ -1,6 +1,7 @@ @echo off set TargetFramework=%1 +set ProjectName=%2 del "*.nupkg" -"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].Theme.[Theme].nuspec -Properties targetframework=%TargetFramework% -XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Packages\" /Y +"..\..\[RootFolder]\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% +XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Packages\" /Y \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.sh b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.sh index 4c4c08f54..1334e6a78 100644 --- a/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.sh +++ b/Oqtane.Server/wwwroot/Themes/Templates/External/Package/release.sh @@ -1,4 +1,5 @@ TargetFramework=$1 +ProjectName=$2 -"..\..\oqtane.framework\oqtane.package\nuget.exe" pack [Owner].Theme.[Theme].nuspec -Properties targetframework=$TargetFramework -cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\" \ No newline at end of file +"..\..\[RootFolder]\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% +cp -f "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\Packages\" \ No newline at end of file