Skip to content

Commit

Permalink
Ensure standard code format and license header
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliouzbett committed Nov 16, 2022
1 parent 1421b87 commit 7ce282b
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 13 deletions.
32 changes: 26 additions & 6 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,35 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
</properties>
</project>
10 changes: 9 additions & 1 deletion api/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
Expand Down
10 changes: 10 additions & 0 deletions api/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
# the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
#
# Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
# graphic logo is a trademark of OpenMRS Inc.
#

dhpevents.title=DHP Events
10 changes: 10 additions & 0 deletions api/src/main/resources/messages_es.properties
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
# the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
#
# Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
# graphic logo is a trademark of OpenMRS Inc.
#

dhpevents.title=DHP Events
10 changes: 10 additions & 0 deletions api/src/main/resources/messages_fr.properties
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
# the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
#
# Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
# graphic logo is a trademark of OpenMRS Inc.
#

dhpevents.title=DHP Events
8 changes: 8 additions & 0 deletions api/src/main/resources/moduleApplicationContext.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
Expand Down
32 changes: 32 additions & 0 deletions license-format.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<additionalHeaders>
<java_style>
<firstLine>/**</firstLine>
<beforeEachLine> * </beforeEachLine>
<endLine> */</endLine>
<firstLineDetectionPattern>(\s|\t)*/\*.*$</firstLineDetectionPattern>
<lastLineDetectionPattern>.*\*/(\s|\t)*$</lastLineDetectionPattern>
<allowBlankLines>false</allowBlankLines>
<isMultiline>true</isMultiline>
<padLines>false</padLines>
</java_style>
<myxml_style>
<firstLine><![CDATA[<!--]]></firstLine>
<beforeEachLine> </beforeEachLine>
<endLine><![CDATA[-->]]></endLine>
<skipLine><![CDATA[^<\?xml.*>$]]></skipLine>
<firstLineDetectionPattern><![CDATA[(\s|\t)*<!--.*$]]></firstLineDetectionPattern>
<lastLineDetectionPattern><![CDATA[.*-->(\s|\t)*$]]></lastLineDetectionPattern>
<allowBlankLines>false</allowBlankLines>
<isMultiline>true</isMultiline>
<padLines>false</padLines>
</myxml_style>
</additionalHeaders>
7 changes: 7 additions & 0 deletions license-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.

Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
31 changes: 25 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,31 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>directories</id>
<goals>
<goal>highest-basedir</goal>
</goals>
<phase>validate</phase>
<configuration>
<property>main.basedir</property>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<header>..${file.separator}license-header.txt</header>
<header>${main.basedir}${file.separator}license-header.txt</header>
<headerDefinitions>
<headerDefinition>..${file.separator}license-format.xml</headerDefinition>
<headerDefinition>${main.basedir}${file.separator}license-format.xml</headerDefinition>
</headerDefinitions>
<mapping>
<java>JAVA_STYLE</java>
Expand All @@ -105,6 +122,7 @@
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>license-format.xml</exclude>
<exclude>**/pom.xml</exclude>
<exclude>**/target/**</exclude>
<exclude>.git/**</exclude>
Expand All @@ -117,9 +135,9 @@
</configuration>
<executions>
<execution>
<id>check-license</id>
<id>add-license</id>
<goals>
<goal>check</goal>
<goal>format</goal>
</goals>
<phase>validate</phase>
</execution>
Expand All @@ -128,7 +146,7 @@
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.11.0</version>
<version>2.13.0</version>
<configuration>
<lineEnding>LF</lineEnding>
<configFile>eclipse/OpenMRSFormatter.xml</configFile>
Expand All @@ -151,7 +169,7 @@
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.3.2</version>
<version>1.5.0</version>
<configuration>
<groups>javax, java, *</groups>
<removeUnused>true</removeUnused>
Expand All @@ -169,6 +187,7 @@
</build>

<properties>
<main.basedir>${project.basedir}</main.basedir>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 7ce282b

Please sign in to comment.