Merge pull request #64 from AppleCommander/modern_swt_and_restructure

Update to modern SWT and restructure project
This commit is contained in:
A2 Geek 2021-12-21 20:43:03 -06:00 committed by GitHub
commit 7469d90c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
233 changed files with 676 additions and 580 deletions

5
.gitignore vendored
View File

@ -3,6 +3,9 @@ bin
.gradle
build/
# IDE's
.vscode
# In case we run it locally, AppleCommander files we don't want to commit
AppleCommander.preferences
*.bas
@ -15,7 +18,7 @@ AppleCommander.preferences
*.2mg
*.2img
# But allowing disk images from the unit tests
!src/test/resources/disks/*
!lib/ac-api/src/test/resources/disks/*
# Eclipse
.classpath

View File

@ -24,24 +24,35 @@ Extract secret key for the Gradle signing plugin:
$ gpg2 --export-secret-keys > secring.gpg
```
## Build and publish to Central Repository
## Gradle build and publish to Central Repository
> NOTE: The build has been updated to allow snapshots to be published. These appear to be automatically available.
Ensure full build passes:
```bash
$ ./gradlew clean test javadoc assemble
<...lots of stuff, primarily Javadoc issues...>
BUILD SUCCESSFUL in 3s
13 actionable tasks: 13 executed
./gradlew clean build
BUILD SUCCESSFUL in 8s
91 actionable tasks: 91 executed
```
Upload:
Publish:
```bash
$ ./gradlew uploadArchives
$ ./gradlew publish
BUILD SUCCESSFUL in 10s
10 actionable tasks: 1 executed, 9 up-to-date
BUILD SUCCESSFUL in 8s
2 actionable tasks: 2 executed
```
The can also be combined:
```bash
$ ./gradlew clean build publish
BUILD SUCCESSFUL in 16s
93 actionable tasks: 93 executed
```
Then follow "releasing the deployment" below.
@ -52,6 +63,7 @@ Just a reminder!
# References
* http://central.sonatype.org/pages/gradle.html
* http://central.sonatype.org/pages/gradle.html (NOTE: Documentation is out of date)
* http://central.sonatype.org/pages/releasing-the-deployment.html
* https://docs.gradle.org/current/userguide/publishing_maven.html
* For all the other little pieces, Google is your friend. ;-)

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

@ -0,0 +1,33 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'ac'
manifest {
attributes 'Implementation-Title': "AppleCommander 'ac'",
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

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

@ -0,0 +1,26 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'swing-ui'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Swing)',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

View File

@ -0,0 +1,30 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'linux-aarch64'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Linux Arm)',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

View File

@ -0,0 +1,30 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'linux-x86_64'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Linux)',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

View File

@ -0,0 +1,30 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'macosx-aarch64'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Mac Arm)',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

View File

@ -0,0 +1,30 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'macosx-x86_64'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Mac)',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}

View File

@ -0,0 +1,30 @@
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 {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'win32-x86_64'
manifest {
attributes 'Implementation-Title': 'AppleCommander (Windows)',
'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

@ -1,20 +1,15 @@
# Universal AppleCommander version number. Used for:
# - Naming JAR file.
# - The build will insert this into a file that is read at run time as well.
version=1.7.0pre
version=1.7.0-SNAPSHOT
# Dependency versions
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
commonsCsvVersion=1.8
gsonVersion=2.8.6
# Maven Central Repository G and A of GAV coordinate. :-)
group=net.sf.applecommander
archivesBaseName=AppleCommander

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" "$@"

View File

@ -1,18 +0,0 @@
/*
* This settings file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
* In a single project build this file can be empty or even removed.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/4.3.1/userguide/multi_project_builds.html
*/
/*
// To declare projects as part of a multi-project build use the 'include' method
include 'shared'
include 'api'
include 'services:webservice'
*/
rootProject.name = 'AppleCommander'

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

@ -0,0 +1,93 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
ext.isSnapshotVersion = version.endsWith("SNAPSHOT")
ext.isReleaseVersion = !ext.isSnapshotVersion
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"
}
tasks.withType(Jar) {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'api'
manifest {
attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion
}
from('../../LICENSE')
}
javadoc {
title = "AppleCommander ${version}"
source = sourceSets.main.allJava
options.addStringOption('Xdoclint:none', '-quiet')
}
java {
withSourcesJar()
withJavadocJar()
}
signing {
// Only sign if we're uploading...
required {
isReleaseVersion && gradle.taskGraph.hasTask("publish")
}
sign configurations.archives
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = "net.sf.applecommander"
artifactId = "AppleCommander"
name = 'AppleCommander'
description = 'AppleCommander is a general utility for Apple II disk images.'
url = 'https://applecommander.github.io/'
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'
name = 'Rob Greene'
email = 'robgreene@gmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/AppleCommander/AppleCommander.git'
developerConnection = 'scm:git:git@github.com:AppleCommander/AppleCommander.git'
url = 'https://github.com/AppleCommander/AppleCommander'
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = isSnapshotVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
}
}
}

View File

@ -0,0 +1,34 @@
/*
* 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;
/**
* Make AppleCommander version available.
* <p>
* Date created: Nov 16, 2002 9:13:25 PM
* @author Rob Greene
*/
public class AppleCommander {
public static final String VERSION;
static {
VERSION = AppleCommander.class.getPackage().getImplementationVersion();
}
}

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