Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Mar 4, 2024
1 parent 57e5e7f commit 9f827be
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 173 deletions.
52 changes: 20 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,29 @@ jobs:
PKGFOLDER="org/weasis/core/weasis-core-img"
TAG_VERSION=${{ env.LIB_VERSION }}
F_META="maven-metadata.xml"
cd ~/.m2/repository/${PKGFOLDER}
find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${PKGFOLDER}
cd ${REPO}/${PKGFOLDER}
xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
-u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
IFS=$'\n'
versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
if printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
:
else
xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
fi
cd ~/.m2/repository/${PKGFOLDER}-bom
find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${PKGFOLDER}-bom
cd ${REPO}/${PKGFOLDER}-bom
xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
-u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
IFS=$'\n'
versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
if printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
:
else
xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
fi
paths=($(find . -name "*.pom" -o -name "${F_META}"))
for file in ${paths[@]}; do
function update_metadata() {
cd ~/.m2/repository/${1}
find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${1}
cd ${REPO}/${1}
xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
-u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
if ! printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
fi
paths=($(find . -name "*.pom" -o -name "${F_META}"))
for file in ${paths[@]}; do
$(sha1sum "${file}" | awk '{printf $1}' > "${file}".sha1)
$(md5sum "${file}" | awk '{printf $1}' > "${file}".md5)
done
done
}
update_metadata ${PKGFOLDER}
update_metadata ${PKGFOLDER}-bom
git config user.name github-actions
git config user.email [email protected]
Expand Down
106 changes: 106 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,37 @@
<module>weasis-core-img</module>
</modules>

<licenses>
<license>
<name>Eclipse Public License v2.0</name>
<url>https://www.eclipse.org/legal/epl-v20.html</url>
<distribution>repo</distribution>
</license>
<license>
<name>Apache License v2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>

<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>mvn-repo-master</id>
<url>https://raw.github.com/nroduit/mvn-repo/master/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<dependencyManagement>
<dependencies>

Expand Down Expand Up @@ -106,6 +137,81 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M13</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
Expand Down
110 changes: 0 additions & 110 deletions weasis-core-img/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,117 +50,7 @@
<argLine>-Djava.library.path=${project.build.directory}/lib/${os-name}-${cpu-name}</argLine>
</properties>

<licenses>
<license>
<name>Eclipse Public License v2.0</name>
<url>https://www.eclipse.org/legal/epl-v20.html</url>
<distribution>repo</distribution>
</license>
<license>
<name>Apache License v2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>

<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>mvn-repo-master</id>
<url>https://raw.github.com/nroduit/mvn-repo/master/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M13</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static String getNativeLibSpecification() {
// See naming conventions at https://docs.osgi.org/reference/osnames.html
String osName = System.getProperty("os.name").toLowerCase();
String osArch = System.getProperty("os.arch").toLowerCase();

if (osName.startsWith("win")) {
// All Windows versions with a specific processor architecture (x86 or x86-64) are grouped
// under windows. If you need to make different native libraries for the Windows versions,
Expand All @@ -26,38 +27,25 @@ public static String getNativeLibSpecification() {
osName = "macosx";
} else if (osName.startsWith("linux")) {
osName = "linux";
} else if (osName.equals("symbianos")) {
osName = "epoc32";
} else if (osName.equals("hp-ux")) {
osName = "hpux";
} else if (osName.equals("os/2")) {
osName = "os2";
} else if (osName.equals("procnto")) {
osName = "qnx";
} else {
osName = osName.toLowerCase();
switch (osName) {
case "symbianos" -> osName = "epoc32";
case "hp-ux" -> osName = "hpux";
case "os/2" -> osName = "os2";
case "procnto" -> osName = "qnx";
default -> osName = osName.toLowerCase();
}
}

if (osArch.equals("x86-64")
|| osArch.equals("amd64")
|| osArch.equals("em64t")
|| osArch.equals("x86_64")) {
osArch = "x86-64";
} else if (osArch.equals("aarch64") || osArch.equals("arm64")) {
osArch = "aarch64";
} else if (osArch.equals("arm")) {
osArch = "armv7a";
} else if (osArch.equals("pentium")
|| osArch.equals("i386")
|| osArch.equals("i486")
|| osArch.equals("i586")
|| osArch.equals("i686")) {
osArch = "x86";
} else if (osArch.equals("power ppc")) {
osArch = "powerpc";
} else if (osArch.equals("psc1k")) {
osArch = "ignite";
}
osArch = switch (osArch) {
case "x86-64", "amd64", "em64t", "x86_64" -> "x86-64";
case "aarch64", "arm64" -> "aarch64";
case "arm" -> "armv7a";
case "pentium", "i386", "i486", "i586", "i686" -> "x86";
case "power ppc" -> "powerpc";
case "psc1k" -> "ignite";
default -> osArch;
};
return osName + "-" + osArch;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static boolean hasText(String str) {
/**
* Removing diacritical marks aka accents
*
* @param str
* @param str the input string
* @return the input string without accents
*/
public static String deAccent(String str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@ public static boolean writePNG(Mat source, File file) {
int elemSize = CvType.ELEM_SIZE(type);
int channels = CvType.channels(type);
int bpp = (elemSize * 8) / channels;
// TODO should test is the library can write 16 bit image
if (bpp > 16 || !CvType.isInteger(type)) {
dstImg = new Mat();
srcImg.convertTo(dstImg, CvType.CV_16SC(channels));
Expand Down

0 comments on commit 9f827be

Please sign in to comment.