PaintIt Java example using the Harmony skeleton updated by Varen core_developer_branch
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Fri, 19 Sep 2025 15:54:44 +0000 (08:54 -0700)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Fri, 19 Sep 2025 15:54:44 +0000 (08:54 -0700)
16 files changed:
.gitattributes [new file with mode: 0644]
README.md
developer/document/#variable_suffix_conventions.txt# [deleted file]
developer/document/RT_code_style.txt
developer/tool/env
developer/tool/make
env_developer [new file with mode: 0755]
env_tester [new file with mode: 0755]
scratchdir/.githolder [new file with mode: 0644]
tester/java/TestPaintIt.java [new file with mode: 0644]
tester/tool/make.sh [deleted file]
tester/tool/run_tests.sh [new file with mode: 0755]
tmp/.githolder [new file with mode: 0644]
tool/#env_administrator# [deleted file]
tool_shared/document/#install_java.txt# [deleted file]
tool_shared/document/install_groovy.txt [deleted file]

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..fa36537
--- /dev/null
@@ -0,0 +1,19 @@
+* text=auto eol=lf
+*.sh     eol=lf
+*.bash   eol=lf
+*.py     eol=lf
+*.org    linguist-language=Org
+*.md     linguist-language=Markdown
+*.c      linguist-language=C
+*.cc     linguist-language=C++
+*.lib.c  linguist-language=C
+*.cli.c  linguist-language=C
+*.lib.cc linguist-language=C++
+*.cli.cc linguist-language=C++
+**/.githolder export-ignore
+scratchdir/       export-ignore
+tmp/              export-ignore
+.gitignore        export-ignore
+.editorconfig     export-ignore
+LICENSES/* text
+document/licenses/* text
index c845768..5dca061 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,10 +1,46 @@
+# Paint-It (Java) — RT example project
 
-First draft of a skeleton project. This project structure is intended to
-be language agnostic.
+Tiny example app using the **Harmony** skeleton & RT conventions.  
+No Groovy, no Gradle — just plain Java + small scripts.
 
-This skeleton is built around the simple Java 'Paintit' example.
+## What it does
+Three classes under `developer/javac/`:
+- `Black` prints “Paint it black.” (jar entry main)
+- `Blue` prints “Paint it blue.”
+- `Green` extends `Blue` and overrides `print()`.
 
-No build tool is assumed, instead there are some simple bash scripts which
-build the project, and thus show what a build tool needs to do.
+## How to build (developer role)
+```bash
+source ./env_developer
+developer/tool/make
+# jar lands at: release_candidate/PaintIt.jar
+# launchers:
+developer/shell/black
+developer/shell/blue
+developer/shell/green
+```
 
+## How to test (tester role)
+```bash
+source ./env_tester
+tester/tool/run_tests.sh
+```
+The test compiles a tiny Java program against the jar and asserts on output.  
+(We can switch to **Mosaic** later if you want the full harness.)
 
+## Layout notes
+- Role envs live at repo root (source them; don’t execute).
+- Build scripts are intentionally simple and local.
+- No Groovy: prior copies have been removed.
+
+## RT build & test ecosystem (where this fits)
+- *Ariadne* — shared make rules (e.g., suffixes like `.lib.cc`, `.cli.cc`).  
+  This Java example doesn’t need them, but if you want Ariadne here, we can add a `Makefile` that includes the rules from **RT-project-share** when present.
+- *Mosaic* — test orchestration. The current test is a lightweight shell; Mosaic can wrap this later.
+
+Repos:
+- RT GCC (C/C++ extras): https://github.com/Thomas-Walker-Lynch/RT_gcc
+- RT project share (makefiles, docs): https://github.com/Thomas-Walker-Lynch/RT-project-share
+
+## License
+MIT (inherit from the skeleton unless you replace `LICENSE`).
diff --git a/developer/document/#variable_suffix_conventions.txt# b/developer/document/#variable_suffix_conventions.txt#
deleted file mode 100644 (file)
index 8aca090..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Suffix Conventions
-
-## Specify interface used with variable when clarification is useful:
-
-- `_set`: Indicates that the variable holds a set of items.
-
-- `_list`: Used for variables that represent a list of items.
-
-- `_f`: Refers to a function.
-
-Instead of making a variable name plural, add the interface qualifier:
-
-   e.g. names ->  name_set  or name_list
-
-## Always a good idea to use these when working with files:
-
-- `_fp`: Refers to a file path. The part after the last slash is a file name.
-  
-- `_dp`: Refers to a directory path. By convention, the value ends in a slash.
-
-- `_fn`: Refers to a file name. Value has no slashes.
-
-- `_dn`: Refers to a directory name. Value has no slashes.
-  
-- `_fn_base`: The file name without the last dot and subsequent characters.
-  
-- `_fn_ext`: The subsequent characters after the last dot in a file name.
index e142eba..594eeaa 100644 (file)
@@ -37,11 +37,23 @@ with the padding rules for enclosures.
 
    - No space **after** the comma (e.g., `a ,b`).
 
-   - **Line break before** the comma when breaking lines, but no line break after (e.g.,
+   - **Line break before** the comma when breaking lines, but no line break after, as examples:
+
      ```
      a
      ,b
-     ```).
+     ```
+
+     and, when a function call gets too long, perhaps due to long argument 
+     names it will look like this:
+
+     ```
+     result = some_function(
+       arg1
+      ,arg2_has_a_very_long_name_causing_the_call_to_not_fit_on_a_single_line
+      ,arg3_has_a_long_name_also_but_not_as_long_as_for_arg2
+      );
+     ```
 
 3. Variable Naming:
 
index 0e456f7..9ee6e73 100644 (file)
@@ -2,7 +2,6 @@
 
 echo "REOP_HOME/developer/tool/env"
 
-
 # The build environment. 
 #
 env_error=false
index 7c6291e..07c4942 100755 (executable)
@@ -1,63 +1,49 @@
-#!/bin/env bash
+#!/usr/bin/env bash
+# Paint-It developer build (no Groovy; plain Java)
+set -euo pipefail
 
-if [ -z "$ENV_DEVELOPER" ]; then
-  echo "make_PaintIt:: script can only be run from the developer environment"
-  return 1
+if [ -z "${ENV_DEVELOPER:-}" ]; then
+  echo "make:: run this from the developer environment (source ./env_developer)"
+  exit 1
 fi
 
-# Ensure we are in the right directory
-cd "$REPO_HOME"/developer
+cd "$REPO_HOME/developer"
 
-# Start with a fresh scratch_pad and remove a prior jvm
-# Depending, this is unnecessary and might even be undesirable.
-# Better to clean up the stuff we will rewrite instead of everything.
-# But for testing and in an unstable environment, this is probably best.
-echo "Starting with a clean scratch_pad and jvm directories..."
-rm -rf scratch_pad/*
-rm -rf jvm/PaintIt.jar
+SRC_DIR="javac"
+BUILD_DIR="build/classes"
+DIST_DIR="$REPO_HOME/release_candidate"
+JAR_NAME="PaintIt.jar"
 
-# Compile all files (Black.java and Blue.java) with the correct package
-echo "Compiling files..."
-javac -d scratch_pad javac/Black.java javac/Blue.java javac/Green.java
+mkdir -p "$BUILD_DIR" "$DIST_DIR" shell
 
-if [ $? -ne 0 ]; then
-  echo "Compilation failed."
-  exit 1
-fi
+echo "[build] Compiling Java sources from $SRC_DIR → $BUILD_DIR"
+find "$SRC_DIR" -name '*.java' > .sources.list
+javac -d "$BUILD_DIR" @.sources.list
+rm -f .sources.list
 
-# Create a JAR file from the compiled class files with correct package structure
-echo "Creating JAR file..."
-mkdir -p jvm
-jar cf jvm/PaintIt.jar -C scratch_pad .
+echo "[build] Creating JAR: $DIST_DIR/$JAR_NAME"
+cd "$BUILD_DIR"
+jar --create --file "$DIST_DIR/$JAR_NAME"     --manifest <(printf 'Main-Class: com.ReasoningTechnology.PaintIt.Black\n')     $(find . -type f -name '*.class' -print)
 
-if [ $? -eq 0 ]; then
-  echo "JAR file created successfully: jvm/PaintIt.jar"
-else
-  echo "Failed to create JAR file."
-  exit 1
-fi
-
-# Create shell wrappers in developer/shell for easy execution
-echo "Creating shell wrappers..."
-mkdir -p shell
+cd "$REPO_HOME/developer"
 
-cat > shell/black << EOL
-#!/bin/bash
-java com/ReasoningTechnology/PaintIt/Black
+# simple launchers (classpath to jar)
+cat > shell/black << 'EOL'
+#!/usr/bin/env bash
+exec java -jar "$REPO_HOME/release_candidate/PaintIt.jar"
 EOL
 chmod +x shell/black
 
-cat > shell/blue << EOL
-#!/bin/bash
-java com/ReasoningTechnology/PaintIt/Blue
+cat > shell/blue << 'EOL'
+#!/usr/bin/env bash
+exec java -cp "$REPO_HOME/release_candidate/PaintIt.jar" com.ReasoningTechnology.PaintIt.Blue
 EOL
 chmod +x shell/blue
 
-cat > shell/green << EOL
-#!/bin/bash
-java com/ReasoningTechnology/PaintIt/Green
+cat > shell/green << 'EOL'
+#!/usr/bin/env bash
+exec java -cp "$REPO_HOME/release_candidate/PaintIt.jar" com.ReasoningTechnology.PaintIt.Green
 EOL
 chmod +x shell/green
 
-echo "Shell wrappers created successfully: black, blue, green"
-
+echo "[build] done"
diff --git a/env_developer b/env_developer
new file mode 100755 (executable)
index 0000000..0963e2f
--- /dev/null
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# source this file
+source ./tool/env_developer
diff --git a/env_tester b/env_tester
new file mode 100755 (executable)
index 0000000..10a3d6b
--- /dev/null
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# source this file
+source ./tool/env_tester
diff --git a/scratchdir/.githolder b/scratchdir/.githolder
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tester/java/TestPaintIt.java b/tester/java/TestPaintIt.java
new file mode 100644 (file)
index 0000000..7bb4756
--- /dev/null
@@ -0,0 +1,11 @@
+package test;
+
+import com.ReasoningTechnology.PaintIt.*; 
+
+public class TestPaintIt {
+  public static void main(String[] args) {
+    Blue.print();
+    Green.print();
+    System.out.println("OK");
+  }
+}
diff --git a/tester/tool/make.sh b/tester/tool/make.sh
deleted file mode 100755 (executable)
index 4ecb729..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/env bash
-
-if [ -z "$ENV_TESTER" ]; then
-  echo "make.sh:: script can only be run in the tester  environment"
-  env_error=true
-fi
-
-set -x
-
-groovyc TestGraph.groovy
diff --git a/tester/tool/run_tests.sh b/tester/tool/run_tests.sh
new file mode 100755 (executable)
index 0000000..3a2a404
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ -z "${ENV_TESTER:-}" ]; then
+  echo "run_tests:: run this from the tester environment (source ./env_tester)"
+  exit 1
+fi
+
+cd "$REPO_HOME"
+
+JAR="$REPO_HOME/release_candidate/PaintIt.jar"
+if [ ! -f "$JAR" ]; then
+  echo "[test] No jar found, building via developer tool…"
+  ( source ./env_developer && "$REPO_HOME"/developer/tool/make )
+fi
+
+echo "[test] Compiling test"
+mkdir -p tester/build
+javac -cp "$JAR" -d tester/build tester/java/TestPaintIt.java
+
+echo "[test] Running"
+output=$(java -cp "$JAR:tester/build" test.TestPaintIt)
+echo "$output"
+
+# naive assertions
+echo "$output" | grep -q "Paint it blue."
+echo "$output" | grep -q "Paint it green."
+echo "$output" | grep -q "OK"
+
+echo "[test] PASS"
diff --git a/tmp/.githolder b/tmp/.githolder
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tool/#env_administrator# b/tool/#env_administrator#
deleted file mode 100644 (file)
index e6bddc4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env bash
-
-# Ensure the script is sourced
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
-  echo "This script must be sourced, not executed. Exiting."
-  exit 1
-fi
-
-if [ -z "$ENV_BASE" ]; then
-  script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
-  source "${script_path}/env_base"
-fi
-
-ENV_ADMINISTRATOR=true
-
-PROJECT="$PROJECT"_administrator
-
-export PATH=\
-"$REPO_HOME"/tool\
-:"$PATH"
-
-# no sneaky hidden files
-alias ls="ls -a"
-
-
-export ENV_ADMINISTRATOR=true
-jecho "${BASH_SOURCE[0]}" "complete"
diff --git a/tool_shared/document/#install_java.txt# b/tool_shared/document/#install_java.txt#
deleted file mode 100644 (file)
index 0091eac..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#1. downlaod
-
-cd "$REPO_HOME/tool/upstream"
-curl -C - -o OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16+8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz
-
-#2. extract
-
-cd "$REPO_HOME/tool"
-mkdir -p jdk-11
-tar -xzf "$REPO_HOME/tool/upstream/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz" -C jdk-11 --strip-components 1
diff --git a/tool_shared/document/install_groovy.txt b/tool_shared/document/install_groovy.txt
deleted file mode 100644 (file)
index 76ec07e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-
-1. Docs
-  https://groovy-lang.org/documentation.html
-
-2. Install from source
-
-  # 1.1 Download
-
-    # https://dlcdn.apache.org/groovy/
-
-    cd $REPO_HOME/toolsmith/upstream
-    wget https://dlcdn.apache.org/groovy/4.0.23/sources/apache-groovy-src-4.0.23.zip
-
-  # 1.2 then build them ;-)
-
-2. Install binaries
-
-  #!/usr/bin/env bash
-
-  # Define version of Groovy to be installed
-  version="4.0.9"
-
-  # 2.1 Download using curl
-  cd "$REPO_HOME/toolsmith/upstream"
-  curl -o apache-groovy-binary-${version}.zip https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-binary-${version}.zip
-
-  # 2.2 Extract
-  cd "$REPO_HOME/tools"
-  unzip "$REPO_HOME/tools/upstream/apache-groovy-binary-${version}.zip" -d .