From: Thomas Walker Lynch Date: Mon, 7 Oct 2024 07:43:54 +0000 (+0000) Subject: groovy class not reocgnized by jvm, switching to Java X-Git-Url: https://git.reasoningtechnology.com/style/static/%7Bstyle.link%7D?a=commitdiff_plain;h=c117a1b95c197ca3f300fe0c157223f7f45f4178;p=Ariadne groovy class not reocgnized by jvm, switching to Java --- diff --git a/developer/executable/env_build b/developer/executable/env_build new file mode 100644 index 0000000..a651d09 --- /dev/null +++ b/developer/executable/env_build @@ -0,0 +1,35 @@ +#!/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" diff --git a/developer/executable/make.sh b/developer/executable/make.sh new file mode 100755 index 0000000..fe471b5 --- /dev/null +++ b/developer/executable/make.sh @@ -0,0 +1,36 @@ +#!/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 diff --git a/developer/executable/release b/developer/executable/release new file mode 100755 index 0000000..74690cb --- /dev/null +++ b/developer/executable/release @@ -0,0 +1,59 @@ +#!/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." diff --git a/developer/executable/version b/developer/executable/version new file mode 100755 index 0000000..12f7625 --- /dev/null +++ b/developer/executable/version @@ -0,0 +1,4 @@ +#!/bin/env bash + +# get this from the project management level exector directory +"$REPO_HOME"/executor/version \ No newline at end of file diff --git a/developer/executor/env_build b/developer/executor/env_build deleted file mode 100644 index 6c53847..0000000 --- a/developer/executor/env_build +++ /dev/null @@ -1,26 +0,0 @@ -#!/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" diff --git a/developer/executor/make.sh b/developer/executor/make.sh deleted file mode 100755 index 985c122..0000000 --- a/developer/executor/make.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/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 diff --git a/developer/executor/release b/developer/executor/release deleted file mode 100755 index c8ab7f4..0000000 --- a/developer/executor/release +++ /dev/null @@ -1,51 +0,0 @@ -#!/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") -} - diff --git a/developer/executor/version b/developer/executor/version deleted file mode 100755 index 12f7625..0000000 --- a/developer/executor/version +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/env bash - -# get this from the project management level exector directory -"$REPO_HOME"/executor/version \ No newline at end of file diff --git a/developer/groovy/build b/developer/groovy/build deleted file mode 100755 index 2fb7a39..0000000 --- a/developer/groovy/build +++ /dev/null @@ -1,55 +0,0 @@ -#!/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 [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) - diff --git a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure7.class b/developer/groovyc/AriadneGraph$_all_DAG_DF_closure7.class deleted file mode 100644 index 8857e4d..0000000 Binary files a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure7.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure8.class b/developer/groovyc/AriadneGraph$_all_DAG_DF_closure8.class deleted file mode 100644 index 48d0c81..0000000 Binary files a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure8.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure9.class b/developer/groovyc/AriadneGraph$_all_DAG_DF_closure9.class deleted file mode 100644 index 7be96ed..0000000 Binary files a/developer/groovyc/AriadneGraph$_all_DAG_DF_closure9.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_good_dependency_q_closure10.class b/developer/groovyc/AriadneGraph$_good_dependency_q_closure10.class deleted file mode 100644 index b4b33ad..0000000 Binary files a/developer/groovyc/AriadneGraph$_good_dependency_q_closure10.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_mark_node_form_closure3.class b/developer/groovyc/AriadneGraph$_mark_node_form_closure3.class deleted file mode 100644 index 9d962ba..0000000 Binary files a/developer/groovyc/AriadneGraph$_mark_node_form_closure3.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure4.class b/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure4.class deleted file mode 100644 index 062667b..0000000 Binary files a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure4.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure5.class b/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure5.class deleted file mode 100644 index 5d177fd..0000000 Binary files a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure5.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure6.class b/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure6.class deleted file mode 100644 index 1b72f75..0000000 Binary files a/developer/groovyc/AriadneGraph$_markup_graph_f_descend_closure6.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_newer_than_all_closure11.class b/developer/groovyc/AriadneGraph$_newer_than_all_closure11.class deleted file mode 100644 index ecf40dd..0000000 Binary files a/developer/groovyc/AriadneGraph$_newer_than_all_closure11.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure12.class b/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure12.class deleted file mode 100644 index 00e7821..0000000 Binary files a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure12.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure13.class b/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure13.class deleted file mode 100644 index d9301b8..0000000 Binary files a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure13.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure14.class b/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure14.class deleted file mode 100644 index f0205aa..0000000 Binary files a/developer/groovyc/AriadneGraph$_run_build_scripts_f_closure14.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_wellformed_q_closure1.class b/developer/groovyc/AriadneGraph$_wellformed_q_closure1.class deleted file mode 100644 index 202eee3..0000000 Binary files a/developer/groovyc/AriadneGraph$_wellformed_q_closure1.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph$_wellformed_q_closure2.class b/developer/groovyc/AriadneGraph$_wellformed_q_closure2.class deleted file mode 100644 index 3dc9e6d..0000000 Binary files a/developer/groovyc/AriadneGraph$_wellformed_q_closure2.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph.class b/developer/groovyc/AriadneGraph.class deleted file mode 100644 index c064680..0000000 Binary files a/developer/groovyc/AriadneGraph.class and /dev/null differ diff --git a/developer/groovyc/AriadneGraph.groovy b/developer/groovyc/AriadneGraph.groovy index 93c7d12..9ea9b41 100644 --- a/developer/groovyc/AriadneGraph.groovy +++ b/developer/groovyc/AriadneGraph.groovy @@ -3,7 +3,10 @@ import java.nio.file.Paths 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 = [] @@ -24,21 +27,36 @@ class AriadneGraph { /*-------------------------------------------------------------------------------- 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 ){ @@ -50,8 +68,21 @@ class AriadneGraph { 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' @@ -86,6 +117,7 @@ class AriadneGraph { ,'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' @@ -97,7 +129,7 @@ class AriadneGraph { def form_error_set = [] as Set if( !node ){ - form_error_set << 'no_node' + form_error_set << 'null_node' return form_error_set } @@ -144,21 +176,25 @@ class AriadneGraph { */ 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("") } @@ -167,25 +203,36 @@ class AriadneGraph { } - /* - 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] } @@ -194,15 +241,15 @@ class AriadneGraph { 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' } @@ -215,7 +262,13 @@ class AriadneGraph { } 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 @@ -251,6 +304,7 @@ class AriadneGraph { 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 @@ -275,22 +329,38 @@ class AriadneGraph { 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 diff --git a/developer/groovyc/BuildGraph.groovy b/developer/groovyc/BuildGraph.groovy new file mode 100644 index 0000000..c68fa43 --- /dev/null +++ b/developer/groovyc/BuildGraph.groovy @@ -0,0 +1,58 @@ +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 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 [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) + } +} diff --git a/developer/javac/PaintItBlack.java b/developer/javac/PaintItBlack.java new file mode 100644 index 0000000..60f27b8 --- /dev/null +++ b/developer/javac/PaintItBlack.java @@ -0,0 +1,5 @@ +public class PaintItBlack { + public static void main(String[] args) { + System.out.println("Paint it black."); + } +} diff --git a/developer/jvm/Ariadne.jar b/developer/jvm/Ariadne.jar new file mode 100644 index 0000000..c679924 Binary files /dev/null and b/developer/jvm/Ariadne.jar differ diff --git a/developer/shell/build b/developer/shell/build new file mode 100755 index 0000000..7477f8e --- /dev/null +++ b/developer/shell/build @@ -0,0 +1,3 @@ +#!/bin/env bash + +java BuildGraph "$@" diff --git a/document/goovy_hardfail.txt b/document/goovy_hardfail.txt new file mode 100644 index 0000000..a7d221a --- /dev/null +++ b/document/goovy_hardfail.txt @@ -0,0 +1,129 @@ +Tried many variations, including using 'groovy' instead of java to run it. +Also did -cp on the command line. Nothing can convince `java` to find +the class created by groovyc. When build is instead made into a script +with a shabang, it works. That is how test0 and test1 passed. + +PaintItBlack is a class created by javac run in the same environment, and it +works fine. Not sure what I am doing wrong, if anything. This is not cool, so +it looks like time to say goodbye to groovy. + + +2024-10-07T07:56:10Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> echo $CLASSPATH | tr ':' '\n' +/var/user_data/Thomas-developer/Ariadne/developer/jvm +/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar +/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib +/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib +/var/user_data/Thomas-developer/Ariadne/developer/jvm +/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar +/var/user_data/Thomas-developer/Ariadne/developer/scratch_pad +/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib +/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib +/var/user_data/Thomas-developer/Ariadne/developer/jvm +/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar +/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib +/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib + + +2024-10-07T07:56:35Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> make.sh +Cleaning scratch_pad and jvm directories... +Compiling files... +Creating JAR file... +JAR file created successfully: jvm/Ariadne.jar + +2024-10-07T07:56:47Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> cat `which build` +#!/bin/env bash + +java BuildGraph "$@" + +2024-10-07T07:57:04Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> build +Error: Could not find or load main class BuildGraph +Caused by: java.lang.NoClassDefFoundError: groovy/lang/GroovyObject + +2024-10-07T07:57:09Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> java PaintItBlack +Paint it black. + +2024-10-07T07:57:28Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> + +---- + + +2024-10-07T07:57:28Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> printenv +CLASSPATH=/var/user_data/Thomas-developer/Ariadne/developer/jvm:/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib:/var/user_data/Thomas-developer/Ariadne/developer/jvm:/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar:/var/user_data/Thomas-developer/Ariadne/developer/scratch_pad:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib:/var/user_data/Thomas-developer/Ariadne/developer/jvm:/var/user_data/Thomas-developer/Ariadne/developer/jvm/Ariadne.jar:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/lib:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/lib: +DISPLAY= +EDITOR=emacs +ENV_BASE=true +ENV_DEV_BUILD=true +ENV_DEV=true +GROOVY_HOME=/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9 +HOME=/home/Thomas-developer +HOSTNAME=Blossac +INSIDE_EMACS= +JAVA_HOME=/var/user_data/Thomas-developer/Ariadne/tool/jdk-11 +LANG= +LC_ALL=en_DK.UTF-8 +LOGNAME= +NO_AT_BRIDGE=1 +OLDPWD=/var/user_data/Thomas-developer/Ariadne +PATH=/var/user_data/Thomas-developer/Ariadne/developer/shell:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/bin:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/bin:/var/user_data/Thomas-developer/Ariadne/developer/shell:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/bin:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/bin:/var/user_data/Thomas-developer/Ariadne/developer/shell:/var/user_data/Thomas-developer/Ariadne/tool/jdk-11/bin:/var/user_data/Thomas-developer/Ariadne/tool/groovy-4.0.9/bin:/var/user_data/Thomas-developer/Ariadne/developer/executable:/var/user_data/Thomas-incommon/iseq_loadable:/var/user_data/Thomas-developer/resource/development/iseq_loadable:/usr/local/bin:/usr/bin:/usr/sbin +PPS1=\n[Ariadne]\n\u@\h§/var/user_data/Thomas-developer/Ariadne§\n> +PPS2=>> +PROJECT=Ariadne +PS1=\n$($iseq/Z)[$PROJECT]\n\u@\h§$(pwd)§\n> +PS2=>> +PS_FORMAT=user:15,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,command +PWD=/var/user_data/Thomas-developer/Ariadne/developer +REPO=Ariadne +REPO_DIR=/var/user_data/Thomas-developer +REPO_HOME=/var/user_data/Thomas-developer/Ariadne +RESOURCE=/var/user_data/Thomas-developer/resource/development +SHELL=/bin/bash +SHLVL=1 +SUBU_SHARE_DIR= +TERMCAP= +TERM=dumb +TIME_STYLE=long-iso +TMP=/var/user_data/Thomas-developer/Ariadne/developer/scratch_pad +TZ=UTC +USER_DATA=/var/user_data/Thomas-developer +USERNAME=Thomas-developer +_=/usr/bin/printenv + +2024-10-07T07:59:25Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> ls -l $REPO_HOME/tool +total 4 +drwx------. 1 Thomas-developer Thomas-developer 88 2024-10-02 11:47 . +drwx------. 1 Thomas-developer Thomas-developer 198 2024-10-07 02:34 .. +drwx------. 1 Thomas-developer Thomas-developer 104 2024-10-02 11:55 document +-rw-------. 1 Thomas-developer Thomas-developer 76 2024-10-02 09:28 .gitignore +drwxr-x---. 1 Thomas-developer Thomas-developer 74 1980-02-01 00:00 groovy-4.0.9 +drwx------. 1 Thomas-developer Thomas-developer 86 2024-10-02 11:53 jdk-11 +drwx------. 1 Thomas-developer Thomas-developer 178 2024-10-02 11:50 upstream + +2024-10-07T07:59:39Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> ls -l $REPO_HOME/tool/upstream/ +total 217996 +drwx------. 1 Thomas-developer Thomas-developer 178 2024-10-02 11:50 . +drwx------. 1 Thomas-developer Thomas-developer 88 2024-10-02 11:47 .. +-rw-------. 1 Thomas-developer Thomas-developer 29467411 2024-10-02 08:30 apache-groovy-binary-4.0.9.zip +-rw-------. 1 Thomas-developer Thomas-developer 15 2024-10-02 08:10 .gitignore +-rw-------. 1 Thomas-developer Thomas-developer 193752176 2022-07-21 15:13 OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz + +2024-10-07T07:59:49Z[Ariadne] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Ariadne/developer§ +> diff --git a/executable/env_base b/executable/env_base new file mode 100644 index 0000000..d150193 --- /dev/null +++ b/executable/env_base @@ -0,0 +1,23 @@ +#!/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 diff --git a/executable/env_dev b/executable/env_dev new file mode 100644 index 0000000..fa1076c --- /dev/null +++ b/executable/env_dev @@ -0,0 +1,26 @@ +#!/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" + + + diff --git a/executable/env_pm b/executable/env_pm new file mode 100644 index 0000000..5f614d1 --- /dev/null +++ b/executable/env_pm @@ -0,0 +1,27 @@ +#!/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" diff --git a/executable/env_tester b/executable/env_tester new file mode 100644 index 0000000..51b8e51 --- /dev/null +++ b/executable/env_tester @@ -0,0 +1,26 @@ +#!/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" diff --git a/executable/version b/executable/version new file mode 100755 index 0000000..6e696ef --- /dev/null +++ b/executable/version @@ -0,0 +1,4 @@ +#!/bin/env bash + +echo 0.1 + diff --git a/executor/env_base b/executor/env_base deleted file mode 100644 index d150193..0000000 --- a/executor/env_base +++ /dev/null @@ -1,23 +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." - 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 diff --git a/executor/env_dev b/executor/env_dev deleted file mode 100644 index cd66ee7..0000000 --- a/executor/env_dev +++ /dev/null @@ -1,29 +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." - 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" - - - diff --git a/executor/env_pm b/executor/env_pm deleted file mode 100644 index 5f614d1..0000000 --- a/executor/env_pm +++ /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." - 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" diff --git a/executor/env_tester b/executor/env_tester deleted file mode 100644 index 51b8e51..0000000 --- a/executor/env_tester +++ /dev/null @@ -1,26 +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." - 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" diff --git a/executor/version b/executor/version deleted file mode 100755 index 6e696ef..0000000 --- a/executor/version +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/env bash - -echo 0.1 - diff --git a/release_candidate/AriadneGraph$_all_DAG_DF_closure10.class b/release_candidate/AriadneGraph$_all_DAG_DF_closure10.class new file mode 100644 index 0000000..ed70dc4 Binary files /dev/null and b/release_candidate/AriadneGraph$_all_DAG_DF_closure10.class differ diff --git a/release_candidate/AriadneGraph$_all_DAG_DF_closure7.class b/release_candidate/AriadneGraph$_all_DAG_DF_closure7.class index 8857e4d..f1873bb 100644 Binary files a/release_candidate/AriadneGraph$_all_DAG_DF_closure7.class and b/release_candidate/AriadneGraph$_all_DAG_DF_closure7.class differ diff --git a/release_candidate/AriadneGraph$_all_DAG_DF_closure8.class b/release_candidate/AriadneGraph$_all_DAG_DF_closure8.class index 48d0c81..89bfd7b 100644 Binary files a/release_candidate/AriadneGraph$_all_DAG_DF_closure8.class and b/release_candidate/AriadneGraph$_all_DAG_DF_closure8.class differ diff --git a/release_candidate/AriadneGraph$_all_DAG_DF_closure9.class b/release_candidate/AriadneGraph$_all_DAG_DF_closure9.class index 7be96ed..c659646 100644 Binary files a/release_candidate/AriadneGraph$_all_DAG_DF_closure9.class and b/release_candidate/AriadneGraph$_all_DAG_DF_closure9.class differ diff --git a/release_candidate/AriadneGraph$_good_dependency_q_closure10.class b/release_candidate/AriadneGraph$_good_dependency_q_closure10.class index b4b33ad..ac3b277 100644 Binary files a/release_candidate/AriadneGraph$_good_dependency_q_closure10.class and b/release_candidate/AriadneGraph$_good_dependency_q_closure10.class differ diff --git a/release_candidate/AriadneGraph$_good_dependency_q_closure11.class b/release_candidate/AriadneGraph$_good_dependency_q_closure11.class new file mode 100644 index 0000000..85adf52 Binary files /dev/null and b/release_candidate/AriadneGraph$_good_dependency_q_closure11.class differ diff --git a/release_candidate/AriadneGraph$_mark_node_form_closure3.class b/release_candidate/AriadneGraph$_mark_node_form_closure3.class index 9d962ba..3daa7a4 100644 Binary files a/release_candidate/AriadneGraph$_mark_node_form_closure3.class and b/release_candidate/AriadneGraph$_mark_node_form_closure3.class differ diff --git a/release_candidate/AriadneGraph$_mark_node_form_closure4.class b/release_candidate/AriadneGraph$_mark_node_form_closure4.class new file mode 100644 index 0000000..add9310 Binary files /dev/null and b/release_candidate/AriadneGraph$_mark_node_form_closure4.class differ diff --git a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure4.class b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure4.class index 062667b..4bd2cf5 100644 Binary files a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure4.class and b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure4.class differ diff --git a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure5.class b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure5.class index 5d177fd..cb560b7 100644 Binary files a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure5.class and b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure5.class differ diff --git a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure6.class b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure6.class index 1b72f75..2e4ac45 100644 Binary files a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure6.class and b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure6.class differ diff --git a/release_candidate/AriadneGraph$_markup_graph_f_descend_closure7.class b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure7.class new file mode 100644 index 0000000..1163929 Binary files /dev/null and b/release_candidate/AriadneGraph$_markup_graph_f_descend_closure7.class differ diff --git a/release_candidate/AriadneGraph$_newer_than_all_closure11.class b/release_candidate/AriadneGraph$_newer_than_all_closure11.class index ecf40dd..e895c0e 100644 Binary files a/release_candidate/AriadneGraph$_newer_than_all_closure11.class and b/release_candidate/AriadneGraph$_newer_than_all_closure11.class differ diff --git a/release_candidate/AriadneGraph$_newer_than_all_closure12.class b/release_candidate/AriadneGraph$_newer_than_all_closure12.class new file mode 100644 index 0000000..9a78dbf Binary files /dev/null and b/release_candidate/AriadneGraph$_newer_than_all_closure12.class differ diff --git a/release_candidate/AriadneGraph$_run_build_scripts_f_closure12.class b/release_candidate/AriadneGraph$_run_build_scripts_f_closure12.class index 00e7821..4867af2 100644 Binary files a/release_candidate/AriadneGraph$_run_build_scripts_f_closure12.class and b/release_candidate/AriadneGraph$_run_build_scripts_f_closure12.class differ diff --git a/release_candidate/AriadneGraph$_run_build_scripts_f_closure13.class b/release_candidate/AriadneGraph$_run_build_scripts_f_closure13.class index d9301b8..1d0d9f0 100644 Binary files a/release_candidate/AriadneGraph$_run_build_scripts_f_closure13.class and b/release_candidate/AriadneGraph$_run_build_scripts_f_closure13.class differ diff --git a/release_candidate/AriadneGraph$_run_build_scripts_f_closure14.class b/release_candidate/AriadneGraph$_run_build_scripts_f_closure14.class index f0205aa..3536604 100644 Binary files a/release_candidate/AriadneGraph$_run_build_scripts_f_closure14.class and b/release_candidate/AriadneGraph$_run_build_scripts_f_closure14.class differ diff --git a/release_candidate/AriadneGraph$_run_build_scripts_f_closure15.class b/release_candidate/AriadneGraph$_run_build_scripts_f_closure15.class new file mode 100644 index 0000000..54f1db3 Binary files /dev/null and b/release_candidate/AriadneGraph$_run_build_scripts_f_closure15.class differ diff --git a/release_candidate/AriadneGraph$_wellformed_q_closure1.class b/release_candidate/AriadneGraph$_wellformed_q_closure1.class index 202eee3..e774627 100644 Binary files a/release_candidate/AriadneGraph$_wellformed_q_closure1.class and b/release_candidate/AriadneGraph$_wellformed_q_closure1.class differ diff --git a/release_candidate/AriadneGraph$_wellformed_q_closure2.class b/release_candidate/AriadneGraph$_wellformed_q_closure2.class index 3dc9e6d..d029042 100644 Binary files a/release_candidate/AriadneGraph$_wellformed_q_closure2.class and b/release_candidate/AriadneGraph$_wellformed_q_closure2.class differ diff --git a/release_candidate/AriadneGraph$_wellformed_q_closure3.class b/release_candidate/AriadneGraph$_wellformed_q_closure3.class new file mode 100644 index 0000000..36db685 Binary files /dev/null and b/release_candidate/AriadneGraph$_wellformed_q_closure3.class differ diff --git a/release_candidate/AriadneGraph.class b/release_candidate/AriadneGraph.class index c064680..8fd3e35 100644 Binary files a/release_candidate/AriadneGraph.class and b/release_candidate/AriadneGraph.class differ diff --git a/release_candidate/build b/release_candidate/build index 2fb7a39..f28d6ce 100755 --- a/release_candidate/build +++ b/release_candidate/build @@ -1,5 +1,18 @@ #!/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 @@ -8,13 +21,14 @@ def include_a_class( 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'" + 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) @@ -50,6 +64,5 @@ if(args.length == 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) diff --git a/tester/document/what_the_tests_do.txt b/tester/document/what_the_tests_do.txt new file mode 100644 index 0000000..792ac31 --- /dev/null +++ b/tester/document/what_the_tests_do.txt @@ -0,0 +1,17 @@ + +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. + + diff --git a/tester/executor/make.sh b/tester/executor/make.sh index c5d47ac..4ecb729 100755 --- a/tester/executor/make.sh +++ b/tester/executor/make.sh @@ -5,5 +5,6 @@ if [ -z "$ENV_TESTER" ]; then env_error=true fi -cd "$REPO_HOME"/tester/test0 +set -x + groovyc TestGraph.groovy diff --git a/tester/test2/HelloWorld.java b/tester/test2/HelloWorld.java new file mode 100644 index 0000000..74d76d1 --- /dev/null +++ b/tester/test2/HelloWorld.java @@ -0,0 +1,5 @@ +public class HelloWorld{ + public static void main( String[] args ){ + System.out.println( "Hello, world!" ); + } +} diff --git a/tester/test2/TestGraph$_get_node_f_list_closure2.class b/tester/test2/TestGraph$_get_node_f_list_closure2.class new file mode 100644 index 0000000..12489c0 Binary files /dev/null and b/tester/test2/TestGraph$_get_node_f_list_closure2.class differ diff --git a/tester/test2/TestGraph$_get_node_f_list_closure3.class b/tester/test2/TestGraph$_get_node_f_list_closure3.class new file mode 100644 index 0000000..88475e8 Binary files /dev/null and b/tester/test2/TestGraph$_get_node_f_list_closure3.class differ diff --git a/tester/test2/TestGraph$_java_to_class_closure1.class b/tester/test2/TestGraph$_java_to_class_closure1.class new file mode 100644 index 0000000..8deb4f0 Binary files /dev/null and b/tester/test2/TestGraph$_java_to_class_closure1.class differ diff --git a/tester/test2/TestGraph$_java_to_class_f_closure1.class b/tester/test2/TestGraph$_java_to_class_f_closure1.class new file mode 100644 index 0000000..ba07c8a Binary files /dev/null and b/tester/test2/TestGraph$_java_to_class_f_closure1.class differ diff --git a/tester/test2/TestGraph.class b/tester/test2/TestGraph.class new file mode 100644 index 0000000..623d6f3 Binary files /dev/null and b/tester/test2/TestGraph.class differ diff --git a/tester/test2/TestGraph.groovy b/tester/test2/TestGraph.groovy new file mode 100644 index 0000000..5024152 --- /dev/null +++ b/tester/test2/TestGraph.groovy @@ -0,0 +1,70 @@ +import AriadneGraph + +class TestGraph { + + static def get_node_map(){ + return [:] + } + + // given label .class returns node to build .class from .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 .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 .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) } + ] + ) + } + +} diff --git a/tester/test2/env_test b/tester/test2/env_test new file mode 100644 index 0000000..78c20df --- /dev/null +++ b/tester/test2/env_test @@ -0,0 +1,11 @@ + +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 + diff --git a/tester/test2/test.sh b/tester/test2/test.sh new file mode 100755 index 0000000..6cd9b04 --- /dev/null +++ b/tester/test2/test.sh @@ -0,0 +1,11 @@ +#!/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" +