Skip to content
Snippets Groups Projects
Commit e7de6b86 authored by viljar's avatar viljar
Browse files

Merge branch 'main' of git.app.uib.no:ii/inf101/23v/tutors/shelllab

parents 652d27c4 639fdfc0
No related branches found
No related tags found
No related merge requests found
......@@ -30,8 +30,11 @@ echo " PROJECT_VERSION: $PROJECT_VERSION" # version in pom, e.g. "1.0-SNAPSHOT"
echo "computed variables..."
CURRENT_YEAR=$(date +'%Y')
echo " CURRENT_YEAR: $CURRENT_YEAR"
PATH_TO_MAIN_CLASS="target/classes/${MAIN_CLASS//'.'//}.class"
#PATH_TO_MAIN_CLASS="target/classes/${MAIN_CLASS//'.'//}.class"
PATH_TO_MAIN_CLASS="target/classes/${APP_PACKAGE//'.'//}/"
echo " PATH_TO_MAIN_CLASS: $PATH_TO_MAIN_CLASS"
echo " pwd: "
pwd
# ------ SETUP DIRECTORIES AND FILES ----------------------------------------
# Remove previously generated java runtime and installers. Copy all required
......@@ -54,6 +57,14 @@ cp "target/${MAIN_JAR}" target/installer/input/libs/
## application.
echo "detecting required modules.."
echo "$JAVA_HOME/bin/jdeps" \
-q \
--multi-release "${JAVA_VERSION}" \
--ignore-missing-deps \
--print-module-deps \
--class-path "target/installer/input/libs/*" \
"$PATH_TO_MAIN_CLASS"
detected_modules=$("$JAVA_HOME/bin/jdeps" \
-q \
--multi-release "${JAVA_VERSION}" \
......@@ -75,6 +86,14 @@ echo " detected modules: ${detected_modules}"
# works with dependencies that are not fully modularized, yet.
echo "creating java runtime image..."
echo "$JAVA_HOME/bin/jlink" \
--strip-native-commands \
--no-header-files \
--no-man-pages \
--compress=2 \
--strip-debug \
--add-modules "${detected_modules}" \
--output target/java-runtime
"$JAVA_HOME/bin/jlink" \
--strip-native-commands \
--no-header-files \
......@@ -88,6 +107,21 @@ echo "creating java runtime image..."
# In the end we will find the package inside the target/installer directory.
echo "creating installer of type $INSTALLER_TYPE..."
echo "$JAVA_HOME/bin/jpackage" \
--type "$INSTALLER_TYPE" \
--dest target/installer \
--input target/installer/input/libs \
--name "${PROJECT_NAME}" \
--main-class "${MAIN_CLASS}" \
--main-jar "${MAIN_JAR}" \
--runtime-image target/java-runtime \
--icon "${ICON_PATH}" \
--app-version "${APP_VERSION}" \
--vendor "${APP_VENDOR}" \
--copyright "Copyright © ${CURRENT_YEAR} ${APP_VENDOR}." \
--mac-package-identifier "${APP_PACKAGE}"
# --java-options -Xmx2048m \
"$JAVA_HOME/bin/jpackage" \
--type "$INSTALLER_TYPE" \
--dest target/installer \
......
......@@ -29,7 +29,8 @@ ECHO " PROJECT_NAME: %PROJECT_NAME%"
ECHO " PROJECT_VERSION: %PROJECT_VERSION%"
ECHO "computed variables..."
SET PATH_TO_MAIN="target\classes\%MAIN_CLASS:.=\%.class"
@REM SET PATH_TO_MAIN="target\classes\%MAIN_CLASS:.=\%.class"
SET PATH_TO_MAIN="target\classes\%APP_PACKAGE:.=\%"
ECHO " PATH_TO_MAIN: %PATH_TO_MAIN%"
SET YEAR=%DATE:~6,4%
ECHO " YEAR: %YEAR%"
......
......@@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion>
<!-- Major project properties -->
<groupId>no.uib.inf101.app</groupId>
<artifactId>SamplePackagedSwingApp</artifactId>
<groupId>no.uib.inf101.terminal</groupId> <!-- must match package of Main class -->
<artifactId>INF101ShellLab</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Sample Application</name>
<name>INF101 Shell Lab</name>
<packaging>jar</packaging>
<properties>
......@@ -17,8 +17,8 @@
<java.version>17</java.version>
<!-- Properties required for packaging application as JAR and installer -->
<app.main.class>no.uib.inf101.terminal.Main</app.main.class>
<app.vendor>Torstein Strømme</app.vendor> <!-- copyright holder -->
<app.main.class>${groupId}.Main</app.main.class> <!-- name of main class -->
<app.vendor>Torstein Strømme</app.vendor> <!-- replace with your name -->
<app.version>1.0.0</app.version> <!-- version displayed in "about" -->
<app.installer.macosx.type>dmg</app.installer.macosx.type> <!-- dmg, pkg -->
<app.installer.windows.type>msi</app.installer.windows.type> <!-- msi, exe -->
......@@ -30,6 +30,7 @@
<maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version>
<maven.dependency.plugin.version>3.4.0</maven.dependency.plugin.version>
<maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
<exec.maven.plugin.version>1.6.0</exec.maven.plugin.version>
<!-- Computed properties -->
......@@ -99,6 +100,17 @@
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
......@@ -125,7 +137,7 @@
</executions>
<configuration>
<workingDirectory>${project.basedir}</workingDirectory>
<executable>./build_app_mac.sh</executable>
<executable>./make/build_app_mac.sh</executable>
<environmentVariables>
<APP_PACKAGE>${project.groupId}</APP_PACKAGE>
<ABOUT_NAME>${project.name}</ABOUT_NAME>
......@@ -168,7 +180,7 @@
</executions>
<configuration>
<workingDirectory>${project.basedir}</workingDirectory>
<executable>build_app_windows.bat</executable>
<executable>./make/build_app_windows.bat</executable>
<environmentVariables>
<APP_PACKAGE>${project.groupId}</APP_PACKAGE>
<APP_VENDOR>${app.vendor}</APP_VENDOR>
......
......@@ -13,7 +13,7 @@ public class TextAnswers {
/** In which class is the object cli refers to? */
static final String q2 = "";
/** True or false: CommandLineInterface is both a type and interface. */
/** True or false: CommandLineInterface is both a type and an interface. */
static final Boolean q3 = null;
/** True or false: DummyShell is both a class and a type. */
......
......@@ -30,7 +30,7 @@ public class TestSimpleShellEcho {
// shell.keyPressed('r');
// shell.keyPressed('\n');
//
// String expected = "$ echo foo bar \nfoo bar \n$ ";
// String expected = "$ echo foo bar\nfoo bar \n$ ";
// assertEquals(expected, shell.getScreenContent());
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment