Multiple changes.

1. This change introduces the current SWT builds that exist in Maven;
removing the need to locate and capture the JAR files.
2. The current SWT change is to capture the new Mac OS X aarch64 builds
("Apple Silicon").
3. The current version of SWT, however, requires Java 11.
4. Due to the complexity of the prior Gradle build, it was restructured.
This commit is contained in:
Rob Greene 2021-12-19 21:19:33 -06:00
parent 9d8b4be006
commit d69c923bad
230 changed files with 698 additions and 546 deletions

31
app/ac-cli/build.gradle Normal file
View File

@ -0,0 +1,31 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-api')
implementation "net.sf.applecommander:ShrinkItArchive:$shkVersion"
implementation "net.sf.applecommander:applesingle-api:$asVersion"
implementation "net.sf.applecommander:bastools-api:$btVersion"
compileOnly "org.apache.ant:ant:$antVersion"
testImplementation "junit:junit:$junitVersion"
}
application {
mainClass = 'com.webcodepro.applecommander.ui.ac'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander (Swing)',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

24
app/ac-swing/build.gradle Normal file
View File

@ -0,0 +1,24 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-api')
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swing.SwingAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -0,0 +1,28 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-swt-common')
implementation("org.eclipse.platform:org.eclipse.swt.gtk.linux.aarch64:$swtVersion") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swt.SwtAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -0,0 +1,28 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-swt-common')
implementation("org.eclipse.platform:org.eclipse.swt.gtk.linux.x86_64:$swtVersion") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swt.SwtAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -0,0 +1,28 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-swt-common')
implementation("org.eclipse.platform:org.eclipse.swt.cocoa.macosx.aarch64:$swtVersion") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swt.SwtAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -0,0 +1,28 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-swt-common')
implementation("org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swt.SwtAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -0,0 +1,28 @@
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':lib:ac-swt-common')
implementation("org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:$swtVersion") {
exclude group: "org.eclipse.platform", module: "org.eclipse.swt"
}
}
application {
mainClass = 'com.webcodepro.applecommander.ui.swt.SwtAppleCommander'
}
bootJar {
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
}

View File

@ -1,247 +0,0 @@
plugins {
id 'java'
id 'application'
id 'maven'
id 'signing'
}
repositories {
mavenCentral()
flatDir {
// SWT libraries
dirs "./swt-lib"
}
}
mainClassName = 'com.webcodepro.applecommander.ui.AppleCommander'
version "${version}"
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
test {
String osName = System.getProperty('os.name').toLowerCase().split()[0]
String osArch = System.getProperty('os.arch').toLowerCase().split()[0]
String swtDependency
switch (osName) {
case 'windows':
swtDependency = "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
break
case 'linux':
swtDependency = "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
if (osArch == 'arm') {
swtDependency = "org.eclipse.swt:org.eclipse.swt.gtk.linux.arm:$piswtVersion"
}
break
case 'mac':
swtDependency = "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
break
default:
throw new Exception('Unknown OS')
}
dependencies {
implementation "$swtDependency"
}
testLogging {
exceptionFormat = 'full'
}
}
// Disable default JAR creation
project.tasks.jar.setEnabled(false)
// Generic additions to JAR creation
tasks.withType(Jar) {
manifest {
attributes 'Main-Class': 'com.webcodepro.applecommander.ui.AppleCommander'
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('LICENSE')
doFirst {
// Jar files with an appendix are standalone applications and need to have ShrinkIt included.
if (archiveAppendix) {
from {
configurations.runtimeClasspath.collect {
it.name.startsWith('ShrinkItArchive') || it.name.startsWith('applesingle-api') ||
it.name.startsWith('bastools-api') || it.name.startsWith('commons-csv') ||
it.name.startsWith('gson')
? zipTree(it) : 'fake'
}
}
}
}
}
dependencies {
implementation "net.sf.applecommander:ShrinkItArchive:$shkVersion"
implementation "net.sf.applecommander:applesingle-api:$asVersion"
implementation "net.sf.applecommander:bastools-api:$btVersion"
implementation "org.apache.commons:commons-csv:$commonsCsvVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
compileOnly "org.apache.ant:ant:$antVersion"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.apache.commons:commons-lang3:$commonsLang3Version"
}
task mavenJar(type: Jar) {
dependencies {
// Just to pass the compile step; these classes are stripped out below.
implementation "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
}
from(sourceSets.main.output) {
include 'com/webcodepro/applecommander/**'
exclude 'com/webcodepro/applecommander/ui/images/**'
exclude 'com/webcodepro/applecommander/ui/swing/**'
exclude 'com/webcodepro/applecommander/ui/swt/**'
}
}
task acJar(type: Jar) {
dependencies {
// Just to pass the compile step; these classes are stripped out below.
implementation "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
}
archiveAppendix = 'ac'
manifest {
attributes 'Main-Class' : 'com.webcodepro.applecommander.ui.ac'
}
from(sourceSets.main.output) {
include 'com/webcodepro/**'
exclude 'com/webcodepro/applecommander/ui/images/**'
exclude 'com/webcodepro/applecommander/ui/swing/**'
exclude 'com/webcodepro/applecommander/ui/swt/**'
}
}
task linuxJar(type: Jar) {
dependencies {
implementation "org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:$swtVersion"
}
archiveAppendix = 'linux64-gtk'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Linux JAR contents
from { configurations.runtimeClasspath.collect { it.name.contains('.linux.x86_64-') ? zipTree(it) : 'fake' } }
}
}
task piJar(type: Jar) {
dependencies {
implementation "org.eclipse.swt:org.eclipse.swt.gtk.linux.arm:$piswtVersion"
}
archiveAppendix = 'linuxarm-gtk'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Linux JAR contents
from { configurations.runtimeClasspath.collect { it.name.contains('.linux.arm-') ? zipTree(it) : 'fake' } }
}
}
task macosxJar(type: Jar) {
dependencies {
implementation "org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:$swtVersion"
}
archiveAppendix = 'macosx'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Mac OS X JAR contents
from { configurations.runtimeClasspath.collect { it.name.contains('.macosx.') ? zipTree(it) : 'fake' } }
}
}
task windowsJar(type: Jar) {
dependencies {
implementation "org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:$swtVersion"
}
archiveAppendix = 'win64'
from(sourceSets.main.output) {
include 'com/webcodepro/**'
}
doFirst {
// Pick and include just the Windows SWT JAR contents
from { configurations.runtimeClasspath.collect { it.name.contains('.win32.') ? zipTree(it) : 'fake' } }
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
artifacts {
archives mavenJar, acJar
archives linuxJar, piJar, macosxJar, windowsJar
archives javadocJar, sourcesJar
}
signing {
// Only sign if we're uploading...
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
addFilter('AppleCommander') { artifact, file ->
// Note that the other executables all have suffixes which change their name.
return artifact.name == 'AppleCommander' && artifact.ext != 'zip' && artifact.ext != 'tar'
}
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
}
// Only preserve the compile and non-SWT POM dependencies
pom('AppleCommander').whenConfigured { p ->
p.dependencies = p.dependencies.findAll { it.scope == "compile" }
p.dependencies = p.dependencies.findAll { it.groupId != "org.eclipse.swt" }
}
pom('AppleCommander').project {
name archivesBaseName
packaging 'jar'
description 'AppleCommander is a general utility for Apple II disk images.'
url 'https://applecommander.github.io/'
scm {
url 'https://github.com/AppleCommander/AppleCommander'
}
licenses {
license {
name 'The GNU General Public License (GPL) Version 2, June 1991'
url 'https://www.gnu.org/licenses/gpl-2.0.html'
}
}
developers {
developer {
id 'robgreene'
email 'robgreene@gmail.com'
}
}
}
}
}
}

View File

@ -7,8 +7,7 @@ version=1.7.0pre
shkVersion=1.2.2
asVersion=1.2.1
btVersion=0.3.1
swtVersion=4.17
piswtVersion=3.8.2
swtVersion=3.118.0
junitVersion=4.12
antVersion=1.8.2
commonsLang3Version=3.7

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# 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.
@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# 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/master/subprojects/plugins/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
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
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
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
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
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
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
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
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"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || 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
@ -106,80 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# 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.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"

15
lib/ac-api/build.gradle Normal file
View File

@ -0,0 +1,15 @@
plugins {
id 'java-library'
}
repositories {
mavenCentral()
}
dependencies {
implementation "net.sf.applecommander:ShrinkItArchive:$shkVersion"
implementation "org.apache.commons:commons-csv:$commonsCsvVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
testImplementation "junit:junit:$junitVersion"
}

View File

@ -0,0 +1,183 @@
/*
* AppleCommander - An Apple ][ image utility.
* Copyright (C) 2002-3 by Robert Greene
* robgreene at users.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.webcodepro.applecommander.ui;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Launch AppleCommander.
* This application attempts to identify which type of user-interface to
* launch. Additionally, there are some command-line interface switches
* available - see the about method.
* <p>
* Regarding SWT, this application launcher tries to not be SWT dependent.
* That means that SwtAppleCommander is launched purely by reflection.
* NOTE: This may yet prove to be a worthless trick. If it is, remove
* the crud. However, as the VERSION and COPYRIGHT are in this class and
* are referenced in various places, it may well be worth it.
* <p>
* Date created: Nov 16, 2002 9:13:25 PM
* @author Rob Greene
*/
public class AppleCommander {
public static final String VERSION;
private static TextBundle textBundle = UiBundle.getInstance();
static {
VERSION = AppleCommander.class.getPackage().getImplementationVersion();
}
// /**
// * Launch AppleCommander.
// */
// public static void main(String[] args) {
// if (args.length == 0) {
// if (isSwtAvailable()) {
// launchSwtAppleCommander(args);
// } else if (isSwingAvailable()) {
// launchSwingAppleCommander(args);
// } else {
// showHelp();
// }
// } else {
// String[] extraArgs = new String[args.length - 1];
// System.arraycopy(args, 1, extraArgs, 0, extraArgs.length);
// if ("-swt".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
// if (isSwtAvailable()) {
// launchSwtAppleCommander(extraArgs);
// } else {
// System.err.println(textBundle.get("SwtVersionNotAvailable")); //$NON-NLS-1$
// }
// } else if ("-swing".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
// if (isSwingAvailable()) {
// launchSwingAppleCommander(extraArgs);
// } else {
// System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
// }
// } else if ("-command".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
// System.err.println(textBundle.get("CommandLineNotAvailable")); //$NON-NLS-1$
// } else if ("-help".equalsIgnoreCase(args[0]) //$NON-NLS-1$
// || "-?".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
// showHelp();
// } else {
// ac.main(args);
// }
// }
// }
// /**
// * Launch the SWT version of AppleCommander. This method
// * uses reflection to load SwtAppleCommander to minimize which
// * classes get loaded. This is particularly important for the
// * command-line version.
// */
// protected static void launchSwtAppleCommander(String[] args) {
// Class<?> swtAppleCommander;
// try {
// swtAppleCommander = Class.forName(
// "com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
// Constructor<?> constructor = swtAppleCommander.getConstructor();
// Object object = constructor.newInstance();
// Method launchMethod = swtAppleCommander.
// getMethod("launch", args.getClass()); //$NON-NLS-1$
// launchMethod.invoke(object, new Object[] { args });
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// } catch (SecurityException e) {
// e.printStackTrace();
// } catch (NoSuchMethodException e) {
// e.printStackTrace();
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// } catch (InvocationTargetException e) {
// e.printStackTrace();
// } catch (InstantiationException e) {
// e.printStackTrace();
// }
// }
// /**
// * Test to see if SWT is available.
// */
// protected static boolean isSwtAvailable() {
// try {
// Class.forName("org.eclipse.swt.SWT"); //$NON-NLS-1$
// Class.forName("com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
// return true;
// } catch (ClassNotFoundException ex) {
// return false;
// }
// }
// /**
// * Test to see if Swing is available.
// */
// protected static boolean isSwingAvailable() {
// try {
// Class.forName("com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
// return true;
// } catch (ClassNotFoundException ex) {
// return false;
// }
// }
// /**
// * Launch the Swing version of AppleCommander. This method
// * uses reflection to load SwingAppleCommander to minimize which
// * classes get loaded. This is particularly important for the
// * command-line version.
// */
// protected static void launchSwingAppleCommander(String[] args) {
// Class<?> swingAppleCommander;
// try {
// swingAppleCommander = Class.forName(
// "com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
// Constructor<?> constructor = swingAppleCommander.getConstructor();
// Object object = constructor.newInstance();
// Method launchMethod = swingAppleCommander.
// getMethod("launch", (Class[]) null); //$NON-NLS-1$
// launchMethod.invoke(object, (Object[]) null);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// } catch (SecurityException e) {
// e.printStackTrace();
// } catch (NoSuchMethodException e) {
// e.printStackTrace();
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// } catch (InvocationTargetException e) {
// e.printStackTrace();
// } catch (InstantiationException e) {
// e.printStackTrace();
// }
// }
// /**
// * Display help message(s) for AppleCommander.
// */
// protected static void showHelp() {
// System.err.println(textBundle.get("AppleCommanderHelp")); //$NON-NLS-1$
// System.err.println();
// ac.help();
// }
}

View File

@ -0,0 +1,89 @@
package com.webcodepro.applecommander.util;
import java.util.List;
import com.webcodepro.applecommander.storage.DirectoryEntry;
import com.webcodepro.applecommander.storage.DiskException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.UiBundle;
public class Name {
private static TextBundle textBundle = UiBundle.getInstance();
private String fullName;
private String name;
private String[] path;
public Name(String s) {
this.fullName = s;
if (s.startsWith("/")) {
fullName = s.substring(1, s.length());
}
this.path = s.split("/");
this.name = path[path.length - 1];
}
public FileEntry getEntry(FormattedDisk formattedDisk) throws DiskException {
List<FileEntry> files = formattedDisk.getFiles();
FileEntry entry = null;
for (int i = 0; i < path.length - 1; i++) {
String dirName = path[i];
for (int j = 0; j < files.size(); j++) {
entry = (FileEntry) files.get(j);
String entryName = entry.getFilename();
if (entry.isDirectory() && dirName.equalsIgnoreCase(entryName)) {
files = ((DirectoryEntry) entry).getFiles();
}
}
}
for (int i = 0; i < files.size(); i++) {
entry = (FileEntry) files.get(i);
String entryName = entry.getFilename();
if (!entry.isDeleted() && name.equalsIgnoreCase(entryName)) {
return entry;
}
}
return null;
}
public FileEntry createEntry(FormattedDisk formattedDisk) throws DiskException {
if (path.length == 1) {
return formattedDisk.createFile();
}
List<FileEntry> files = formattedDisk.getFiles();
DirectoryEntry dir = null, parentDir = null;
for (int i = 0; i < path.length - 1; i++) {
String dirName = path[i];
dir = null;
for (int j = 0; j < files.size(); j++) {
FileEntry entry = (FileEntry) files.get(j);
String entryName = entry.getFilename();
if (!entry.isDeleted() && entry.isDirectory() && dirName.equalsIgnoreCase(entryName)) {
dir = (DirectoryEntry) entry;
parentDir = dir;
files = dir.getFiles();
}
}
if (dir == null) {
if (parentDir != null) {
// If there's a parent directory in the mix, add
// the new child directory to that.
dir = parentDir.createDirectory(dirName);
parentDir = dir;
} else {
// Add the directory to the root of the filesystem
dir = formattedDisk.createDirectory(dirName);
parentDir = dir;
}
}
}
if (dir != null) {
return dir.createFile();
} else {
System.err.println(textBundle.format(
"CommandLineNoMatchMessage", fullName)); //$NON-NLS-1$
return null;
}
}
}

View File

@ -32,7 +32,6 @@ import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk;
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.ui.ac.Name;
import com.webcodepro.shrinkit.HeaderBlock;
import com.webcodepro.shrinkit.NuFileArchive;
import com.webcodepro.shrinkit.ThreadRecord;

Some files were not shown because too many files have changed in this diff Show More