Skip to content
Open
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
62 changes: 31 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: JavaFX Build (Gradle)
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Make Gradle executable
run: chmod +x gradlew
- name: Build using Gradle
run: ./gradlew clean build
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: satyam-consignment
name: JavaFX Build (Gradle)

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Make Gradle executable
run: chmod +x gradlew

- name: Build using Gradle
run: ./gradlew clean build

- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: OpenConsignment
path: build/libs/*
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies {
implementation(libs.javafx.graphics)
implementation(libs.javafx.fxml)

implementation(libs.jgit)

compileOnly(libs.lombok)
annotationProcessor(libs.lombok)

Expand Down
113 changes: 58 additions & 55 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
[versions]
javafx = "17.0.18"
controlsfx = "11.2.2"
jasperreports = "6.21.5"
sqlite = "3.34.0"
olap4j = "1.2.0"
#itext = "2.1.7"
lombok = "1.18.20"
dagger = "2.52"
testfx = "4.0.18"
testfxCore = "4.0.17"
monocle = "17.0.10"
hamcrest = "2.2"
#junit = "5.10.1"
junitbom = "5.10.2"
[versions]
javafx = "17.0.18"
controlsfx = "11.2.2"
jasperreports = "6.21.5"
sqlite = "3.34.0"
olap4j = "1.2.0"
#itext = "2.1.7"
lombok = "1.18.20"
dagger = "2.52"
testfx = "4.0.18"
testfxCore = "4.0.17"
monocle = "17.0.10"
hamcrest = "2.2"
#junit = "5.10.1"
junitbom = "5.10.2"
mockito = "5.14.2"
slf4j = "2.0.17"
log4j = "2.24.3"
snakeyaml = "2.3"

spotless = "7.0.2"
shadow = "7.1.2"
javafxPlugin = "0.1.0"

[libraries]
controlsfx = { module = "org.controlsfx:controlsfx", version.ref = "controlsfx" }
jasperreports = { module = "net.sf.jasperreports:jasperreports", version.ref = "jasperreports" }
sqlite = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
jgit = "7.8.1.202611041320-r"

spotless = "7.0.2"
shadow = "7.1.2"
javafxPlugin = "0.1.0"

[libraries]
controlsfx = { module = "org.controlsfx:controlsfx", version.ref = "controlsfx" }
jasperreports = { module = "net.sf.jasperreports:jasperreports", version.ref = "jasperreports" }
sqlite = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
olap4j = { module = "org.olap4j:olap4j", version.ref = "olap4j" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
snakeyaml = { module = "org.yaml:snakeyaml", version.ref = "snakeyaml" }
log4j-slf4j2-impl = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j" }
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
#itext = { module = "com.lowagie:itext", version.ref = "itext" }

javafx-controls = { module = "org.openjfx:javafx-controls", version.ref = "javafx" }
javafx-base = { module = "org.openjfx:javafx-base", version.ref = "javafx" }
javafx-graphics = { module = "org.openjfx:javafx-graphics", version.ref = "javafx" }
javafx-fxml = { module = "org.openjfx:javafx-fxml", version.ref = "javafx" }

lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }

dagger = { module = "com.google.dagger:dagger", version.ref = "dagger" }
dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" }

testfx-junit5 = { module = "org.testfx:testfx-junit5", version.ref = "testfx" }
testfx-core = { module = "org.testfx:testfx-core", version.ref = "testfxCore" }
testfx-monocle = { module = "org.testfx:openjfx-monocle", version.ref = "monocle" }

hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }

#junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
#junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junitbom" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }

mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }

[plugins]
javafx = { id = "org.openjfx.javafxplugin", version.ref = "javafxPlugin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
#shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
#itext = { module = "com.lowagie:itext", version.ref = "itext" }

javafx-controls = { module = "org.openjfx:javafx-controls", version.ref = "javafx" }
javafx-base = { module = "org.openjfx:javafx-base", version.ref = "javafx" }
javafx-graphics = { module = "org.openjfx:javafx-graphics", version.ref = "javafx" }
javafx-fxml = { module = "org.openjfx:javafx-fxml", version.ref = "javafx" }

jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit"}

lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }

dagger = { module = "com.google.dagger:dagger", version.ref = "dagger" }
dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" }

testfx-junit5 = { module = "org.testfx:testfx-junit5", version.ref = "testfx" }
testfx-core = { module = "org.testfx:testfx-core", version.ref = "testfxCore" }
testfx-monocle = { module = "org.testfx:openjfx-monocle", version.ref = "monocle" }

hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }

#junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
#junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junitbom" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }

mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }

[plugins]
javafx = { id = "org.openjfx.javafxplugin", version.ref = "javafxPlugin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
#shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
9 changes: 9 additions & 0 deletions scripts/configure-backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,22 @@ def init_github_repository():
return
github_username = "drcbabu81"
repo_url = f"git@github.com:{github_username}/{repo_name}.git"
repo_url_https = f"https://github.com/{github_username}/{repo_name}.git"

try:
logger.info(f"cloning {repo_name}")
subprocess.run(
["git", "clone", repo_url], check=True, capture_output=True, text=True
)

repo_path = os.path.abspath(repo_name)

subprocess.run(
["git", "remote", "add", "origin-https", repo_url_https],
cwd=repo_path,
check=True, capture_output=True, text=True
)

if (Path(repo_name) / ".git").is_dir():
logger.info("clone successful")
else:
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/openconsignment/common/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,32 @@
@Setter
@NoArgsConstructor
public class AppConfig {
private String organizationName;
private String organization;
private String year;
private Github github;

public static AppConfig forOrganization(String organizationName) {
AppConfig configuration = new AppConfig();
configuration.setOrganizationName(organizationName);
configuration.setOrganization(organizationName);
configuration.validate();
return configuration;
}

public String organizationName() {
return organizationName;
@Getter
@Setter
@NoArgsConstructor
public static class Github {
private String repository;
private String token;
private String username;
private String branch;
private String remote;
}

public void validate() {
if (organizationName == null || organizationName.isBlank()) {
throw new IllegalArgumentException("organizationName must not be blank");
if (organization == null || organization.isBlank()) {
throw new IllegalArgumentException("organization must not be blank");
}
organizationName = organizationName.strip();
organization = organization.strip();
}
}
20 changes: 20 additions & 0 deletions src/main/java/openconsignment/common/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.HexFormat;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -118,4 +123,19 @@ public static String nextVoucherNumber(String lastVoucher) {
return "0";
}
}

public static String md5sum(Path path) throws Exception {
MessageDigest digest = MessageDigest.getInstance("MD5");

try (InputStream input = Files.newInputStream(path)) {
byte[] buffer = new byte[8192];
int bytesRead;

while ((bytesRead = input.read(buffer)) != -1) {
digest.update(buffer, 0, bytesRead);
}
}

return HexFormat.of().formatHex(digest.digest());
}
}
Loading
Loading