From 16d029b59c3b78ae390d59e2c4cfe7ae1b15cd26 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Sun, 26 Jan 2025 12:52:10 +0100 Subject: [PATCH] adding xmake rule to check file, fixing headers year --- .gitignore | 1 + Sources/Backends/Metal/Metal.h | 2 +- Sources/Backends/Vulkan/Vulkan.c | 2 +- Sources/Backends/Vulkan/Vulkan.h | 2 +- Sources/Backends/Vulkan/VulkanBuffer.c | 2 +- Sources/Backends/Vulkan/VulkanBuffer.h | 2 +- Sources/Backends/Vulkan/VulkanCommandList.c | 2 +- Sources/Backends/Vulkan/VulkanCommandList.h | 2 +- Sources/Backends/Vulkan/VulkanCommandPool.c | 2 +- Sources/Backends/Vulkan/VulkanCommandPool.h | 2 +- Sources/Backends/Vulkan/VulkanComputePass.h | 3 + .../Backends/Vulkan/VulkanComputePipeline.c | 2 +- .../Backends/Vulkan/VulkanComputePipeline.h | 2 +- Sources/Backends/Vulkan/VulkanDescriptor.c | 4 +- Sources/Backends/Vulkan/VulkanDescriptor.h | 2 +- Sources/Backends/Vulkan/VulkanDevice.c | 2 +- Sources/Backends/Vulkan/VulkanDevice.h | 2 +- .../Backends/Vulkan/VulkanDevicePrototypes.h | 2 +- Sources/Backends/Vulkan/VulkanEnums.h | 2 +- Sources/Backends/Vulkan/VulkanFence.c | 2 +- Sources/Backends/Vulkan/VulkanFence.h | 2 +- .../Backends/Vulkan/VulkanGlobalPrototypes.h | 2 +- Sources/Backends/Vulkan/VulkanImage.c | 2 +- Sources/Backends/Vulkan/VulkanImage.h | 2 +- Sources/Backends/Vulkan/VulkanInstance.c | 2 +- Sources/Backends/Vulkan/VulkanInstance.h | 2 +- .../Vulkan/VulkanInstancePrototypes.h | 2 +- Sources/Backends/Vulkan/VulkanLoader.c | 2 +- Sources/Backends/Vulkan/VulkanLoader.h | 2 +- .../VulkanMemoryAllocatorImplementation.cpp | 2 +- Sources/Backends/Vulkan/VulkanQueue.c | 2 +- Sources/Backends/Vulkan/VulkanQueue.h | 2 +- Sources/PulseBackend.c | 2 +- Sources/PulseBuffer.c | 2 +- Sources/PulseCommandList.c | 2 +- Sources/PulseComputePipeline.c | 2 +- Sources/PulseDefs.h | 2 +- Sources/PulseDevice.c | 2 +- Sources/PulseEnums.h | 2 +- Sources/PulseFence.c | 2 +- Sources/PulseImage.c | 4 +- Sources/PulseInternal.h | 2 +- Sources/PulsePFNs.h | 2 +- Sources/PulsePosix.c | 2 +- Sources/PulsePosix.h | 2 +- Sources/PulseWindows.c | 2 +- Sources/PulseWindows.h | 2 +- Xmake/Actions/CheckFiles.lua | 187 ++++++++++++++++++ xmake.lua | 2 +- 49 files changed, 239 insertions(+), 48 deletions(-) create mode 100644 Sources/Backends/Vulkan/VulkanComputePass.h create mode 100644 Xmake/Actions/CheckFiles.lua diff --git a/.gitignore b/.gitignore index ce48fec..ea1f129 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ !/Sources/ !/Tests/ !/Examples/ +!/Xmake/ !/.github/ build/ Build/ diff --git a/Sources/Backends/Metal/Metal.h b/Sources/Backends/Metal/Metal.h index 17f86f8..8a2a5e6 100644 --- a/Sources/Backends/Metal/Metal.h +++ b/Sources/Backends/Metal/Metal.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/Vulkan.c b/Sources/Backends/Vulkan/Vulkan.c index 363857b..cfb4b10 100644 --- a/Sources/Backends/Vulkan/Vulkan.c +++ b/Sources/Backends/Vulkan/Vulkan.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/Vulkan.h b/Sources/Backends/Vulkan/Vulkan.h index 466e109..0dd8627 100644 --- a/Sources/Backends/Vulkan/Vulkan.h +++ b/Sources/Backends/Vulkan/Vulkan.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanBuffer.c b/Sources/Backends/Vulkan/VulkanBuffer.c index bed7d75..8a72dc2 100644 --- a/Sources/Backends/Vulkan/VulkanBuffer.c +++ b/Sources/Backends/Vulkan/VulkanBuffer.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanBuffer.h b/Sources/Backends/Vulkan/VulkanBuffer.h index c1621ef..e0cfca6 100644 --- a/Sources/Backends/Vulkan/VulkanBuffer.h +++ b/Sources/Backends/Vulkan/VulkanBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanCommandList.c b/Sources/Backends/Vulkan/VulkanCommandList.c index 796b343..eb28e74 100644 --- a/Sources/Backends/Vulkan/VulkanCommandList.c +++ b/Sources/Backends/Vulkan/VulkanCommandList.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanCommandList.h b/Sources/Backends/Vulkan/VulkanCommandList.h index 8a69d4d..d1cf5d5 100644 --- a/Sources/Backends/Vulkan/VulkanCommandList.h +++ b/Sources/Backends/Vulkan/VulkanCommandList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanCommandPool.c b/Sources/Backends/Vulkan/VulkanCommandPool.c index 814f2a9..4358e41 100644 --- a/Sources/Backends/Vulkan/VulkanCommandPool.c +++ b/Sources/Backends/Vulkan/VulkanCommandPool.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanCommandPool.h b/Sources/Backends/Vulkan/VulkanCommandPool.h index ce4382c..eafa4d1 100644 --- a/Sources/Backends/Vulkan/VulkanCommandPool.h +++ b/Sources/Backends/Vulkan/VulkanCommandPool.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanComputePass.h b/Sources/Backends/Vulkan/VulkanComputePass.h new file mode 100644 index 0000000..d252e15 --- /dev/null +++ b/Sources/Backends/Vulkan/VulkanComputePass.h @@ -0,0 +1,3 @@ +// Copyright (C) 2025 kanel +// This file is part of "Pulse" +// For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanComputePipeline.c b/Sources/Backends/Vulkan/VulkanComputePipeline.c index bd410a0..568ac96 100644 --- a/Sources/Backends/Vulkan/VulkanComputePipeline.c +++ b/Sources/Backends/Vulkan/VulkanComputePipeline.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanComputePipeline.h b/Sources/Backends/Vulkan/VulkanComputePipeline.h index ff3512e..4e9cb79 100644 --- a/Sources/Backends/Vulkan/VulkanComputePipeline.h +++ b/Sources/Backends/Vulkan/VulkanComputePipeline.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanDescriptor.c b/Sources/Backends/Vulkan/VulkanDescriptor.c index 59af17e..30f1fea 100644 --- a/Sources/Backends/Vulkan/VulkanDescriptor.c +++ b/Sources/Backends/Vulkan/VulkanDescriptor.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE @@ -90,7 +90,7 @@ VulkanDescriptorSetLayout* VulkanGetDescriptorSetLayout(VulkanDescriptorSetLayou { bindings[i].binding = i; bindings[i].descriptorCount = 1; - bindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; + bindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; bindings[i].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; bindings[i].pImmutableSamplers = PULSE_NULLPTR; } diff --git a/Sources/Backends/Vulkan/VulkanDescriptor.h b/Sources/Backends/Vulkan/VulkanDescriptor.h index 0f8c780..40e9c58 100644 --- a/Sources/Backends/Vulkan/VulkanDescriptor.h +++ b/Sources/Backends/Vulkan/VulkanDescriptor.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanDevice.c b/Sources/Backends/Vulkan/VulkanDevice.c index e1eb387..7fc45da 100644 --- a/Sources/Backends/Vulkan/VulkanDevice.c +++ b/Sources/Backends/Vulkan/VulkanDevice.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanDevice.h b/Sources/Backends/Vulkan/VulkanDevice.h index 1a6d257..3c15967 100644 --- a/Sources/Backends/Vulkan/VulkanDevice.h +++ b/Sources/Backends/Vulkan/VulkanDevice.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanDevicePrototypes.h b/Sources/Backends/Vulkan/VulkanDevicePrototypes.h index 3f20b43..111f1aa 100644 --- a/Sources/Backends/Vulkan/VulkanDevicePrototypes.h +++ b/Sources/Backends/Vulkan/VulkanDevicePrototypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanEnums.h b/Sources/Backends/Vulkan/VulkanEnums.h index b7d8923..07b0082 100644 --- a/Sources/Backends/Vulkan/VulkanEnums.h +++ b/Sources/Backends/Vulkan/VulkanEnums.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanFence.c b/Sources/Backends/Vulkan/VulkanFence.c index b2d2a52..14513f5 100644 --- a/Sources/Backends/Vulkan/VulkanFence.c +++ b/Sources/Backends/Vulkan/VulkanFence.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanFence.h b/Sources/Backends/Vulkan/VulkanFence.h index e165988..6755dbf 100644 --- a/Sources/Backends/Vulkan/VulkanFence.h +++ b/Sources/Backends/Vulkan/VulkanFence.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanGlobalPrototypes.h b/Sources/Backends/Vulkan/VulkanGlobalPrototypes.h index 961d3bd..b804f8f 100644 --- a/Sources/Backends/Vulkan/VulkanGlobalPrototypes.h +++ b/Sources/Backends/Vulkan/VulkanGlobalPrototypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanImage.c b/Sources/Backends/Vulkan/VulkanImage.c index f0ea39f..f0ab95d 100644 --- a/Sources/Backends/Vulkan/VulkanImage.c +++ b/Sources/Backends/Vulkan/VulkanImage.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanImage.h b/Sources/Backends/Vulkan/VulkanImage.h index 7b42971..f55349e 100644 --- a/Sources/Backends/Vulkan/VulkanImage.h +++ b/Sources/Backends/Vulkan/VulkanImage.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanInstance.c b/Sources/Backends/Vulkan/VulkanInstance.c index 039e08c..1fa2e7e 100644 --- a/Sources/Backends/Vulkan/VulkanInstance.c +++ b/Sources/Backends/Vulkan/VulkanInstance.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanInstance.h b/Sources/Backends/Vulkan/VulkanInstance.h index dcc9875..d0bb2ef 100644 --- a/Sources/Backends/Vulkan/VulkanInstance.h +++ b/Sources/Backends/Vulkan/VulkanInstance.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanInstancePrototypes.h b/Sources/Backends/Vulkan/VulkanInstancePrototypes.h index 3cd2b2d..62e923d 100644 --- a/Sources/Backends/Vulkan/VulkanInstancePrototypes.h +++ b/Sources/Backends/Vulkan/VulkanInstancePrototypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanLoader.c b/Sources/Backends/Vulkan/VulkanLoader.c index f1fcfa1..476ae05 100644 --- a/Sources/Backends/Vulkan/VulkanLoader.c +++ b/Sources/Backends/Vulkan/VulkanLoader.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanLoader.h b/Sources/Backends/Vulkan/VulkanLoader.h index a4743bf..be6d352 100644 --- a/Sources/Backends/Vulkan/VulkanLoader.h +++ b/Sources/Backends/Vulkan/VulkanLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanMemoryAllocatorImplementation.cpp b/Sources/Backends/Vulkan/VulkanMemoryAllocatorImplementation.cpp index 00dece7..f324180 100644 --- a/Sources/Backends/Vulkan/VulkanMemoryAllocatorImplementation.cpp +++ b/Sources/Backends/Vulkan/VulkanMemoryAllocatorImplementation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanQueue.c b/Sources/Backends/Vulkan/VulkanQueue.c index b9f767d..66249e4 100644 --- a/Sources/Backends/Vulkan/VulkanQueue.c +++ b/Sources/Backends/Vulkan/VulkanQueue.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/Backends/Vulkan/VulkanQueue.h b/Sources/Backends/Vulkan/VulkanQueue.h index 4cb8c8f..d7922b2 100644 --- a/Sources/Backends/Vulkan/VulkanQueue.h +++ b/Sources/Backends/Vulkan/VulkanQueue.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseBackend.c b/Sources/PulseBackend.c index 4aeef30..1830020 100644 --- a/Sources/PulseBackend.c +++ b/Sources/PulseBackend.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseBuffer.c b/Sources/PulseBuffer.c index 45b57c8..c28b34d 100644 --- a/Sources/PulseBuffer.c +++ b/Sources/PulseBuffer.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseCommandList.c b/Sources/PulseCommandList.c index 83a2814..a48865d 100644 --- a/Sources/PulseCommandList.c +++ b/Sources/PulseCommandList.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseComputePipeline.c b/Sources/PulseComputePipeline.c index 04b2914..1fa275e 100644 --- a/Sources/PulseComputePipeline.c +++ b/Sources/PulseComputePipeline.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseDefs.h b/Sources/PulseDefs.h index 957b2cf..3d8363d 100644 --- a/Sources/PulseDefs.h +++ b/Sources/PulseDefs.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseDevice.c b/Sources/PulseDevice.c index 30c1526..787f5f8 100644 --- a/Sources/PulseDevice.c +++ b/Sources/PulseDevice.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseEnums.h b/Sources/PulseEnums.h index bae0b45..6f3e080 100644 --- a/Sources/PulseEnums.h +++ b/Sources/PulseEnums.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseFence.c b/Sources/PulseFence.c index 9cc55d1..18fd439 100644 --- a/Sources/PulseFence.c +++ b/Sources/PulseFence.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseImage.c b/Sources/PulseImage.c index 2ca761a..d8ffb2e 100644 --- a/Sources/PulseImage.c +++ b/Sources/PulseImage.c @@ -1,6 +1,6 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" -// conditions of distribution and use, see copyright notice in LICENSE +// For conditions of distribution and use, see copyright notice in LICENSE #include "Pulse.h" #include "PulseDefs.h" diff --git a/Sources/PulseInternal.h b/Sources/PulseInternal.h index 8bbb7a0..4629366 100644 --- a/Sources/PulseInternal.h +++ b/Sources/PulseInternal.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulsePFNs.h b/Sources/PulsePFNs.h index 5a6ec80..5e496b5 100644 --- a/Sources/PulsePFNs.h +++ b/Sources/PulsePFNs.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulsePosix.c b/Sources/PulsePosix.c index 5906f48..2e11518 100644 --- a/Sources/PulsePosix.c +++ b/Sources/PulsePosix.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulsePosix.h b/Sources/PulsePosix.h index d2c55f6..a92162f 100644 --- a/Sources/PulsePosix.h +++ b/Sources/PulsePosix.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseWindows.c b/Sources/PulseWindows.c index 1da1a51..a5cafdb 100644 --- a/Sources/PulseWindows.c +++ b/Sources/PulseWindows.c @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Sources/PulseWindows.h b/Sources/PulseWindows.h index 6290e15..ed91e80 100644 --- a/Sources/PulseWindows.h +++ b/Sources/PulseWindows.h @@ -1,4 +1,4 @@ -// Copyright (C) 2024 kanel +// Copyright (C) 2025 kanel // This file is part of "Pulse" // For conditions of distribution and use, see copyright notice in LICENSE diff --git a/Xmake/Actions/CheckFiles.lua b/Xmake/Actions/CheckFiles.lua new file mode 100644 index 0000000..8b773eb --- /dev/null +++ b/Xmake/Actions/CheckFiles.lua @@ -0,0 +1,187 @@ +task("check-files") + +set_menu({ + usage = "xmake check-files [options]", + description = "Check every file for consistency (can fix some errors)", + options = + { + {'f', "fix", "k", nil, "Attempt to automatically fix files." } + } +}) + +on_run(function() + import("core.base.option") + + local file_lines = {} + local updated_files = {} + local function GetFile(file_path) + file_path = path.translate(file_path) + + local lines = file_lines[file_path] + if not lines then + lines = table.to_array(io.lines(file_path)) + if not lines then + os.raise("failed to open " .. file_path) + end + + file_lines[file_path] = lines + end + + return lines + end + + local function UpdateFile(file_path, lines) + file_path = path.translate(file_path) + if lines then + file_lines[file_path] = lines + end + updated_files[file_path] = true + end + + local checks = {} + + -- Remove empty lines at the beginning of files + table.insert(checks, { + Name = "empty lines", + Check = function() + local files = table.join( + os.files("Sources/**.h"), + os.files("Sources/**.inl"), + os.files("Sources/**.c") + os.files("Sources/**.cpp") + ) + + local fixes = {} + + for _, file_path in pairs(files) do + local lines = GetFile(file_path) + + for i = 1, #lines do + if not lines[i]:match("^%s*$") then + if i ~= 1 then + print(file_path .. " starts with empty lines") + + table.insert(fixes, { + File = file_path, + Func = function(lines) + for j = 1, i - 1 do + table.remove(lines, 1) + end + + UpdateFile(file_path, lines) + end + }) + end + + break + end + end + end + + return fixes + end + }) + + -- Check copyright date and format + table.insert(checks, { + Name = "copyright", + Check = function() + local files = table.join( + os.files("Sources/**.h"), + os.files("Sources/**.inl"), + os.files("Sources/**.c"), + os.files("Sources/**.cpp") + ) + + local current_year = os.date("%Y") + local fixes = {} + + -- Headers + for _, file_path in pairs(files) do + local lines = GetFile(file_path) + + local has_copyright + local should_fix = false + + local year, authors = lines[1]:match("^// Copyright %(C%) (Y?E?A?R?%d*) kanel$") + has_copyright = year ~= nil + + if has_copyright then + if year ~= current_year then + print(file_path .. ": copyright year error") + sould_fix = true + end + + if lines[2] ~= "// This file is part of \"Pulse\"" then + print(file_path .. ": copyright project error") + sould_fix = true + end + + if lines[3] ~= "// For conditions of distribution and use, see copyright notice in LICENSE" then + print(file_path .. ": copyright file reference error") + sould_fix = true + end + else + print(file_path .. ": copyright not found") + sould_fix = true + end + + if sould_fix then + table.insert(fixes, { + File = file_path, + Func = function(lines) + local copyright_lines = { + "// Copyright (C) " .. current_year .. " kanel", + "// This file is part of \"Pulse\"", + "// For conditions of distribution and use, see copyright notice in LICENSE" + } + + if has_copyright then + for i, line in ipairs(copyright_lines) do + lines[i] = line + end + else + for i, line in ipairs(copyright_lines) do + table.insert(lines, i, line) + end + table.insert(lines, #copyright_lines + 1, "") + end + + return lines + end + }) + end + + ::skip:: + end + + return fixes + end + }) + + local sould_fix = option.get("fix") or false + + for _, check in pairs(checks) do + print("Running " .. check.Name .. " check...") + + local fixes = {} + table.join2(fixes, check.Check()) + + if sould_fix then + for _, fix in pairs(fixes) do + print("Fixing " .. fix.File) + UpdateFile(fix.File, fix.Func(assert(file_lines[fix.File]))) + end + end + end + + for file_path, _ in pairs(updated_files) do + local lines = assert(file_lines[file_path]) + if lines[#lines] ~= "" then + table.insert(lines, "") + end + + print("Saving changes to " .. file_path) + io.writefile(file_path, table.concat(lines, "\n")) + end +end) diff --git a/xmake.lua b/xmake.lua index 25bfb57..37ae3cb 100644 --- a/xmake.lua +++ b/xmake.lua @@ -102,6 +102,6 @@ target("pulse_gpu") end) target_end() +includes("Xmake/**.lua") includes("Examples/*.lua") - includes("Tests/Vulkan/*.lua")