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

O3-3776: Ensure sdk generates a content package template project #284

Merged
merged 8 commits into from
Aug 26, 2024

Conversation

mherman22
Copy link
Member

@mherman22 mherman22 commented Aug 19, 2024

Description of what I changed

Issue I worked on

see https://openmrs.atlassian.net/browse/O3-3776

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean install right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute the above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@mherman22 mherman22 requested a review from ibacher August 19, 2024 15:41
Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

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

Nice work! A few improvements to make.

I think that ideally in the test here, we'd have a reference. See here.

<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>2.2</version>
Copy link
Member

Choose a reason for hiding this comment

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

Let's update to the newest version (3.2.1)

<requiredProperty key="moduleName" />
<requiredProperty key="moduleDescription"/>
<requiredProperty key="moduleAuthor">
<defaultValue>mherman22</defaultValue>
Copy link
Member

Choose a reason for hiding this comment

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

Heh... I don't think you want this?

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requiredProperties>
<requiredProperty key="groupId">
<defaultValue>org.openmrs.module</defaultValue>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<defaultValue>org.openmrs.module</defaultValue>
<defaultValue>org.openmrs.content</defaultValue>

<requiredProperty key="moduleAuthor">
<defaultValue>mherman22</defaultValue>
</requiredProperty>
<requiredProperty key="moduleClassnamePrefix" />
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this for content packages, I don't think.

Copy link
Member Author

Choose a reason for hiding this comment

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

True that! I will add a check that skips adding that property for content-package type.

</includes>
</fileSet>
</fileSets>
</assembly>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
</assembly>
</assembly>

<groupId>org.openmrs.content</groupId>
<artifactId>content-package</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name></name>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<name></name>
<name>${moduleName}</name>

Comment on lines 3 to 5
<groupId>org.openmrs.content</groupId>
<artifactId>content-package</artifactId>
<version>1.0.0-SNAPSHOT</version>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<groupId>org.openmrs.content</groupId>
<artifactId>content-package</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>

Comment on lines 15 to 19
<scm>
<connection>scm:git:[email protected]:openmrs/openmrs-content-hiv.git</connection>
<developerConnection>scm:git:[email protected]:openmrs/openmrs-content-hiv.git</developerConnection>
<url>https://github.com/openmrs/openmrs-content-hiv.git</url>
</scm>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<scm>
<connection>scm:git:[email protected]:openmrs/openmrs-content-hiv.git</connection>
<developerConnection>scm:git:[email protected]:openmrs/openmrs-content-hiv.git</developerConnection>
<url>https://github.com/openmrs/openmrs-content-hiv.git</url>
</scm>
<scm>
<connection>scm:git:[email protected]:openmrs/openmrs-content-${artifactId}.git</connection>
<developerConnection>scm:git:[email protected]:openmrs/openmrs-content-${artifactId}.git</developerConnection>
<url>https://github.com/openmrs/openmrs-content-${artifactId}.git</url>
</scm>

@@ -269,6 +281,10 @@ private void createModule() throws MojoExecutionException {
"What is the lowest version of the Reference Application (-D%s) you want to support?", refapp, "refapp",
"2.4");
archetypeArtifactId = SDKConstants.REFAPP_ARCH_ARTIFACT_ID;
} else if (TYPE_CONTENT_PACKAGE.equals(type)) {
contentpackage = wizard.promptForValueIfMissingWithDefault("What is the lowest version of the content package (-D%s) you want to support?", contentpackage, "contentpackage",
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand what this question is prompting for?

Copy link
Member Author

Choose a reason for hiding this comment

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

It didn't make sense to me either. Was just going by the convention overthere, I can skip the prompt.

Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Oh, yeah. For other things we care about the platform version, etc. We currently don't for content packages, but maybe we should?

@mherman22 mherman22 requested a review from ibacher August 22, 2024 14:49
@ibacher
Copy link
Member

ibacher commented Aug 23, 2024

Does this need a re-review?

@mherman22
Copy link
Member Author

Does this need a re-review?

Looks ok to me

artifactId=content-package
openmrsContentPackageVersion=1.0.0
package=org.openmrs.content.content-package
version=${package.getClass().forName("java.lang.String").getConstructor($package.getClass().forName("java.lang.String")).newInstance("1.0.0-SNAPSHOT")}
Copy link
Member

Choose a reason for hiding this comment

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

We don't need the weird expression here.

Suggested change
version=${package.getClass().forName("java.lang.String").getConstructor($package.getClass().forName("java.lang.String")).newInstance("1.0.0-SNAPSHOT")}
version=1.0.0-SNAPSHOT

Copy link
Member

Choose a reason for hiding this comment

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

Is this required to get the test to pass or something?

@ibacher ibacher merged commit 58f4b90 into openmrs:master Aug 26, 2024
2 checks passed
@mherman22 mherman22 deleted the O3-3776 branch August 26, 2024 16:47
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.

2 participants