Skip to content

Commit

Permalink
TASKS-510 - Add content package builds to each config project (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton authored Dec 17, 2024
1 parent c33709a commit bdebb69
Show file tree
Hide file tree
Showing 3 changed files with 285 additions and 0 deletions.
16 changes: 16 additions & 0 deletions content/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<assembly>
<id>assemble-content</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/package/</directory>
<includes>
<include>**/*</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
265 changes: 265 additions & 0 deletions content/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
<project>

<modelVersion>4.0.0</modelVersion>
<groupId>org.pih.openmrs</groupId>
<artifactId>zl-content</artifactId>
<name>ZL OpenMRS Content Package</name>
<description>Top-Level content package for ZL OpenMRS distro</description>
<version>1.56.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<pihemrContentGroupId>org.pih.openmrs</pihemrContentGroupId>
<pihemrContentArtifactId>pihemr-content</pihemrContentArtifactId>
<pihemrContentVersion>1.0.0-SNAPSHOT</pihemrContentVersion>

<parentBuildDir>${project.build.directory}/parent</parentBuildDir>
<childBuildDir>${project.build.directory}/child</childBuildDir>
<parentConfigDir>${parentBuildDir}/configuration</parentConfigDir>
<childConfigDir>${childBuildDir}/configuration</childConfigDir>
<finalBuildDir>${project.build.directory}/package</finalBuildDir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<developers>
<developer>
<name>Partners In Health</name>
</developer>
</developers>

<organization>
<name>Partners In Health</name>
<url>http://pih.org</url>
</organization>

<dependencies>
<dependency>
<groupId>${pihemrContentGroupId}</groupId>
<artifactId>${pihemrContentArtifactId}</artifactId>
<version>${pihemrContentVersion}</version>
<type>zip</type>
</dependency>
</dependencies>

<build>
<plugins>

<!-- Download and unpack the parent content package into target/parent -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>unpack</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<includeGroupIds>${pihemrContentGroupId}</includeGroupIds>
<includeArtifactIds>${pihemrContentArtifactId}</includeArtifactIds>
<outputDirectory>${parentBuildDir}</outputDirectory>
<type>jar</type>
</configuration>
</execution>
</executions>
</plugin>

<!-- Build this content package into target/child -->
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>openmrs-packager-maven-plugin</artifactId>
<version>1.9.0-SNAPSHOT</version>
<executions>
<execution>
<id>generate-properties</id>
<phase>generate-resources</phase>
<goals>
<goal>generate-resource-filters</goal>
</goals>
<configuration>
<sourceFile>../constants.yml</sourceFile>
</configuration>
</execution>
<execution>
<id>create-content-package</id>
<phase>compile</phase>
<goals>
<goal>create-content-package</goal>
</goals>
<configuration>
<sourceConfigurationDir>../configuration</sourceConfigurationDir>
<targetDir>${childBuildDir}</targetDir>
</configuration>
</execution>
</executions>
</plugin>

<!-- Merge the parent and child configuration files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="${finalBuildDir}/configuration">
<fileset dir="${parentConfigDir}"/>
</copy>
<copy todir="${finalBuildDir}/configuration" overwrite="true">
<fileset dir="${childConfigDir}"/>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>

<!-- Merge the parent and child content.properties files -->
<plugin>
<groupId>org.polago.maven.plugins</groupId>
<artifactId>merge-properties-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<outputDirectory>${finalBuildDir}</outputDirectory>
<outputFile>content.properties</outputFile>
<overwriteProperties>true</overwriteProperties>
<useBuildFilters>false</useBuildFilters>
<encoding>UTF-8</encoding>
<resources>
<resource>
<filtering>false</filtering>
<directory>${parentBuildDir}</directory>
<includes>
<include>content.properties</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>${childBuildDir}</directory>
<includes>
<include>content.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${project.basedir}/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>deployRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<!--
To deploy non-snapshot versions to Sonatype, signatures must be generated useing gpg
Note that gpg2 key must exist on Bamboo server and the key and passphrase can be
passed on the command line.
Instructions for creating a key:
https://central.sonatype.org/pages/working-with-pgp-signatures.html
Command to run: clean deploy -U -DdeployRelease -Dgpg.passphrase=*** -Dgpg.keyname=[email_address_associated_with_generated_key]
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<repositories>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/public</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://openmrs.jfrog.io/artifactory/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

</project>
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
</pluginRepository>
</pluginRepositories>

<modules>
<module>content</module>
</modules>

<build>
<filters>
<filter>${project.build.directory}/openmrs-packager-config/configuration/constants.properties</filter>
Expand Down

0 comments on commit bdebb69

Please sign in to comment.