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

refactor: create parent pom #776

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

MartinWitt
Copy link
Contributor

This PR creates a parent pom, containing all dependencies we need in all submodules. With this parent-pom we could choose to adopt a layout similar to spoon and move way less files.

@MartinWitt MartinWitt changed the title feat: create parent pom (#758) feat: create parent pom Apr 1, 2022
<version>0.0.1-SNAPSHOT</version>
<relativePath>sorald-parent</relativePath>
</parent>

<groupId>se.kth.castor</groupId>
<artifactId>sorald</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

Technically speaking, we should also change sorald to sorald-sonar or something along those lines. But I am not sure how do we handle releases then. For example, what actions to take on maven to instruct users that sorald is now sorald-sonar?

Copy link
Contributor Author

@MartinWitt MartinWitt Apr 1, 2022

Choose a reason for hiding this comment

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

I wouldn't touch the artifact name of a released artifact. This can destroy some infrastructure without a real benefit. And sorald-sonar is somewhat incorrect because it's not only sonar as analyzer.

Copy link
Member

Choose a reason for hiding this comment

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

This can destroy some infrastructure without a real benefit.

Yes, I was reluctant too.

And sorald-sonar is somewhat incorrect because it's not only sonar as analyzer.

Oh, I thought sorald-parent would eventually contain all the SPI stuff while the sorald package would be one of its service.

Copy link
Contributor Author

@MartinWitt MartinWitt Apr 1, 2022

Choose a reason for hiding this comment

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

No, the next step is to create sorald-api and sorald-sonar. The parent is only for aggregation and maven reasons there. Otherwise, we would need to deploy all new artifacts(API and sonar module) directly to maven central before we can proceed.

Copy link
Member

Choose a reason for hiding this comment

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

The parent is only for aggregation and maven reasons there.

I am not sure I understand this. Could you please elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure,

image
In this diagram, we see on the left side the current monolithic structure. We have a single component/module, Sorald. This includes sonar-lint as dependency. On the right side we see the new structure. We have multiple modules namely sorald-api, sorald-qodana, sorald-sonar and sorald.
Sorald API is the analyzer API implemented by sorald-qodana and sorald-sonar. This API is reusable for other static analyzers and contains the interfaces like StaticAnalyzer or SoraldAbstractProcessor. Sorald is the current Sorald module without the API interfaces and sonar package. Sorald has Sorald-API and Sorald-Sonar as dependency declared in its pom. Both are currently local modules. And all of them share a lot of infrastructure in their pom, like spotless config or JUnit dependency declarations. We want to avoid declaring multiple JUnit dependencies, with worst case multiple versions. Adding a parent containing all this infrastructure simplifies this.
The new folder structure looks like this:
image
We have a submodule for each analyzer and the api. The sorald src folder stays in its place. The structure is more or less like spoon, spoon-decompiler and spoon-pom.
Does this help you?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is very helpful and indeed this becomes very similar to Spoon. I just had one follow up question from the diagram. Shouldn't we decouple Sorald and Sorald API as well? In other words, Sorald should not have a direct dependency on Sorald API. As far as I understand, Sorald will eventually be a CLI and depending upon the argument it takes, it can either invoke sorald-sonar or sorald qodana.

Copy link
Contributor Author

@MartinWitt MartinWitt Apr 1, 2022

Choose a reason for hiding this comment

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

Sorald should not have a direct dependency on Sorald API.

Sorald needs the Sorald API for service loading. We load with SPI all StaticAnalyzers, and we can only load the class with a reference to it. We could decouple in more modules and event split the analyzer API more fine granular, but each split is a time investment that needs to be worth it.

As far as I understand, Sorald will eventually be a CLI and depending upon the argument it takes, it can either invoke sorald-sonar or sorald qodana.

This sounds like refactoring the CLI from Sorald to a new artifact. You are more or less talking about the red marked area I added.
image
These are new artifacts dependent on Sorald. I would start with creating the structure from the first diagram and build the lower part you mentioned in the future, after we integrated Qodana successfully. There can exist way more Sorald dependent artifacts and this is not limited to the two.

Copy link
Member

Choose a reason for hiding this comment

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

Sorald needs the Sorald API for service loading.

Oh right. I forgot that we would need references to the services defined.

There can exist way more Sorald dependent artifacts and this is not limited to the two.

Of course, let's take it step-by-step. The initial diagram and directory structure you proposed above seems nice. We should work towards it.

I will merge this PR now.

Copy link
Member

@algomaster99 algomaster99 Apr 1, 2022

Choose a reason for hiding this comment

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

@khaes-kth do check this thread out. @MartinWitt is working to split Sorald into multiple modules so that integration of more static analyzers becomes easier.

@algomaster99 algomaster99 changed the title feat: create parent pom refactor: create parent pom Apr 1, 2022
@algomaster99 algomaster99 merged commit 9f5c26c into ASSERT-KTH:spi Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants