Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

refactor: restructure server packages & include Simple-ML core Jar #339

Merged
merged 15 commits into from
Dec 17, 2021

Conversation

lars-reimann
Copy link
Member

@lars-reimann lars-reimann commented Dec 15, 2021

Closes partially #327.

Summary of Changes

  • Restructure server packages (flatter hierarchy)
  • Include Simple-ML core Jar
    • Use this to generate code for function stubs

Testing instructions

  • Structure should make sense, but no need to go through all the changes to names and imports
  • Should still be able to generate code from the client
  • Tests should still run

Additional notes

  • I'll also update the stub creators for classes and modules in a future PR.
  • The Jar will be pulled from Maven Central once it's published there.

# Conflicts:
#	server/build.gradle.kts
#	server/src/main/java/com/larsreimann/api_editor/transformation/RenameAnnotationProcessor.java
#	server/src/main/kotlin/com/larsreimann/api_editor/server/Routing.kt
#	server/src/main/kotlin/com/larsreimann/api_editor/transformation/OriginalDeclarationProcessor.kt
#	server/src/main/kotlin/com/larsreimann/api_editor/util/PackageDataFactories.kt
#	server/src/test/java/com/larsreimann/api_editor/io/ClassAdapterContentBuilderTest.java
#	server/src/test/java/com/larsreimann/api_editor/io/FunctionAdapterContentBuilderTest.java
#	server/src/test/java/com/larsreimann/api_editor/io/ModuleAdapterContentBuilderTest.java
#	server/src/test/java/com/larsreimann/api_editor/server/file_handling/ModuleStubContentBuilderTest.java
#	server/src/test/java/com/larsreimann/api_editor/transformation/RenameAnnotationProcessorTest.java
#	server/src/test/kotlin/com/larsreimann/api_editor/transformation/OriginalDeclarationProcessorTest.kt
# Conflicts:
#	server/src/main/java/com/larsreimann/api_editor/codegen/ModuleAdapterContentBuilder.java
#	server/src/main/java/com/larsreimann/api_editor/transformation/CleanupModulesProcessor.java
#	server/src/main/java/com/larsreimann/api_editor/transformation/MoveAnnotationProcessor.java
#	server/src/main/kotlin/com/larsreimann/api_editor/server/Routing.kt
#	server/src/test/java/com/larsreimann/api_editor/server/annotationProcessing/RenameAnnotationProcessorTest.java
#	server/src/test/java/com/larsreimann/api_editor/transformation/CleanupModulesProcessorTest.java
#	server/src/test/java/com/larsreimann/api_editor/transformation/MoveAnnotationProcessorTest.java
#	server/src/test/java/com/larsreimann/api_editor/transformation/UnusedAnnotationProcessorTest.java
@github-actions
Copy link

github-actions bot commented Dec 15, 2021

MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ CREDENTIALS secretlint yes no 1.92s
✅ GIT git_diff yes no 0.01s
✅ KOTLIN ktlint 18 0 0 35.67s
✅ TYPESCRIPT eslint 1 0 0 8.62s
✅ TYPESCRIPT prettier 1 0 0 1.35s

See errors details in artifact MegaLinter reports on GitHub Action page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

@lars-reimann
Copy link
Member Author

lars-reimann commented Dec 15, 2021

@paul0314 Reviewing this is not urgent. However, I'd ask you to base new branches on this one rather than on main.

@lars-reimann lars-reimann changed the title refactor: restructure server package & include Simple-ML core Jar refactor: restructure server packages & include Simple-ML core Jar Dec 16, 2021
@paul0314
Copy link
Contributor

@paul0314 Reviewing this is not urgent. However, I'd ask you to base new branches on this one rather than on main.

I'll look over it tomorrow

@paul0314
Copy link
Contributor

There seems to be 2 (nearly) identical "RenameAnnotationProcessorTest"-files in server.annotationProcessing and transformation. One should probably be deleted.

@lars-reimann
Copy link
Member Author

There seems to be 2 (nearly) identical "RenameAnnotationProcessorTest"-files in server.annotationProcessing and transformation. One should probably be deleted.

Well spotted, thanks.

Copy link
Contributor

@paul0314 paul0314 left a comment

Choose a reason for hiding this comment

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

Tests and adapter generation still worked and most of the changes were structural.

The codegen for Stub files in Kotlin was a bit challenging to read and I'd probably have some problems changing it in the future. However, I probably don't need to touch it in the near future, right?! Also, can I assume that all "createSml..."-methods from the CreatorsKt.class already return the desired Strings?!
I haven't really figured out what the use of methods like "createSmlDummyResource" / "createSmlCompilationUnit" /... is, but I don't think I need to, right?

@paul0314 paul0314 merged commit d88f18a into main Dec 17, 2021
@paul0314 paul0314 deleted the feature/refactorStubCreation branch December 17, 2021 17:46
@lars-reimann
Copy link
Member Author

lars-reimann commented Dec 17, 2021

The codegen for Stub files in Kotlin was a bit challenging to read and I'd probably have some problems changing it in the future. However, I probably don't need to touch it in the near future, right?!

You don't. Whatever I convert to Kotlin is basically done from your side.

Also, can I assume that all "createSml..."-methods from the CreatorsKt.class already return the desired Strings?! I haven't really figured out what the use of methods like "createSmlDummyResource" / "createSmlCompilationUnit" /... is, but I don't think I need to, right?

I've recently added these methods in Simple-ML. They create yet another model, this time representing a Simple-ML program. This has some advantages over outputting strings directly:

  • The model is validated, so errors like identifiers that contain dashes are immediately reported.
  • Some value conversion happens. For example, identifiers that are at the same time Simple-ML keywords are automatically escaped. This also works in case I add new keywords in the future. Another example is that quotes in a string are escaped (" is replaced by \").
  • The output is automatically formatted using the built-in Simple-ML formatter. Any improvements there will also affect the code generation here.
  • All those components are already well tested, so it's not necessary to repeat that work here.

In general, the entire pipeline from the JSON files that are imported in the frontend to the outputted Python & Simple-ML files is a series of model-to-model transformations, with code generation at the end. This includes the annotation processors, which transform a package data model onto another package data model.

lars-reimann pushed a commit that referenced this pull request Nov 2, 2022
)

Bumps [numpydoc](https://github.com/numpy/numpydoc) from 1.4.0 to 1.5.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/numpy/numpydoc/blob/main/doc/release_notes.rst">numpydoc's
changelog</a>.</em></p>
<blockquote>
<h2>1.5.0</h2>
<p>Release date: 8 October 2022</p>
<p>Requires Python 3.7+ and Sphinx 4.2+.</p>
<p><code>Full Changelog
&lt;https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0&gt;</code>__</p>
<p>Fixed bugs</p>
<pre><code>
- Parsing ``returns`` section with several types and no name
`[#428](numpy/numpydoc#428)
&lt;https://github.com/numpy/numpydoc/issues/428&gt;`__
- BUG: Fix returns parsing no name
`[#429](numpy/numpydoc#429)
&lt;https://github.com/numpy/numpydoc/pull/429&gt;`__ (`rossbar
&lt;https://github.com/rossbar&gt;`__)
<p>Closed issues
</code></pre></p>
<ul>
<li>readthedocs build failing
<code>[#439](numpy/numpydoc#439)
&lt;https://github.com/numpy/numpydoc/issues/439&gt;</code>__</li>
<li>Exclude class properties from being listed under METHODS section
<code>[#339](numpy/numpydoc#339)
&lt;https://github.com/numpy/numpydoc/issues/339&gt;</code>__</li>
<li>BUG: Numpydoc doesn’t render attributes decorated with
<code>cached\_property</code> in the Attributes section
<code>[#432](numpy/numpydoc#432)
&lt;https://github.com/numpy/numpydoc/issues/432&gt;</code>__</li>
<li>Is numpydoc_use_blockquotes deprecated or not yet?
<code>[#420](numpy/numpydoc#420)
&lt;https://github.com/numpy/numpydoc/issues/420&gt;</code>__</li>
<li>No light theme available in docs
<code>[#413](numpy/numpydoc#413)
&lt;https://github.com/numpy/numpydoc/issues/413&gt;</code>__</li>
<li>1.4.0 release plan
<code>[#408](numpy/numpydoc#408)
&lt;https://github.com/numpy/numpydoc/issues/408&gt;</code>__</li>
</ul>
<p>Merged pull requests</p>
<pre><code>
- Update doc requirements
`[#441](numpy/numpydoc#441)
&lt;https://github.com/numpy/numpydoc/pull/441&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Update pydata-sphinx-theme
`[#440](numpy/numpydoc#440)
&lt;https://github.com/numpy/numpydoc/pull/440&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Support Python 3.11
`[#438](numpy/numpydoc#438)
&lt;https://github.com/numpy/numpydoc/pull/438&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Update precommit hooks
`[#437](numpy/numpydoc#437)
&lt;https://github.com/numpy/numpydoc/pull/437&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Use Python 3.10 to build docs
`[#436](numpy/numpydoc#436)
&lt;https://github.com/numpy/numpydoc/pull/436&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Use `requirements/*.txt` files for CI
`[#435](numpy/numpydoc#435)
&lt;https://github.com/numpy/numpydoc/pull/435&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Fix front page `[#434](numpy/numpydoc#434)
&lt;https://github.com/numpy/numpydoc/pull/434&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Add cached property support
`[#433](numpy/numpydoc#433)
&lt;https://github.com/numpy/numpydoc/pull/433&gt;`__ (`rossbar
&lt;https://github.com/rossbar&gt;`__)
- ENH: Update validate.py to allow parameters with trailing underscores.
`[#425](numpy/numpydoc#425)
&lt;https://github.com/numpy/numpydoc/pull/425&gt;`__ (`stefmolin
&lt;https://github.com/stefmolin&gt;`__)
- DOC: Use ``:ref:`` when referring to section headers
`[#424](numpy/numpydoc#424)
&lt;https://github.com/numpy/numpydoc/pull/424&gt;`__ (`namurphy
&lt;https://github.com/namurphy&gt;`__)
- Remove numpydoc_use_blockquotes
`[#422](numpy/numpydoc#422)
&lt;https://github.com/numpy/numpydoc/pull/422&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Require sphinx&gt;=4.2 (cleanup)
`[#421](numpy/numpydoc#421)
&lt;https://github.com/numpy/numpydoc/pull/421&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- docs: fix validation include line numbers
`[#418](numpy/numpydoc#418)
&lt;https://github.com/numpy/numpydoc/pull/418&gt;`__ (`thatlittleboy
&lt;https://github.com/thatlittleboy&gt;`__)
- Update precommit linters
`[#417](numpy/numpydoc#417)
&lt;https://github.com/numpy/numpydoc/pull/417&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- Update GH actions
`[#416](numpy/numpydoc#416)
&lt;https://github.com/numpy/numpydoc/pull/416&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
- ENH: Add support for dict show_inherited_class_members
`[#415](numpy/numpydoc#415)
&lt;https://github.com/numpy/numpydoc/pull/415&gt;`__ (`larsoner
&lt;https://github.com/larsoner&gt;`__)
- DOC: Add theme switcher and default to lightmode.
`[#414](numpy/numpydoc#414)
&lt;https://github.com/numpy/numpydoc/pull/414&gt;`__ (`rossbar
&lt;https://github.com/rossbar&gt;`__)
- Require sphinx&gt;=4.2
`[#411](numpy/numpydoc#411)
&lt;https://github.com/numpy/numpydoc/pull/411&gt;`__ (`jarrodmillman
&lt;https://github.com/jarrodmillman&gt;`__)
<p>* <em>This Changelog was automatically generated by</em>\
<code>github_changelog_generator
&amp;lt;https://github.com/github-changelog-generator/github-changelog-generator&amp;gt;</code>__
</code></pre></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/numpy/numpydoc/commit/3a8a96cda5e04ef77caa076be1fcd115e3987b62"><code>3a8a96c</code></a>
Designate 1.5.0 release</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/c6338c7607355f38c382017e5f492f50e1b44da9"><code>c6338c7</code></a>
Update doc requirements (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/441">#441</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/72e9cd4dae1d451ca24f06e0fa7a82285b381139"><code>72e9cd4</code></a>
Update pydata-sphinx-theme (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/440">#440</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/8b983feb66ffcbebebe58aa5d10fea6c2a66207f"><code>8b983fe</code></a>
Bump version</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/26cfa5847df5cdd6c0fa49c9be410fdfac2c7afe"><code>26cfa58</code></a>
Designate 1.5.0rc1 release</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/664e7144ece8f0779b18f6282ed7a42e35f130ab"><code>664e714</code></a>
Suport Python 3.11 (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/438">#438</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/4c74647afc82a1b352701a52f0f1a33891dbd3ff"><code>4c74647</code></a>
Fix front page (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/434">#434</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/ddcf0fea7a68d9f826ed863588ecc494b11d83a4"><code>ddcf0fe</code></a>
Add cached property support (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/433">#433</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/94b7a844a8ed956a2fc2f17cf0630ae54af323ea"><code>94b7a84</code></a>
Update precommit hooks (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/437">#437</a>)</li>
<li><a
href="https://github.com/numpy/numpydoc/commit/db404754f0cd7bb0927280e769bc8c9d95a2e42d"><code>db40475</code></a>
Use Python 3.10 to build docs (<a
href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/436">#436</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=numpydoc&package-manager=pip&previous-version=1.4.0&new-version=1.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants