Skip to content

Commit

Permalink
chore(package): bump to 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
M0Rf30 committed Feb 28, 2022
1 parent cac6fda commit 58f5634
Show file tree
Hide file tree
Showing 57 changed files with 14,232 additions and 13,170 deletions.
91 changes: 31 additions & 60 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,47 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- "*"
tags:
- 1.*
pull_request:
branches: [ main ]
tags:
- 1.*


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
gradle:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11

# Runs a set of commands using the runners shell
- name: Build
run: |
cd packages
docker run -v $(pwd):/project packagefoundation/yap-ubuntu-bionic:latest build ubuntu-bionic .
for i in $(ls artifacts/); do sha256sum artifacts/$i >> SHA256SUMS; done
- name: version
run: echo "::set-output name=version::$(cat packages/cie-middleware/PKGBUILD | grep pkgver | cut -d\" -f2)"
id: version
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# - name: release
# uses: actions/create-release@v1
# id: create_release
# with:
# draft: false
# prerelease: false
# release_name: ${{ steps.version.outputs.version }}
# tag_name: ${{ github.ref }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
# - name: upload deb artifact
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: packages/artifacts
# asset_name: cie-middleware_1.4.2-0ubuntu1_amd64.deb
# asset_content_type: application/vnd.debian.binary-package
# - name: upload SHA
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: packages/SHA256SUMS
# asset_name: SHA256SUMS
# asset_content_type: application/text
- name: Execute Gradle build
run: |
gradle -b cie-java/build.gradle standalone
- name: Install Dependencies
run: sudo apt install -y g++ libpcsclite-dev openjdk-11-jre-headless libssl-dev pkg-config python3-pip unzip libcrypto++-dev libcrypto++6 libpcsclite1 libssl1.1 pcscd

- name: Archive production artifacts
uses: actions/upload-artifact@v2
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- run: pip install meson ninja
env:
CC: gcc
- run: meson builddir libcie-pkcs11
- run: meson configure -Dprefix=/usr builddir
- run: meson compile -C builddir
- uses: actions/upload-artifact@v1
if: failure()
with:
name: dist
path: |
packages/artifacts/*.deb
packages/artifacts/*.rpm
packages/artifacts/*.zst
packages/SHA256SUMS
name: Linux_Meson_Testlog
path: builddir/meson-logs/testlog.txt
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.VC.opendb
/cie-java/.gradle
/cie-java/bin
*.a
*.o
*.d
*.so
Expand All @@ -16,3 +17,6 @@ gradle/
.idea/
gradlew
gradlew.bat
.trunk
build/
builddir/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ distro GNU/Linux:

### Prerequisiti

Fare riferimento al file [pacur/PKGBUILD](pacur/PKGBUILD) per ottenere le
dipendenze di build-time and run-time per la propria distribuzione.
Fare riferimento al file [PKGBUILD](packages/cie-middleware/PKGBUILD) per
ottenere le dipendenze di build-time and run-time per la propria distribuzione.

È inoltre possibile trovare le istruzioni complete per costruire gli artefatti
necessari e specifici per la propria distro.
Expand All @@ -72,8 +72,8 @@ Da terminale, spostarsi nella root del presente repo e digitare:

```sh
gradle -b cie-java/build.gradle standalone
cd libcie-pkcs11/
meson builddir

meson builddir libcie-pkcs11/
meson configure -Dprefix=/usr builddir
meson compile -C builddir
```
Expand Down
8 changes: 4 additions & 4 deletions cie-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

// Apply the application plugin to add support for building a CLI application.
id 'application'
id "com.diffplug.spotless" version "6.0.0"
id "com.diffplug.spotless" version "6.3.0"
}

repositories {
Expand All @@ -23,7 +23,7 @@ spotless {
}
java {
// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp()
googleJavaFormat('1.14.0').aosp()
}
}

Expand All @@ -36,13 +36,13 @@ dependencies {
implementation 'com.dorkbox:ShellExecutor:1.1'
implementation 'com.dorkbox:SystemTray:4.1'
implementation 'com.dorkbox:TweenEngine:8.3'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.jgoodies:jgoodies-forms:1.9.0'
implementation 'net.java.dev.jna:jna:5.9.0'
implementation 'net.java.dev.jna:jna-platform:5.9.0'
implementation 'org.ghost4j:ghost4j:1.0.1'
implementation 'org.javassist:javassist:3.28.0-GA'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'org.slf4j:slf4j-api:1.7.36'
}

application {
Expand Down
4 changes: 3 additions & 1 deletion cie-java/src/main/com/ugos/crypt/hash/SHA1.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.ugos.crypt.hash;

/** @author Ugo Chirico <ugo.chirico@ugosweb.com> Customized and ported on J2ME */
/**
* @author Ugo Chirico <ugo.chirico@ugosweb.com> Customized and ported on J2ME
*/
public final class SHA1 {
// Length of the final hash (in bytes).
private static final int HASH_LENGTH = 20;
Expand Down
112 changes: 112 additions & 0 deletions cie-java/src/main/it/ipzs/cieid/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package it.ipzs.cieid;

import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

public class Logger {

public enum LogLevel {
NONE,
DEBUG,
INFO,
ERROR;

public static Logger.LogLevel getLevelFromInteger(Integer value) {
LogLevel logLevel = Logger.defaultLogLevel;
switch (value) {
case 0:
logLevel = NONE;
break;
case 1:
logLevel = DEBUG;
break;
case 2:
logLevel = INFO;
break;
case 3:
logLevel = ERROR;
break;
default:
throw new IllegalArgumentException("Integer value out of range");
}
return logLevel;
}
}

public static LogLevel defaultLogLevel = LogLevel.ERROR;

private LogLevel level;
private static Logger Instance;

private Logger() {}

private Logger(LogLevel logLevel) {
setLevel(logLevel);
}

private void Log(String message, LogLevel messageLevel) {
if (level.compareTo(LogLevel.NONE) > 0 && (level.compareTo(messageLevel) <= 0)) {
Write(message);
}
}

private void Write(String message) {
OffsetDateTime currentOffsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);

String currentDate = currentOffsetDateTime.format(DateTimeFormatter.ISO_LOCAL_DATE);
String logFileName = String.format("CIEID_%s.log", currentDate);
Path logFilePath = Paths.get(System.getProperty("user.home"), ".CIEPKI", logFileName);

String currentTimestamp =
currentOffsetDateTime.format(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
String timestampedMessage = String.format("%s %s\n", currentTimestamp, message);

try {
Files.write(
logFilePath,
timestampedMessage.getBytes(StandardCharsets.UTF_8),
StandardOpenOption.APPEND,
StandardOpenOption.CREATE);
} catch (Exception exception) {
System.out.print("Exception at Logger.Write() - message: " + timestampedMessage);
}
}

public static Logger getInstance() {
return getInstance(defaultLogLevel);
}

public static Logger getInstance(LogLevel logLevel) {
if (Instance == null) {
Instance = new Logger(logLevel);
}
return Instance;
}

public void Debug(String message) {
Log(String.format("[D] %s", message), LogLevel.DEBUG);
}

public void Info(String message) {
Log(String.format("[I] %s", message), LogLevel.INFO);
}

public void Error(String message) {
Log(String.format("[E] %s", message), LogLevel.ERROR);
}

public void setLevel(LogLevel level) {
this.level = level;
}

public LogLevel getLevel() {
return this.level;
}
}
Loading

0 comments on commit 58f5634

Please sign in to comment.