automatically generate dist files with correct version number - fixes #262

Tue, 12 Sep 2023 22:42:12 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 12 Sep 2023 22:42:12 +0200
changeset 50
d26da280c934
parent 49
68cc8e282a26
child 51
5c12e9e29733

automatically generate dist files with correct version number - fixes #262

.hgignore file | annotate | diff | comparison | revisions
dist.src/bin/uwproj file | annotate | diff | comparison | revisions
dist.src/install.sh file | annotate | diff | comparison | revisions
dist/bin/uwproj file | annotate | diff | comparison | revisions
dist/install.sh file | annotate | diff | comparison | revisions
pom.xml file | annotate | diff | comparison | revisions
--- a/.hgignore	Tue Sep 12 22:34:02 2023 +0200
+++ b/.hgignore	Tue Sep 12 22:42:12 2023 +0200
@@ -2,3 +2,4 @@
 ^nb-configuration.xml$
 ^target/.*$
 ^.idea/
+^dist/.*$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dist.src/bin/uwproj	Tue Sep 12 22:42:12 2023 +0200
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+PREFIX=%%PREFIX%%
+
+java -jar $PREFIX/lib/uwproj/uwproj-${project.version}.jar "$@"
+if [ $? -eq 0 ]; then
+	chmod +x configure
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dist.src/install.sh	Tue Sep 12 22:42:12 2023 +0200
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+PREFIX=/usr/local
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [PREFIX=<path>]"
+	echo
+	echo "Default PREFIX: /usr/local"
+}
+
+# error function
+exit_on_error()
+{
+  echo "$1"
+  exit 1
+}
+
+#
+# parse arguments 
+#
+for arg in "$@"
+do
+    case "$arg" in
+		"PREFIX="*)         PREFIX=${arg#PREFIX=} ;;
+		"--help"*)          printhelp; exit 1 ;;
+		"-"*) echo "unknown option: $arg"; exit 1 ;;
+	esac
+done
+
+#
+# create install dir
+#
+echo "mkdir -p $PREFIX/lib/uwproj $PREFIX/bin"
+mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \
+  || exit_on_error "Creating install directory failed."
+
+#
+# install the JAR file
+#
+echo "cp ../target/uwproj-${project.version}-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-${project.version}.jar"
+cp "../target/uwproj-${project.version}-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-${project.version}.jar" \
+  || exit_on_error "Installing JAR file failed."
+
+#
+# create a run script in the bin dir
+#
+echo "cp bin/uwproj $PREFIX/bin"
+sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" \
+  || exit_on_error "Creating run script failed."
+
+echo "chmod 0555 $PREFIX/bin/uwproj"
+chmod 0755 "$PREFIX/bin/uwproj" \
+  || exit_on_error "Changing permissions for run script failed."
+
+echo
+echo "uwproj has been successfully installed."
--- a/dist/bin/uwproj	Tue Sep 12 22:34:02 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-PREFIX=%%PREFIX%%
-
-java -jar $PREFIX/lib/uwproj/uwproj-0.1.jar "$@"
-if [ $? -eq 0 ]; then
-	chmod +x configure
-fi
--- a/dist/install.sh	Tue Sep 12 22:34:02 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#!/bin/sh
-
-PREFIX=/usr/local
-
-# help text
-printhelp()
-{
-	echo "Usage: $0 [PREFIX=<path>]"
-	echo
-	echo "Default PREFIX: /usr/local"
-}
-
-# error function
-exit_on_error()
-{
-  echo "$1"
-  exit 1
-}
-
-#
-# parse arguments 
-#
-for arg in "$@"
-do
-    case "$arg" in
-		"PREFIX="*)         PREFIX=${arg#PREFIX=} ;;
-		"--help"*)          printhelp; exit 1 ;;
-		"-"*) echo "unknown option: $arg"; exit 1 ;;
-	esac
-done
-
-#
-# create install dir
-#
-echo "mkdir -p $PREFIX/lib/uwproj $PREFIX/bin"
-mkdir -p "$PREFIX/lib/uwproj" "$PREFIX/bin" \
-  || exit_on_error "Creating install directory failed."
-
-#
-# install the JAR file
-#
-echo "cp ../target/uwproj-0.1-jar-with-dependencies.jar $PREFIX/lib/uwproj/uwproj-0.1.jar"
-cp "../target/uwproj-0.1-jar-with-dependencies.jar" "$PREFIX/lib/uwproj/uwproj-0.1.jar" \
-  || exit_on_error "Installing JAR file failed."
-
-#
-# create a run script in the bin dir
-#
-echo "cp bin/uwproj $PREFIX/bin"
-sed "s:%%PREFIX%%:$PREFIX:g" "bin/uwproj" > "$PREFIX/bin/uwproj" \
-  || exit_on_error "Creating run script failed."
-
-echo "chmod 0555 $PREFIX/bin/uwproj"
-chmod 0755 "$PREFIX/bin/uwproj" \
-  || exit_on_error "Changing permissions for run script failed."
-
-echo
-echo "uwproj has been successfully installed."
--- a/pom.xml	Tue Sep 12 22:34:02 2023 +0200
+++ b/pom.xml	Tue Sep 12 22:42:12 2023 +0200
@@ -4,7 +4,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>de.unixwork</groupId>
     <artifactId>uwproj</artifactId>
-    <version>0.1</version>
+    <version>0.1-SNAPSHOT</version>
     <packaging>jar</packaging>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -32,6 +32,13 @@
         </dependency>
     </dependencies>
     <build>
+        <resources>
+            <resource>
+                <directory>dist.src</directory>
+                <filtering>true</filtering>
+                <targetPath>../../dist</targetPath>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

mercurial