From 5b90eb28fea92e1228f7865e5ddb5024c7349303 Mon Sep 17 00:00:00 2001 From: Jan Staelens Date: Thu, 16 Jan 2025 14:37:19 +0100 Subject: [PATCH 1/2] Added support for Zip content. --- Sdk/Sdk.csproj | 2 +- Sdk/Tasks/DmappCreation.cs | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Sdk/Sdk.csproj b/Sdk/Sdk.csproj index acc4ab7..0334f8c 100644 --- a/Sdk/Sdk.csproj +++ b/Sdk/Sdk.csproj @@ -40,7 +40,7 @@ - + diff --git a/Sdk/Tasks/DmappCreation.cs b/Sdk/Tasks/DmappCreation.cs index ddb4423..65881ea 100644 --- a/Sdk/Tasks/DmappCreation.cs +++ b/Sdk/Tasks/DmappCreation.cs @@ -105,7 +105,7 @@ public override bool Execute() // Relative path (starting from project directory baseLocation = FileSystem.Instance.Path.GetFullPath(FileSystem.Instance.Path.Combine(preparedData.Project.ProjectDirectory, BaseOutputPath)); } - + string destinationFilePath = FileSystem.Instance.Path.Combine(baseLocation, Configuration, $"{PackageId}.{PackageVersion}.dmapp"); // Create directories in case they don't exist yet @@ -212,7 +212,7 @@ private void PackageCatalogReferences(PackageCreationData preparedData, AppPacka } // TODO: Handle catalog references - + Log.LogWarning($"Not supported yet: {catalogReferencesFile} could not be added to the package."); } @@ -230,13 +230,21 @@ private void PackageBasicFiles(PackageCreationData preparedData, AppPackage.AppP appPackageBuilder.WithCompanionFiles(companionFilesDirectory); // Include LowCodeApps - string lowCodeAppDirectory = - FileSystem.Instance.Path.Combine(packageContentPath, "LowCodeApps"); - foreach (string lcaZip in FileSystem.Instance.Directory.GetFiles(lowCodeAppDirectory, "*.zip")) + IncludeFromPackageContent(appPackageBuilder, packageContentPath, "LowCodeApps", ZipType.LowCodeApp); + + // Include Dashboards + IncludeFromPackageContent(appPackageBuilder, packageContentPath, "Dashboards", ZipType.Dashboard); + } + + private void IncludeFromPackageContent(AppPackage.AppPackageBuilder appPackageBuilder, string packageContentPath, string contentFolderName, ZipType contentType) + { + string directory = + FileSystem.Instance.Path.Combine(packageContentPath, contentFolderName); + + foreach (string zipFile in FileSystem.Instance.Directory.GetFiles(directory, "*.zip")) { - Log.LogWarning($"Not supported yet: {lcaZip} could not be added to the package."); - // TODO: Handle zip LCA's - //appPackageBuilder.WithLowCodeApp(lcaZip); + appPackageBuilder.WithZip(zipFile, contentType); + Log.LogWarning($"Added {contentType}: {zipFile}"); } } From ec432610d0c2fb660c63c14665d39c1cbf34a10a Mon Sep 17 00:00:00 2001 From: Jan Staelens Date: Thu, 16 Jan 2025 17:29:05 +0100 Subject: [PATCH 2/2] Log as message not warning --- Sdk/Sdk.csproj | 2 +- Sdk/Tasks/DmappCreation.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sdk/Sdk.csproj b/Sdk/Sdk.csproj index 0334f8c..817804e 100644 --- a/Sdk/Sdk.csproj +++ b/Sdk/Sdk.csproj @@ -40,7 +40,7 @@ - + diff --git a/Sdk/Tasks/DmappCreation.cs b/Sdk/Tasks/DmappCreation.cs index 65881ea..f2a1cd6 100644 --- a/Sdk/Tasks/DmappCreation.cs +++ b/Sdk/Tasks/DmappCreation.cs @@ -244,7 +244,7 @@ private void IncludeFromPackageContent(AppPackage.AppPackageBuilder appPackageBu foreach (string zipFile in FileSystem.Instance.Directory.GetFiles(directory, "*.zip")) { appPackageBuilder.WithZip(zipFile, contentType); - Log.LogWarning($"Added {contentType}: {zipFile}"); + Log.LogMessage($"Added {contentType}: {zipFile}"); } }