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

feat(#909): move to class; read from resources #943

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

l3r8yJ
Copy link

@l3r8yJ l3r8yJ commented Dec 8, 2024

Closes: #909

@volodya-lombrozo take a look, please

Copy link
Member

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@l3r8yJ Thank you for the contribution! I like the idea with the License class. Let's keep it. Moreover, you right that we need to read LICENSE.txt from resources. However, there is one significant issue with the solution you sent: we still need to keep 2 license files in the project root and in the src/main/resources. The original issue we aimed to solve were to remove this redundancy. What do you think if we will copy LICENSE.txt from the root directory to src/main/resources or to ${project.build.directory}/generated-sources as a part of Maven build process? By doing this we will be able to leave only one LICENSE.txt.

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 9, 2024

@volodya-lombrozo when I first started, I considered this approach, but at the time, it felt a bit overly complicated for this type of problem. However, I now think it makes sense, and I’ll implement it using a single file

Copy link
Member

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@l3r8yJ Most probably, you can just use the following Maven configuration:

<plugin>
  <artifactId>maven-resources-plugin</artifactId>
  <version>3.3.1</version>
  <executions>
    <execution>
      <id>copy-resources</id>
      <!-- here the phase you need -->
      <phase>compile</phase>
      <goals>
        <goal>copy-resources</goal>
      </goals>
      <configuration>
        <outputDirectory>${project.build.outputDirectory}</outputDirectory>
        <resources>
          <resource>
            <directory>${project.basedir}</directory>
            <includes>
              <include>LICENSE.txt</include>
            </includes>
          </resource>
        </resources>
      </configuration>
    </execution>
  </executions>
</plugin>

However, I haven't test it yet.

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 10, 2024

@volodya-lombrozo oh, thanks, I'll try it

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 10, 2024

@volodya-lombrozo it worked, take a look, please

Copy link
Member

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@l3r8yJ Looks good. Just one small comment.


@Override
public String value() {
return new TextOf(new ResourceOf(this.name)).toString();
Copy link
Member

Choose a reason for hiding this comment

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

@l3r8yJ There is a potential performance issue related to this line. We will definitely use this method thousands of times. As a result, each time, we will be required to read the license from the resources, which will significantly slow down the plugin. I would suggest adding one more puzzle for this here. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

@volodya-lombrozo I think we can add some cache here

Copy link
Member

Choose a reason for hiding this comment

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

@l3r8yJ Yes, something like Sticky object from cactoos.

Copy link
Member

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@l3r8yJ Seems, there are some qulice complaints. Could you fix them please?

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 11, 2024

@volodya-lombrozo can you restart CI? I've checked another time locally mvn clean install -Pqulice:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:51 min
[INFO] Finished at: 2024-12-11T14:15:25+03:00
[INFO] ------------------------------------------------------------------------

@volodya-lombrozo
Copy link
Member

@volodya-lombrozo can you restart CI? I've checked another time locally mvn clean install -Pqulice:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:51 min
[INFO] Finished at: 2024-12-11T14:15:25+03:00
[INFO] ------------------------------------------------------------------------

@l3r8yJ Shure, I've restarted them. Have you tried to run the same command using Java 8? Maybe it's something specific to the Java version.

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 12, 2024

@volodya-lombrozo can you check it with Java 8 on your environment? I'm getting an infinite build. Also, we can temporary turn off Java 8 on CI and add the puzzle to return it back, wdyt?

@volodya-lombrozo
Copy link
Member

volodya-lombrozo commented Dec 13, 2024

@volodya-lombrozo can you check it with Java 8 on your environment? I'm getting an infinite build. Also, we can temporary turn off Java 8 on CI and add the puzzle to return it back, wdyt?

@l3r8yJ It would be the best option. Would you be able to disable it in this PR then?

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 13, 2024

@volodya-lombrozo sure

@l3r8yJ
Copy link
Author

l3r8yJ commented Dec 18, 2024

@volodya-lombrozo added a puzzle, take a look, please

Copy link
Member

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@l3r8yJ Seems, there is one more problem with pipelines. Some of them are failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DirectivesProgram.java:132-136: Retrieve License From The...
2 participants