--- /dev/null
+#!/usr/bin/env bash
+
+# The build environment.
+#
+env_error=false
+if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
+ echo "env_build:: This script must be sourced, not executed."
+ env_error=true
+fi
+if [ -z "$ENV_DEV" ]; then
+ echo "env_build:: script can only be run from the developer environment"
+ env_error=true
+fi
+if [ "$env_error" = true ]; then
+ return 1
+fi
+
+export JAVA_HOME="$REPO_HOME/tool/jdk-11"
+export GROOVY_HOME="$REPO_HOME/tool/groovy-4.0.9"
+
+export PATH=\
+"$REPO_HOME"/developer/shell\
+:"$JAVA_HOME"/bin\
+:"$GROOVY_HOME"/bin\
+:"$PATH"
+
+export CLASSPATH=\
+"$REPO_HOME"/developer/jvm\
+:"$REPO_HOME"/developer/jvm/Ariadne.jar\
+:"$JAVA_HOME"/lib\
+:"$GROOVY_HOME"/lib\
+:"$CLASSPATH"
+
+export ENV_DEV_BUILD=true
+echo "${BASH_SOURCE[0]}" "complete"
--- /dev/null
+#!/bin/env bash
+
+if [ -z "$ENV_DEV" ]; then
+ echo "make.sh:: script can only be run from the developer environment"
+ return 1
+fi
+
+# Ensure we are in the right directory
+cd "$REPO_HOME"/developer
+
+# Clean the scratch_pad and jvm directories
+echo "Cleaning scratch_pad and jvm directories..."
+rm -rf scratch_pad/*
+rm -rf jvm/*
+
+# Compile all files
+echo "Compiling files..."
+groovyc groovyc/*.groovy -d scratch_pad
+javac javac/*.java -d scratch_pad
+
+if [ $? -ne 0 ]; then
+ echo "Compilation failed."
+ exit 1
+fi
+
+# Create a JAR file from the compiled class files
+echo "Creating JAR file..."
+mkdir -p jvm
+jar cf jvm/Ariadne.jar -C scratch_pad .
+
+if [ $? -eq 0 ]; then
+ echo "JAR file created successfully: jvm/Ariadne.jar"
+else
+ echo "Failed to create JAR file."
+ exit 1
+fi
--- /dev/null
+#!/usr/bin/env groovy
+
+// Access the environment variable REPO_HOME
+def repo_home = System.getenv('REPO_HOME')
+def env_dev_build = System.getenv('ENV_DEV_BUILD')
+def arg_error = false
+if (!repo_home) {
+ println "release:: REPO_HOME is not set."
+ arg_error = true
+}
+if (!env_dev_build) {
+ println "release:: ENV_DEV_BUILD is not set."
+ arg_error = true
+}
+if (arg_error) {
+ System.exit(1)
+}
+
+def release_dir = "${repo_home}/release_candidate"
+def release_dir_file = new File(release_dir)
+if (!release_dir_file.exists()) {
+ release_dir_file.mkdirs()
+}
+
+// Function to use 'install' command for copying and setting permissions
+def install_file(source_fp, target_dp, perms) {
+ def target_file = "${target_dp}/${new File(source_fp).name}"
+ try {
+ def cmd = ["install", "-m", perms, source_fp, target_file]
+ def process = cmd.execute()
+ process.waitFor()
+ if (process.exitValue() != 0) {
+ println "Error: Failed to install ${new File(source_fp).name} to ${target_dp}"
+ println process.err.text
+ System.exit(1)
+ }
+ println "Installed ${new File(source_fp).name} to ${target_dp} with permissions ${perms}"
+ } catch (Exception e) {
+ println "Error: ${e.message}"
+ System.exit(1)
+ }
+}
+
+println "Starting release process..."
+
+def build_fp = "${repo_home}/developer/groovy/build"
+def ariadne_class_files = new File("${repo_home}/developer/groovyc").listFiles().findAll {
+ it.name.startsWith("AriadneGraph") && it.name.endsWith(".class")
+}
+
+// Install the build script
+install_file(build_fp, release_dir, "ug+r,ug+x")
+
+// Install all matching class files
+ariadne_class_files.each { class_file ->
+ install_file(class_file.absolutePath, release_dir, "ug+r")
+}
+
+println "Release process completed successfully."
--- /dev/null
+#!/bin/env bash
+
+# get this from the project management level exector directory
+"$REPO_HOME"/executor/version
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/env bash
-
-# The build environment.
-#
-env_error=false
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
- echo "env_build:: This script must be sourced, not executed."
- env_error=true
-fi
-if [ -z "$ENV_DEV" ]; then
- echo "env_build:: script can only be run from the developer environment"
- env_error=true
-fi
-if [ "$env_error" = true ]; then
- return 1
-fi
-
-export JAVA_HOME="$REPO_HOME/tool/jdk-11"
-export GROOVY_HOME="$REPO_HOME/tool/groovy-4.0.9"
-export PATH=\
-:"$JAVA_HOME"/bin\
-:"$GROOVY_HOME"/bin\
-:"$PATH"
-
-export ENV_DEV_BUILD=true
-echo "${BASH_SOURCE[0]}" "complete"
+++ /dev/null
-#!/bin/env bash
-
-if [ -z "$ENV_DEV" ]; then
- echo "make.sh:: script can only be run from in developer environment"
- return 1
-fi
-
-cd "$REPO_HOME"/developer/groovyc
-groovyc AriadneGraph.groovy
+++ /dev/null
-#!/usr/bin/env groovy
-
-// Access the environment variable REPO_HOME
-def repo_home = System.getenv('REPO_HOME')
-def env_dev_build = System.getenv('ENV_DEV_BUILD')
-def arg_error = false;
-if(!repo_home){
- println "release:: REPO_HOME is not set."
- arg_error = true
-}
-if(!env_dev_build){
- println "release:: ENV_BUILD_VERSION is not set."
- arg_error = true
-}
-if(arg_error){
- System.exit(1)
-}
-
-def release_dir = "${repo_home}/release_candidate"
-def release_dir_file = new File(release_dir)
-if (!release_dir_file.exists()){
- release_dir_file.mkdirs()
-}
-
-// Function to use 'install' command for copying and setting permissions
-def install_file(source_fp, target_dp, perms){
- def target_file = "${target_dp}/${new File(source_fp).name}"
- def cmd = ["install", "-m", perms, source_fp, target_file]
- def process = cmd.execute()
- process.waitFor()
- if( process.exitValue() != 0 ){
- println "Error: Failed to install ${new File(source_fp).name} to ${target_dp}"
- println process.err.text
- System.exit(1)
- }
- println "Installed ${new File(source_fp).name} to ${target_dp} with permissions ${perms}"
-}
-
-def build_fp = "${repo_home}/developer/groovy/build"
-def ariadne_class_files = new File("${repo_home}/developer/groovyc").listFiles().findAll {
- it.name.startsWith("AriadneGraph") && it.name.endsWith(".class")
-}
-
-// Install the build script
-install_file(build_fp, release_dir, "ug+r,ug+x")
-
-// Install all matching class files
-ariadne_class_files.each { class_file ->
- install_file(class_file.absolutePath, release_dir, "ug+r")
-}
-
+++ /dev/null
-#!/bin/env bash
-
-# get this from the project management level exector directory
-"$REPO_HOME"/executor/version
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/env groovy
-
-// Function to load the graph class dynamically
-def include_a_class( a_class_fp ){
- def class_loader = this.class.classLoader
- try{
- return class_loader.loadClass(a_class_fp)
- } catch(Exception e){
- return null
- }
-}
-
-// Shell User Interface to the build function
-def build(graph_definition_fp, root_node_labels){
-
- // Print summary of what we are doing
- println "Summary: Building targets for graph '${graph_definition_fp}.class'"
- if (root_node_labels.isEmpty()) {
- println "No build targets specified. Please provide root node labels to build."
- System.exit(0)
- }
- println "Building targets: ${root_node_labels.join(', ')}"
-
- // Load the dependency graph class from arg[1]
- def graph_definition_class = include_a_class(graph_definition_fp)
- if(graph_definition_class){
- println "build:: loaded ${graph_definition_fp}.class"
- } else{
- println "build:: failed to load ${graph_definition_fp}.class"
- System.exit(1)
- }
-
- // Get the node_map and node_f_list from the graph class
- def node_map = graph_definition_class.get_node_map()
- def node_f_list = graph_definition_class.get_node_f_list()
- println "node_map: ${node_map}"
- println "node_f_list: ${node_f_list}"
-
- // Create an instance of AriadneGraph, and run the build scripts
- def graph = new AriadneGraph(node_map ,node_f_list)
- graph.run_build_scripts_f(root_node_labels)
-}
-
-// Entry point for the script
-if(args.length == 0){
- println "Usage: ./build <graph_definition.class> [root_node_labels...]"
- System.exit(1)
-}
-
-// Get graph definition file and root node labels
-def graph_definition_fp = args[0]
-def root_node_labels = args.length > 1 ? args[1..-1] : []
-
-build(graph_definition_fp, root_node_labels)
-
class AriadneGraph {
- // Instance variables for graph data if needed
+ // to turn on debug checks and messages
+ static Boolean debug = true
+
+ // Instance variables for graph data
Map node_map = [:]
List node_f_list = []
/*--------------------------------------------------------------------------------
File utility functions
*/
+ static Map unpack_file_path(String file_fp) {
+ if (debug) println("unpack_file_path::file_fp: ${file_fp}")
+
+ def file = new File(file_fp)
+ def parent_dp = file.getParent() ?: ""
- static Map unpack_file_path( String file_fp ){
- def file = new File( file_fp )
+ if (parent_dp && !parent_dp.endsWith(File.separator)) {
+ parent_dp += File.separator
+ }
- def parent_dp = file.getParent()
def file_fn = file.getName()
- def file_fn_base = file_fn.lastIndexOf('.') > 0 ? file_fn[ 0..file_fn.lastIndexOf('.') - 1 ] : file_fn
- def file_fn_ext = file_fn.lastIndexOf('.') > 0 ? file_fn[ file_fn.lastIndexOf('.') + 1..-1 ] : ''
-
- return [
- parent_dp: parent_dp
- ,file_fn: file_fn
- ,file_fn_base: file_fn_base
- ,file_fn_ext: file_fn_ext
+ def file_fn_base = file_fn
+ def file_fn_ext = ''
+
+ if (file_fn.lastIndexOf('.') > 0) {
+ file_fn_base = file_fn[0..file_fn.lastIndexOf('.') - 1]
+ if (file_fn.lastIndexOf('.') + 1 < file_fn.length()) {
+ file_fn_ext = file_fn[file_fn.lastIndexOf('.') + 1..-1]
+ }
+ }
+
+ def ret_val = [
+ dp : parent_dp,
+ fn : file_fn,
+ fn_base : file_fn_base,
+ fn_ext : file_fn_ext
]
+ if (debug) println("unpack_file_path::ret_val: ${ret_val}")
+
+ return ret_val
}
static boolean file_exists_q( String node_label ){
Node type checks and marking
*/
- static Set all_node_type_set = ['symbol' ,'path' ,'leaf' ,'generator'] as Set
- static Set persistent_node_mark_set = ['cycle_member' ,'wellformed' ,'build_failed'] as Set
+ static Set all_node_type_set = [
+ 'symbol' // label is a symbol
+ ,'path' // label is a path to a file, though it might not exist
+ ,'leaf' // label is a path to a file that has no dependencies
+ ,'generator' // label is a path, but node has no neighbors
+ ,'error' // typically created by the system node has a message property
+ ] as Set
+
+ static Set persistent_node_mark_set =
+ [
+ 'cycle_member'
+ ,'wellformed'
+ ,'build_failed'
+ ,'null_node'
+ ] as Set
static boolean leaf_q( Map node ){
return node && node.type == 'leaf'
,'bad_node_type'
,'neighbor_value_must_be_list'
,'neighbor_reference_must_be_string'
+ ,'neighbor_label_not_in_graph'
,'mark_property_value_must_be_set'
,'unregistered_mark'
,'missing_required_build_code'
def form_error_set = [] as Set
if( !node ){
- form_error_set << 'no_node'
+ form_error_set << 'null_node'
return form_error_set
}
*/
def mark_node_form(node ,verbose = true){
- println("mark_node_form::node: ${node}")
+ if(debug){
+ if(node)
+ println("mark_node_form::node: ${node}")
+ else
+ println("mark_node_form given a null node")
+ }
def form_errors = wellformed_q(node)
-
if( form_errors.isEmpty() ){
set_mark(node ,'wellformed');
return 'wellformed'
}
-
+ // at this point we know that form_errors is not empty
+
if(verbose){
- if(node.label && node.label.length() > 0){
+ if(node && node.label && node.label.length() > 0)
print("node ${neighbor_node.label} is malformed due to:")
- } else {
+ else
print("anonymous node is malformed due to:")
- }
form_errors.each { error -> print(" ${error}") }
println("")
}
}
- /*
- Given a path stack initialized with the path root ,descends to a leaf node
- while looking for cycles. Marks nodes as 'cycle_member' if a cycle is
- detected. Marks nodes as `wellformed` if `wellformed_q`. Returns a set of
- tokens indicating the status: 'cycle_found' ,'defacto_leaf' ,and
- 'exists_malformed'.
+ /*
+ Each node_label must be a string and not empty.
- the de-fact leaf node test ..
- // a 'de-facto' leaf node test .. subtleties here because we have not yet
- // determined if the nodes we are wellformed. This is purposeful ,as
- // this function does not know about the relationships between the
- // possible error marks.
+ Subleties here because we have not yet determined if the nodes we are
+ wellformed (after all, that is what we are determining here).
+ Given a path stack initialized with the path root ,descends to a leaf node
+ while looking for cycles. Marks nodes as to their form. Returns a set of
+ tokens.
+
+ If we want to attempt to build 'islands' of things that might be located on
+ the far side of cycles, then modify the cycle finder to return a list of
+ cycles (i.e. a list of lists), then use each of cycle definition (a list) as
+ the root nodes for further search.
+
+
+ */
+ static Set markup_graph_f_descend_set = [
+ 'empty_path_stack'
+ ,'cycle_found'
+ ,'undefined_node'
+ ,'exists_malformed'
+ ,'defacto_leaf'
+ ] as Set
- */
def markup_graph_f_descend(path_stack ,boolean verbose = true){
def ret_value = [] as Set
if( path_stack.isEmpty() ){
- println( "markup_graph_f_descend:: given null to descend from")
+ if(verbose) println( "markup_graph_f_descend:: given empty path_stack to descend from")
+ ret_value << 'empty_path_stack'
return ret_value
}
def local_path = path_stack.collect{ it[0] }
do{
- // Check for a cycle in the local path
+ // Check for a cycle in the local path, if found marks cycle members
if( local_path.size() > 1){
cycle_start_index = local_path[0..-2].findIndexOf{ it == local_node_label }
if(cycle_start_index != -1){ // Cycle detected
ret_value << 'cycle_found'
if(verbose) print "markup_graph_f_descend:: dependency cycle found:"
local_path[cycle_start_index..-1].each{ cycle_node_label ->
+ if(verbose) print " ${cycle_node_label}"
def cycle_node = lookup(cycle_node_label)
- if(verbose) print " ${cycle_node.label}"
cycle_node.mark = cycle_node.mark ?: [] as Set // Initialize mark set if needed
cycle_node.mark << 'cycle_member'
}
}
def local_node = lookup(local_node_label)
- if( mark_node_form(local_node) == 'malformed' ) ret_value << 'exists_malformed'
+ if( !local_node ){
+ ret_value << 'undefined_node'
+ return ret_value
+ }
+ if( mark_node_form(local_node) == 'malformed' ){
+ ret_value << 'exists_malformed'
+ }
if( local_node.neighbor.isEmpty() ){
ret_value << 'defacto_leaf' // might not be `type:leaf`
return ret_value
do{
result = markup_graph_f_descend(path_stack ,verbose)
if('cycle_found' in result) ret_value << 'cycle_exists'
+ if('undefined_node' in result) exists_malformed = true;
if('exists_malformed' in result) exists_malformed = true;
// increment the iterator to the next leftmost path
Graph traversal
*/
+ // given a node label, looks it up on the dependency graph, returns the node or null
Map lookup(String node_label ,boolean verbose = true){
- def lookup_node = this.node_map[node_label]
- if(!lookup_node){
- if(verbose) println "lookup:: Node ${node_label} could not be found."
- def match_result
- for( func in this.node_f_list ){
- match_result = func( node_label )
- if( match_result.status == "matched" ){
- lookup_node = match_result
- break
- }
+
+ if(!node_label){
+ if(verbose) println("lookup:: given node_label is null or an empty string")
+ return null
+ }
+
+ // try the map
+ def node = this.node_map[node_label]
+ if(node){
+ node.label = node_label
+ if(verbose) println("lookup:: found from map: ${node}")
+ return node
+ }
+ // at this point node will be null
+
+ // The map lookup failed, lets try the function recognizer list ..
+ def match_result
+ for( func in this.node_f_list ){
+ match_result = func(node_label)
+ if( match_result.status == 'matched' ){
+ node = match_result
+ break
}
}
- lookup_node.label = node_label
- if(verbose) println("lookup::node: ${lookup_node}")
- return lookup_node
+
+ if(verbose)
+ if(node) println("lookup:: found from recognizer function: ${node}")
+ else println("lookup:: failed to find label: ${node_label}")
+
+ return node
}
// mark aware lookup function
--- /dev/null
+class BuildGraph {
+
+ // Function to load the graph class dynamically
+ static def include_a_class(String a_class_fp) {
+ def class_loader = BuildGraph.class.classLoader
+ def class_name = a_class_fp.replace('/', '.').replace('.class', '')
+ try {
+ return class_loader.loadClass(class_name)
+ } catch (Exception e) {
+ println "Error loading class '${class_name}': ${e.message}"
+ return null
+ }
+ }
+
+ // Build function
+ static def build(String graph_definition_fp, List<String> root_node_labels) {
+
+ // Print summary of what we are doing
+ println "build:: Building targets for graph '${graph_definition_fp}.class'"
+ if (root_node_labels.isEmpty()) {
+ println "No build targets specified. Please provide root node labels to build."
+ System.exit(0)
+ }
+ println "Building targets: ${root_node_labels.join(', ')}"
+
+ // Load the dependency graph class from arg[1]
+ def graph_definition_class = include_a_class(graph_definition_fp)
+ if (graph_definition_class) {
+ println "build:: loaded ${graph_definition_fp}.class"
+ } else {
+ println "build:: failed to load ${graph_definition_fp}.class"
+ System.exit(1)
+ }
+
+ // Get the node_map and node_f_list from the graph class
+ def node_map = graph_definition_class.get_node_map()
+ def node_f_list = graph_definition_class.get_node_f_list()
+ println "node_map: ${node_map}"
+ println "node_f_list: ${node_f_list}"
+
+ // Create an instance of AriadneGraph, and run the build scripts
+ def graph = new AriadneGraph(node_map, node_f_list)
+ graph.run_build_scripts_f(root_node_labels)
+ }
+
+ // Entry point when run as a script
+ static void main(String[] args) {
+ if (args.length == 0) {
+ println "Usage: ./build <graph_definition.class> [root_node_labels...]"
+ System.exit(1)
+ }
+
+ // Get graph definition file and root node labels
+ def graph_definition_fp = args[0]
+ def root_node_labels = args.length > 1 ? args[1..-1] : []
+ build(graph_definition_fp, root_node_labels)
+ }
+}
--- /dev/null
+public class PaintItBlack {
+ public static void main(String[] args) {
+ System.out.println("Paint it black.");
+ }
+}
--- /dev/null
+#!/bin/env bash
+
+java BuildGraph "$@"
--- /dev/null
+#!/usr/bin/env bash
+
+# Ensure the script is sourced
+if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
+ echo "This script must be sourced, not executed. Exiting."
+ return 1
+fi
+
+# These are things set by the `repo` command found in the `resource` project,
+# but if you don't have that, then source this into the environment.
+
+script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+export REPO_HOME="${script_path%/*}"
+export PROJECT=$(basename "$REPO_HOME")
+
+PPS1="\n[$PROJECT]\n\u@\h§$(pwd)§\n> "
+PPS2=">> "
+
+echo REPO_HOME "$REPO_HOME"
+echo PROJECT "$PROJECT"
+echo "${BASH_SOURCE[0]}" "complete"
+
+export ENV_BASE=true
--- /dev/null
+#!/usr/bin/env bash
+
+# Ensure the script is sourced
+if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
+ echo "This script must be sourced, not executed. Exiting."
+ return 1
+fi
+
+if [ -z "$ENV_BASE" ]; then
+ script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+ source "${script_path}/env_base"
+fi
+
+export PATH="$REPO_HOME/developer/executable":"$PATH"
+
+# so the .gitignore files can be seen:
+alias ls="ls -a"
+
+cd "$REPO_HOME/developer"
+
+export ENV_DEV=true
+source "$REPO_HOME"/developer/executable/env_build
+echo "${BASH_SOURCE[0]}" "complete"
+
+
+
--- /dev/null
+#!/usr/bin/env bash
+
+# Ensure the script is sourced
+if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
+ echo "This script must be sourced, not executed. Exiting."
+ return 1
+fi
+
+if [ -z "$ENV_BASE" ]; then
+ script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+ source "${script_path}/env_base"
+fi
+
+ENV_PM=true
+
+PROJECT="$PROJECT"_PM
+
+export PATH=\
+"$REPO_HOME"/executor\
+:"$PATH"
+
+# no sneaky hidden files
+alias ls="ls -a"
+
+
+export ENV_PM=true
+echo "${BASH_SOURCE[0]}" "complete"
--- /dev/null
+#!/usr/bin/env bash
+
+# Ensure the script is sourced
+if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
+ echo "This script must be sourced, not executed. Exiting."
+ return 1
+fi
+
+# Check if REPO_HOME is set, if not source env_base
+if [ -z "$ENV_BASE" ]; then
+ script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+ source "${script_path}/env_base"
+fi
+
+PROJECT="$PROJECT"_TESTER
+
+export PATH=\
+"$REPO_HOME"/tester/executor\
+:"$PATH"
+
+cd "$REPO_HOME"/tester
+
+
+export ENV_TESTER=true
+source executor/env_tester
+echo "${BASH_SOURCE[0]}" "complete"
--- /dev/null
+#!/bin/env bash
+
+echo 0.1
+
+++ /dev/null
-#!/usr/bin/env bash
-
-# Ensure the script is sourced
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
- echo "This script must be sourced, not executed. Exiting."
- return 1
-fi
-
-# These are things set by the `repo` command found in the `resource` project,
-# but if you don't have that, then source this into the environment.
-
-script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
-export REPO_HOME="${script_path%/*}"
-export PROJECT=$(basename "$REPO_HOME")
-
-PPS1="\n[$PROJECT]\n\u@\h§$(pwd)§\n> "
-PPS2=">> "
-
-echo REPO_HOME "$REPO_HOME"
-echo PROJECT "$PROJECT"
-echo "${BASH_SOURCE[0]}" "complete"
-
-export ENV_BASE=true
+++ /dev/null
-#!/usr/bin/env bash
-
-# Ensure the script is sourced
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
- echo "This script must be sourced, not executed. Exiting."
- return 1
-fi
-
-if [ -z "$ENV_BASE" ]; then
- script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
- source "${script_path}/env_base"
-fi
-
-export PATH=\
-"$REPO_HOME"/developer/executor\
-:"$PATH"
-
-# so the .gitignore files can be seen:
-alias ls="ls -a"
-
-# Corrected line:
-cd "$REPO_HOME/developer"
-
-export ENV_DEV=true
-source "$REPO_HOME"/developer/executor/env_build
-echo "${BASH_SOURCE[0]}" "complete"
-
-
-
+++ /dev/null
-#!/usr/bin/env bash
-
-# Ensure the script is sourced
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
- echo "This script must be sourced, not executed. Exiting."
- return 1
-fi
-
-if [ -z "$ENV_BASE" ]; then
- script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
- source "${script_path}/env_base"
-fi
-
-ENV_PM=true
-
-PROJECT="$PROJECT"_PM
-
-export PATH=\
-"$REPO_HOME"/executor\
-:"$PATH"
-
-# no sneaky hidden files
-alias ls="ls -a"
-
-
-export ENV_PM=true
-echo "${BASH_SOURCE[0]}" "complete"
+++ /dev/null
-#!/usr/bin/env bash
-
-# Ensure the script is sourced
-if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
- echo "This script must be sourced, not executed. Exiting."
- return 1
-fi
-
-# Check if REPO_HOME is set, if not source env_base
-if [ -z "$ENV_BASE" ]; then
- script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
- source "${script_path}/env_base"
-fi
-
-PROJECT="$PROJECT"_TESTER
-
-export PATH=\
-"$REPO_HOME"/tester/executor\
-:"$PATH"
-
-cd "$REPO_HOME"/tester
-
-
-export ENV_TESTER=true
-source executor/env_tester
-echo "${BASH_SOURCE[0]}" "complete"
+++ /dev/null
-#!/bin/env bash
-
-echo 0.1
-
#!/usr/bin/env groovy
+// Function to load the graph class dynamically
+def include_a_class(a_class_fp) {
+ def class_loader = this.class.classLoader
+ def class_name = a_class_fp.replace('/', '.').replace('.class', '')
+ try {
+ return class_loader.loadClass(class_name)
+ } catch (Exception e) {
+ println "Error loading class '${class_name}': ${e.message}"
+ return null
+ }
+}
+
+/*
// Function to load the graph class dynamically
def include_a_class( a_class_fp ){
def class_loader = this.class.classLoader
} catch(Exception e){
return null
}
-}
+ }
+ */
// Shell User Interface to the build function
def build(graph_definition_fp, root_node_labels){
// Print summary of what we are doing
- println "Summary: Building targets for graph '${graph_definition_fp}.class'"
+ println "build:: Building targets for graph '${graph_definition_fp}.class'"
if (root_node_labels.isEmpty()) {
println "No build targets specified. Please provide root node labels to build."
System.exit(0)
// Get graph definition file and root node labels
def graph_definition_fp = args[0]
def root_node_labels = args.length > 1 ? args[1..-1] : []
-
build(graph_definition_fp, root_node_labels)
--- /dev/null
+
+Normally I would test individual subroutines/methods, then
+combinations. However, this code was copied over from a Gradle script. So
+instead, the tests are graded in complexity.
+
+test0 - tests that the code will compile. The test itself consists
+of an empty graph. This was also the first test to make use of the
+directory structure and work flow.
+
+test1 - The test graph has a single symbolic node. The question is if
+the build code will run. The build code prints a message, said to
+be the title of the graph.
+
+test2 - The test graph consists of a single node abstraction function
+that builds nodes on the fly given a recognized target input.
+
+
env_error=true
fi
-cd "$REPO_HOME"/tester/test0
+set -x
+
groovyc TestGraph.groovy
--- /dev/null
+public class HelloWorld{
+ public static void main( String[] args ){
+ System.out.println( "Hello, world!" );
+ }
+}
--- /dev/null
+import AriadneGraph
+
+class TestGraph {
+
+ static def get_node_map(){
+ return [:]
+ }
+
+ // given label <x>.class returns node to build <x>.class from <x>.java
+ static java_to_class( node_label ){
+ println("java_to_class::")
+
+ def target=AriadneGraph.unpack_file_path(node_label)
+ println("java_to_class_f:: given target: ${target}")
+
+ // this function recognizes <x>.class files:
+ if( !target.fn || target.fn_ext != 'class' ) return [status: 'no_match']
+ println("java_to_class_f:: node_label ${node_label} matched")
+
+ def class_fp = node_label
+ def java_fp = target.dp + target.fn_base + '.java'
+
+ return [
+ status: 'matched'
+ ,label: class_fp
+ ,type: 'path'
+ ,neighbor: [java_fp] // The corresponding .java file
+ ,build: {
+ def process="javac ${java_fp}".execute()
+ process.waitFor()
+ if( process.exitValue() == 0 ){
+ return [status: 'success' ,output: class_fp]
+ } else {
+ return [status: 'failure' ,error: process.err.text]
+ }
+ }
+ ]
+ }
+
+ static java_leaf( node_label ){
+ println("java_to_leaf::")
+
+ def target = AriadneGraph.unpack_file_path( node_label )
+ println("java_to_class_f:: given target: ${target}")
+
+ // This function recognizes <x>.java files:
+ if( !target.fn || target.fn_ext != 'java' ) return [status: 'no_match']
+ println("java_to_class_f:: node_label ${node_label} matched")
+
+ def java_fp = node_label
+
+ return [
+ status: 'matched'
+ ,label: java_fp
+ ,type: 'leaf'
+ ,neighbor: [] // Leaf nodes have no dependencies
+ ]
+ }
+
+ // Static method to define the function list
+ static def get_node_f_list(){
+ return (
+ [
+ { node_label -> java_to_class(node_label) }
+ ,{ node_label -> java_leaf(node_label) }
+ ]
+ )
+ }
+
+}
--- /dev/null
+
+if [ -z "$ENV_TESTER" ]; then
+ echo "env_test0:: script can only be run in the tester environment"
+ env_error=true
+fi
+
+export CLASSPATH=\
+"$REPO_HOME"/release_candidate\
+:"$REPO_HOME"/tester/test2\
+:$CLASSPATH
+
--- /dev/null
+#!/bin/env bash
+
+# smoke test, and yes, there was a lot of smoke
+set -x
+
+source env_test
+echo $CLASSPATH
+build TestGraph HelloWorld.class
+
+echo "test complete"
+