Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare API generator for automatic check #12175

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Jan 28, 2025

Pull Request Description

First step of #10507. Preparations for the Standard.Base API check job that will be introduced in a follow-up PR. In this PR, the functionality of DocsEmitSignatures is modified and tested such that its generated signatures for a module is ready for usage in the API check job. Most importantly, the signatures are sorted.

Sorting of the generated signatures prevents future false-positive failures of the API check job when somebody just reorders items in a module.

Important Notes

Further modifications to DocsEmitSignatures:

  • Every definition in a module is represented as a list item in the Markdown for convenient rendering.
  • Synthetic and empty modules are skipped.
  • The directory structure of the generated docs/api corresponds to the directory structure in src.
    • Previously, it was docs/api/Standard/Base/Any.md but now it is just docs/api/Any.md (which was generated from src/Any.enso).

Example output is:

## Enso Signatures 1.0
## module Standard.Base.System.File
- type File
    - / self subpath:Standard.Base.Data.Text.Text -> Standard.Base.Any.Any
    - absolute self -> Standard.Base.Any.Any
    - copy_to self destination:Standard.Base.System.File.Generic.File_Like.File_Like replace_existing:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any
    - create_directory self -> Standard.Base.Any.Any
    - create_dry_run_file self copy_original:Standard.Base.Any.Any= -> Standard.Base.Any.Any
    - create_temporary_file prefix:Standard.Base.Any.Any= suffix:Standard.Base.Any.Any= -> Standard.Base.Any.Any
    - creation_time self -> Standard.Base.Any.Any
    - current_directory -> Standard.Base.Any.Any
    - delete self recursive:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any
    - delete_if_exists self recursive:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any
    - exists self -> Standard.Base.Any.Any
    - extension self -> Standard.Base.Any.Any
    - home -> Standard.Base.Any.Any
    - is_absolute self -> Standard.Base.Any.Any
    - is_data_link self -> Standard.Base.Data.Boolean.Boolean
    - is_descendant_of self other:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - is_directory self -> Standard.Base.Any.Any
    - is_regular_file self -> Standard.Base.Any.Any
    - is_writable self -> Standard.Base.Any.Any
    - join self subpaths:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - last_modified_time self -> Standard.Base.Any.Any
    - list self name_filter:Standard.Base.Data.Text.Text= recursive:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any
    - list_immediate_children self -> Standard.Base.Any.Any
    - move_to self destination:Standard.Base.System.File.Generic.File_Like.File_Like replace_existing:Standard.Base.Data.Boolean.Boolean= -> Standard.Base.Any.Any
    - name self -> Standard.Base.Any.Any
    - new path:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - normalize self -> Standard.Base.Any.Any
    - parent self -> Standard.Base.Any.Any
    - path self -> Standard.Base.Any.Any
    - posix_permissions self -> Standard.Base.Any.Any
    - read self format:Standard.Base.Any.Any= on_problems:Standard.Base.Errors.Problem_Behavior.Problem_Behavior= -> Standard.Base.Any.Any
    - read_bytes self -> Standard.Base.Any.Any
    - read_first_bytes self n:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - read_last_bytes self n:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - read_text self encoding:Standard.Base.Data.Text.Encoding.Encoding= on_problems:Standard.Base.Errors.Problem_Behavior.Problem_Behavior= -> Standard.Base.Any.Any
    - relativize self child:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - resolve self subpath:Standard.Base.Data.Text.Text -> Standard.Base.Any.Any
    - resolve_single_part self part:Standard.Base.Data.Text.Text -> Standard.Base.Any.Any
    - size self -> Standard.Base.Any.Any
    - starts_with self parent:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - to_display_text self -> Standard.Base.Any.Any
    - to_js_object self -> Standard.Base.Any.Any
    - to_text self -> Standard.Base.Any.Any
    - with_input_stream self open_options:Standard.Base.Data.Vector.Vector action:Standard.Base.Any.Any -> Standard.Base.Any.Any
    - with_output_stream self open_options:Standard.Base.Data.Vector.Vector action:Standard.Base.Any.Any -> Standard.Base.Any.Any
- file_as_java file:Standard.Base.System.File.File -> Standard.Base.Any.Any
- file_types -> Standard.Base.Any.Any
- find_extension_from_name name:Standard.Base.Any.Any -> Standard.Base.Any.Any
- get_child_widget file:Standard.Base.Any.Any -> Standard.Base.Any.Any
- list_descendants file:Standard.Base.Any.Any -> Standard.Base.Any.Any
- resolve_local_file path:Standard.Base.Data.Text.Text -> Standard.Base.Any.Any
- Standard.Base.System.File.File.from that:Standard.Base.Data.Text.Text -> Standard.Base.System.File.File
- Standard.Base.System.File.Generic.File_Like.File_Like.from that:Standard.Base.System.File.File -> Standard.Base.System.File.Generic.File_Like.File_Like
- Standard.Base.System.File.Generic.Writable_File.Writable_File.from that:Standard.Base.System.File.File -> Standard.Base.System.File.Generic.Writable_File.Writable_File
- Standard.Base.Enso_Cloud.Data_Link.Data_Link_From_File.from that:Standard.Base.System.File.File -> Standard.Base.Enso_Cloud.Data_Link.Data_Link_From_File

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@Akirathan Akirathan self-assigned this Jan 28, 2025
@Akirathan Akirathan added CI: No changelog needed Do not require a changelog entry for this PR. CI: Clean build required CI runners will be cleaned before and after this PR is built. labels Jan 29, 2025
@Akirathan Akirathan marked this pull request as ready for review January 29, 2025 18:48
@Akirathan Akirathan changed the title API check of Standard.Base Prepare API generator for automatic check Jan 29, 2025
@@ -11,7 +12,7 @@
import org.enso.filesystem.FileSystem;
import org.enso.pkg.QualifiedName;
import scala.collection.immutable.Seq;
import scala.jdk.CollectionConverters;
import scala.jdk.javaapi.CollectionConverters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be using org.enso.scala.wrapper modules's convertors anyway?

public static <File> File defaultOutputDir(org.enso.pkg.Package<File> pkg) {
var fs = pkg.fileSystem();
var docs = fs.getChild(pkg.root(), "docs");
var api = fs.getChild(docs, "api");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could select the directory based on the "type of documentation" - e.g. api for --docs=api and md for --docs or --docs=md

@@ -8,7 +8,7 @@ add_specs suite_builder = suite_builder.group "Standard.Base Signature Checks" g
setup = Api_Setup.create 'Standard' 'Base' [ "--docs=api" ]

group_builder.specify "Standard.Base.Meta" <|
snapshot = setup.api_dir / "Standard" / "Base" / "Meta.md"
snapshot = setup.api_dir / "Meta.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping namespace and name from the directory structure? That is probably good idea. CCing @radeusgd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants