Skip to content

100 update GitHub actions to export with javafx compatibility #101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/buildOnRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ jobs:
- name: Set versioned JAR name
run: |
$tag = "${{ github.ref_name }}"
echo "JAR_NAME=APPLICATION-$tag.jar" >> $env:GITHUB_ENV
echo "JAR_NAME=MillionsG40-$tag.jar" >> $env:GITHUB_ENV
- name: Rename JAR
run: mv target/*.jar $env:JAR_NAME
run: mv target/*-shaded.jar $env:JAR_NAME


- uses: softprops/action-gh-release@v1
with:
Expand Down
25 changes: 24 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>edu.ntnu.idi.idatt2003.g40.mappe</groupId>
<artifactId>mappe</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.0.0</version>

<properties>
<maven.compiler.source>25</maven.compiler.source>
Expand Down Expand Up @@ -39,6 +39,29 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>edu.ntnu.idi.idatt2003.g40.mappe.Launcher</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package edu.ntnu.idi.idatt2003.g40.mappe;

public class Launcher {
static void main(String[] args) {
Main.main(args);
}
}
6 changes: 5 additions & 1 deletion src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
* */
public class Main extends Application {

static void main(String[] args) {
launch(args);
}

/**
* {@inheritDoc}
* */
Expand All @@ -57,7 +61,7 @@ public void start(final Stage stage) throws Exception {
ViewManager viewManager = new ViewManager(stage, eventManager);

List<Stock> stocksInFile;
FileParser parser1 = new FileParser("src/main/resources/dummydata.txt");
FileParser parser1 = new FileParser("/dummydata.txt");

FileConverter converter1 = new FileConverter();
stocksInFile = converter1.getStocksFromStrings(parser1.readFile());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package edu.ntnu.idi.idatt2003.g40.mappe.service;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -120,8 +119,8 @@ public FileParser(final String pathName) {
* */

public List<String> readFile() throws IOException {
Path path = Paths.get(pathName);
try (BufferedReader bufferedReader = Files.newBufferedReader(path)) {
try (InputStream inputStream = getClass().getResourceAsStream(pathName);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {

List<String> allLines = bufferedReader.readAllLines();
List<String> readableLines =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

class FileParserTest {

private final String testStockDataPath = "src/main/resources/testStockData.txt";
private final String testStockDataPath = "/testStockData.txt";

private final String absoluteTestStockDataPath = "src/main/resources/testStockData.txt";
FileParser fileParser;

private final String validStockFromFile = "NVID, Nvidida Corporation, 241.591";
Expand All @@ -29,7 +31,7 @@ class FileParserTest {
@BeforeEach
void setUp() throws Exception {
fileParser = new FileParser(testStockDataPath);
Path path = Paths.get(testStockDataPath);
Path path = Paths.get(absoluteTestStockDataPath);
allLines = Files.readAllLines(path);
try {
validStocks = fileParser.readFile();
Expand Down