Add License annotation to external functions
This PR comes along with #4411 (after merging Mo-2900) and makes the license texts of the external functions/objects explicit such that FMU exporting tools no longer need to distribute all files of modelica:/Modelica/Resources/Licenses/ along with the FMU, but only the actually used license texts.
Edit: Dependency on lapack (and the corresponding license texts) still is an exception since it is not seen as MSL dependency, but as tool requirement (see #2849).
Edit 2: Needs to be coordinated with #4240 and #4496.
Summary by CodeRabbit
-
Chores
- Added explicit license information to external C function annotations across multiple packages, enhancing metadata about third-party and internal library usage.
- No changes to function signatures, logic, or user-facing behavior; only license references were added for greater transparency regarding external dependencies.
Walkthrough
This update adds explicit license annotations to all external C function declarations across multiple Modelica packages. The modifications introduce License attributes referencing relevant license files for both internal Modelica code and third-party dependencies. These changes are limited to metadata within function annotations and do not alter function signatures, logic, control flow, or exported/public APIs. The affected areas include table handling, random number generation, file and string utilities, system operations, and obsolete table functions.
Changes
| File(s) | Change Summary |
|---|---|
| Modelica/Blocks/Tables.mo, ObsoleteModelica4.mo |
Added explicit License annotations to all external C function declarations for table reading and interpolation functions. |
| Modelica/Blocks/Types.mo | Added License annotations to external function declarations for table object constructors/destructors. |
| Modelica/Math/FastFourierTransform.mo | Added a License annotation to the external C function annotation for the FFT implementation. |
| Modelica/Math/Random.mo | Added License annotations to all external C function declarations for random number generators and related utilities. |
| Modelica/Utilities/Files.mo | Added License annotations to external C function declarations for file path and temporary file utilities. |
| Modelica/Utilities/Internal.mo | Added License annotations to all external C function declarations in the internal file system utilities. |
| Modelica/Utilities/Streams.mo | Added License annotations to all external C function declarations for file and matrix stream operations. |
| Modelica/Utilities/Strings.mo | Added License annotations to all external C function declarations for string operations and advanced scanning functions. |
| Modelica/Utilities/System.mo | Added License annotations to all external C function declarations for system-level operations. |
Suggested labels
task
Poem
Oh, what a hop through Modelica's code, Where licenses now lighten every load! From tables and streams to strings and files, Each annotation brings compliant smiles. With every C call, a license in tow, This rabbit ensures the right credits show. đâš
đ Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
đ„ Commits
Reviewing files that changed from the base of the PR and between 2d5dea34de04239888bb4ed49128ab739d8db6ea and 44ec97ae834e03f6463cbef2e4db8412ae6bfadb.
đ Files selected for processing (10)
-
Modelica/Blocks/Tables.mo(25 hunks) -
Modelica/Blocks/Types.mo(3 hunks) -
Modelica/Math/FastFourierTransform.mo(1 hunks) -
Modelica/Math/Random.mo(6 hunks) -
Modelica/Utilities/Files.mo(2 hunks) -
Modelica/Utilities/Internal.mo(3 hunks) -
Modelica/Utilities/Streams.mo(8 hunks) -
Modelica/Utilities/Strings.mo(9 hunks) -
Modelica/Utilities/System.mo(6 hunks) -
ObsoleteModelica4.mo(3 hunks)
â° Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: external_c_checks_cmake_windows-msvc
- GitHub Check: external_c_checks_cmake_windows-cygwin
đ Additional comments (40)
Modelica/Math/FastFourierTransform.mo (1)
645-645: Add License annotation for rawRealFFT external binding
TheLicenseattribute correctly references the KissFFT license file (LICENSE_ModelicaKissFFT.txt), fulfilling the PR objective to include explicit license metadata for external dependencies.Modelica/Math/Random.mo (6)
225-225: Add License annotation for Xorshift64star random external binding
TheLicenseattribute lists both the KissFFT and stdint MSVC license files, ensuring proper attribution for the C dependencies.
398-398: Add License annotation for Xorshift128plus random external binding
The annotation now includes the correct license files for the external C implementation, matching the pattern used across the library.
575-575: Add License annotation for Xorshift1024star random external binding
The license metadata for KissFFT and stdint MSVC is consistently applied to this external function as well.
938-938: Add License annotation for automaticGlobalSeed external binding
TheLicenseentry accurately references the thirdâparty license files for the C implementation of the global seed generator.
1076-1076: Add License annotation for setInternalState external binding
TheLicenseattribute is properly set for the function that initializes the C static state, aligning with PR-wide metadata updates.
1156-1156: Add License annotation for impureRandom external binding
The external C call now includes explicit license references for both KissFFT and stdint MSVC, consistent with other RNG bindings.Modelica/Blocks/Types.mo (6)
135-135: Add License annotation for ExternalCombiTimeTable constructor
The annotation lists all relevant license files for the ModelicaStandardTables C library and its thirdâparty dependencies.
142-142: Add License annotation for ExternalCombiTimeTable destructor
Consistent license metadata added to the destructor to mirror the constructorâs licensing.
175-175: Add License annotation for ExternalCombiTable1D constructor
The license list correctly covers the core tables library and its dependencies, matching the style of related packages.
182-182: Add License annotation for ExternalCombiTable1D destructor
The destructor now carries the same set of license references as the constructor.
212-212: Add License annotation for ExternalCombiTable2D constructor
All required license files are explicitly declared for the 2D table external binding.
219-219: Add License annotation for ExternalCombiTable2D destructor
The license metadata is appropriately extended to the 2D table destructor as well.Modelica/Utilities/Internal.mo (8)
165-165: Add License annotation for mkdir external function
TheLicenseattribute now includes ModelicaInternal and its thirdâparty license files, in line with PR objectives.
171-171: Add License annotation for rmdir external function
Consistent license metadata has been added for the directoryâremoval binding.
178-178: Add License annotation for stat external function
The license list covers the core ModelicaInternal license and thirdâparty components used bystat.
185-185: Add License annotation for rename external function
The annotation now explicitly declares all relevant license files for the rename binding.
191-191: Add License annotation for removeFile external function
License metadata correctly added to the fileâremoval external call.
199-199: Add License annotation for copyFile external function
The license list for ModelicaInternal copy operation is now explicit.
211-211: Add License annotation for readDirectory external function
Proper license references are now included for directoryâreading functionality.
220-220: Add License annotation for getNumberOfFiles external function
The external binding for counting files now includes the required license metadata.Modelica/Utilities/System.mo (6)
9-9: Add License annotation for getWorkDirectory external function
The binding togetcwdnow carries explicit information on ModelicaInternal and related thirdâparty licenses.
19-19: Add License annotation for setWorkDirectory external function
Consistent license metadata has been applied to thechdirbinding.
34-34: Add License annotation for getEnvironmentVariable external function
Thegetenvbinding now includes all pertinent license files in its annotation.
46-46: Add License annotation for setEnvironmentVariable external function
License references have been correctly extended to thesetenvbinding.
62-62: Add License annotation for getTime external function
The annotation now declares ModelicaInternal and thirdâparty license files for the timeâretrieval binding.
134-134: Add License annotation for getPid external function
Thegetpidbinding is now accompanied by explicit license metadata for all dependencies.Modelica/Utilities/Files.mo (2)
572-572: License annotation addition looks correct.The License annotation has been properly added to the
fullPathNameexternal C function declaration, referencing all the relevant license files. This change aligns with the PR objective to explicitly specify license texts for external functions and objects.
661-661: License annotation addition looks correct.The License annotation has been properly added to the
temporaryFileNameexternal C function declaration, referencing all the relevant license files. This change aligns with the PR objective to explicitly specify license texts for external functions and objects.Modelica/Blocks/Tables.mo (1)
1038-1329: All license annotations have been correctly added to external C functions.The License annotations have been systematically added to all 25 external C function declarations in the
Internalpackage. Each annotation consistently references the same set of relevant license files for the ModelicaStandardTables library and its dependencies. This implementation aligns perfectly with the PR objective to explicitly specify license texts for external functions and objects within the Modelica Standard Library.ObsoleteModelica4.mo (1)
220-223: Add explicit license annotation forreadTimeTableData.
TheLicenseattribute now lists all relevant licence files for ModelicaStandardTables, ModelicaIO, ModelicaMatIO, zlib, and the included thirdâparty snippets. This meets the objective of including only the licences actually used by external functions.Modelica/Utilities/Strings.mo (1)
9-9: Add explicit license annotation tolength.
The external binding now referencesLICENSE_ModelicaStrings.txtand the required thirdâparty licences (uthash,stdint_msvc,APHashFunction).Modelica/Utilities/Streams.mo (8)
9-9: License annotation added forModelicaInternal_print.
The License attribute now explicitly lists the internal (LICENSE_ModelicaInternal.txt) and thirdâparty dependencies (uthash,stdint_msvc,win32_dirent). This matches the PR objective to include only used license texts.
47-47: License annotation added forModelicaInternal_readFile.
The License attribute correctly coversLICENSE_ModelicaInternal.txtand the relevant thirdâparty libraries. Good alignment with FMU export requirements.
69-69: License annotation added forModelicaInternal_readLine.
Explicitly listing the internal and thirdâparty license files (uthash, stdint_msvc, win32_dirent) ensures only required texts are packaged.
94-94: License annotation added forModelicaInternal_countLines.
The new License list matches the other Internal functions in this package and covers all dependencies.
143-143: License annotation added forModelicaStreams_closeFile.
Consistent with the other Streams functions, the License attribute now details all relevant internal and thirdâparty licenses.
162-162: License annotation added forModelicaIO_readMatrixSizes.
The annotation includesLICENSE_ModelicaIO.txt,LICENSE_ModelicaMatIO.txt, and thirdâparty licenses (zlib,stdint_msvc,portable-snippets,c99-snprintf), covering all code paths.
199-199: License annotation added forModelicaIO_readRealMatrix.
The set of license files mirrorsreadMatrixSizes, ensuring the FMU export only bundles necessary license texts for ModelicaIO and its dependencies.
241-241: License annotation added forModelicaIO_writeRealMatrix.
Consistent with other IO functions, the License attribute enumerates internal and thirdâparty license files. This completes the metadata enhancement for all external C interfaces.
đȘ§ Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.