diff --git a/.classpath b/.classpath deleted file mode 100644 index cbaecb5..0000000 --- a/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.gitattributes b/.gitattributes index 5e2b2de..097f9f9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,32 +1,9 @@ -# See https://help.github.com/articles/dealing-with-line-endings/ -# Set the default behavior, in case people don't have core.autocrlf set. -* text=auto +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf -# Explicitly declare text files you want to always be normalized and converted -# to native line endings on checkout. -*.java text -*.properties text -*.js text -*.html text -*.css text -*.svg text -*.xml text -*.txt text -LICENSE text +# These are Windows script files and should use crlf +*.bat text eol=crlf -# Declare files that will always have LF line endings on checkout. -# MANIFEST may have any line endings but we prefer the same on all platforms -*.MF text eol=lf -# Same with .git* files -.git* text eol=lf - -# Denote all files that are truly binary and should not be modified. -*.jar binary -*.png binary -*.jpg binary -*.gif binary -*.eot binary -*.ttf binary -*.woff binary -*.woff2 binary -*.pdf binary diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml deleted file mode 100644 index b7d24ec..0000000 --- a/.github/workflows/ant.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - -on: - push: - branches: - - main - - dev/pitc-* - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - - name: Build with Ant - run: ant -noinput -buildfile build.xml build - - name: Run tests with Ant - run: ant -noinput -buildfile build.xml test diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd36ab9..da87164 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: runTests: description: 'Run tests' required: true - default: 'false' + default: 'true' type: choice options: - 'true' @@ -44,4 +44,4 @@ jobs: ./gradlew build else ./gradlew build -x test - fi + fi \ No newline at end of file diff --git a/.github/workflows/deliverables.yml b/.github/workflows/deliverables.yml new file mode 100644 index 0000000..bf33cda --- /dev/null +++ b/.github/workflows/deliverables.yml @@ -0,0 +1,44 @@ +name: Create and upload jar file + +env: + PROJECT_NAME: Zip64File + +on: + push: + tags: + - v*.** + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set TAG-Env + run: echo "NAME_TAG=${PROJECT_NAME}-${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Show current application version + run: ./gradlew cV + - name: Execute Gradle build + run: ./gradlew build + - name: Store reports + if: failure() + uses: actions/upload-artifact@v4 + with: + name: reports + path: | + **/build/reports/ + **/build/test-results/ + - name: upload deliverables + uses: actions/upload-artifact@v4 + with: + name: ${{ env.NAME_TAG }} + path: build/libs/ + if-no-files-found: error diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 5eaed9c..e572d60 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -10,7 +10,7 @@ jobs: name: Add issue to project runs-on: ubuntu-latest steps: - - uses: actions/add-to-project@v0.4.1 + - uses: actions/add-to-project@v1.0.1 with: project-url: https://github.com/users/sfa-siard/projects/1 github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} diff --git a/.gitignore b/.gitignore index c9e201d..49947ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,22 @@ # ignore all build directories -/build/** +/build/ + # ignore javadoc folder /doc/javadoc/** + # tmp contains temporary files /tmp/** + # dist contains the binary build results /dist/** + # sometimes junit4 produces temporary files that we do not want to check in /junit*.* -/build/ - +# ignore IDE and tool-specific files .idea/ *.iml .tool-versions + +# ignore Gradle project-specific cache directory +.gradle diff --git a/.project b/.project deleted file mode 100644 index ced7d28..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Zip64File - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 08dff53..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -encoding/LICENSE.txt=ISO-8859-1 -encoding/build.properties.template=ISO-8859-1 diff --git a/README.md b/README.md index 39c6e91..843fba0 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,31 @@ -# Zip64File - ZIP 64 handler for SIARD 2.1 +# Zip64File - SIARD ZIP 64 handler -This package contains a ZIP 64 handler. -Its main intention reading and writing ZIP files which conform to the -64 bit extension of the ZIP standard. +This package contains a ZIP 64 handler. Its main purpose is reading and writing ZIP files which conform to the 64 bit extension of the ZIP standard. It also includes a command-line tool for reading and writing ZIP files in ZIP 64 format. -It also includes a command-line tool for reading and -writing ZIP files in ZIP 64 format. +## Prerequisites -## Getting started (for devs) - -For building the binaries, Java JDK (1.8 or higher) and Ant must -have been installed. Adjust `build.properties` according to your needs (if needed). - -Run all tests: +For building the binaries, Java JDK (1.8 or higher) must be installed. +### Run all tests ```shell -ant test +./gradlew check ``` -Create a release +### Build the project +```shell +./gradlew clean build +``` +### Create a release +This creates a new tag and pushes the tag to main branch. ```shell -ant release +./gradlew release ``` ## Documentation +- [User's Manual](./doc/manual/user/index.html) +- [Developer's Manual](./doc/manual/developer/index.html) -[./doc/manual/user/index.html](./doc/manual/user/index.html) contains the manual for using the binaries. -[./doc/manual/developer/index.html](./doc/manual/user/index.html) is the manual for developers wishing -build the binaries or work on the code. - +## Declaration +Contributions to the codebase have been made with the support of Codeium. Codeium is AI-powered code completion tool, that is trained exclusively on natural language and source code data with [permissive licenses](https://codeium.com/blog/copilot-trains-on-gpl-codeium-does-not ). -More information about the build process can be found in -[./doc/manual/developer/build.html](./doc/manual/developer/build.html). diff --git a/RELEASE.txt b/RELEASE.txt deleted file mode 100644 index c9fee75..0000000 --- a/RELEASE.txt +++ /dev/null @@ -1,17 +0,0 @@ -Release Notes for Zip64File 2.1 -=============================== - -2.1.47 -Corrected erroneous deferred flag -with backward compatibility for bug. - -2.1.0 -Release for JAVA 10 -GPL 2 license removed, CDDL 1.0 license added -Scripts for command line added - -2.0.60 -.gitattributes added - -2.0.54 -Published on GitHub diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..b76a23c --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + `java-library` + id("pl.allegro.tech.build.axion-release") version "1.14.3" + id("io.freefair.lombok") version "6.5.0" +} + +group = "ch.admin.bar" +version = scmVersion.version + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +repositories { + mavenCentral() +} + +dependencies { + implementation("ch.admin.bar:enterutilities:v2.2.3") + testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1") +} + +tasks.test { + useJUnitPlatform() +} + diff --git a/build.properties b/build.properties deleted file mode 100644 index ceeb384..0000000 --- a/build.properties +++ /dev/null @@ -1,44 +0,0 @@ -# ====================================================================== -# Properties of ANT build file of ZIP64. -# Application: ZIP64 -# Description: user-specific build properties of ZIP64. -# Platform : JAVA, ANT, Windows -# Copyright : Enter AG, Zurich, Switzerland, 2011 -# Created : 25.03.2011, Hartwig Thomas -# ====================================================================== - -# ---------------------------------------------------------------------- -# Windows developers: -# if you want to use backslashes (\) then you must repeat them twice -# e.g. c:\\foo\\bar -# or - in path names - you can use just slashes, e.g. c:/foo/bar -# ---------------------------------------------------------------------- -#----------------------------------------------------------------------- -# The deployment folder to which the binaries are to be unzipped. -#dirdeploy=/Users/Hartwig/test -#dirdeploy=/home/hartwig/test -dirdeploy=./target - -#----------------------------------------------------------------------- -# The bootstrap class (run-time jar) for compiling code compatible with JSE 1.8. -#java8rtjar=C:/Program Files/Java/jdk1.8.0_144/jre/lib/rt.jar -java8rtjar= - -#------------------------------------------------------------------------ -# value of additionalparam for javadoc (must be empty for JDK 1.8 and -# -html5 for later versions. -#javadocadd=-html5 -javadocadd= - -# location of pkzipc executable (if available) -#pkzipc=C:/Program Files (x86)/PKWARE/PKZIPC/pkzipc.exe - -#------------------------------------------------------------------------ -# location of Info-Zip zip30 executable (if available) -#zip30=C:/Program Files/Info-Zip/zip30/zip.exe -zip30=/usr/bin/zip - -#------------------------------------------------------------------------ -# location of Info-Zip unzip60 executable (if available) -#unzip60=C:/Program Files/Info-Zip/unzip60/unzip.exe -unzip60=/usr/bin/unzip diff --git a/build.properties.template b/build.properties.template deleted file mode 100644 index 78f37d8..0000000 --- a/build.properties.template +++ /dev/null @@ -1,53 +0,0 @@ -# ====================================================================== -# Properties of ANT build file of ZIP64. -# Application: ZIP64 -# Description: user-specific build properties of ZIP64. -# Platform : JAVA, ANT, Windows -# ---------------------------------------------------------------------- -# Copyright : Enter AG, Zurich, Switzerland, 2011 -# Created : 25.03.2011, Hartwig Thomas -# ====================================================================== - -# ---------------------------------------------------------------------- -# Windows developers: -# if you want to use backslashes (\) then you must repeat them twice -# e.g. c:\\foo\\bar -# or - in path names - you can use just slashes, e.g. c:/foo/bar -# ---------------------------------------------------------------------- -#----------------------------------------------------------------------- -# The deployment folder to which the binaries are to be unzipped. -#dirdeploy=/Users/Hartwig/test -#dirdeploy=/home/hartwig/test -dirdeploy=/temp - -#----------------------------------------------------------------------- -# The bootstrap class (run-time jar) for compiling code compatible with JSE 1.8. -#java8rtjar=C:/Program Files/Java/jdk1.8.0_144/jre/lib/rt.jar -java8rtjar=~/.asdf/installs/java/zulu-8.50.0.51/jre/librt.jar - -#----------------------------------------------------------------------- -# The following property definition signals, that git can be -# called with "git commit", "git pull" and "git push" from the project's -# root folder. If that is not the case, it must be commented out. -# (Setting it to "false" is not sufficient!) -#git=/usr/bin/git -#git=C:/Program Files/Git/bin/git.exe - -#------------------------------------------------------------------------ -# value of additionalparam for javadoc (must be empty for JDK 1.8 and -# -html5 for later versions. -javadocadd=-html5 -#javadocadd= - -# location of pkzipc executable (if available) -#pkzipc=C:/Program Files (x86)/PKWARE/PKZIPC/pkzipc.exe - -#------------------------------------------------------------------------ -# location of Info-Zip zip30 executable (if available) -#zip30=C:/Program Files/Info-Zip/zip30/zip.exe -zip30=/usr/bin/zip - -#------------------------------------------------------------------------ -# location of Info-Zip unzip60 executable (if available) -#unzip60=C:/Program Files/Info-Zip/unzip60/unzip.exe -unzip60=/usr/bin/unzip diff --git a/build.xml b/build.xml deleted file mode 100644 index 84a2e38..0000000 --- a/build.xml +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..877fe51 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,14 @@ +# deployment folder to which the binaries are to be unzipped. +dirdeploy=./target + +# bootstrap class (run-time jar) for compiling code compatible with JSE 1.8. +java8rtjar= + +# value of additionalparam for javadoc (must be empty for JDK 1.8 and -html5 for later versions. +javadocadd= + +# location of Info-Zip zip30 executable (if available) +zip30=/usr/bin/zip + +# location of Info-Zip unzip60 executable (if available) +unzip60=/usr/bin/unzip \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e644113 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a441313 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..b740cf1 --- /dev/null +++ b/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..25da30d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/lib/enterutils.jar b/lib/enterutils.jar deleted file mode 100644 index 7f65062..0000000 Binary files a/lib/enterutils.jar and /dev/null differ diff --git a/lib/hamcrest-core-1.3.jar b/lib/hamcrest-core-1.3.jar deleted file mode 100644 index 9d5fe16..0000000 Binary files a/lib/hamcrest-core-1.3.jar and /dev/null differ diff --git a/lib/junit-4.12.jar b/lib/junit-4.12.jar deleted file mode 100644 index 3a7fc26..0000000 Binary files a/lib/junit-4.12.jar and /dev/null differ diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..d23582a --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ +import java.net.URI + +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.8/userguide/multi_project_builds.html in the Gradle documentation. + */ + +rootProject.name = "Zip64File" + +sourceControl { + gitRepository(URI.create("https://github.com/sfa-siard/EnterUtilities.git")) { + producesModule("ch.admin.bar:enterutilities") + } +} + diff --git a/src/ch/enterag/utils/zip/EntryInputStream.java b/src/main/java/ch/enterag/utils/zip/EntryInputStream.java similarity index 100% rename from src/ch/enterag/utils/zip/EntryInputStream.java rename to src/main/java/ch/enterag/utils/zip/EntryInputStream.java diff --git a/src/ch/enterag/utils/zip/EntryOutputStream.java b/src/main/java/ch/enterag/utils/zip/EntryOutputStream.java similarity index 100% rename from src/ch/enterag/utils/zip/EntryOutputStream.java rename to src/main/java/ch/enterag/utils/zip/EntryOutputStream.java diff --git a/src/ch/enterag/utils/zip/FileEntry.java b/src/main/java/ch/enterag/utils/zip/FileEntry.java similarity index 100% rename from src/ch/enterag/utils/zip/FileEntry.java rename to src/main/java/ch/enterag/utils/zip/FileEntry.java diff --git a/src/ch/enterag/utils/zip/Zip64File.java b/src/main/java/ch/enterag/utils/zip/Zip64File.java similarity index 100% rename from src/ch/enterag/utils/zip/Zip64File.java rename to src/main/java/ch/enterag/utils/zip/Zip64File.java diff --git a/src/ch/enterag/zip/zip64.java b/src/main/java/ch/enterag/zip/zip64.java similarity index 99% rename from src/ch/enterag/zip/zip64.java rename to src/main/java/ch/enterag/zip/zip64.java index 2dda3a6..f270c07 100644 --- a/src/ch/enterag/zip/zip64.java +++ b/src/main/java/ch/enterag/zip/zip64.java @@ -783,7 +783,7 @@ else if (COMMAND_INJECT.equals(m_sCommand)) */ public static void main(String[] args) { - zip64 z64 = new zip64(Arguments.newInstance(args)); + zip64 z64 = new zip64(Arguments.getInstance(args)); System.exit(z64.m_iReturn); } /* main */ diff --git a/src/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF similarity index 100% rename from src/META-INF/MANIFEST.MF rename to src/main/resources/META-INF/MANIFEST.MF diff --git a/test/ch/enterag/utils/zip/EntryInputStreamTester.java b/src/test/java/ch/enterag/utils/zip/EntryInputStreamTester.java similarity index 99% rename from test/ch/enterag/utils/zip/EntryInputStreamTester.java rename to src/test/java/ch/enterag/utils/zip/EntryInputStreamTester.java index e23f02a..04283d8 100644 --- a/test/ch/enterag/utils/zip/EntryInputStreamTester.java +++ b/src/test/java/ch/enterag/utils/zip/EntryInputStreamTester.java @@ -26,8 +26,8 @@ package ch.enterag.utils.zip; import java.io.*; -import static org.junit.Assert.*; -import org.junit.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; import ch.enterag.utils.*; import ch.enterag.utils.lang.*; @@ -170,7 +170,7 @@ private void zip64Zip(File fileFolderUnzip, File fileFileZip) /* (non-Javadoc) @see junit.framework.TestCase#setUp() */ - @Before + @BeforeEach public void setUp() throws Exception { /* create a file of moderate length in Temp and zip it */ @@ -202,7 +202,7 @@ else if (_sZip30 != null) /* (non-Javadoc) @see junit.framework.TestCase#tearDown() */ - @After + @AfterEach public void tearDown() throws Exception { } /* tearDown */ diff --git a/test/ch/enterag/utils/zip/EntryOutputStreamTester.java b/src/test/java/ch/enterag/utils/zip/EntryOutputStreamTester.java similarity index 95% rename from test/ch/enterag/utils/zip/EntryOutputStreamTester.java rename to src/test/java/ch/enterag/utils/zip/EntryOutputStreamTester.java index ca0447a..68503d0 100644 --- a/test/ch/enterag/utils/zip/EntryOutputStreamTester.java +++ b/src/test/java/ch/enterag/utils/zip/EntryOutputStreamTester.java @@ -26,8 +26,8 @@ package ch.enterag.utils.zip; import java.io.*; -import static org.junit.Assert.*; -import org.junit.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; /*====================================================================*/ /** Tests EntryOutputStream. @@ -40,7 +40,7 @@ public class EntryOutputStreamTester /** zip file */ private String m_sZipFile = null; /** test files directory */ - private final static String sTESTFILES_DIRECTORY = "testfiles"; + private final static String sTESTFILES_DIRECTORY = "src/test/resources"; /** temp directory */ private final static String sTEMP_DIRECTORY = "tmp"; @@ -48,7 +48,7 @@ public class EntryOutputStreamTester /* (non-Javadoc) @see junit.framework.TestCase#setUp() */ - @Before + @BeforeEach public void setUp() throws Exception { /* create a file of moderate length in Temp and zip it */ @@ -64,7 +64,7 @@ public void setUp() throws Exception /* (non-Javadoc) @see junit.framework.TestCase#tearDown() */ - @After + @AfterEach public void tearDown() throws Exception { } /* tearDown */ diff --git a/test/ch/enterag/utils/zip/Zip64FileTester.java b/src/test/java/ch/enterag/utils/zip/Zip64FileTester.java similarity index 97% rename from test/ch/enterag/utils/zip/Zip64FileTester.java rename to src/test/java/ch/enterag/utils/zip/Zip64FileTester.java index ab1e3c2..2287172 100644 --- a/test/ch/enterag/utils/zip/Zip64FileTester.java +++ b/src/test/java/ch/enterag/utils/zip/Zip64FileTester.java @@ -18,8 +18,8 @@ import ch.enterag.utils.*; import ch.enterag.utils.lang.*; -import static org.junit.Assert.*; -import org.junit.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; /*====================================================================*/ /** Tests Zip64File. @@ -30,11 +30,11 @@ public class Zip64FileTester /** buffer size for I/O */ private final static int iBUFFER_SIZE = 8192; /** small file size for I/O */ - private final static int iSMALL_SIZE = 16; - /** number of buffers for more than 4 GB */ - private final static int iLARGE_BUFFERS = 0x0A0000; - /** number of buffers for more than 65 KB */ - private final static int iMODERATE_BUFFERS = 20; + private final static int iSMALL_SIZE = 20480; + /** number of buffers for more than 250 MB */ + private final static int iLARGE_BUFFERS = 31250; + /** number of buffers for more than 50 MB */ + private final static int iMODERATE_BUFFERS = 6250; /** global file comment */ private final static String sZIP_COMMENT = "a global ZIP file comment"; /** zip file produced by external zip */ @@ -42,7 +42,7 @@ public class Zip64FileTester /** test zip file */ private String m_sTestZipFile = null; /** test files directory */ - private final static String sTESTFILES_DIRECTORY = "testfiles"; + private final static String sTESTFILES_DIRECTORY = "src/test/resources"; /** temp location with lots of free space which does not need to be backuped */ private final static String sTEMP_LOCATION = "tmp"; /** temp directory */ @@ -436,7 +436,7 @@ private static void createMedium(File fileMedium) } FileOutputStream fos = new FileOutputStream(fileMedium); byte[] buffer = new byte[iBUFFER_SIZE]; - for (int iBuffer = 0; iBuffer < iLARGE_BUFFERS; iBuffer++) + for (int iBuffer = 0; iBuffer < iMODERATE_BUFFERS; iBuffer++) { /* fill the buffer with randomly chosen prepared words */ for (int iPos = 0; iPos < buffer.length; ) @@ -505,38 +505,33 @@ private static void createSmall(File fileSmall) fos.close(); } /* createLarge */ - @BeforeClass + @BeforeAll public static void setupClass() { try { - /* in temp directory: */ File fileTemp = new File(sTEMP_DIRECTORY); if (!fileTemp.exists()) fileTemp.mkdirs(); - /* 1. write more than 4 GB incompressible random file "large" */ String sLargeFile = fileTemp.getAbsolutePath()+File.separator+"large.txt"; File fileLarge = new File(sLargeFile); if (!fileLarge.exists()) createLarge(fileLarge); - /* 2. write more than 4 GB random file which can be compressed to less than 4 GB "medium" */ String sMediumFile = fileTemp.getAbsolutePath()+File.separator+"medium.txt"; File fileMedium = new File(sMediumFile); if (!fileMedium.exists()) createMedium(fileMedium); - /* 2.a) write more than 65 KB random file */ String sModerateFile = fileTemp.getAbsolutePath()+File.separator+"moderate.txt"; File fileModerate = new File(sModerateFile); if (!fileModerate.exists()) createModerate(fileModerate); - /* 3. create sub directory "many" */ + String sManyFolder = fileTemp.getAbsolutePath()+File.separator+"many"+File.separator; File fileMany = new File(sManyFolder); if (!fileMany.exists()) { System.out.println("writing small files"); fileMany.mkdir(); - /* 4. write more than 65'000 small files "small00001" - "smallxxxxx" */ for (int i = 0; i < 0x014000; i++) { DecimalFormat df = new DecimalFormat("00000"); @@ -555,7 +550,7 @@ public static void setupClass() /* (non-Javadoc) @see junit.framework.TestCase#setUp() */ - @Before + @BeforeEach public void setUp() throws Exception { File fileTemp = new File(sTEMP_DIRECTORY); @@ -583,7 +578,7 @@ else if (_sZip30 != null) /* (non-Javadoc) @see junit.framework.TestCase#tearDown() */ - @After + @AfterEach public void tearDown() throws Exception { } @@ -767,7 +762,7 @@ public void testGetFileEntry() if (feMedium != null) { long lSize = iBUFFER_SIZE; - lSize *= iLARGE_BUFFERS; + lSize *= iMODERATE_BUFFERS; if (feMedium.getSize() != lSize) fail("Invalid size for medium.txt: "+String.valueOf(feMedium.getSize())); } @@ -789,7 +784,7 @@ public void testGetListFileEntriesOld() /* open external file read-only */ try { - Zip64File zf = new Zip64File("..\\SiardApi\\testfiles\\sql1999.siard",true); + Zip64File zf = new Zip64File("src/test/resources/sql1999.siard", true); /* get the file entries */ List listFileEntries = zf.getListFileEntries(); for (Iterator iterFileEntry = listFileEntries.iterator(); iterFileEntry.hasNext(); ) diff --git a/src/test/java/ch/enterag/utils/zip/ZipProperties.java b/src/test/java/ch/enterag/utils/zip/ZipProperties.java new file mode 100644 index 0000000..6dffbb7 --- /dev/null +++ b/src/test/java/ch/enterag/utils/zip/ZipProperties.java @@ -0,0 +1,49 @@ +package ch.enterag.utils.zip; + +import ch.enterag.utils.EU; + +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.Properties; + +public class ZipProperties extends Properties { + + private static ZipProperties _zp = null; + + private ZipProperties() throws IOException { + super(); + readProperties(); + } + + public static ZipProperties getInstance() { + if (_zp == null) { + try { + _zp = new ZipProperties(); + } catch (IOException ie) { + System.err.println(EU.getExceptionMessage(ie)); + } + } + return _zp; + } + + public String getPkzipc() { + return getProperty("pkzipc"); + } + + public String getZip30() { + return getProperty("zip30"); + } + + public String getUnzip60() { + return getProperty("unzip60"); + } + + + private void readProperties() throws IOException { + Reader rdr = new FileReader("gradle.properties"); + load(rdr); + rdr.close(); + } + +} diff --git a/test/ch/enterag/utils/zip/zip64Tester.java b/src/test/java/ch/enterag/utils/zip/zip64Tester.java similarity index 99% rename from test/ch/enterag/utils/zip/zip64Tester.java rename to src/test/java/ch/enterag/utils/zip/zip64Tester.java index 1743282..88896ce 100644 --- a/test/ch/enterag/utils/zip/zip64Tester.java +++ b/src/test/java/ch/enterag/utils/zip/zip64Tester.java @@ -28,11 +28,12 @@ ======================================================================*/ package ch.enterag.utils.zip; -import static org.junit.Assert.*; -import org.junit.*; import java.io.*; import java.util.*; +import org.junit.jupiter.api.*; +import static org.junit.jupiter.api.Assertions.*; + import ch.enterag.utils.*; import ch.enterag.utils.lang.*; import java.text.*; @@ -41,6 +42,7 @@ /** Tests zip64. @author Hartwig Thomas */ +@Disabled public class zip64Tester { /** small file size for test file */ @@ -301,7 +303,7 @@ private void zip64Zip(File fileFolderUnzip, File fileFileZip) catch(InterruptedException ie) { fail(EU.getExceptionMessage(ie)); } } - @Before + @BeforeEach public void setUp() throws IOException { @@ -377,7 +379,7 @@ else if (_sZip30 != null) } /* setUp */ - @After + @AfterEach public void tearDown() throws IOException { diff --git a/testfiles/moderate.txt b/src/test/resources/moderate.txt similarity index 100% rename from testfiles/moderate.txt rename to src/test/resources/moderate.txt diff --git a/src/test/resources/sql1999.siard b/src/test/resources/sql1999.siard new file mode 100644 index 0000000..4c6b0fd Binary files /dev/null and b/src/test/resources/sql1999.siard differ diff --git a/test/ch/enterag/utils/zip/ZipProperties.java b/test/ch/enterag/utils/zip/ZipProperties.java deleted file mode 100644 index cc94b1a..0000000 --- a/test/ch/enterag/utils/zip/ZipProperties.java +++ /dev/null @@ -1,45 +0,0 @@ -package ch.enterag.utils.zip; - -import java.io.*; - -import ch.enterag.utils.BuildProperties; -import ch.enterag.utils.EU; - -public class ZipProperties - extends BuildProperties -{ - private static final long serialVersionUID = 1L; - private static ZipProperties _zp = null; - - private ZipProperties() - throws IOException - { - super(); - } - - public static ZipProperties getInstance() - { - if (_zp == null) - { - try { _zp = new ZipProperties(); } - catch(IOException ie) {System.err.println(EU.getExceptionMessage(ie));} - } - return _zp; - } - - public String getPkzipc() - { - return getProperty("pkzipc"); - } - - public String getZip30() - { - return getProperty("zip30"); - } - - public String getUnzip60() - { - return getProperty("unzip60"); - } - -} /* ZipProperties */