адаптация s13bby/osc под vst и gui. (вайбкод)

вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio.
обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
This commit is contained in:
2026-11-20 14:52:33 +06:00
parent 8384123f87
commit b0a75e98db
10387 changed files with 4025195 additions and 0 deletions
+417
View File
@@ -0,0 +1,417 @@
{
"lastUpdated": "2026-09-04T00:00:00Z",
"firstPartyPatterns": [
"^modules/[^/]+/native/java(core|opt)?/"
],
"components": {
"examples": { "license": "ISC",
"description": "The JUCE example projects" },
"extras": { "license": "AGPL-3.0-only OR LicenseRef-JUCE-Commercial",
"description": "The bundled JUCE applications" },
"build-system": { "license": "AGPL-3.0-only OR LicenseRef-JUCE-Commercial",
"description": "The JUCE build system" }
},
"dependencies": [
{ "name": "zlib",
"module": "juce_core",
"path": "modules/juce_core/zip/zlib",
"license": "Zlib",
"licenseFile": "modules/juce_core/zip/zlib/README",
"homepage": "https://zlib.net",
"supplier": "Person: Jean-loup Gailly and Mark Adler",
"cpe": "cpe:2.3:a:zlib:zlib",
"purl": "pkg:github/madler/zlib",
"version": { "file": "modules/juce_core/zip/zlib/zlib.h",
"patterns": ["#define\\s+ZLIB_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "HarfBuzz",
"module": "juce_graphics",
"path": "modules/juce_graphics/fonts/harfbuzz",
"license": "MIT-Modern-Variant",
"licenseFile": "modules/juce_graphics/fonts/harfbuzz/COPYING",
"homepage": "https://harfbuzz.github.io",
"supplier": "Organization: HarfBuzz Project",
"cpe": "cpe:2.3:a:harfbuzz_project:harfbuzz",
"purl": "pkg:github/harfbuzz/harfbuzz",
"version": { "file": "modules/juce_graphics/fonts/harfbuzz/hb-version.h",
"patterns": ["#define\\s+HB_VERSION_STRING\\s+\"([^\"]+)\""] } },
{ "name": "SheenBidi",
"module": "juce_graphics",
"path": "modules/juce_graphics/unicode/sheenbidi",
"license": "Apache-2.0",
"licenseFile": "modules/juce_graphics/unicode/sheenbidi/LICENSE",
"homepage": "https://github.com/Tehreer/SheenBidi",
"supplier": "Person: Muhammad Tayyab Akram",
"purl": "pkg:github/Tehreer/SheenBidi",
"version": { "file": "modules/juce_graphics/unicode/sheenbidi/Headers/SheenBidi/SBVersion.h",
"patterns": ["#define\\s+SHEENBIDI_VERSION_STRING\\s+\"([^\"]+)\""] } },
{ "name": "LunaSVG",
"module": "juce_graphics",
"path": "modules/juce_graphics/drawables/lunasvg",
"license": "MIT",
"licenseFile": "modules/juce_graphics/drawables/lunasvg/LICENSE",
"homepage": "https://github.com/sammycage/lunasvg",
"supplier": "Person: Samuel Ugochukwu",
"purl": "pkg:github/sammycage/lunasvg",
"version": { "file": "modules/juce_graphics/drawables/lunasvg/include/lunasvg.h",
"patterns": ["#define\\s+LUNASVG_VERSION_MAJOR\\s+(\\d+)",
"#define\\s+LUNASVG_VERSION_MINOR\\s+(\\d+)",
"#define\\s+LUNASVG_VERSION_MICRO\\s+(\\d+)"] } },
{ "name": "PlutoVG",
"module": "juce_graphics",
"path": "modules/juce_graphics/drawables/lunasvg/plutovg",
"license": "MIT",
"licenseFile": "modules/juce_graphics/drawables/lunasvg/plutovg/LICENSE",
"homepage": "https://github.com/sammycage/plutovg",
"supplier": "Person: Samuel Ugochukwu",
"purl": "pkg:github/sammycage/plutovg",
"version": { "file": "modules/juce_graphics/drawables/lunasvg/plutovg/include/plutovg.h",
"patterns": ["#define\\s+JUCE_PLUTOVG_VERSION_MAJOR\\s+(\\d+)",
"#define\\s+JUCE_PLUTOVG_VERSION_MINOR\\s+(\\d+)",
"#define\\s+JUCE_PLUTOVG_VERSION_MICRO\\s+(\\d+)"] } },
{ "name": "libpng",
"module": "juce_graphics",
"path": "modules/juce_graphics/image_formats/pnglib",
"license": "libpng-2.0",
"licenseFile": "modules/juce_graphics/image_formats/pnglib/LICENSE",
"homepage": "http://www.libpng.org/pub/png/libpng.html",
"supplier": "Organization: The PNG Reference Library Authors",
"cpe": "cpe:2.3:a:libpng:libpng",
"purl": "pkg:github/pnggroup/libpng",
"version": { "file": "modules/juce_graphics/image_formats/pnglib/png.h",
"patterns": ["#define\\s+PNG_LIBPNG_VER_STRING\\s+\"([^\"]+)\""] } },
{ "name": "jpeglib",
"module": "juce_graphics",
"path": "modules/juce_graphics/image_formats/jpglib",
"license": "IJG",
"licenseFile": "modules/juce_graphics/image_formats/jpglib/README",
"homepage": "https://ijg.org",
"supplier": "Organization: Independent JPEG Group",
"cpe": "cpe:2.3:a:ijg:libjpeg",
"version": { "file": "modules/juce_graphics/image_formats/jpglib/jpeglib.h",
"patterns": ["#define\\s+JPEG_LIB_VERSION_MAJOR\\s+(\\d+)",
"#define\\s+JPEG_LIB_VERSION_MINOR\\s+(\\d+)"] } },
{ "name": "libwebp",
"module": "juce_graphics",
"path": "modules/juce_graphics/image_formats/libwebp",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_graphics/image_formats/libwebp/COPYING",
"homepage": "https://developers.google.com/speed/webp",
"supplier": "Organization: Google LLC",
"cpe": "cpe:2.3:a:webmproject:libwebp",
"purl": "pkg:github/webmproject/libwebp",
"version": { "file": "modules/juce_graphics/image_formats/libwebp/JUCE_UPSTREAM.txt",
"patterns": ["Version:\\s+(\\S+)"] } },
{ "name": "Chromium cubic_bezier",
"module": "juce_animation",
"path": "modules/juce_animation/detail/chromium",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_animation/detail/chromium/cubic_bezier.h",
"homepage": "https://chromium.googlesource.com/chromium/src",
"supplier": "Organization: The Chromium Authors",
"version": { "file": "modules/juce_animation/detail/chromium/JUCE_UPSTREAM.txt",
"patterns": ["Commit:\\s+(\\S+)"] } },
{ "name": "FLAC",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/flac",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/flac/Flac Licence.txt",
"homepage": "https://xiph.org/flac",
"supplier": "Organization: Xiph.Org Foundation",
"cpe": "cpe:2.3:a:xiph:flac",
"purl": "pkg:github/xiph/flac",
"version": { "file": "modules/juce_audio_formats/codecs/juce_flac_config.h",
"patterns": ["#define\\s+PACKAGE_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "libogg",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/ogg",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/ogg/COPYING",
"homepage": "https://xiph.org/ogg",
"supplier": "Organization: Xiph.Org Foundation",
"cpe": "cpe:2.3:a:xiph.org:libogg",
"purl": "pkg:github/xiph/ogg",
"version": { "file": "modules/juce_audio_formats/codecs/ogg/JUCE_UPSTREAM.txt",
"patterns": ["Version:\\s+(\\S+)"] } },
{ "name": "libvorbis",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/vorbis",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/vorbis/COPYING",
"homepage": "https://xiph.org/vorbis",
"supplier": "Organization: Xiph.Org Foundation",
"cpe": "cpe:2.3:a:xiph.org:libvorbis",
"purl": "pkg:github/xiph/vorbis",
"version": { "file": "modules/juce_audio_formats/codecs/vorbis/JUCE_UPSTREAM.txt",
"patterns": ["Version:\\s+(\\S+)"] } },
{ "name": "Opus",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/opus/opus",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/opus/opus/COPYING",
"homepage": "https://opus-codec.org",
"supplier": "Organization: Xiph.Org Foundation",
"cpe": "cpe:2.3:a:opus-codec:opus",
"purl": "pkg:github/xiph/opus",
"version": { "file": "modules/juce_audio_formats/codecs/opus/opus/package_version.h",
"patterns": ["#define\\s+PACKAGE_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "opusfile",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/opus/opusfile",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/opus/opusfile/COPYING",
"homepage": "https://opus-codec.org",
"supplier": "Organization: Xiph.Org Foundation",
"cpe": "cpe:2.3:a:xiph:opusfile",
"purl": "pkg:github/xiph/opusfile",
"version": { "file": "modules/juce_audio_formats/codecs/opus/opusfile/JUCE_UPSTREAM.txt",
"patterns": ["Version:\\s+(\\S+)"] } },
{ "name": "libopusenc",
"module": "juce_audio_formats",
"path": "modules/juce_audio_formats/codecs/opus/libopusenc",
"license": "BSD-3-Clause",
"licenseFile": "modules/juce_audio_formats/codecs/opus/libopusenc/COPYING",
"homepage": "https://opus-codec.org",
"supplier": "Organization: Xiph.Org Foundation",
"purl": "pkg:github/xiph/libopusenc",
"version": { "file": "modules/juce_audio_formats/codecs/opus/libopusenc/package_version.h",
"patterns": ["#define\\s+PACKAGE_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "Oboe",
"module": "juce_audio_devices",
"path": "modules/juce_audio_devices/native/oboe",
"license": "Apache-2.0",
"licenseFile": "modules/juce_audio_devices/native/oboe/LICENSE",
"homepage": "https://github.com/google/oboe",
"supplier": "Organization: Google LLC",
"purl": "pkg:github/google/oboe",
"version": { "file": "modules/juce_audio_devices/native/oboe/include/oboe/Version.h",
"patterns": ["#define\\s+OBOE_VERSION_MAJOR\\s+(\\d+)",
"#define\\s+OBOE_VERSION_MINOR\\s+(\\d+)",
"#define\\s+OBOE_VERSION_PATCH\\s+(\\d+)"] } },
{ "name": "ASIO SDK",
"module": "juce_audio_devices",
"path": "modules/juce_audio_devices/native/asio",
"license": "LicenseRef-Steinberg-ASIO OR GPL-3.0-only",
"licenseFile": "modules/juce_audio_devices/native/asio/LICENSE.txt",
"homepage": "https://www.steinberg.net/developers",
"supplier": "Organization: Steinberg Media Technologies GmbH",
"version": { "file": "modules/juce_audio_devices/native/asio/asio.h",
"patterns": ["Steinberg Audio Stream I/O API v([\\d.]+)"] } },
{ "name": "VST3 SDK",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/VST3_SDK",
"license": "MIT",
"licenseFile": "modules/juce_audio_processors_headless/format_types/VST3_SDK/LICENSE.txt",
"homepage": "https://github.com/steinbergmedia/vst3sdk",
"supplier": "Organization: Steinberg Media Technologies GmbH",
"purl": "pkg:github/steinbergmedia/vst3sdk",
"version": { "file": "modules/juce_audio_processors_headless/format_types/VST3_SDK/pluginterfaces/vst/vsttypes.h",
"patterns": ["#define\\s+kVstVersionString\\s+\"VST ([\\d.]+)\""] } },
{ "name": "LV2",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/LV2_SDK/lv2",
"license": "ISC",
"licenseFile": "modules/juce_audio_processors_headless/format_types/LV2_SDK/lv2/COPYING",
"homepage": "https://lv2plug.in",
"supplier": "Person: Steve Harris and David Robillard",
"purl": "pkg:github/lv2/lv2",
"version": { "file": "modules/juce_audio_processors_headless/format_types/LV2_SDK/lv2/lv2/core/manifest.ttl",
"patterns": ["lv2:minorVersion\\s+(\\d+)",
"lv2:microVersion\\s+(\\d+)"],
"transform": "lv2" } },
{ "name": "lilv",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/LV2_SDK/lilv",
"license": "ISC",
"licenseFile": "modules/juce_audio_processors_headless/format_types/LV2_SDK/lilv/COPYING",
"homepage": "https://drobilla.net/software/lilv.html",
"supplier": "Person: David Robillard",
"also": ["modules/juce_audio_processors_headless/format_types/LV2_SDK/lilv_config.h"],
"version": { "file": "modules/juce_audio_processors_headless/format_types/LV2_SDK/juce_lv2_config.h",
"patterns": ["#define\\s+LILV_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "serd",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/LV2_SDK/serd",
"license": "ISC",
"licenseFile": "modules/juce_audio_processors_headless/format_types/LV2_SDK/serd/COPYING",
"homepage": "https://drobilla.net/software/serd.html",
"supplier": "Person: David Robillard",
"also": ["modules/juce_audio_processors_headless/format_types/LV2_SDK/serd_config.h"],
"version": { "file": "modules/juce_audio_processors_headless/format_types/LV2_SDK/juce_lv2_config.h",
"patterns": ["#define\\s+SERD_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "sord",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/LV2_SDK/sord",
"license": "ISC",
"licenseFile": "modules/juce_audio_processors_headless/format_types/LV2_SDK/sord/COPYING",
"homepage": "https://drobilla.net/software/sord.html",
"supplier": "Person: David Robillard",
"also": ["modules/juce_audio_processors_headless/format_types/LV2_SDK/sord_config.h"],
"version": { "file": "modules/juce_audio_processors_headless/format_types/LV2_SDK/juce_lv2_config.h",
"patterns": ["#define\\s+SORD_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "sratom",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/LV2_SDK/sratom",
"license": "ISC",
"licenseFile": "modules/juce_audio_processors_headless/format_types/LV2_SDK/sratom/COPYING",
"homepage": "https://drobilla.net/software/sratom.html",
"supplier": "Person: David Robillard",
"version": { "file": "modules/juce_audio_processors_headless/format_types/LV2_SDK/juce_lv2_config.h",
"patterns": ["#define\\s+SRATOM_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "pslextensions",
"module": "juce_audio_processors_headless",
"path": "modules/juce_audio_processors_headless/format_types/pslextensions",
"license": "LicenseRef-Public-Domain",
"licenseFile": "modules/juce_audio_processors_headless/format_types/pslextensions/ipslcontextinfo.h",
"homepage": null,
"supplier": "Organization: PreSonus Software Ltd.",
"version": { "unversioned": "PreSonus distributed these extension headers without version information" } },
{ "name": "AAX SDK",
"module": "juce_audio_plugin_client",
"path": "modules/juce_audio_plugin_client/AAX/SDK",
"license": "LicenseRef-Avid-AAX OR GPL-3.0-only",
"licenseFile": "modules/juce_audio_plugin_client/AAX/SDK/LICENSE.txt",
"homepage": "https://developer.avid.com/aax",
"supplier": "Organization: Avid Technology, Inc.",
"version": { "file": "modules/juce_audio_plugin_client/AAX/SDK/Interfaces/AAX_Version.h",
"patterns": ["#define\\s+AAX_SDK_VERSION\\s*\\(\\s*0x([0-9A-Fa-f]+)\\s*\\)"],
"transform": "aax" } },
{ "name": "AudioUnitSDK",
"module": "juce_audio_plugin_client",
"path": "modules/juce_audio_plugin_client/AU/AudioUnitSDK",
"license": "Apache-2.0",
"licenseFile": "modules/juce_audio_plugin_client/AU/AudioUnitSDK/LICENSE.txt",
"homepage": "https://github.com/apple/AudioUnitSDK",
"supplier": "Organization: Apple Inc.",
"purl": "pkg:github/apple/AudioUnitSDK",
"version": { "file": "modules/juce_audio_plugin_client/AU/AudioUnitSDK/AUUtility.h",
"patterns": ["#define\\s+AUSDK_VERSION_MAJOR\\s+(\\d+)",
"#define\\s+AUSDK_VERSION_MINOR\\s+(\\d+)",
"#define\\s+AUSDK_VERSION_PATCH\\s+(\\d+)"] } },
{ "name": "Box2D",
"module": "juce_box2d",
"path": "modules/juce_box2d/box2d",
"license": "Zlib",
"licenseFile": "modules/juce_box2d/box2d/Box2D.h",
"homepage": "https://box2d.org",
"supplier": "Person: Erin Catto",
"purl": "pkg:github/erincatto/box2d",
"version": { "file": "modules/juce_box2d/box2d/Common/b2Settings.cpp",
"patterns": ["b2_version\\s*=\\s*\\{(\\d+),\\s*(\\d+),\\s*(\\d+)\\}"] } },
{ "name": "CHOC",
"module": "juce_javascript",
"path": "modules/juce_javascript/choc",
"license": "ISC",
"licenseFile": "modules/juce_javascript/choc/LICENSE.md",
"homepage": "https://github.com/Tracktion/choc",
"supplier": "Organization: Tracktion Corporation",
"purl": "pkg:github/Tracktion/choc",
"version": { "file": "modules/juce_javascript/choc/JUCE_UPSTREAM.txt",
"patterns": ["Commit:\\s+(\\S+)"] } },
{ "name": "QuickJS",
"module": "juce_javascript",
"path": "modules/juce_javascript/choc/javascript/choc_javascript_QuickJS.h",
"license": "MIT",
"licenseFile": "modules/juce_javascript/choc/javascript/choc_javascript_QuickJS.h",
"homepage": "https://bellard.org/quickjs",
"supplier": "Person: Fabrice Bellard",
"purl": "pkg:github/bellard/quickjs",
"version": { "file": "modules/juce_javascript/choc/javascript/choc_javascript_QuickJS.h",
"patterns": ["#define\\s+CONFIG_VERSION\\s+\"([^\"]+)\""] } },
{ "name": "OpenGL registry headers",
"module": "juce_opengl",
"path": "modules/juce_opengl/opengl/juce_gl.h",
"license": "BSD-3-Clause AND MIT",
"licenseFile": "modules/juce_opengl/opengl/juce_gl.h",
"homepage": "https://registry.khronos.org/OpenGL",
"supplier": "Organization: The Khronos Group Inc.",
"version": { "file": "modules/juce_opengl/opengl/juce_gl.h",
"patterns": ["Registry data retrieved on (\\d{4}-\\d{2}-\\d{2})"] } },
{ "name": "@juce-framework/webview",
"module": "juce_gui_extra",
"path": "modules/juce_gui_extra/native/typescript/webview-interop",
"license": "AGPL-3.0-only OR LicenseRef-JUCE-Commercial",
"licenseFile": "modules/juce_gui_extra/native/typescript/webview-interop/package.json",
"homepage": "https://github.com/juce-framework/JUCE",
"supplier": "Organization: Raw Material Software Limited",
"purl": "pkg:npm/%40juce-framework/webview",
"firstParty": true,
"version": { "file": "modules/juce_gui_extra/native/typescript/webview-interop/package.json",
"patterns": ["\"version\":\\s*\"([^\"]+)\""] } },
{ "name": "reaper-sdk",
"module": "examples",
"path": "examples/Plugins/extern",
"license": "Zlib",
"licenseFile": "examples/Plugins/extern/LICENSE.md",
"homepage": "https://github.com/justinfrankel/reaper-sdk",
"supplier": "Organization: Cockos Incorporated",
"purl": "pkg:github/justinfrankel/reaper-sdk",
"version": { "file": "examples/Plugins/extern/JUCE_UPSTREAM.txt",
"patterns": ["Commit:\\s+(\\S+)"] } },
{ "name": "Box2D testbed",
"module": "examples",
"path": "examples/Assets/Box2DTests",
"license": "Zlib",
"licenseFile": "examples/Assets/Box2DTests/ApplyForce.h",
"homepage": "https://box2d.org",
"supplier": "Person: Erin Catto",
"purl": "pkg:github/erincatto/box2d",
"version": { "file": "examples/Assets/Box2DTests/JUCE_UPSTREAM.txt",
"patterns": ["Version:\\s+(\\S+)"] } },
{ "name": "Projucer icons",
"module": "extras",
"path": "extras/Projucer/Source/Utility/UI/jucer_Icons.cpp",
"license": "MIT",
"licenseFile": "extras/Projucer/Source/Utility/UI/jucer_Icons.cpp",
"homepage": "https://raphaeljs.com/icons",
"supplier": "Person: Dmitry Baranovskiy",
"version": { "unversioned": "path data derived from the unversioned Raphael icon set" } },
{ "name": "Gradle wrapper",
"module": "build-system",
"path": "examples/DemoRunner/Builds/Android/gradle/wrapper",
"license": "Apache-2.0",
"licenseFile": "examples/DemoRunner/Builds/Android/gradle/wrapper/LICENSE-for-gradlewrapper.txt",
"homepage": "https://gradle.org",
"supplier": "Organization: Gradle Inc.",
"cpe": "cpe:2.3:a:gradle:gradle",
"purl": "pkg:github/gradle/gradle",
"version": { "file": "examples/DemoRunner/Builds/Android/gradle/wrapper/gradle-wrapper.properties",
"patterns": ["distributionUrl=.*gradle-([\\d.]+)-"] } }
]
}
+535
View File
@@ -0,0 +1,535 @@
#!/usr/bin/env python3
"""Generates (or checks) the SPDX software bill of materials for the JUCE framework.
Usage:
generate_sbom.py <path-to-juce-root> # writes <juce-root>/JUCE.spdx.json
generate_sbom.py <path-to-juce-root> --check # fails if the committed file is stale
generate_sbom.py <path-to-juce-root> --output <path>
This script uses the manifest of vendored third-party code located in
extras/SBOM/dependencies.json, which holds (amongst other information):
"lastUpdated" The SPDX creation timestamp. Bump this whenever the
manifest or any vendored code changes.
"dependencies" One entry per vendored third-party component:
"name" The upstream project name.
"module" The JUCE module (or component) containing it, which owns
its package in the SPDX document.
"path" The directory or single file where it is vendored,
relative to the repository root.
"also" Optional: additional covered files outside "path".
"license" An SPDX licence expression. Any LicenseRef- identifier
used must have an entry in EXTRACTED_LICENSES below.
"licenseFile" The licence text within the tree, relative to the
repository root. For a LicenseRef- licence this file
supplies the SPDX extractedText (see EXTRACTED_LICENSES).
"homepage" The upstream URL (or null), used as the SPDX
downloadLocation.
"supplier" "Organization: <name>" or "Person: <name>", normally the
upstream copyright holder. Required: every package must
name a supplier for the document to be NTIA-conformant.
"purl" Optional: the package URL without a version; the extracted
version is appended automatically.
"cpe" Optional: a CPE 2.3 prefix ending at the product field
(e.g. "cpe:2.3:a:zlib:zlib"); the extracted version
completes the identifier. Only add a CPE that exists in
the NVD CPE dictionary.
"version" A version rule, described below.
To add a new dependency: vendor the code, add a JUCE_UPSTREAM.txt file to its
directory (see below), add a manifest entry, bump "lastUpdated", and run this
script. The same applies when updating a dependency.
Version rules in the manifest are one of:
{"file": <path>, "patterns": [<regex>...], "transform": <name, optional>}
Each regex contributes its capture groups, joined with '.' or passed to
the named transform function defined in this script.
{"directory": <path>, "pattern": <regex>}
The version is captured from the name of a directory entry.
{"unversioned": <note>}
Upstream publishes no version information; the note goes into the SPDX
sourceInfo field.
Directories of vendored code may carry a JUCE_UPSTREAM.txt file documenting
the provenance of the code and any local modifications: a header block of "Key:
value" lines (Upstream: always; Version: or Commit: when the version cannot be
determined from the upstream source directly), a blank line, then free-form
notes. This script will note the presence of JUCE_UPSTREAM.txt in the SPDX
sourceInfo field.
The generated SPDX document is designed so that JUCE's build systems can reduce
it down to the modules a project actually uses without needing to understand its
contents:
- Each JUCE module is a package with SPDXID "SPDXRef-<module>" where
<module> is the module name with underscores replaced by hyphens
(e.g. "SPDXRef-juce-core").
- Each third-party dependency is a package with SPDXID
"SPDXRef-<module>.<library>" (e.g. "SPDXRef-juce-core.zlib"). The dot
cannot appear in a module ID, so ownership is unambiguous.
To remove an unused module M: delete every package whose SPDXID is exactly
"SPDXRef-<M>" or starts with "SPDXRef-<M>.", then delete every relationship
whose spdxElementId or relatedSpdxElement referred to a deleted package.
Nothing else in the document needs to change.
The examples, bundled applications, and build system also carry third-party
code. Their packages use the same scheme under the non-module owners listed in
the manifest's "components" object (e.g. "SPDXRef-examples.reaper-sdk"). None
of these are ever part of a user's product, so a project-level trimming utility
should remove those owners and their contents outright, using the same rule.
The SPDX document produced is NTIA-conformant and contains enough information to
be converted to the CycloneDX format using the CycloneDX CLI tool for security
SBOM analysis.
"""
import argparse
import hashlib
import json
import re
import sys
from pathlib import Path
MANIFEST_PATH = 'extras/SBOM/dependencies.json'
JUCE_DOWNLOAD_LOCATION = 'git+https://github.com/juce-framework/JUCE.git'
JUCE_SUPPLIER = 'Organization: Raw Material Software Limited'
EXCLUDED_DIRS = frozenset ({ '.git', 'build', 'Builds', 'JuceLibraryCode' })
SOURCE_EXTENSIONS = { '.h', '.hpp', '.hxx', '.c', '.cc', '.cpp', '.cxx',
'.m', '.mm', '.java', '.kt', '.ts', '.js' }
MODULE_LICENSES = {
'AGPLv3/Commercial': 'AGPL-3.0-only OR LicenseRef-JUCE-Commercial',
'ISC': 'ISC',
}
# Licences referenced by the manifest or the module declarations that have no
# identifier on the SPDX licence list. SPDX 2.3 requires the extractedText of
# each to be the actual licence text found in the package, so it is the full
# contents of a file in the tree: the "licenseFile" of the manifest dependency
# that uses the identifier, or the "file" named here for licences that the
# manifest does not introduce. "seeAlsos" lists the URLs of the full terms
# where the in-tree text refers out to them.
EXTRACTED_LICENSES = {
'LicenseRef-JUCE-Commercial': { 'name': 'JUCE Commercial Licence',
'file': 'LICENSE.md',
'seeAlsos': [ 'https://juce.com/legal/juce-9-licence/' ] },
'LicenseRef-Avid-AAX': { 'name': 'Avid AAX SDK Licence',
'seeAlsos': [ 'https://developer.avid.com/aax' ] },
'LicenseRef-Steinberg-ASIO': { 'name': 'Steinberg ASIO SDK Licence',
'seeAlsos': [ 'https://www.steinberg.net/en/company/developers.html' ] },
'LicenseRef-Public-Domain': { 'name': 'Public Domain' },
}
def fail (message):
print (f'error: {message}', file=sys.stderr)
sys.exit (1)
def framework_version (juce_root):
"""The JUCE version string, parsed from the version macros in
juce_StandardHeader.h."""
header = Path (juce_root) / 'modules' / 'juce_core' / 'system' / 'juce_StandardHeader.h'
text = header.read_text (encoding='utf-8', errors='replace')
parts = []
for macro in ('JUCE_MAJOR_VERSION', 'JUCE_MINOR_VERSION', 'JUCE_BUILDNUMBER'):
if (match := re.search (rf'#define\s+{macro}\s+(\d+)', text)) is None:
fail (f'{macro} not found in {header}')
parts.append (match.group (1))
return '.'.join (parts)
def load_manifest (juce_root):
path = Path (juce_root) / MANIFEST_PATH
if not path.exists():
fail (f'no SBOM manifest found at {path}')
return json.loads (path.read_text (encoding='utf-8'))
def third_party_paths (juce_root):
"""Repo-relative paths (directories or single files) of all vendored
third-party code, for other tooling (e.g. check_copyright_banners.py) to
exclude from checks that only apply to JUCE-authored files. First-party
entries such as the webview-interop package are not included."""
return tuple (d['path'] for d in load_manifest (juce_root)['dependencies']
if not d.get ('firstParty', False))
def aax_version (groups):
value = int (groups[0], 16)
return f'{value >> 8}.{value & 0xff}'
def lv2_version (groups):
return f'1.{groups[0]}.{groups[1]}'
TRANSFORMS = { 'aax': aax_version, 'lv2': lv2_version }
def extract_version (root, spec, name):
if 'unversioned' in spec:
return None
if 'directory' in spec:
pattern = re.compile (spec['pattern'])
for entry in sorted (p.name for p in (root / spec['directory']).iterdir()):
if (match := pattern.match (entry)) is not None:
return match.group (1)
fail (f'{name}: no directory in {spec["directory"]} matches {spec["pattern"]}')
if 'file' not in spec:
fail (f'{name}: unrecognised version rule {spec}')
text = (root / spec['file']).read_text (encoding='utf-8', errors='replace')
groups = []
for pattern in spec['patterns']:
if (match := re.search (pattern, text)) is None:
fail (f'{name}: pattern {pattern} not found in {spec["file"]}')
groups.extend (match.groups())
if 'transform' in spec:
return TRANSFORMS[spec['transform']] (groups)
return '.'.join (groups)
def parse_module_declarations (root):
"""Returns {module_name: {key: value}} from each module's
BEGIN_JUCE_MODULE_DECLARATION block."""
modules = {}
for module_dir in sorted ((root / 'modules').iterdir()):
if not module_dir.is_dir() or not module_dir.name.startswith ('juce_'):
continue
header = module_dir / f'{module_dir.name}.h'
if not header.exists():
fail (f'no module header found for {module_dir.name}')
text = header.read_text (encoding='utf-8', errors='replace')
match = re.search (r'BEGIN_JUCE_MODULE_DECLARATION(.*?)END_JUCE_MODULE_DECLARATION',
text, re.DOTALL)
if match is None:
fail (f'no module declaration found in {header}')
metadata = {}
current_key = None
for line in match.group (1).splitlines():
if (key_value := re.match (r'^\s*([a-zA-Z]+):\s*(.*?)\s*$', line)) is not None:
current_key = key_value.group (1)
metadata[current_key] = key_value.group (2)
elif current_key is not None and line.strip():
metadata[current_key] += ' ' + line.strip()
modules[module_dir.name] = metadata
return modules
def scan_for_uncovered_files (root, manifest):
"""Every non-juce_-prefixed source file under modules/ must belong to a
manifest dependency or match a first-party pattern."""
dependencies = manifest['dependencies']
first_party = [re.compile (p) for p in manifest.get ('firstPartyPatterns', [])]
covered_dirs = [d['path'] + '/' for d in dependencies]
covered_files = { d['path'] for d in dependencies }
covered_files.update (extra for d in dependencies for extra in d.get ('also', []))
uncovered = []
for path in sorted ((root / 'modules').rglob ('*')):
if not path.is_file() or path.suffix not in SOURCE_EXTENSIONS:
continue
if path.name.startswith ('juce_'):
continue
relative = path.relative_to (root).as_posix()
if any (part in EXCLUDED_DIRS for part in relative.split ('/')):
continue
if any (pattern.match (relative) for pattern in first_party):
continue
if relative in covered_files or any (relative.startswith (d) for d in covered_dirs):
continue
uncovered.append (relative)
return uncovered
def spdx_id_for_module (module_name):
return 'SPDXRef-' + module_name.replace ('_', '-')
def dependency_slug (dependency):
return re.sub (r'[^A-Za-z0-9.-]+', '-', dependency['name'].lower()).strip ('-')
def spdx_id_for_dependency (dependency):
return spdx_id_for_module (dependency['module']) + '.' + dependency_slug (dependency)
def normalised_text (text):
"""Licence text with line endings and trailing whitespace normalised, so
that the document does not depend on how the file happens to be stored."""
return '\n'.join (line.rstrip() for line in text.splitlines()).strip()
def license_refs (expression):
return re.findall (r'LicenseRef-[A-Za-z0-9.-]+', expression)
def extracted_licensing_info (root, manifest, packages):
"""The hasExtractedLicensingInfos entries for every LicenseRef- identifier
used by a package, with the text read from the tree as described at
EXTRACTED_LICENSES."""
used = sorted ({ ref for p in packages for ref in license_refs (p['licenseDeclared']) })
extracted = []
for license_id in used:
if (info := EXTRACTED_LICENSES.get (license_id)) is None:
fail (f'{license_id} is used but has no entry in EXTRACTED_LICENSES')
files = [info['file']] if 'file' in info else [d['licenseFile'] for d in manifest['dependencies']
if license_id in license_refs (d['license'])]
for file in files:
if not (root / file).is_file():
fail (f'{license_id}: licence file {file} does not exist')
texts = { normalised_text ((root / file).read_text (encoding='utf-8', errors='replace')) for file in files }
if len (texts) != 1:
fail (f'{license_id}: expected exactly one licence text but found {len (texts)} '
f'in {", ".join (files) or "no files"}')
entry = { 'licenseId': license_id, 'name': info['name'], 'extractedText': texts.pop() }
if 'seeAlsos' in info:
entry['seeAlsos'] = info['seeAlsos']
extracted.append (entry)
return extracted
def build_document (root, modules, manifest):
juce_version = framework_version (root)
packages = []
relationships = [ { 'spdxElementId': 'SPDXRef-DOCUMENT',
'relationshipType': 'DESCRIBES',
'relatedSpdxElement': 'SPDXRef-JUCE' } ]
packages.append ({ 'name': 'JUCE',
'SPDXID': 'SPDXRef-JUCE',
'versionInfo': juce_version,
'supplier': JUCE_SUPPLIER,
'downloadLocation': JUCE_DOWNLOAD_LOCATION,
'filesAnalyzed': False,
'licenseConcluded': 'AGPL-3.0-only OR LicenseRef-JUCE-Commercial',
'licenseDeclared': 'AGPL-3.0-only OR LicenseRef-JUCE-Commercial',
'copyrightText': 'Copyright (c) Raw Material Software Limited' })
for module_name, metadata in modules.items():
declared = metadata.get ('license', '')
license_expression = MODULE_LICENSES.get (declared)
if license_expression is None:
print (f'warning: module {module_name} has unrecognised licence "{declared}"; '
f'add it to MODULE_LICENSES', file=sys.stderr)
license_expression = 'NOASSERTION'
packages.append ({ 'name': module_name,
'SPDXID': spdx_id_for_module (module_name),
'versionInfo': metadata.get ('version', juce_version),
'supplier': JUCE_SUPPLIER,
'downloadLocation': JUCE_DOWNLOAD_LOCATION,
'filesAnalyzed': False,
'licenseConcluded': license_expression,
'licenseDeclared': license_expression,
'copyrightText': 'Copyright (c) Raw Material Software Limited',
'sourceInfo': f'modules/{module_name} in the JUCE source tree' })
relationships.append ({ 'spdxElementId': 'SPDXRef-JUCE',
'relationshipType': 'CONTAINS',
'relatedSpdxElement': spdx_id_for_module (module_name) })
for dependency in re.split (r'[,\s]+', metadata.get ('dependencies', '')):
if dependency in modules:
relationships.append ({ 'spdxElementId': spdx_id_for_module (module_name),
'relationshipType': 'DEPENDS_ON',
'relatedSpdxElement': spdx_id_for_module (dependency) })
for component, info in manifest['components'].items():
packages.append ({ 'name': component,
'SPDXID': spdx_id_for_module (component),
'versionInfo': juce_version,
'supplier': JUCE_SUPPLIER,
'downloadLocation': JUCE_DOWNLOAD_LOCATION,
'filesAnalyzed': False,
'licenseConcluded': info['license'],
'licenseDeclared': info['license'],
'copyrightText': 'Copyright (c) Raw Material Software Limited',
'sourceInfo': f'{info["description"]} in the JUCE source tree' })
relationships.append ({ 'spdxElementId': 'SPDXRef-JUCE',
'relationshipType': 'CONTAINS',
'relatedSpdxElement': spdx_id_for_module (component) })
for dependency in manifest['dependencies']:
spec = dependency['version']
version = extract_version (root, spec, dependency['name'])
# Every package must name a supplier for the document to meet the
# NTIA SBOM minimum elements, so a manifest entry without one is an
# error.
supplier = dependency.get ('supplier', '')
if not supplier.startswith (('Organization: ', 'Person: ')):
fail (f'{dependency["name"]}: NTIA conformance requires a supplier of the form '
f'"Organization: <name>" or "Person: <name>"')
source_info = f'Vendored at {dependency["path"]} in the JUCE source tree'
if 'unversioned' in spec:
source_info += f'; {spec["unversioned"]}'
if (root / dependency['path'] / 'JUCE_UPSTREAM.txt').exists():
source_info += '; provenance and local modifications are documented in JUCE_UPSTREAM.txt'
package = { 'name': dependency['name'],
'SPDXID': spdx_id_for_dependency (dependency),
'versionInfo': version if version is not None else 'NOASSERTION',
'supplier': supplier,
'downloadLocation': dependency['homepage'] or 'NOASSERTION',
'filesAnalyzed': False,
'licenseConcluded': dependency['license'],
'licenseDeclared': dependency['license'],
'copyrightText': 'NOASSERTION',
'sourceInfo': source_info }
external_refs = []
# Every dependency carries a purl so that purl-based consumers (e.g.
# the GitHub dependency snapshot) never need to synthesise an
# identifier; packages with no upstream package URL get a generic
# one. The version is appended so that SBOM consumers such as
# vulnerability scanners can match the exact package.
locator = dependency.get ('purl', 'pkg:generic/' + dependency_slug (dependency))
external_refs.append ({ 'referenceCategory': 'PACKAGE-MANAGER',
'referenceType': 'purl',
'referenceLocator': locator + (f'@{version}' if version is not None else '') })
# A CPE identifier lets NVD-based vulnerability scanners match the
# package. The manifest holds the vendor and product fields, and the
# extracted version completes the identifier.
if 'cpe' in dependency and version is not None:
external_refs.append ({ 'referenceCategory': 'SECURITY',
'referenceType': 'cpe23Type',
'referenceLocator': f'{dependency["cpe"]}:{version}:*:*:*:*:*:*:*' })
if external_refs:
package['externalRefs'] = external_refs
packages.append (package)
relationships.append ({ 'spdxElementId': spdx_id_for_module (dependency['module']),
'relationshipType': 'CONTAINS',
'relatedSpdxElement': spdx_id_for_dependency (dependency) })
# Dependencies of the non-module components are never part of a JUCE
# user's product, so mark them development-only for SBOM consumers.
if dependency['module'] in manifest['components']:
relationships.append ({ 'spdxElementId': spdx_id_for_dependency (dependency),
'relationshipType': 'DEV_DEPENDENCY_OF',
'relatedSpdxElement': 'SPDXRef-JUCE' })
extracted = extracted_licensing_info (root, manifest, packages)
document = { 'spdxVersion': 'SPDX-2.3',
'dataLicense': 'CC0-1.0',
'SPDXID': 'SPDXRef-DOCUMENT',
'name': f'JUCE-{juce_version}',
'documentNamespace': None,
'creationInfo': { 'created': manifest['lastUpdated'],
'creators': [ 'Tool: generate_sbom.py',
JUCE_SUPPLIER ] },
'packages': packages,
'relationships': relationships,
'hasExtractedLicensingInfos': extracted }
# SPDX requires every revision of a document to have a unique namespace
# URI, so derive it from the whole of the rest of the document: any change
# at all, including to the creation timestamp alone, produces a new URI.
content_hash = hashlib.sha256 (json.dumps (document, sort_keys=True).encode()).hexdigest()[:12]
document['documentNamespace'] = f'https://juce.com/spdx/JUCE-{juce_version}-{content_hash}'
return document
def main():
parser = argparse.ArgumentParser (description='Generate or check the JUCE SPDX SBOM.')
parser.add_argument ('juce_root', type=Path, help='path to the root of the JUCE repository')
parser.add_argument ('--output', type=Path, default=None,
help='output path (default: <juce_root>/JUCE.spdx.json)')
parser.add_argument ('--check', action='store_true',
help='verify that the existing document is up to date instead of writing')
arguments = parser.parse_args()
root = arguments.juce_root.resolve()
if not (root / 'modules' / 'juce_core').is_dir():
fail (f'{root} does not look like a JUCE repository')
manifest = load_manifest (root)
uncovered = scan_for_uncovered_files (root, manifest)
if uncovered:
for path in uncovered:
print (f'error: {path} looks like third-party code but has no entry in {MANIFEST_PATH}',
file=sys.stderr)
fail (f'{len (uncovered)} file(s) are not covered by the manifest at {root / MANIFEST_PATH}')
modules = parse_module_declarations (root)
document = build_document (root, modules, manifest)
output_path = arguments.output or (root / 'JUCE.spdx.json')
serialized = json.dumps (document, indent=2) + '\n'
if arguments.check:
if not output_path.exists():
fail (f'{output_path} does not exist; run generate_sbom.py to create it')
if output_path.read_text (encoding='utf-8') != serialized:
fail (f'{output_path} is out of date; re-run generate_sbom.py and commit the result')
print (f'{output_path} is up to date ({len (document["packages"])} packages)')
else:
output_path.write_text (serialized, encoding='utf-8')
print (f'wrote {output_path} ({len (document["packages"])} packages)')
if __name__ == '__main__':
main()
@@ -0,0 +1,138 @@
#!/usr/bin/env python3
"""Submits the JUCE software bill of materials from JUCE.spdx.json to GitHub's
dependency submission API, so that the vendored third-party code appears in the
repository's dependency graph and in GitHub's own SBOM export.
Usage:
submit_dependency_snapshot.py <path-to-juce-root> # submit
submit_dependency_snapshot.py <path-to-juce-root> --dry-run # print only
"""
import argparse
import datetime
import json
import os
import sys
import urllib.error
import urllib.request
from pathlib import Path
CORRELATOR = 'juce-sbom'
JUCE_SUPPLIER = 'Organization: Raw Material Software Limited'
MANIFEST_PATH = 'extras/SBOM/dependencies.json'
def fail (message):
print (f'error: {message}', file=sys.stderr)
sys.exit (1)
def github_environment (dry_run):
def value_of (name, placeholder):
value = os.environ.get (name, '')
if not value:
if dry_run:
return placeholder
fail (f'{name} is not set')
return value
return { 'repository': value_of ('GITHUB_REPOSITORY', 'juce-framework/JUCE'),
'sha': value_of ('GITHUB_SHA', '0' * 40),
'ref': value_of ('GITHUB_REF', 'refs/heads/develop'),
'run_id': value_of ('GITHUB_RUN_ID', '0'),
'api_url': os.environ.get ('GITHUB_API_URL', 'https://api.github.com') }
def package_purl (package):
for reference in package.get ('externalRefs', []):
if reference['referenceType'] == 'purl':
return reference['referenceLocator']
fail (f'{package["name"]} has no purl')
def build_snapshot (document, environment):
development = { r['spdxElementId'] for r in document['relationships']
if r['relationshipType'] == 'DEV_DEPENDENCY_OF' }
resolved = {}
for package in document['packages']:
if package.get ('supplier') == JUCE_SUPPLIER:
continue
resolved[package['name']] = {
'package_url': package_purl (package),
'relationship': 'direct',
'scope': 'development' if package['SPDXID'] in development else 'runtime',
}
return { 'version': 0,
'sha': environment['sha'],
'ref': environment['ref'],
'job': { 'id': environment['run_id'], 'correlator': CORRELATOR },
'detector': { 'name': 'generate_sbom.py',
'version': document['name'].removeprefix ('JUCE-'),
'url': 'https://github.com/juce-framework/JUCE' },
'scanned': datetime.datetime.now (datetime.timezone.utc).isoformat(),
'manifests': { 'JUCE.spdx.json': { 'name': 'JUCE.spdx.json',
'file': { 'source_location': MANIFEST_PATH },
'resolved': resolved } } }
def submit (snapshot, environment):
url = f'{environment["api_url"]}/repos/{environment["repository"]}/dependency-graph/snapshots'
token = os.environ.get ('GITHUB_TOKEN', '')
if not token:
fail ('GITHUB_TOKEN is not set')
request = urllib.request.Request (url,
data=json.dumps (snapshot).encode(),
headers={ 'Authorization': f'Bearer {token}',
'Accept': 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
'Content-Type': 'application/json' },
method='POST')
try:
with urllib.request.urlopen (request) as response:
print (f'{response.status}: {response.read().decode()}')
except urllib.error.HTTPError as error:
fail (f'submission failed with {error.code}: {error.read().decode()}')
def main():
parser = argparse.ArgumentParser (description='Submit the JUCE SBOM to the '
'GitHub dependency submission API.')
parser.add_argument ('juce_root', type=Path, help='path to the root of the JUCE repository')
parser.add_argument ('--dry-run', action='store_true',
help='print the snapshot instead of submitting it')
arguments = parser.parse_args()
document_path = arguments.juce_root.resolve() / 'JUCE.spdx.json'
if not document_path.exists():
fail (f'{document_path} does not exist; run generate_sbom.py to create it')
document = json.loads (document_path.read_text (encoding='utf-8'))
environment = github_environment (arguments.dry_run)
snapshot = build_snapshot (document, environment)
resolved = snapshot['manifests']['JUCE.spdx.json']['resolved']
development = sum (1 for p in resolved.values() if p['scope'] == 'development')
print (f'{len (resolved)} dependencies ({development} development-only)', file=sys.stderr)
if arguments.dry_run:
print (json.dumps (snapshot, indent=2))
else:
submit (snapshot, environment)
if __name__ == '__main__':
main()