Skip to content

Commit

Permalink
[TF-239] Update java version to 19 and gradle to 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjunjiezhao committed Apr 20, 2023
1 parent f888eda commit 16ff420
Show file tree
Hide file tree
Showing 30 changed files with 207 additions and 170 deletions.
30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: com.github.kt3k.coveralls
versions:
- "> 2.8.2"
- dependency-name: commons-codec:commons-codec
versions:
- "> 1.6"
- dependency-name: net.nemerosa.versioning
versions:
- "> 2.7.1"
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: com.github.kt3k.coveralls
versions:
- "> 2.12.2"
- dependency-name: commons-codec:commons-codec
versions:
- "> 1.6"
- dependency-name: net.nemerosa.versioning
versions:
- "> 2.7.1"
44 changes: 22 additions & 22 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Gradle Package
on:
push:
branches:
- '**'
- "**"
tags:
- '**'
- "**"
release:
types: [created]

Expand All @@ -17,27 +17,27 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
- uses: actions/checkout@v2
- name: Set up JDK 19
uses: actions/setup-java@v2
with:
java-version: "19"
distribution: "adopt"
server-id: github
settings-path: ${{ github.workspace }}

- name: Display bradle version
run: ./gradlew versionDisplay
- name: Display bradle version
run: ./gradlew versionDisplay

- name: Build with Gradle
run: ./gradlew build
- name: Build with Gradle
run: ./gradlew build

- name: Gradle report
run: ./gradlew jacocoTestReport coveralls
- name: Gradle report
run: ./gradlew jacocoTestReport coveralls

- name: Publish to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: ./gradlew publish
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: ./gradlew publish
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java adoptopenjdk-19.0.2+7
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).

## Unrelased

* [TF-239] Update java version to 19 and gradle version to 8.1

## 1.8.0

* [TT-11417] Implemented adjustable margin sizes in TicketPageSettings
Expand Down
38 changes: 24 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ plugins {
id "com.jfrog.bintray" version "1.8.5"
id "maven-publish"
id 'java-library'
id 'net.nemerosa.versioning' version '2.7.1'
id 'net.nemerosa.versioning' version '3.0.0'
id 'jacoco'
id 'checkstyle'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.github.kt3k.coveralls' version '2.12.2'
}
group = 'au.com.sealink'

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.encoding = 'UTF-8'
}

jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
xml.required.set(true) // coveralls plugin depends on xml format report
html.required.set(true)
}
}

Expand All @@ -44,22 +44,34 @@ checkstyle {
toolVersion = '8.1'
}

checkstyle {
configProperties = [
'allowStaticMemberImports': 'true'
]
}

repositories {
google()
mavenCentral()
jcenter()
}

dependencies {
compile group: 'commons-codec', name: 'commons-codec', version:'1.6'
testCompile 'junit:junit:4.13.2'
implementation group: 'commons-codec', name: 'commons-codec', version:'1.15'
testImplementation 'junit:junit:4.13.2'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

task versionInfo {
doLast {
println "Version: ${project.version}"
}
}

artifacts {
archives sourcesJar
}
Expand Down Expand Up @@ -89,9 +101,7 @@ publishing {
publications {
mavenPublication(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact sourcesJar
groupId 'au.com.sealink'
artifactId 'printing'
version project.version
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package au.com.sealink.printing.receipt;

import au.com.sealink.printing.receipt.*;
import au.com.sealink.printing.ticket_printer.Justification;
import au.com.sealink.printing.ticket_printer.Underline;
import au.com.sealink.printing.ticketprinter.Justification;
import au.com.sealink.printing.ticketprinter.Underline;

import java.awt.image.BufferedImage;
import java.io.IOException;
Expand Down Expand Up @@ -74,7 +74,7 @@ public void close() throws IOException {

@Override
public IPrinter cut(CutMode mode) throws IOException {
switch(mode) {
switch (mode) {
case PARTIAL:
getConnector().write(PAPER_PART_CUT);
break;
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/au/com/sealink/printing/receipt/IPrinter.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
package au.com.sealink.printing.receipt;

import au.com.sealink.printing.ticket_printer.Justification;
import au.com.sealink.printing.ticket_printer.Underline;

import au.com.sealink.printing.ticketprinter.Justification;
import au.com.sealink.printing.ticketprinter.Underline;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;

public interface IPrinter {
OutputStream getConnector();

IPrinter initialise() throws IOException;

void close() throws IOException;

IPrinter cut(CutMode mode) throws IOException;

IPrinter feed(int numberOfLines) throws IOException;

IPrinter feed() throws IOException;

IPrinter text(String text) throws IOException;

IPrinter setFont(Font font) throws IOException;

IPrinter setMode(PrintMode mode) throws IOException;

IPrinter setUnderline(Underline mode) throws IOException;

IPrinter setDoubleWidth(Boolean isEnabled) throws IOException;

IPrinter setDoubleHeight(Boolean isEnabled) throws IOException;

IPrinter setJustification(Justification justification) throws IOException;

IPrinter setColour(Colour colour) throws IOException;

IPrinter setEmphasis(Boolean isEnabled) throws IOException;

IPrinter printImage(BufferedImage image) throws IOException;
}
8 changes: 6 additions & 2 deletions src/main/java/au/com/sealink/printing/receipt/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ public byte[] recollectSlice(int y, int x, int[][] img) {

private boolean shouldPrintColor(int col) {
final int threshold = 127;
int a, r, g, b, luminance;
int a;
int r;
int g;
int b;
int luminance;
a = (col >> 24) & 0xff;
if (a != 0xff) {// Ignore transparencies
if (a != 0xff) { // Ignore transparencies
return false;
}
r = (col >> 16) & 0xff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

public enum FontStyle {
Bold, Italic, Inverted
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

public enum Justification {
LEFT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import au.com.sealink.printing.ticketprinter.exceptions.NoSuchPrinterException;
import java.awt.print.PrinterJob;
import javax.print.PrintService;
import au.com.sealink.printing.ticket_printer.exceptions.NoSuchPrinterException;


public class PrintServiceLocator {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import au.com.sealink.printing.receipt.CutMode;
import au.com.sealink.printing.receipt.EpsonPrinter;
import au.com.sealink.printing.ticket_printer.exceptions.NoSuchPrinterException;
import au.com.sealink.printing.ticketprinter.exceptions.NoSuchPrinterException;
import au.com.sealink.printing.utils.ImageLoader;

import javax.print.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.print.*;

public class ReceiptPrinter {
private final PrintService printer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import java.util.EnumSet;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import au.com.sealink.printing.utils.NumberConverter;
import java.awt.print.PageFormat;
import java.awt.print.Paper;

import au.com.sealink.printing.utils.NumberConverter;

public class TicketPageSettings {

private double width; // = 87f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

import au.com.sealink.printing.ticketprinter.exceptions.NoSuchPrinterException;
import au.com.sealink.printing.ticketprinter.exceptions.NoTicketPageSettingsAssigned;
import au.com.sealink.printing.ticketprinter.printables.PrintableTickets;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.util.List;
import javax.print.PrintService;

import au.com.sealink.printing.ticket_printer.exceptions.NoSuchPrinterException;
import au.com.sealink.printing.ticket_printer.exceptions.NoTicketPageSettingsAssigned;
import au.com.sealink.printing.ticket_printer.printables.PrintableTickets;

/*
* TicketPrintCommand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer;
package au.com.sealink.printing.ticketprinter;

public enum Underline {
None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer.exceptions;
package au.com.sealink.printing.ticketprinter.exceptions;

public class NoSuchPrinterException extends Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package au.com.sealink.printing.ticket_printer.exceptions;
package au.com.sealink.printing.ticketprinter.exceptions;

public class NoTicketPageSettingsAssigned extends Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package au.com.sealink.printing.ticket_printer.printables;
package au.com.sealink.printing.ticketprinter.printables;

import au.com.sealink.printing.ticketprinter.TicketElement;
import java.awt.Graphics2D;

import au.com.sealink.printing.ticket_printer.TicketElement;

public abstract class PrintableElement {

TicketElement element;
Expand Down
Loading

0 comments on commit 16ff420

Please sign in to comment.