summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-18 21:09:11 +0200
committerEdoardo La Greca2025-08-18 21:09:11 +0200
commit7341ead2aade10ea1b833e94275277658741883a (patch)
tree46495f24c54278d50aa0da5046822fbe502f3f14
parent1e50cf9c224d03896f176f3718ff80ef1659e9c2 (diff)
switch to multi-module project structure
-rw-r--r--.idea/.gitignore2
-rw-r--r--.idea/AndroidProjectSystem.xml6
-rw-r--r--.idea/artifacts/ninekt.xml10
-rw-r--r--.idea/gradle.xml16
-rw-r--r--.idea/kotlinc.xml2
-rw-r--r--.idea/misc.xml33
-rw-r--r--buildSrc/build.gradle.kts15
-rw-r--r--buildSrc/settings.gradle.kts17
-rw-r--r--buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts29
-rw-r--r--demo/build.gradle.kts21
-rw-r--r--demo/src/main/kotlin/Main.kt (renamed from src/main/kotlin/demo/Main.kt)11
-rw-r--r--gradle.properties8
-rw-r--r--gradle/libs.versions.toml22
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin60756 -> 43764 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xgradlew47
-rw-r--r--gradlew.bat41
-rw-r--r--lib/build.gradle.kts21
-rw-r--r--lib/src/main/kotlin/Authenticator.kt (renamed from src/main/kotlin/Authenticator.kt)12
-rw-r--r--lib/src/main/kotlin/Authenticator9PAnyV2DP9IK.kt (renamed from src/main/kotlin/Authenticator9PAnyV2DP9IK.kt)2
-rw-r--r--lib/src/main/kotlin/Connection.kt (renamed from src/main/kotlin/Connection.kt)2
-rw-r--r--lib/src/main/kotlin/FileMode.kt (renamed from src/main/kotlin/FileMode.kt)0
-rw-r--r--lib/src/main/kotlin/FilePermissions.kt (renamed from src/main/kotlin/FilePermissions.kt)0
-rw-r--r--lib/src/main/kotlin/IPAddress.kt (renamed from src/main/kotlin/IPAddress.kt)0
-rw-r--r--lib/src/main/kotlin/NinePMacros.kt (renamed from src/main/kotlin/NinePMacros.kt)6
-rw-r--r--lib/src/main/kotlin/NinePMessageType.kt (renamed from src/main/kotlin/NinePMessageType.kt)0
-rw-r--r--lib/src/main/kotlin/PathInfo.kt (renamed from src/main/kotlin/PathInfo.kt)0
-rw-r--r--lib/src/main/kotlin/ProtocolTranslator.kt (renamed from src/main/kotlin/ProtocolTranslator.kt)0
-rw-r--r--lib/src/main/kotlin/QID.kt (renamed from src/main/kotlin/QID.kt)0
-rw-r--r--lib/src/main/kotlin/SizedInteger.kt (renamed from src/main/kotlin/SizedInteger.kt)0
-rw-r--r--lib/src/main/kotlin/Stat.kt (renamed from src/main/kotlin/Stat.kt)0
-rw-r--r--lib/src/main/kotlin/TagGenerator.kt (renamed from src/main/kotlin/TagGenerator.kt)0
-rw-r--r--lib/src/main/kotlin/Utils.kt (renamed from src/main/kotlin/Utils.kt)0
-rw-r--r--lib/src/main/kotlin/except/FailedAuthenticationException.kt (renamed from src/main/kotlin/except/FailedAuthenticationException.kt)0
-rw-r--r--lib/src/main/kotlin/except/InvalidMessageException.kt (renamed from src/main/kotlin/except/InvalidMessageException.kt)0
-rw-r--r--lib/src/main/kotlin/except/MsizeValueTooBigException.kt (renamed from src/main/kotlin/except/MsizeValueTooBigException.kt)0
-rw-r--r--lib/src/main/kotlin/except/RErrorException.kt (renamed from src/main/kotlin/except/RErrorException.kt)0
-rw-r--r--lib/src/main/kotlin/except/UnaccessibleFileException.kt (renamed from src/main/kotlin/except/UnaccessibleFileException.kt)0
-rw-r--r--lib/src/main/kotlin/except/UnknownVersionException.kt (renamed from src/main/kotlin/except/UnknownVersionException.kt)0
-rw-r--r--lib/src/main/kotlin/except/UnresolvableHostException.kt (renamed from src/main/kotlin/except/UnresolvableHostException.kt)0
-rw-r--r--lib/src/main/kotlin/net/InMessage.kt (renamed from src/main/kotlin/net/InMessage.kt)0
-rw-r--r--lib/src/main/kotlin/net/OutMessage.kt (renamed from src/main/kotlin/net/OutMessage.kt)0
-rw-r--r--lib/src/main/kotlin/net/TransportLayer.kt (renamed from src/main/kotlin/net/TransportLayer.kt)0
-rw-r--r--lib/src/main/kotlin/net/TransportLayerJavaNet.kt (renamed from src/main/kotlin/net/TransportLayerJavaNet.kt)0
-rw-r--r--lib/src/test/kotlin/IPAddressTest.kt (renamed from src/test/kotlin/IPAddressTest.kt)0
-rw-r--r--settings.gradle.kts24
46 files changed, 245 insertions, 107 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore
index a0ccf77..26d3352 100644
--- a/.idea/.gitignore
+++ b/.idea/.gitignore
@@ -1,5 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
-# Environment-dependent path to Maven home directory
-/mavenHomeManager.xml
diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml
deleted file mode 100644
index 4a53bee..0000000
--- a/.idea/AndroidProjectSystem.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="AndroidProjectSystem">
- <option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
- </component>
-</project> \ No newline at end of file
diff --git a/.idea/artifacts/ninekt.xml b/.idea/artifacts/ninekt.xml
deleted file mode 100644
index a8a9184..0000000
--- a/.idea/artifacts/ninekt.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<component name="ArtifactManager">
- <artifact type="jar" name="ninekt">
- <output-path>$PROJECT_DIR$/out/artifacts/ninekt</output-path>
- <root id="archive" name="ninekt.jar">
- <element id="module-output" name="ninekt.main" />
- <element id="library" level="project" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:2.1.20" />
- <element id="library" level="project" name="Gradle: org.jetbrains:annotations:13.0" />
- </root>
- </artifact>
-</component> \ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 197c430..6295298 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -1,15 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
+ <compositeConfiguration>
+ <compositeBuild compositeDefinitionSource="SCRIPT">
+ <builds>
+ <build path="$PROJECT_DIR$/buildSrc" name="buildSrc">
+ <projects>
+ <project path="$PROJECT_DIR$/buildSrc" />
+ </projects>
+ </build>
+ </builds>
+ </compositeBuild>
+ </compositeConfiguration>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
- <option value="$PROJECT_DIR$/ninekt.demo" />
+ <option value="$PROJECT_DIR$/buildSrc" />
+ <option value="$PROJECT_DIR$/demo" />
+ <option value="$PROJECT_DIR$/lib" />
</set>
</option>
</GradleProjectSettings>
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 131e44d..03fcfb7 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
- <option name="version" value="2.1.20" />
+ <option name="version" value="2.2.0" />
</component>
</project> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9a966e3..5cd9a10 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,37 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
- <component name="ProjectInspectionProfilesVisibleTreeState">
- <entry key="Project Default">
- <profile-state>
- <expanded-state>
- <State>
- <id>Android Lint: Correctness</id>
- </State>
- <State>
- <id>Android Lint: Security</id>
- </State>
- <State>
- <id>Best practisesGradle</id>
- </State>
- <State>
- <id>Gradle</id>
- </State>
- <State>
- <id>JUnit</id>
- </State>
- <State>
- <id>Java</id>
- </State>
- <State>
- <id>Probable bugsJava</id>
- </State>
- <State>
- <id>TestNGJava</id>
- </State>
- </expanded-state>
- </profile-state>
- </entry>
- </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
new file mode 100644
index 0000000..6f476b8
--- /dev/null
+++ b/buildSrc/build.gradle.kts
@@ -0,0 +1,15 @@
+plugins {
+ // The Kotlin DSL plugin provides a convenient way to develop convention plugins.
+ // Convention plugins are located in `src/main/kotlin`, with the file extension `.gradle.kts`,
+ // and are applied in the project's `build.gradle.kts` files as required.
+ `kotlin-dsl`
+}
+
+kotlin {
+ jvmToolchain(21)
+}
+
+dependencies {
+ // Add a dependency on the Kotlin Gradle plugin, so that convention plugins can apply it.
+ implementation(libs.kotlinGradlePlugin)
+}
diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts
new file mode 100644
index 0000000..705bfb5
--- /dev/null
+++ b/buildSrc/settings.gradle.kts
@@ -0,0 +1,17 @@
+dependencyResolutionManagement {
+
+ // Use Maven Central and the Gradle Plugin Portal for resolving dependencies in the shared build logic (`buildSrc`) project.
+ @Suppress("UnstableApiUsage")
+ repositories {
+ mavenCentral()
+ }
+
+ // Reuse the version catalog from the main build.
+ versionCatalogs {
+ create("libs") {
+ from(files("../gradle/libs.versions.toml"))
+ }
+ }
+}
+
+rootProject.name = "buildSrc" \ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts
new file mode 100644
index 0000000..d11bbb9
--- /dev/null
+++ b/buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts
@@ -0,0 +1,29 @@
+// The code in this file is a convention plugin - a Gradle mechanism for sharing reusable build logic.
+// `buildSrc` is a Gradle-recognized directory and every plugin there will be easily available in the rest of the build.
+package buildsrc.convention
+
+import org.gradle.api.tasks.testing.logging.TestLogEvent
+
+plugins {
+ // Apply the Kotlin JVM plugin to add support for Kotlin in JVM projects.
+ kotlin("jvm")
+}
+
+kotlin {
+ // Use a specific Java version to make it easier to work in different environments.
+ jvmToolchain(21)
+}
+
+tasks.withType<Test>().configureEach {
+ // Configure all test Gradle tasks to use JUnitPlatform.
+ useJUnitPlatform()
+
+ // Log information about all test results, not only the failed ones.
+ testLogging {
+ events(
+ TestLogEvent.FAILED,
+ TestLogEvent.PASSED,
+ TestLogEvent.SKIPPED
+ )
+ }
+}
diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts
new file mode 100644
index 0000000..dd40ae5
--- /dev/null
+++ b/demo/build.gradle.kts
@@ -0,0 +1,21 @@
+plugins {
+ kotlin("jvm")
+}
+
+group = "net.edolg.ninekt"
+version = "unspecified"
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation(kotlin("test"))
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
+kotlin {
+ jvmToolchain(21)
+} \ No newline at end of file
diff --git a/src/main/kotlin/demo/Main.kt b/demo/src/main/kotlin/Main.kt
index 640ec25..d04b135 100644
--- a/src/main/kotlin/demo/Main.kt
+++ b/demo/src/main/kotlin/Main.kt
@@ -1,17 +1,14 @@
-package demo
-
-import NetworkPacketTransporterJavaNet
-import NinePConnection
-import UnresolvableHostException
+import except.UnresolvableHostException
+import net.TransportLayerJavaNet
import kotlin.system.exitProcess
fun main(args: Array<String>) {
val myUsername = ""
val myPassword = ""
- val npconn: NinePConnection
+ val npconn: Connection
try {
- npconn = NinePConnection(NetworkPacketTransporterJavaNet("net!9p.mydomain.com!564"))
+ npconn = Connection(TransportLayerJavaNet("net!9p.mydomain.com!564"))
} catch (uhe: UnresolvableHostException) {
println("failed to connect :(")
exitProcess(1)
diff --git a/gradle.properties b/gradle.properties
index 7fc6f1f..b06a80a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1,7 @@
-kotlin.code.style=official
+# Enable the build cache to save time by reusing outputs produced by other successful builds.
+# https://docs.gradle.org/current/userguide/build_cache.html
+org.gradle.caching=true
+# Enable the configuration cache to reuse the build configuration and enable parallel task execution.
+# (Note that some plugins may not yet be compatible with the configuration cache.)
+# https://docs.gradle.org/current/userguide/configuration_cache.html
+org.gradle.configuration-cache=true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..93dc132
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,22 @@
+# Version catalog is a central place for you to declare and version dependencies
+# https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
+# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
+
+[versions]
+kotlin = "2.2.0"
+kotlinxDatetime = "0.6.2"
+kotlinxSerializationJSON = "1.8.1"
+kotlinxCoroutines = "1.10.2"
+
+[libraries]
+kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
+kotlinxDatetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
+kotlinxSerialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJSON" }
+kotlinxCoroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
+
+# Libraries can be bundled together for easier import
+[bundles]
+kotlinxEcosystem = ["kotlinxDatetime", "kotlinxSerialization", "kotlinxCoroutines"]
+
+[plugins]
+kotlinPluginSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 249e583..1b33c55 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 19226d2..ca025c8 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Thu Jun 19 23:52:08 CEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 1b6c787..23d15a9 100755
--- a/gradlew
+++ b/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# 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
+# 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/.
@@ -80,13 +82,11 @@ do
esac
done
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
+# This is normally unused
+# shellcheck disable=SC2034
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"'
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -133,22 +133,29 @@ location of your Java installation."
fi
else
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.
+ 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
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
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.
+
+# 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, 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 \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
+# 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.
diff --git a/gradlew.bat b/gradlew.bat
index ac1b06f..5eed7ee 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
-@if "%DEBUG%" == "" @echo off
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
+if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+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
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+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
+set CLASSPATH=
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+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!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
+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
diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts
new file mode 100644
index 0000000..dd40ae5
--- /dev/null
+++ b/lib/build.gradle.kts
@@ -0,0 +1,21 @@
+plugins {
+ kotlin("jvm")
+}
+
+group = "net.edolg.ninekt"
+version = "unspecified"
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation(kotlin("test"))
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
+kotlin {
+ jvmToolchain(21)
+} \ No newline at end of file
diff --git a/src/main/kotlin/Authenticator.kt b/lib/src/main/kotlin/Authenticator.kt
index 932004f..2d501ae 100644
--- a/src/main/kotlin/Authenticator.kt
+++ b/lib/src/main/kotlin/Authenticator.kt
@@ -3,16 +3,18 @@
*/
interface Authenticator {
/**
- * Authenticate a user identified by the given [username] and whose authenticity is confirmed by the given
- * [password]. The authentication protocol can read and write data within the underlying connection using [readFun]
- * and [writeFun].
+ * Authenticate a user identified by the given [username] and whose authenticity is confirmed by the given [key].
+ * The authentication protocol can read and write data within the underlying connection using [readFun] and
+ * [writeFun].
*
* @param username The name the user goes by.
- * @param password The confirmation of the user's authenticity.
+ * @param key The confirmation of the user's identity and authenticity. It could be any public, private, or derived
+ * (e.g. mixed with something else or hashed) datum, possibly shared between the server and the client, such as a
+ * UTF-8-encoded password or a raw public key.
* @param readFun A function to read incoming data from the underlying connection.
* @param writeFun A function to write outgoing data into the underlying connection.
* @throws except.FailedAuthenticationException if the authentication could not be performed. A human-readable
* reason for the failure can be provided if necessary.
*/
- fun authenticate(username: String, password: String, readFun: () -> List<UByte>, writeFun: (b: List<UByte>) -> Unit)
+ fun authenticate(username: String, key: List<UByte>, readFun: () -> List<UByte>, writeFun: (b: List<UByte>) -> Unit)
} \ No newline at end of file
diff --git a/src/main/kotlin/Authenticator9PAnyV2DP9IK.kt b/lib/src/main/kotlin/Authenticator9PAnyV2DP9IK.kt
index 99c52a0..a6495b1 100644
--- a/src/main/kotlin/Authenticator9PAnyV2DP9IK.kt
+++ b/lib/src/main/kotlin/Authenticator9PAnyV2DP9IK.kt
@@ -6,7 +6,7 @@
* default authenticated 9P service, it must implement the p9any meta-protocol, preferably version 2.
*/
class Authenticator9PAnyV2DP9IK : Authenticator {
- override fun authenticate(username: String, password: String, readFun: () -> List<UByte>, writeFun: (List<UByte>) -> Unit) {
+ override fun authenticate(username: String, key: List<UByte>, readFun: () -> List<UByte>, writeFun: (List<UByte>) -> Unit) {
}
} \ No newline at end of file
diff --git a/src/main/kotlin/Connection.kt b/lib/src/main/kotlin/Connection.kt
index f2cdd15..7f2e505 100644
--- a/src/main/kotlin/Connection.kt
+++ b/lib/src/main/kotlin/Connection.kt
@@ -101,8 +101,6 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
}
override fun auth(afid: UInt, uname: String, aname: String) {
- // TODO: Leave this unimplemented until p9any and TLS are implemented
- TODO("Not yet implemented")
}
override fun flush(oldtag: UShort) {
diff --git a/src/main/kotlin/FileMode.kt b/lib/src/main/kotlin/FileMode.kt
index 81712e6..81712e6 100644
--- a/src/main/kotlin/FileMode.kt
+++ b/lib/src/main/kotlin/FileMode.kt
diff --git a/src/main/kotlin/FilePermissions.kt b/lib/src/main/kotlin/FilePermissions.kt
index 84a7944..84a7944 100644
--- a/src/main/kotlin/FilePermissions.kt
+++ b/lib/src/main/kotlin/FilePermissions.kt
diff --git a/src/main/kotlin/IPAddress.kt b/lib/src/main/kotlin/IPAddress.kt
index 8eb7414..8eb7414 100644
--- a/src/main/kotlin/IPAddress.kt
+++ b/lib/src/main/kotlin/IPAddress.kt
diff --git a/src/main/kotlin/NinePMacros.kt b/lib/src/main/kotlin/NinePMacros.kt
index 738732b..d5aa83e 100644
--- a/src/main/kotlin/NinePMacros.kt
+++ b/lib/src/main/kotlin/NinePMacros.kt
@@ -1,6 +1,8 @@
/**
* Handy function that initializes the 9P connection.
*/
-fun initNineP(npconn: NinePConnection) {
+fun initNineP(npconn: Connection) {
// TODO: implement
-} \ No newline at end of file
+}
+
+fun readAll(npconn: Connection, ) \ No newline at end of file
diff --git a/src/main/kotlin/NinePMessageType.kt b/lib/src/main/kotlin/NinePMessageType.kt
index 4c8c60f..4c8c60f 100644
--- a/src/main/kotlin/NinePMessageType.kt
+++ b/lib/src/main/kotlin/NinePMessageType.kt
diff --git a/src/main/kotlin/PathInfo.kt b/lib/src/main/kotlin/PathInfo.kt
index 2aee406..2aee406 100644
--- a/src/main/kotlin/PathInfo.kt
+++ b/lib/src/main/kotlin/PathInfo.kt
diff --git a/src/main/kotlin/ProtocolTranslator.kt b/lib/src/main/kotlin/ProtocolTranslator.kt
index fee52f4..fee52f4 100644
--- a/src/main/kotlin/ProtocolTranslator.kt
+++ b/lib/src/main/kotlin/ProtocolTranslator.kt
diff --git a/src/main/kotlin/QID.kt b/lib/src/main/kotlin/QID.kt
index 4d0bd6a..4d0bd6a 100644
--- a/src/main/kotlin/QID.kt
+++ b/lib/src/main/kotlin/QID.kt
diff --git a/src/main/kotlin/SizedInteger.kt b/lib/src/main/kotlin/SizedInteger.kt
index 48e4e25..48e4e25 100644
--- a/src/main/kotlin/SizedInteger.kt
+++ b/lib/src/main/kotlin/SizedInteger.kt
diff --git a/src/main/kotlin/Stat.kt b/lib/src/main/kotlin/Stat.kt
index 20692c5..20692c5 100644
--- a/src/main/kotlin/Stat.kt
+++ b/lib/src/main/kotlin/Stat.kt
diff --git a/src/main/kotlin/TagGenerator.kt b/lib/src/main/kotlin/TagGenerator.kt
index c386b17..c386b17 100644
--- a/src/main/kotlin/TagGenerator.kt
+++ b/lib/src/main/kotlin/TagGenerator.kt
diff --git a/src/main/kotlin/Utils.kt b/lib/src/main/kotlin/Utils.kt
index 45185de..45185de 100644
--- a/src/main/kotlin/Utils.kt
+++ b/lib/src/main/kotlin/Utils.kt
diff --git a/src/main/kotlin/except/FailedAuthenticationException.kt b/lib/src/main/kotlin/except/FailedAuthenticationException.kt
index 94935c3..94935c3 100644
--- a/src/main/kotlin/except/FailedAuthenticationException.kt
+++ b/lib/src/main/kotlin/except/FailedAuthenticationException.kt
diff --git a/src/main/kotlin/except/InvalidMessageException.kt b/lib/src/main/kotlin/except/InvalidMessageException.kt
index 02a3cc4..02a3cc4 100644
--- a/src/main/kotlin/except/InvalidMessageException.kt
+++ b/lib/src/main/kotlin/except/InvalidMessageException.kt
diff --git a/src/main/kotlin/except/MsizeValueTooBigException.kt b/lib/src/main/kotlin/except/MsizeValueTooBigException.kt
index f1f6da1..f1f6da1 100644
--- a/src/main/kotlin/except/MsizeValueTooBigException.kt
+++ b/lib/src/main/kotlin/except/MsizeValueTooBigException.kt
diff --git a/src/main/kotlin/except/RErrorException.kt b/lib/src/main/kotlin/except/RErrorException.kt
index c15cbc2..c15cbc2 100644
--- a/src/main/kotlin/except/RErrorException.kt
+++ b/lib/src/main/kotlin/except/RErrorException.kt
diff --git a/src/main/kotlin/except/UnaccessibleFileException.kt b/lib/src/main/kotlin/except/UnaccessibleFileException.kt
index 07d5d13..07d5d13 100644
--- a/src/main/kotlin/except/UnaccessibleFileException.kt
+++ b/lib/src/main/kotlin/except/UnaccessibleFileException.kt
diff --git a/src/main/kotlin/except/UnknownVersionException.kt b/lib/src/main/kotlin/except/UnknownVersionException.kt
index 5023bc5..5023bc5 100644
--- a/src/main/kotlin/except/UnknownVersionException.kt
+++ b/lib/src/main/kotlin/except/UnknownVersionException.kt
diff --git a/src/main/kotlin/except/UnresolvableHostException.kt b/lib/src/main/kotlin/except/UnresolvableHostException.kt
index 19dd3b6..19dd3b6 100644
--- a/src/main/kotlin/except/UnresolvableHostException.kt
+++ b/lib/src/main/kotlin/except/UnresolvableHostException.kt
diff --git a/src/main/kotlin/net/InMessage.kt b/lib/src/main/kotlin/net/InMessage.kt
index 771c670..771c670 100644
--- a/src/main/kotlin/net/InMessage.kt
+++ b/lib/src/main/kotlin/net/InMessage.kt
diff --git a/src/main/kotlin/net/OutMessage.kt b/lib/src/main/kotlin/net/OutMessage.kt
index c9ae879..c9ae879 100644
--- a/src/main/kotlin/net/OutMessage.kt
+++ b/lib/src/main/kotlin/net/OutMessage.kt
diff --git a/src/main/kotlin/net/TransportLayer.kt b/lib/src/main/kotlin/net/TransportLayer.kt
index 90dcd11..90dcd11 100644
--- a/src/main/kotlin/net/TransportLayer.kt
+++ b/lib/src/main/kotlin/net/TransportLayer.kt
diff --git a/src/main/kotlin/net/TransportLayerJavaNet.kt b/lib/src/main/kotlin/net/TransportLayerJavaNet.kt
index 3d2867a..3d2867a 100644
--- a/src/main/kotlin/net/TransportLayerJavaNet.kt
+++ b/lib/src/main/kotlin/net/TransportLayerJavaNet.kt
diff --git a/src/test/kotlin/IPAddressTest.kt b/lib/src/test/kotlin/IPAddressTest.kt
index b213d71..b213d71 100644
--- a/src/test/kotlin/IPAddressTest.kt
+++ b/lib/src/test/kotlin/IPAddressTest.kt
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 4fb307b..1344179 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,5 +1,27 @@
+// The settings file is the entry point of every Gradle build.
+// Its primary purpose is to define the subprojects.
+// It is also used for some aspects of project-wide configuration, like managing plugins, dependencies, etc.
+// https://docs.gradle.org/current/userguide/settings_file_basics.html
+
+dependencyResolutionManagement {
+ // Use Maven Central as the default repository (where Gradle will download dependencies) in all subprojects.
+ @Suppress("UnstableApiUsage")
+ repositories {
+ mavenCentral()
+ }
+}
+
plugins {
+ // Use the Foojay Toolchains plugin to automatically download JDKs required by subprojects.
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
+
+// Include the `app` and `utils` subprojects in the build.
+// If there are changes in only one of the projects, Gradle will rebuild only the one that has changed.
+// Learn more about structuring projects with Gradle - https://docs.gradle.org/8.7/userguide/multi_project_builds.html
+//include(":app")
+//include(":utils")
+
rootProject.name = "ninekt"
-include("ninekt.demo") \ No newline at end of file
+include("lib")
+include("demo") \ No newline at end of file