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-3511: Content package to create zip file #1

Merged
merged 15 commits into from
Aug 15, 2024
Merged
24 changes: 24 additions & 0 deletions assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3
http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>assemble-content</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>content.properties</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/configs</directory>
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
<directory>${project.basedir}/configs</directory>
<directory>${project.basedir}/configs</directory>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a change suggested here?

Copy link
Member

Choose a reason for hiding this comment

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

Removing whitespace

<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
nravilla marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
34 changes: 26 additions & 8 deletions content.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
#name=Ref 3.x distro
#version=3.0.0
#war.openmrs=2.6.1-SNAPSHOT
omod.fhir2=1.9.0
omod.webservices.rest=2.40.0-SNAPSHOT
spa.frontendModules.@ohri/openmrs-esm-ohri-hiv-care-treatment-app=latest
spa.frontendModules.@ohri/openmrs-esm-ohri-core-app=latest
#spa.frontendModules.@openmrs/esm-primary-navigation-app=next
# content.properties - Metadata for the content package and its dependencies

# The name of this content package
name=openmrs-content-hiv
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=openmrs-content-hiv
name=hiv

Copy link
Member

Choose a reason for hiding this comment

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

Ideally, however, this would be populated from the POM directly:

Suggested change
name=openmrs-content-hiv
name=${project.artifactId}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The above recommended change has been implemented, I don't know much about the data in content.properties, Amos will be responsible for the data. i just have name and version for the time being.


# The version of this content package (must follow SemVer)
version=1.0.0-SNAPSHOT

# Dependencies (specified in a format similar to distro.properties)

# OMOD modules with their SemVer range
omod.fhir2=1.0.0-SNAPSHOT
omod.reporting=^2.0.0

# SPA modules with their SemVer range
spa.frontendModules.@openmrs/esm-login-app=^3.0.0
spa.frontendModules.@openmrs/esm-patient-chart=^1.0.0
Copy link
Member

Choose a reason for hiding this comment

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

Although this is good for demo purposes, I don't think we need this here.


# Additional dependencies can be listed here
# omod.another-module=^X.X.X
# spa.frontendModules.@openmrs/esm-another-app=^X.X.X

# Ensure to follow SemVer ranges when specifying versions
# For example:
# - ^1.0.0 means compatible with 1.0.0 including patch updates
# - ~1.2.3 means compatible with 1.2.x but not 1.3.0
nravilla marked this conversation as resolved.
Show resolved Hide resolved
91 changes: 84 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,86 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openmrs</groupId>
<artifactId>openmrs-content-hiv</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Archetype - openmrs-content-hiv</name>
<url>http://maven.apache.org</url>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openmrs.content</groupId>
Copy link
Member

Choose a reason for hiding this comment

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

The formatting here is a little inconsistent using both spaces and tabs. Could we stick to one please?

<artifactId>openmrs-content-hiv</artifactId>
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
<artifactId>openmrs-content-hiv</artifactId>
<artifactId>hiv</artifactId>

<version>1.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.

As discussed:

Suggested change
<version>1.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>

<name>OpenMRS HIV Content Package</name>
<packaging>pom</packaging>
<developers>
<developer>
<name>OpenMRS</name>
<organization>OpenMRS</organization>
<organizationUrl>http://openmrs.org</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:openmrs/openmrs-content-hiv.git</connection>
<developerConnection>scm:git:git@github.com:openmrs/openmrs-content-hiv.git</developerConnection>
<url>https://github.com/openmrs/openmrs-content-hiv.git</url>
<tag>HEAD</tag>
</scm>
<dependencies>
<dependency>
ibacher marked this conversation as resolved.
Show resolved Hide resolved
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>openmrs-packager-maven-plugin</artifactId>
<version>1.8.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>openmrs-packager-maven-plugin</artifactId>
<version>1.8.0-SNAPSHOT</version>
<executions>
<execution>
<id>validate-assemble</id>
<phase>package</phase>
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
<phase>package</phase>
<phase>package</phase>

Copy link
Member

Choose a reason for hiding this comment

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

I also think this should probably be run in the verify phase rather than the package phase. Technically, that comes after the Zip is generated, but in production usage, we're doing to be running the deploy phase to publish this, and that will block that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done! updated it to verify phase instead of package phase.

<configuration>
<sourceFile>{project.basedir}/content.properties</sourceFile>
</configuration>
<goals>
<goal>validate-assemble</goal>
</goals>
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
<goals>
<goal>validate-assemble</goal>
</goals>
<goals>
<goal>validate-assemble</goal>
</goals>

</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
Copy link
Member

Choose a reason for hiding this comment

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

We should always use the latest version available, if possible.

Suggested change
<version>3.3.0</version>
<version>3.7.1</version>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>${project.basedir}/assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<!-- Ensure this is set to false -->
Copy link
Member

Choose a reason for hiding this comment

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

It'd likely be nice to have a why for this comment, but at least it should go with the right part.

Suggested change
<appendAssemblyId>false</appendAssemblyId>
<!-- Ensure this is set to false -->
<!-- Ensure this is set to false -->
<appendAssemblyId>false</appendAssemblyId>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added a comment, at the top instead of bottom.

<finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>openmrs-repo-releases</id>
<name>OpenMRS Nexus Releases</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>openmrs-repo-snapshots</id>
<name>OpenMRS Nexus Snapshots</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>