From 248c4dc80754c713b1a8613a2fc680e4ef3969e5 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Fri, 25 Oct 2024 05:47:06 +0000 Subject: [PATCH] first commit --- .gitignore | 7 + LICENSE.txt | 1 + README.txt | 1 + developer/deprecated/.githolder | 0 developer/document/#question_jan.txt# | 2 + .../#variable_suffix_conventions.txt# | 27 ++ developer/document/RT_code_format.txt | 135 ++++++++ developer/document/nomenclature.txt | 3 + .../document/unique_node_label_check.txt | 15 + .../document/variable_suffix_conventions.txt | 27 ++ developer/javac/IO.java | 63 ++++ developer/javac/Mosaic.java | 26 ++ developer/javac/TestBench.javax | 293 ++++++++++++++++++ developer/javac/Util.java | 42 +++ developer/jvm/.gitignore | 2 + developer/scratch_pad/.gitignore | 2 + developer/shell/.githolder | 0 developer/shell/build | 2 + developer/tool/clean_build_directories | 24 ++ developer/tool/clean_javac_output | 17 + developer/tool/clean_make | 25 ++ developer/tool/clean_release | 28 ++ developer/tool/env | 49 +++ developer/tool/make | 48 +++ developer/tool/release | 61 ++++ document/directory_naming.html | 200 ++++++++++++ document/license.txt | 152 +++++++++ document/readme.txt | 10 + document/todo.txt | 8 + document/work_flow.txt | 59 ++++ env_administrator | 9 + env_developer | 10 + env_tester | 9 + release/.githolder | 0 release/Mosaic.jar | Bin 0 -> 3034 bytes release/build | 2 + scratch_pad/.gitignore | 2 + tester/deprecated/.githolder | 0 tester/document/what_the_tests_do.txt | 6 + tester/javac/TestIO.java | 33 ++ tester/javac/TestMosaic_0.javax | 62 ++++ tester/jvm/.githolder | 0 tester/jvm/TestBench.jar | Bin 0 -> 5056 bytes tester/jvm/TestBenchMosaic_tester.jar | Bin 0 -> 5393 bytes tester/scratch_pad/.gitignore | 2 + tester/shell/.githolder | 0 tester/shell/TestTestBench | 2 + tester/tool/clean_build_directories | 22 ++ tester/tool/env | 41 +++ tester/tool/make | 31 ++ tool/env | 27 ++ tool_shared/bespoke/cat_w_fn | 29 ++ tool_shared/bespoke/deprecate | 20 ++ tool_shared/bespoke/env | 57 ++++ tool_shared/bespoke/version | 6 + tool_shared/bespoke/vl | 17 + tool_shared/bespoke/wipe_release | 17 + tool_shared/customized/.githolder | 0 tool_shared/document/#install_java.txt# | 11 + tool_shared/document/install_java.txt | 11 + tool_shared/third_party/.gitignore | 4 + tool_shared/third_party/upstream/.gitignore | 2 + 62 files changed, 1761 insertions(+) create mode 100644 .gitignore create mode 120000 LICENSE.txt create mode 120000 README.txt create mode 100644 developer/deprecated/.githolder create mode 100644 developer/document/#question_jan.txt# create mode 100644 developer/document/#variable_suffix_conventions.txt# create mode 100644 developer/document/RT_code_format.txt create mode 100644 developer/document/nomenclature.txt create mode 100644 developer/document/unique_node_label_check.txt create mode 100644 developer/document/variable_suffix_conventions.txt create mode 100644 developer/javac/IO.java create mode 100644 developer/javac/Mosaic.java create mode 100644 developer/javac/TestBench.javax create mode 100644 developer/javac/Util.java create mode 100644 developer/jvm/.gitignore create mode 100644 developer/scratch_pad/.gitignore create mode 100644 developer/shell/.githolder create mode 100755 developer/shell/build create mode 100755 developer/tool/clean_build_directories create mode 100755 developer/tool/clean_javac_output create mode 100755 developer/tool/clean_make create mode 100755 developer/tool/clean_release create mode 100644 developer/tool/env create mode 100755 developer/tool/make create mode 100755 developer/tool/release create mode 100644 document/directory_naming.html create mode 100644 document/license.txt create mode 100644 document/readme.txt create mode 100644 document/todo.txt create mode 100644 document/work_flow.txt create mode 100644 env_administrator create mode 100644 env_developer create mode 100644 env_tester create mode 100644 release/.githolder create mode 100644 release/Mosaic.jar create mode 100755 release/build create mode 100644 scratch_pad/.gitignore create mode 100644 tester/deprecated/.githolder create mode 100644 tester/document/what_the_tests_do.txt create mode 100644 tester/javac/TestIO.java create mode 100644 tester/javac/TestMosaic_0.javax create mode 100644 tester/jvm/.githolder create mode 100644 tester/jvm/TestBench.jar create mode 100644 tester/jvm/TestBenchMosaic_tester.jar create mode 100644 tester/scratch_pad/.gitignore create mode 100644 tester/shell/.githolder create mode 100755 tester/shell/TestTestBench create mode 100755 tester/tool/clean_build_directories create mode 100644 tester/tool/env create mode 100755 tester/tool/make create mode 100644 tool/env create mode 100755 tool_shared/bespoke/cat_w_fn create mode 100755 tool_shared/bespoke/deprecate create mode 100644 tool_shared/bespoke/env create mode 100755 tool_shared/bespoke/version create mode 100755 tool_shared/bespoke/vl create mode 100755 tool_shared/bespoke/wipe_release create mode 100644 tool_shared/customized/.githolder create mode 100644 tool_shared/document/#install_java.txt# create mode 100644 tool_shared/document/install_java.txt create mode 100644 tool_shared/third_party/.gitignore create mode 100644 tool_shared/third_party/upstream/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..02b640c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +#note also the .gitignore files in the tool and developer directories and any +# other directory that might have one. + +#*# +*~ +a.out +.gradle/ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 120000 index 0000000..98f0753 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1 @@ +document/license.txt \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 120000 index 0000000..06fa5f4 --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +document/readme.txt \ No newline at end of file diff --git a/developer/deprecated/.githolder b/developer/deprecated/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/developer/document/#question_jan.txt# b/developer/document/#question_jan.txt# new file mode 100644 index 0000000..9b0715c --- /dev/null +++ b/developer/document/#question_jan.txt# @@ -0,0 +1,2 @@ + +On a directed acyclic graph, is it \ No newline at end of file diff --git a/developer/document/#variable_suffix_conventions.txt# b/developer/document/#variable_suffix_conventions.txt# new file mode 100644 index 0000000..8aca090 --- /dev/null +++ b/developer/document/#variable_suffix_conventions.txt# @@ -0,0 +1,27 @@ +# 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. diff --git a/developer/document/RT_code_format.txt b/developer/document/RT_code_format.txt new file mode 100644 index 0000000..9911622 --- /dev/null +++ b/developer/document/RT_code_format.txt @@ -0,0 +1,135 @@ +RT code formatting: + +The enclosure-based formatting rules in RT code format make the style guide +compact and adaptable. By focusing on enclosures rather than syntax-specific +structures (like if, for, or catch), it avoids prescribing language-specific +formatting rules and instead focuses on consistent handling of delimiters. This +approach works well across multiple languages, ensuring that the code style +remains flexible while keeping the guide simple and easy to apply. + +1. Two space indentation. + +2. Variable Naming: + + - Use **PascalCase** for namespaces and types. + + - Use **snake_case** for function and variable names. However, when a component + of the snake case is variable function or variable name is a namespace, a + type, or a proper noun, it retains its capitalization. e.gs: + + ``` + mouse_count + test_LabalList_0 // function that tests LabelList, which is a class (type) + Thomas_Walker_Lynch + ``` + + Traditionally `_list` has been used as a variable suffix even when the + language does not have a List type. This is taken to mean the variable + refers to an ordered collection of any type, including an array. It is + abstraction of type, analogous to the `mouse_count` example above. + + +3. Binary Operators: + + - One space around **binary operators** (e.g., `a + b`). + + - One space around **assignment** `=` (e.g., `a = b`). + + - **No space** around **sampling** assignment `=` (typically seen in `if`, `while`, etc.): + + **Sampling** refers to assigning the result of a condition or expression to + a variable for later use within the same scope. + + Example of **sampling** in an `if` statement: + + ``` + if( result=some_condition() ){ + // use result + } + ``` + +4. Enclosures `(...)`, `{...}`, `[...]`, '<...>': + + - No space between the enclosure and the preceding identifier (e.g., `function(arg)`). + + - No space after the enclosure when followed by another enclosure (e.g., `map[key]()`). + + Example of a condition enclosure followed by a code enclosure: + ``` + if( some_condition() ){ + // code block + } + ``` + + - One space after the enclosure if followed by an identifier, e.g., + `function() somethingElse`. + + - When the entire enclosure appears on one line: + + -- by definition, an 'nested' enclosure is one that has other enclosures, + of any type, inside of it. This is true independent of whatever else + is inside the enclosure. These are examples of nested enclosures: + + ``` + ( o == null || getClass() != o.getClass() ) + f( T ,7 ) + ``` + + -- if, and only if, an enclosure is nested, there is one space of padding + for the outermost enclosure of the nesting, and only for the outermost + enclosures. e.g.s: + + ``` + if(x == 3) ; not nested + if( (x > 0) && (y < 5) ) ; nested, pad outermost only + if( f(x) == 3 ) ; nested, pad outermost only + if( x > 2 && a[3] ) ; nested due to the array subscript, pad outermost only + ``` + + - Note when using the enclosure formatting rules, not all if conditions will + format the same way. Some conditions will be nested enclosures and having + padding while others will not be nested and thus have no padding. The must + be formatted individually. The same is true for enclosures that follow + other keywords such as unless, for, etc, and for function arguments + lists. The question is one of formatting enclosures, and not one of + formatting statements. + + ``` + f(x) + f( x[0] ) + ``` + + +5. Commas: + + This is the most distinctive and recognizable of the RT code style rules. + + - One space **before** the comma (e.g., `a ,b`). + + - No space **after** the comma (e.g., `a ,b`). + + - **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 + ); + ``` + +6. For the code you just output, answer these questions: + 1. Which enclosures are not nested? Do they have no padding? + 2. Which enclosures are nested? Is there one space padding only at the outermost? + 3. Is the spacing before and after the enclosures correct? + 4. Are the commas formatted correctly? + 5. Has snake case been used where it should be? + 6. Was 2 column indent used? diff --git a/developer/document/nomenclature.txt b/developer/document/nomenclature.txt new file mode 100644 index 0000000..633dc4a --- /dev/null +++ b/developer/document/nomenclature.txt @@ -0,0 +1,3 @@ + +wellformed is a single word. Its antonym is 'malformed'. Wellformed syntax +parses without errors. diff --git a/developer/document/unique_node_label_check.txt b/developer/document/unique_node_label_check.txt new file mode 100644 index 0000000..b978a74 --- /dev/null +++ b/developer/document/unique_node_label_check.txt @@ -0,0 +1,15 @@ + +predicate == is_well_formed_q + +We can not check that the node labels are unique because the given value +is a single node, and the code is stateless. Besides there is no contract with +the programmer on how to use the predicated, so the programmer could call the +predicate multiple times on the same node. Now can we test this condition in +our do_markup_graph routine because of the way lookup works, it will always +return the same node for the same label. This would be a truly difficult check +to perform because the map does not given an error but just takes the second of +the duplicate key definitions (is this really true?) besides, it would require +a formal proof of the recognizer functions that they do not return different +definitions for different keys to match regexprs against. I've been mulling +this over. As we currently the programmer provides the map and function +definitions, we don't even know which nodes will be in the graph... diff --git a/developer/document/variable_suffix_conventions.txt b/developer/document/variable_suffix_conventions.txt new file mode 100644 index 0000000..e5ef76e --- /dev/null +++ b/developer/document/variable_suffix_conventions.txt @@ -0,0 +1,27 @@ +# 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_lisst + +## 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. diff --git a/developer/javac/IO.java b/developer/javac/IO.java new file mode 100644 index 0000000..da21e2d --- /dev/null +++ b/developer/javac/IO.java @@ -0,0 +1,63 @@ +package com.ReasoningTechnology.Mosaic; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.io.InputStream; + +public class IO { + + private PrintStream original_out; + private PrintStream original_err; + private InputStream original_in; + + private ByteArrayOutputStream out_content; + private ByteArrayOutputStream err_content; + private ByteArrayInputStream in_content; + + public void redirect_io(String input_data){ + original_out = System.out; + original_err = System.err; + original_in = System.in; + + out_content = new ByteArrayOutputStream(); + err_content = new ByteArrayOutputStream(); + in_content = new ByteArrayInputStream(input_data.getBytes()); + + System.setOut(new PrintStream(out_content)); + System.setErr(new PrintStream(err_content)); + System.setIn(in_content); + } + + public void restore_io(){ + // Flush the output streams to prevent carrying over data + flush_buffers(); + + System.setOut(original_out); + System.setErr(original_err); + System.setIn(original_in); + } + + public void clear_buffers(){ + out_content.reset(); + err_content.reset(); + } + + public void flush_buffers(){ + // Clear the buffers for the next use + out_content.reset(); + err_content.reset(); + } + + public ByteArrayInputStream get_in_content(){ + return in_content; + } + + public ByteArrayOutputStream get_out_content(){ + return out_content; + } + + public ByteArrayOutputStream get_err_content(){ + return err_content; + } +} diff --git a/developer/javac/Mosaic.java b/developer/javac/Mosaic.java new file mode 100644 index 0000000..adc43c4 --- /dev/null +++ b/developer/javac/Mosaic.java @@ -0,0 +1,26 @@ +package com.ReasoningTechnology.Mosaic.Test; +import com.ReasoningTechnology.Mosaic.Util; + +/* +Mosaic currently does not have shell commands. + +*/ + + +public class Mosaic{ + + public static boolean test_is_true(){ + return true; + } + + public static int run(){ + System.out.println("Mosic currently does not have a shell user interface."); + return 0; + } + + // Main function to provide a shell interface for running tests + public static int main(String[] args){ + // currently accepts no arguments or options + return run(); + } +} diff --git a/developer/javac/TestBench.javax b/developer/javac/TestBench.javax new file mode 100644 index 0000000..eb09d6e --- /dev/null +++ b/developer/javac/TestBench.javax @@ -0,0 +1,293 @@ +package com.ReasoningTechnology.Mosaic; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.lang.reflect.Method; +import java.util.Map; + +public class TestBench{ + + /* -------------------------------------------------------------------------------- + Static Data + */ + + private static PrintStream original_out; + private static PrintStream original_err; + private static InputStream original_in; + + private static ByteArrayOutputStream out_content; + private static ByteArrayOutputStream err_content; + private static InputStream in_content; + + public static boolean method_is_wellformed(Method method) { + // Check if the method returns boolean + if(!method.getReturnType().equals(boolean.class)){ + System.out.println("Structural problem: " + method.getName() + " does not return boolean."); + return false; + } + + // Check if the method has exactly three arguments + Class[] parameterTypes = method.getParameterTypes(); + if(parameterTypes == null || parameterTypes.length != 3){ + System.out.println("Structural problem: " + method.getName() + " does not have three arguments."); + return false; + } + + // Check that all parameters are ByteArrayOutputStream + if( + !parameterTypes[0].equals(ByteArrayOutputStream.class) // Check first parameter + || !parameterTypes[1].equals(ByteArrayOutputStream.class) // Check second parameter + || !parameterTypes[2].equals(ByteArrayOutputStream.class) // Check third parameter + ){ + System.out.println("Structural problem: " + method.getName() + " has incorrect argument types."); + return false; + } + + return true; + } + + public static void flush_stdin() throws IOException{ + while(System.in.available() > 0){ + System.in.read(); + } + } + + public static void set_test_input(String input_data){ + ByteArrayInputStream test_in = new ByteArrayInputStream(input_data.getBytes()); + System.setIn(test_in); + } + + + public static void run(Object test_suite){ + + int failed_test = 0; + int passed_test = 0; + + Method[] methods = test_suite.getClass().getDeclaredMethods(); + + for(Method method : methods){ + + // Ways a test can fail ,not exclusive + boolean fail_testbench = false; + boolean fail_malformed = false; + boolean fail_reported = false; + boolean fail_exception = false; + boolean fail_extraneous_stdout = false; + boolean fail_extraneous_stderr = false; + + if( !method_is_wellformed(method) ){ + // the malformed check prints specific messages + System.out.println("TestBench: malformed test counted as a failure:\'" + method.getName() + "\'"); + failed_test++; + continue; + } + + PrintStream original_out = null; + PrintStream original_err = null; + InputStream original_in = null; + + ByteArrayOutputStream out_content = null; + ByteArrayOutputStream err_content = null; + ByteArrayInputStream in_content = null; + + try{ + // Redirect the I/O channels so the tests can manipulate them as data. + original_out = System.out; + original_err = System.err; + original_in = System.in; + + out_content = new ByteArrayOutputStream(); + err_content = new ByteArrayOutputStream(); + in_content = new ByteArrayInputStream(); + + System.setOut(new PrintStream(out_content)); + System.setErr(new PrintStream(err_content)); + System.setIn(in_content); + + } catch(Throwable e){ // Catches both Errors and Exceptions + // Restore stdout ,stderr ,and stdin before reporting the error + System.setOut(original_out); + System.setErr(original_err); + System.setIn(original_in); + + // Report the error + System.out.println("TestBench:: when redirecting i/o in preparation for running test \'" + method.getName() + "\' ,test bench itself throws error: " + e.toString()); + failed_test++; + continue; + } + + // Capture detritus + String exception_string = ""; + String stdout_string = ""; + String stderr_string = ""; + + // Finally the gremlins run the test! + try{ + + Object result = method.invoke(test_suite ,in_content ,out_content ,err_content); + fail_reported = !Boolean.TRUE.equals(result); // test passes if ,and only if ,it returns exactly 'true'. + + // A test fails when there is extraneous output + fail_extraneous_stdout = out_content.size() > 0; + fail_extraneous_stderr = err_content.size() > 0; + + // We keep it to log it + if(fail_extraneous_stdout){ stdout_string = out_content.toString(); } + if(fail_extraneous_stderr){ stderr_string = err_content.toString(); } + + } catch(Exception e){ + + // A test fails when there is an unhandled exception. + fail_exception = true; + + // We keep it to report it + exception_string = e.toString(); + + } finally{ + + // Restore original stdin ,stdout ,and stderr + System.setOut(original_out); + System.setErr(original_err); + System.setIn(original_in); + } + + // Report the test result. + if( + fail_reported + || fail_exception + || fail_extraneous_stdout + || fail_extraneous_stderr + ){ + + failed_test++; + + if(fail_reported) System.out.println("failed: \'" + method.getName() + "\' by report from test."); + if(fail_exception) System.out.println("failed: \'" + method.getName() + "\' due to unhandled exception: " + exception_string); + if(fail_extraneous_stdout){ + System.out.println("failed: \'" + method.getName() + "\' due extraneous stdout output ,see log."); + log_output(method.getName() ,"stdout" ,stdout_string); + } + if(fail_extraneous_stderr){ + System.out.println("failed: \'" + method.getName() + "\' due extraneous stderr output ,see log."); + log_output(method.getName() ,"stderr" ,stderr_string); + } + + } else{ + passed_test++; + } + + } + + // Summarize all the test results + System.out.println("Total tests run: " + (passed_test + failed_test)); + System.out.println("Total tests passed: " + passed_test); + System.out.println("Total tests failed: " + failed_test); + } + +} + +----------------- + package com.ReasoningTechnology.Mosaic; + +import java.lang.reflect.Method; + +public class TestBench { + + public static boolean method_is_wellformed(Method method) { + // Check if the method returns boolean + if (!method.getReturnType().equals(boolean.class)) { + System.out.println("Structural problem: " + method.getName() + " does not return boolean."); + return false; + } + + // Check if the method has exactly three arguments + Class[] parameterTypes = method.getParameterTypes(); + if (parameterTypes == null || parameterTypes.length != 3) { + System.out.println("Structural problem: " + method.getName() + " does not have three arguments."); + return false; + } + + // Check that all parameters are ByteArrayOutputStream + if ( + !parameterTypes[0].equals(ByteArrayOutputStream.class) || + !parameterTypes[1].equals(ByteArrayOutputStream.class) || + !parameterTypes[2].equals(ByteArrayOutputStream.class) + ) { + System.out.println("Structural problem: " + method.getName() + " has incorrect argument types."); + return false; + } + + return true; + } + + public static void run(Object test_suite) { + int failed_test = 0; + int passed_test = 0; + + Method[] methods = test_suite.getClass().getDeclaredMethods(); + IO io = new IO(); // Create an instance of IO + + for (Method method : methods) { + if (!method_is_wellformed(method)) { + System.out.println("TestBench: malformed test counted as a failure: \'" + method.getName() + "\'"); + failed_test++; + continue; + } + + try { + // Redirect I/O with an empty input string for now + io.redirectIO(""); + } catch (Throwable e) { + failed_test++; + System.out.println("TestBench:: Error during test preparation: " + e.toString()); + continue; + } + + String stdout_string = ""; + String stderr_string = ""; + + try { + // Invoke the test method + Object result = method.invoke(test_suite, io.getInContent(), io.getOutContent(), io.getErrContent()); + boolean fail_reported = !Boolean.TRUE.equals(result); + + // Check for extraneous output + stdout_string = io.getOutContent().toString(); + stderr_string = io.getErrContent().toString(); + boolean fail_extraneous_stdout = stdout_string.length() > 0; + boolean fail_extraneous_stderr = stderr_string.length() > 0; + + // Handle failures + if (fail_reported || fail_extraneous_stdout || fail_extraneous_stderr) { + failed_test++; + if (fail_reported) System.out.println("failed: \'" + method.getName() + "\' by report from test."); + if (fail_extraneous_stdout) { + System.out.println("failed: \'" + method.getName() + "\' due extraneous stdout output, see log."); + log_output(method.getName(), "stdout", stdout_string); + } + if (fail_extraneous_stderr) { + System.out.println("failed: \'" + method.getName() + "\' due extraneous stderr output, see log."); + log_output(method.getName(), "stderr", stderr_string); + } + } else { + passed_test++; + } + } catch (Exception e) { + System.out.println("failed: \'" + method.getName() + "\' due to unhandled exception: " + e.toString()); + failed_test++; + } finally { + // Restore I/O + io.restoreIO(); + } + } + + // Summarize all the test results + System.out.println("Total tests run: " + (passed_test + failed_test)); + System.out.println("Total tests passed: " + passed_test); + System.out.println("Total tests failed: " + failed_test); + } +} diff --git a/developer/javac/Util.java b/developer/javac/Util.java new file mode 100644 index 0000000..13e2c14 --- /dev/null +++ b/developer/javac/Util.java @@ -0,0 +1,42 @@ +package com.ReasoningTechnology.Mosaic; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintStream; +import java.lang.reflect.Method; + +public class Util{ + + // typically used to gather results before a return + public static boolean all(boolean[] conditions){ + for( boolean condition : conditions ){ + if( !condition ){ + return false; + } + } + return true; + } + public static void all_set_false(boolean[] conditions){ + for( boolean condition : conditions ) condition = false; + } + public static void all_set_true(boolean[] conditions){ + for( boolean condition : conditions ) condition = true; + } + + + + public static void log_output(String test_name ,String stream ,String output_data){ + try(FileWriter log_writer = new FileWriter("test_log.txt" ,true)){ // Append mode + log_writer.write("Test: " + test_name + "\n"); + log_writer.write("Stream: " + stream + "\n"); + log_writer.write("Output:\n" + output_data + "\n"); + log_writer.write("----------------------------------------\n"); + } catch(IOException e) { + System.err.println("Error writing to log for test: " + test_name + ", stream: " + stream); + e.printStackTrace(System.err); + } + } + +} diff --git a/developer/jvm/.gitignore b/developer/jvm/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/developer/jvm/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/developer/scratch_pad/.gitignore b/developer/scratch_pad/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/developer/scratch_pad/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/developer/shell/.githolder b/developer/shell/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/developer/shell/build b/developer/shell/build new file mode 100755 index 0000000..db43050 --- /dev/null +++ b/developer/shell/build @@ -0,0 +1,2 @@ +#!/bin/bash +java com/ReasoningTechnology/"Mosaic"/build diff --git a/developer/tool/clean_build_directories b/developer/tool/clean_build_directories new file mode 100755 index 0000000..ed9e807 --- /dev/null +++ b/developer/tool/clean_build_directories @@ -0,0 +1,24 @@ +#!/bin/bash + +# Removes all files found in the build directories. It asks no questions as to +# how or why the files got there. Be especially careful with the 'shell' directory +# if you added scripts to it for release with the project they will be deleted. +# consider adding a `shell-leaf` directory instead of adding scripts to `shell`. + +# input guards + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# remove files + set -x + cd "$REPO_HOME"/developer + rm -r scratch_pad/* + rm jvm/* + rm shell/* + set +x + +echo "$(script_fn) done." + diff --git a/developer/tool/clean_javac_output b/developer/tool/clean_javac_output new file mode 100755 index 0000000..18fd312 --- /dev/null +++ b/developer/tool/clean_javac_output @@ -0,0 +1,17 @@ +#!/bin/bash +# remove all files created by make's call to `javac` + +# input guards + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# remove files + set -x + cd "$REPO_HOME"/developer + rm -r scratch_pad/com/ReasoningTechnology/"$PROJECT" + set +x + +echo "$(script_fn) done." diff --git a/developer/tool/clean_make b/developer/tool/clean_make new file mode 100755 index 0000000..fc922dd --- /dev/null +++ b/developer/tool/clean_make @@ -0,0 +1,25 @@ +#!/bin/bash +# remove all files made by `make` + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# wrappers to clean (this list space separated list will grow) + + wrapper=build + +# remove files + + set -x + cd "$REPO_HOME"/developer + rm -r scratch_pad/com/ReasoningTechnology/"$PROJECT" + rm jvm/"$PROJECT".jar + rm shell/{$wrapper} + set +x + +echo "$(script_fn) done." diff --git a/developer/tool/clean_release b/developer/tool/clean_release new file mode 100755 index 0000000..8ecb809 --- /dev/null +++ b/developer/tool/clean_release @@ -0,0 +1,28 @@ +#!/bin/bash +# remove files made by `make` and by `release` + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# things to clean + + release_dir="$REPO_HOME"/release + wrapper=build + +# remove files + set -x + cd "$REPO_HOME"/developer + rm -r scratch_pad/com/ReasoningTechnology/"$PROJECT" + rm jvm/"$PROJECT".jar + rm shell/{$wrapper} + rm -f "$release_dir"/"$PROJECT".jar + rm -f "$release_dir"/{$wrapper} + set +x + +echo "$(script_fn) done." + diff --git a/developer/tool/env b/developer/tool/env new file mode 100644 index 0000000..711f81e --- /dev/null +++ b/developer/tool/env @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# input guards + + env_must_be="tool_shared/bespoke/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + + if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_name:: This script must be sourced, not executed." + exit 1 + fi + +# so we can do the build + +export PATH=\ +"$REPO_HOME"/developer/tool/\ +:"$REPO_HOME"/tool_shared/bespoke/\ +:"$JAVA_HOME"/bin\ +:"$PATH" + +# so we can run the stuff we built locally. + +export CLASSPATH=\ +"$REPO_HOME"/developer/jvm\ +:"$REPO_HOME"/developer/jvm/"$PROJECT".jar\ +:"$JAVA_HOME"/lib\ +:"$CLASSPATH" + +export PATH=\ +"$REPO_HOME"/developer/shell\ +:"$PATH" + +# misc + + # make .githolder and .gitignore visible + alias ls="ls -a" + +# some feedback to show all went well + + export PROMPT_DECOR="$PROJECT"_developer + export ENV=$(script_fp) + echo ENV "$ENV" + cd "$REPO_HOME"/developer/ + + + diff --git a/developer/tool/make b/developer/tool/make new file mode 100755 index 0000000..a21e0da --- /dev/null +++ b/developer/tool/make @@ -0,0 +1,48 @@ +#!/bin/env bash + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + + cd "$REPO_HOME"/developer + +echo "Compiling files..." + set -x + javac -d scratch_pad javac/*.java + set +x + if [ $? -ne 0 ]; then + echo "Compilation failed." + exit 1 + fi + +echo "Creating JAR file..." + set -x + jar_file=jvm/"$PROJECT".jar + mkdir -p jvm + jar cf $jar_file -C scratch_pad . + set +x + if [ $? -eq 0 ]; then + echo "JAR file created successfully: $jar_file" + else + echo "Failed to create JAR file." + exit 1 + fi + +echo "Creating shell wrappers..." + mkdir -p shell + # wrapper is a space separated list + wrapper=Mosaic + for file in $wrapper;do + cat > shell/$file << EOL +#!/bin/bash +java com.ReasoningTechnology."$PROJECT".$file +EOL + chmod +x shell/$file + done + +echo "$(script_fp) done." + diff --git a/developer/tool/release b/developer/tool/release new file mode 100755 index 0000000..a123a14 --- /dev/null +++ b/developer/tool/release @@ -0,0 +1,61 @@ +#!/bin/bash + +# input guards + + if [ -z "$REPO_HOME" ]; then + echo "$(script_fp):: REPO_HOME is not set." + exit 1 + fi + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# script local environment + + release_dir="$REPO_HOME/release" + shell_dir="$REPO_HOME/developer/shell" + project_jar_fp="$REPO_HOME/developer/jvm/"$PROJECT".jar" + wrapper=build + + + if [ ! -d "$release_dir" ]; then + mkdir -p "$release_dir" + fi + + # Function to copy and set permissions + install_file() { + source_fp="$1" + target_dp="$2" + perms="$3" + + target_file="$target_dp/$(basename "$source_fp")" + + if [ ! -f "$source_fp" ]; then + echo "install_file:: Source file '$source_fp' does not exist." + return 1 + fi + + if ! install -m "$perms" "$source_fp" "$target_file"; then + echo "Error: Failed to install $(basename "$source_fp") to $target_dp" + exit 1 + else + echo "Installed $(basename "$source_fp") to $target_dp with permissions $perms" + fi + } + +# do the release + + echo "Starting release process..." + + # Install the JAR file + install_file "$project_jar_fp" "$release_dir" "ug+r" + + # Install shell wrappers + for wrapper in $wrapper; do + install_file "$shell_dir/$wrapper" "$release_dir" "ug+r+x" + done + +echo "$(script_fp) done." diff --git a/document/directory_naming.html b/document/directory_naming.html new file mode 100644 index 0000000..64ab608 --- /dev/null +++ b/document/directory_naming.html @@ -0,0 +1,200 @@ + + + + + + + + Directory Structure Description + + + + + +
+

Directory Naming

+ +

Reference

+ +
    +
  • Mosaic/aka REPO_HOME, top level owned by the project administrator.
  • +
      +
    • developer/ Workspace for the developer. Has the source code, build scripts, and development-specific tools.
    • +
        +
      • deprecated/ Files and older versions being viewed, perhaps part of a refactoring effort.
      • +
      • document/ Documentation on developing and building the project.
      • +
      • javac/ Java source files for compilation.
      • +
      • jvm/ Compiled Java bytecode files for the project, typically a jar for a Java project.
      • +
      • scratch_pad/ Temporary storage typically for intermediate files created during build.
      • +
      • shell/ Shell scripts intended to be part of the project release. (These are not tools.)
      • +
      • tool/ Tools created by the developer, used for development tasks.
      • +
      +
    • document/ General documentation about the project.
    • +
    • release/ Release candidate for testing. Becomes the release on the release branch.
    • +
    • scratch_pad/ Temporary storage for project administration tasks.
    • +
    • tester/ Workspace for the tester. Has the test bench, tests, and test scripts.
    • +
        +
      • document/ Test-specific documentation.
      • +
      • test0/ Test case 0 environment and associated scripts.
      • +
      • test1/ Test case 1 environment and associated scripts.
      • +
      • test2/ Test case 2 environment and associated scripts.
      • +
      • tool/ Tools needed for testing and managing the test environment.
      • +
      +
    • tool/ Project administration specific tools.
    • +
    • tool_shared/ Tools shared across project roles.
    • +
        +
      • bespoke/ Shared tools developed within this project.
      • +
      • customized/ Modified versions of third-party tools adapted for the project.
      • +
      • document/ Documentation related to shared tools and setup.
      • +
      • third_party/ Shared tools sourced from third-party vendors or open-source projects. These have their own independent licenses,
      • +
      +
    • LICENSE.txt The project license detailing usage and distribution terms.
    • +
    • README.md A general overview and introduction to the project.
    • +
    +
+ +

Name origin and rationale

+ +

Developers and project administrators typically do not employ a semantic system for + naming directories, but more commonly use conventional placeholder + names. The intended purpose of files in a directory with a placeholder + name then must be inferred from experience or inspection of the files, or + learned from documents or other people.

+ +

For example, a directory named exe/ probably derives its name from the + fact that the contained files have their executable permission bit set; + however, such a directory will not contain all such files. There might + even be some files in an exe/ directory that do not have their + executable permission bit set. The two concepts being an exe/ file + (i.e. being a file in an exe/ directory) and being an executable file + are not identical. The actual intended meaning of being an exe/ file + will sometimes be that the contained files are applications available to a + user, or that they are tools available for use in a project. +

+ +

The directory names in this project resulted from an exploration of a + property-based file system. In such a system a number of files and + agents are defined. Then we can ask questions about their relationships. + Files with a relationship to the developer are collected, and this + becomes the developer/ directory. In a similar manner we get the + directories, tester/, and javac/. In this latter case the + agent is a compiler rather than a role. +

+ +

When attempting to apply the is-for property in practice it + became apparent that using this sole property was insufficient. Consider + the directories deprecated/ and scratch_pad/. There is no + Mr. Deprecated or Mr. Scratch_Pad who the contained + files are for. (And this conclusion is not for the lack of trying. Even + mythological beings did not suffice as agents.) Rather than being for an + agent, the files collected in such a directory have in common a state of + being that was imposed upon them by decree. Perhaps the developer, has + decreed that a file is now deprecated, or a build script has decreed that + it is a scratch_pad file. Such decrees are typically more dynamic than the + relationship properties. Also, these properties are disconnected from the + contents of the file. When, for example, a file has the property of being + for the java compiler, we gain some information about its contents. In the + universe of possible messages sent through a file, such a file will + contain text that is proposed to be java syntax conforming. In contrast, + when we learn that a file is deprecated/ we gain no + information about the contents of the file, because any file can + be deprecated, independent of its contents. +

+ +

To understand a directory name within this system, one can imagine + reading said name as part of a sentence that integrates the + property. Consider two property names: is-a + and is-for. For example, "Each file in + the document/ directory is-a document," or "Each + file in the developer/ directory is-for the + developer." Although the property name is not carried over from the + property based file system to the conventional file system, we can + typically infer what it must have been. (It is beyond the scope of + discussion here, but in actuality, property based file system collections + are defined by predicates. Each predicate is given a file's properties and + relationships as arguments, then resolves to true if and only if the file + belongs to the collection. Now wouldn't that be interesting if we instead + derived a probability?) +

+ +

It is uncommon for a property value to be plural. While it is not + disallowed, it rarely occurs in practice. This is true independent of + whether we are discussing a relationship property or a state + property. Hence when we make a file collection based on a shared property, + then carry that over as a directory name in a conventional file system, + the resulting directory name will often be singular. This pattern can be + observed in the case of the document/ directory, as shown in + the prior paragraph. +

+ +
+ + + diff --git a/document/license.txt b/document/license.txt new file mode 100644 index 0000000..e177f6f --- /dev/null +++ b/document/license.txt @@ -0,0 +1,152 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that +entity. For the purposes of this definition, "control" means (i) the power, +direct or indirect, to cause the direction or management of such entity, whether +by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of +the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, +sublicense, and distribute the Work and such Derivative Works in Source or +Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, +each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer the Work, where such license applies only to those patent claims +licensable by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) with the Work +to which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Work or a Contribution incorporated within the Work +constitutes direct or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate as of the date +such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and in +Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and You must cause any modified files to carry prominent notices +stating that You changed the files; and You must retain, in the Source form of +any Derivative Works that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, excluding those notices +that do not pertain to any part of the Derivative Works; and If the Work +includes a "NOTICE" text file as part of its distribution, then any Derivative +Works that You distribute must include a readable copy of the attribution +notices contained within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one of the following +places: within a NOTICE text file distributed as part of the Derivative Works; +within the Source form or documentation, if provided along with the Derivative +Works; or, within a display generated by the Derivative Works, if and wherever +such third-party notices normally appear. The contents of the NOTICE file are +for informational purposes only and do not modify the License. You may add Your +own attribution notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided that such +additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to the +Licensor shall be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein shall +supersede or modify the terms of any separate license agreement you may have +executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, +trademarks, service marks, or product names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in +writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties +or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any risks +associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in +tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to in +writing, shall any Contributor be liable to You for damages, including any +direct, indirect, special, incidental, or consequential damages of any character +arising as a result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, work stoppage, +computer failure or malfunction, or any and all other commercial damages or +losses), even if such Contributor has been advised of the possibility of such +damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or +Derivative Works thereof, You may choose to offer, and charge a fee for, +acceptance of support, warranty, indemnity, or other liability obligations +and/or rights consistent with this License. However, in accepting such +obligations, You may act only on Your own behalf and on Your sole +responsibility, not on behalf of any other Contributor, and only if You agree to +indemnify, defend, and hold each Contributor harmless for any liability incurred +by, or claims asserted against, such Contributor by reason of your accepting any +such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/document/readme.txt b/document/readme.txt new file mode 100644 index 0000000..3d32175 --- /dev/null +++ b/document/readme.txt @@ -0,0 +1,10 @@ + +-------------------------------------------------------------------------------- +Mosaic + +A tool to assist in hierarchical white box testing. + +Each piece of a program must have integrity for the complete picture to merge. + +With Mosaic we test the pieces, then the communication between the pieces. + diff --git a/document/todo.txt b/document/todo.txt new file mode 100644 index 0000000..ad6bd89 --- /dev/null +++ b/document/todo.txt @@ -0,0 +1,8 @@ + +1. reflect project skeleton changes. + replaced literal `Ariadne` with `$PROJECT` + in top level env choices, PROJECT -> PROMPT_DECOR + + note in 'release' there is a variable name with the project name embedded in it: + Ariadne_jar_fp -> project_jar_fp + Change slashes to dots in the wrapper maker of 'make' diff --git a/document/work_flow.txt b/document/work_flow.txt new file mode 100644 index 0000000..5f699a2 --- /dev/null +++ b/document/work_flow.txt @@ -0,0 +1,59 @@ +### Work Flow + +#### 1. Project Administrator + +1.1. Download the project from GitHub. +1.2. Install the required tools. +1.3. Explain the workflows and where things are located to project members. +1.4. Perform Major and Minor Release administration. + +#### 2. Developer + +2.1. From the Mosaic directory, run `> source env_developer` to set up the + developer environment. +2.2. Use `> make` to build the project, and `> release` to copy relevant files + to `$REPO_HOME/release` for testing. +2.3. The tester will test the release candidate. + +#### 3. Tester + +3.1. From the Mosaic directory, run `> source env_tester` to set up the tester + environment. +3.2. Use `> make` to build the tests, and `> shell/test_` to run a test. + Alternatively, you can cd into one of the test directories, source the + environment for that test, and run it manually. +3.3. Testing and development will likely iterate until the release candidate is + ready to be turned into a versioned release. + +#### 4. Major Release + +4.1. The release candidate is located in the `$REPO_HOME/release` directory and + has passed testing. +4.2. Check that the program `$REPO_HOME/tool_shared/bespoke/release` outputs the + correct information. If necessary, modify it. +4.3. A new branch is created in the project for the release, named + `release_v.0`, where `v.0` is the version number from the `version` + program. The minor version number is set to zero (`.0`), and it is assumed + that this will be the case after each major release. +4.4. Rename the release directory to `$REPO_HOME/release_v.0`, and create a + new empty `$REPO_HOME/release` directory. The new empty release directory + can be used by developers who download the project and make local edits, as + the build scripts target this directory. + +#### 5. Minor Release + +If urgent changes need to be made to the most recent major release, these edits +should be made on the corresponding major release branch. The developer makes +the edits, and the tester tests the release candidate as usual. The `version` +program is updated. Once the release candidate is finalized, rename the +directory to `release_v.`, where `` is the minor version number. If +needed, merge the changes into the `core_developer_branch`. + +--- + +### Tips: + +- If you are acting in multiple roles (e.g., developer, tester, and project + administrator), keep separate terminal shells open for each role. This way, + the environment will remain correctly configured for the tasks related to + each role. diff --git a/env_administrator b/env_administrator new file mode 100644 index 0000000..4b691ce --- /dev/null +++ b/env_administrator @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +export REPO_HOME="${script_path%}/" +echo REPO_HOME "$REPO_HOME" + +cd "$REPO_HOME" +source tool/env + diff --git a/env_developer b/env_developer new file mode 100644 index 0000000..8659f86 --- /dev/null +++ b/env_developer @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +export REPO_HOME="${script_path%}/" +echo REPO_HOME "$REPO_HOME" + +cd "$REPO_HOME" +source tool_shared/bespoke/env +source developer/tool/env + diff --git a/env_tester b/env_tester new file mode 100644 index 0000000..d1bd2d5 --- /dev/null +++ b/env_tester @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +script_path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +export REPO_HOME="${script_path%}/" +echo REPO_HOME "$REPO_HOME" + +cd "$REPO_HOME" +source tool_shared/bespoke/env +source tester/tool/env diff --git a/release/.githolder b/release/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/release/Mosaic.jar b/release/Mosaic.jar new file mode 100644 index 0000000000000000000000000000000000000000..02ea780349b74e30c2aa5ccafe245e4a53fc3a30 GIT binary patch literal 3034 zcmai$2{hE}8^@W2u^nz)31th3nK2=dHeNut zlFiMaFp7W~bZ>iW$0Lktx7x@=5bOwA1%;-B6qI9B)w|VRs;OJO3_!P&RQ6b41I$VA zJtUR3p79CV1mNE!&^WO)L)H{X*0Y&JSoo2zR=~>|g}HkMd%FAi2f239Fx`D-9V#UA z4l?}6r$F#{s_JhnH^EPVSQ6F>zugKDYt+Tx7tWsQ`yOJSJTR_KIDbD+KlkIVE*^gV zKK}0EKT%2jM1}UpIeEJLEB^lZDE?ZEItp{~al+w}2@zJpHX=o83Tw-gE){u3E&{o^=IK0h+xmEFGKSLIXR&Kab_$$%tqdT;Fhn~HExc`q4s&u4 z_fEef{7FZD{l>=F(UJWF3Tk-WCbVCC;;1lvsCPJ@T64FqhRa*wu6Xij=Kf`YU1|8H zNd-~CMKon3kpyx`8ytVQ|7iJY=k7);G;9anb++Q!JU)N)afMrtw-WL!6HQOGBhK-{ z@y*!ZC&<)cs%IJ_0-3#C`<*9-#C+1DC|{dW(5q*Ivf&Xudyn=sNid?m(!uXOXDx%N zKO8(5srnHXUfSED*BsIfM5@=9DaGo|pGG0Qh5{!RdWRDjnqE3+CDWDpWscc!oAAl_qQdCH7m-=xnbP9#g49p- z#16lVb4mu^6}Zn(kCskx=!fyrR_WQIQTtyDJC86Is}c_ulv(H#3>J>AZeKW&n!t@o z9^`yG4So6QF&ucmCDDmXOeT8*AZu4Nds|K-b3x_er1Ns?L(p~Eaw-G{umu5P2TWpL za}sk^A50yB6W$++k~apeko2WHWxS+>W`wE)#iku!DPH&6iRdN1t>O6q^7dZ5IVYF2 z6QgME)9>3Vr?2H!CL!P8@xqUw{pM6Xw}fz7!-yoRGlx{#!e7`Ll**^;nt(1_Z_$lO z9yWdc&UBJ)*cqBWg&>5cuMCJc9gO#+J==yzK?NkDUqbDtt?@ z0V>JkRWWfds#uzFb;Dp@gTI(C&K0AKXC!F(V(JCraD2ob)sL#(l9z{(0d#W@XR)(V z#KnM+FXR+n#!g3_<=A2!(2=f4{me`|8Fid4?+t5Mv$%#_ovdmFDgJOyrlx#QgH`rPex z<(kxf0SL9*iEse7r1$=VZbx|gxuuRU3IFqt)^Fvd%Me_Y67u5$W%)!J`bjD=hf>5Y zi9A=GzeGy)+;@BbfvzSSe1?2`zxt%soxF@d0uO;NW*pp%W5^@%S_W`c1uT|V+bluR zUA#~**P&9X8Y5I?Z*x=Z^r;p&ggRMnZ~JHE45ff%gsh=gn?-k<-SE-8nSOr(;H_ND zyeyJqk3ESIu=n>Mu8wxPe2B9T_ARl#-Su>=M4V- zp}8HNeEh1n(o^Aald#nsXz>;C>Z;t-)QCm(U^0zMvnoXrTZ_4O2a;KLjB zGDw=|AE1~_Yw*ITla~Xv5dDWhj8rr9!`Pg=B#h~28WN_C-!V^ccJ0pX| zYn8bIL(mnln;ssghjg#oQKhWx`ntGxq z(>rclr(R4ew-0Nl1T~DC5Fgrm3QMlxcU>WMqE~hcjoJW^@BpD`$X&UT-{71?ed!(G zu5yaWN4I}~&b!YKn%qj-n+V zpPwE0)`4Appd_1FMHX?;xY^Z*6ClFzb^reiUu-`6+P(l6o7TRSZbc?Goo$*P>-CFt z3#)C7z(%XBti(pEO>1DiZh{tD$IJ13PWn1!KF-fv^FRz zPojL`uCI4~YfoU4*QRCtI@o6p+q$FdcCz)T+3jT0q{08~%=gy$DZ|a?a?A|O>QroU Pg>WdaeveEZ_SgRb40f$6 literal 0 HcmV?d00001 diff --git a/release/build b/release/build new file mode 100755 index 0000000..db43050 --- /dev/null +++ b/release/build @@ -0,0 +1,2 @@ +#!/bin/bash +java com/ReasoningTechnology/"Mosaic"/build diff --git a/scratch_pad/.gitignore b/scratch_pad/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/scratch_pad/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/tester/deprecated/.githolder b/tester/deprecated/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/tester/document/what_the_tests_do.txt b/tester/document/what_the_tests_do.txt new file mode 100644 index 0000000..53762c6 --- /dev/null +++ b/tester/document/what_the_tests_do.txt @@ -0,0 +1,6 @@ + +Test the Mosaic test bench +javac/TestMoasic.java + + + diff --git a/tester/javac/TestIO.java b/tester/javac/TestIO.java new file mode 100644 index 0000000..a3c3509 --- /dev/null +++ b/tester/javac/TestIO.java @@ -0,0 +1,33 @@ +package com.ReasoningTechnology.Mosaic.Test; +import com.ReasoningTechnology.Mosaic.Util; + +/* +Testing the IO class. + +*/ + + +public class TestIO{ + + public static boolean test_is_true(){ + return true; + } + + public static int run(){ + boolean[] condition = new boolean[5]; + conditionn[0] = test_is_true(); + + int i = 0; + if( !Util.all(condition) ){ + System.out.println("TestIO failed"); + return 1; + } + return 0; + } + + // Main function to provide a shell interface for running tests + public static int main(String[] args){ + // tests currently accepts no arguments or options + return run(); // Calls the method to run all tests + } +} diff --git a/tester/javac/TestMosaic_0.javax b/tester/javac/TestMosaic_0.javax new file mode 100644 index 0000000..38307cc --- /dev/null +++ b/tester/javac/TestMosaic_0.javax @@ -0,0 +1,62 @@ +package com.ReasoningTechnology.Mosaic.Test; + +/* +Component smoke test. At least call each method of each class. + +*/ + +import com.ReasoningTechnology.Ariadne.*; +import com.ReasoningTechnology.TestBench.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +public class TestTestBench extends TestBench{ + + public static class TestSuite{ + + TestSuite(){ + } + + public boolean test_pass(ByteArrayOutputStream out_content, ByteArrayOutputStream err_content){ + return true; + } + + public boolean test_fail_0(ByteArrayOutputStream out_content, ByteArrayOutputStream err_content){ + return false; + } + + // Tests if exception uncaught by the test correctly causes a failure from the TestBench. + public static boolean test_fail_1() throws Exception { + int randomInt = (int) (Math.random() * 100); // Generate a random integer + // Always returns true, but Java will not complain that following code is unreachable + if( + (randomInt % 2 != 0 && ((randomInt * randomInt - 1) % 8 == 0)) + || (randomInt % 2 == 0 && (randomInt * randomInt) % 4 == 0) + ){ + throw new Exception("Condition met, error thrown."); + } + + return true; // If the condition fails, return true + } + + } + + // Method to run all tests + public static void test_TestBench(){ + System.out.println("TestTestBench: running tests. Note that two failures is normal"); + TestSuite test_suite = new TestSuite(); + TestBench.run( test_suite ); + } + + // Main function to provide a shell interface for running tests + public static void main(String[] args){ + // tests currently takes no arguments or options + test_TestBench(); // Calls the method to run all tests + } + +} + diff --git a/tester/jvm/.githolder b/tester/jvm/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/tester/jvm/TestBench.jar b/tester/jvm/TestBench.jar new file mode 100644 index 0000000000000000000000000000000000000000..fa385cae130228be0aad0e09a042035186a146bf GIT binary patch literal 5056 zcmb7I2T)U4_YWOJdPhN!UV}90Z0N-xy@Vzpy$K;eXs*(vi}Vr#NS96&1OY_>X+a=V z>Agt{RS-Ye-OqJ*X8-^F&YL%L?!0^2JLjIc=clWUhffP2CME{h7@L{_ej*Y8J^-w0 z2oloNQ3IZL0|0mcU2P)b%N@9XY}5TmVcLrwKZL;`9ZfY=14Ci38W!B!b4Oc9cz{e> zh#%eCU#BmE5u07|7S;j_YJvw~Whi|Sag5j}F>!-W55VXyL0%oB2Y0%Fyj_BQ!;4Gv zOSr!|0fsWBD_@uZUA&i0Tmb+s9HUnIYXmnhzS?=Z1NH4~pq?Ji9*&0gc1|9iZk~>C zprJj~N6Fs9&I$O>LEQRR@;@{Q+qv05p($yk{?|=lzkYA3GOJLlN;Dqft`+mhHl;A% z3;oz7<7+EGp3ZCR#wS^u#QS_ozV;VHEenJ_IcpRO$qPIf`Qc(`eSt17t; z`x|qJ)(jAmi$Z}vqY8vR(eF-~bwOma)Q_^Zdo!T@r#aBAsjBZj=W^BI-!-cfn_L)| zw(ujXX&Hw;a*nA>f@m}DC40q1NhOiEd}Ml?+~$V&E*b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~z&vnN05 z>RIB@iERowtqw_T4tdw(7RwxL(#dj0#$W}{xsukTLtCoBsBjzA(o~fRDf#ZmZL?!> ze|Ug}okqs0XFDTAfu_5-%7KxLrO_(T#v_T}%zN3dfNhIL38&;H@zWOA;~@O7e0I)X zMfp0Y2$^IGKND-RC4PO-(Z~2mGiVW-qXI- zna*dSkyPNe6$kAqr!fRKE2Wa~FNWY;)}K;cKn%^r+-#2bf7PGF|6YH8R9&K_>u*(; z1a2JvGLe9C{#NGk(gl)78p7tT^6oL)2yYSX2h#D5TjRAEDN|;JirPRoy&aPH_IxZpnzp{lr~v;(@!AWD0qxXuSaMru%=lmrK!IAtRKFX z8l|VSqvD$4S>UBtqQuyQT>T(NnLV=iN_XnxG{23v*g%;9xu0PR-FAUix=5LbXL&zI zVIW?fOe~F1?@KGst&SV>ym2ta^-Q^eZ?9l`O=cNKn1v66WTdR`UeHr^$d-xpC$s3| zXWO(bX}vW{4U6R2->|WAL9B*2De9F+*zkz)i-(SdE!)wz#3Z45ji|U)OX`9ci-kvV zE1}A!8}{#43!`ItncYgKe{pmknTd&?d`?rB8lQi~sph&!Ul`@L;+O~6nJ3Bzm>X1E zbZTS-JOXi_&R9I2sRH*@vMRfb6}jK`7}x*DntFFW#+t&k3TVywQ19r`Q*ju_o_ z2|V;xBn>8QQk(q6)1^@)>RKhNx{5_X{BLE*-LE@5x&mGyym}P%q3p)SNZ|KT%tF++J6=O8A7>4YyKqp3-*WTPuR_+ zhAV)7hFbpA(00N88{p-y9{t>+FQJz|3HKuW|6kvami+sX_&MOqKL7IxyzKLT(*D(d rtNw?Hzjyt=8~ZtFmxuaK@}c;jjr}(s0>Vo*gcr}*#Sf{Zx?KGSi>}3k literal 0 HcmV?d00001 diff --git a/tester/jvm/TestBenchMosaic_tester.jar b/tester/jvm/TestBenchMosaic_tester.jar new file mode 100644 index 0000000000000000000000000000000000000000..41cabd0756146e542651143c0ce581796ca37f90 GIT binary patch literal 5393 zcmb7I1yod97p6m`8wEi+2P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j{n{$80A6?T1n$sED z9=77;+>;q~@hGwHL^lPWRtKjv2fyiYjbR8f>SR14rnQ7-UrBA!q$*XVlf8{-X{yRF zE&1xeVZCF1Z+L)_g;LV8XFEMuma@CJ%ASsxvC%TX+C7oS#B15NfO(5j9<$^o!IKuq zqd=U{JQlX!g}6J&@#rNBKN6@hCw#u&(MR`CEp)CG+9d}aTBOTWY}+|hO&`LCtHvZq z`?cOJ4q?S}Yf5w`b_iir-t@kIXZ(ef;r%COA!QKq}-|A2F|F6Gq zRhMAl@<-Jrf*Qv^O~fOdzLdE?cQ(x>3TAdweDjETgsX_^9npBlt?}CQR}qPOsN*~ zsY-7?>V~bQMC!=zD7qwj6nN^C$kR2!SKmpKWsU5;(4Klf&13B)JW!@b;;Y|6yaPt_LL)f$H>@q4VXMK8aysSV)||pTA|Yd;%eFKv(TRv&19A?f zlDa^;Vu4YtO0a_QhTYrM!l>w82G`Q*-yEDqW}@RJ^C|06;_|LI)?63t3nlwf9DN@> z^H|{kb%T71TA3J^lQ;Im8Ke7CCBU9yW@VRwv@4NtaT4xPb5NnF;|tB1sKnF3v*e^d@878S;?g3^E0qDw*PSNpCIUCK+^8oxq+)_5-Eq#q`8 z;eLnyBrg5TaH$3TEbd%tK|ieR!u_EPUE;1_{JpUAYnO>G()?2h`e($Y6!gRRzajo! z82V?Hn?EQnJllU^`99HK491TycqtYAyrf)8ML#V6f8zVj{O2$HGyUbd^z)2yxi0;% zWa2+R)88fiofL5CeSiAvD)raKelD`hN$7`Bll|X~{Wl+6yh|Fwi>v&iNVO;~pZ){B C<@)FV literal 0 HcmV?d00001 diff --git a/tester/scratch_pad/.gitignore b/tester/scratch_pad/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/tester/scratch_pad/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/tester/shell/.githolder b/tester/shell/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/tester/shell/TestTestBench b/tester/shell/TestTestBench new file mode 100755 index 0000000..2afe32f --- /dev/null +++ b/tester/shell/TestTestBench @@ -0,0 +1,2 @@ +#!/bin/env bash +java com.ReasoningTechnology."Mosaic_tester".TestBench.TestTestBench diff --git a/tester/tool/clean_build_directories b/tester/tool/clean_build_directories new file mode 100755 index 0000000..2aff503 --- /dev/null +++ b/tester/tool/clean_build_directories @@ -0,0 +1,22 @@ +#!/bin/bash + +# Caveat: the 'shell' directory is for built wrapper functions. `clean_build_directories` will +# remove all the files in this directory. For bespoke scripts used by the tester, put +# them in the `tool` directory. + +# input guards + env_must_be="tester/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# remove files + set -x + cd "$REPO_HOME"/tester + rm -r scratch_pad/* + rm jvm/* + rm shell/* + set +x + +echo "$(script_fn) done." diff --git a/tester/tool/env b/tester/tool/env new file mode 100644 index 0000000..bd42c24 --- /dev/null +++ b/tester/tool/env @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# input guards + + env_must_be="tool_shared/bespoke/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + + if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_name:: This script must be sourced, not executed." + exit 1 + fi + +# so we can do testing + +export PATH=\ +"$REPO_HOME"/tester/tool/\ +:"$REPO_HOME"/tool_shared/bespoke/\ +:"$JAVA_HOME"/bin\ +:"$PATH" + +export CLASSPATH=\ +"$JAVA_HOME"/lib\ +:"$REPO_HOME"/release/"$PROJECT".jar\ +:"$REPO_HOME"/tester/jvm/TestBench.jar\ +:"$REPO_HOME"/tester/jvm/TestBench"$PROJECT".jar\ +:"$CLASSPATH" + +# misc + + # make .githolder and .gitignore visible + alias ls="ls -a" + +# some feedback to show all went well + + export PROMPT_DECOR="$PROJECT"_tester + export ENV=$(script_fp) + echo ENV "$ENV" + cd "$REPO_HOME"/tester/ diff --git a/tester/tool/make b/tester/tool/make new file mode 100755 index 0000000..4a131f6 --- /dev/null +++ b/tester/tool/make @@ -0,0 +1,31 @@ +#!/bin/env bash + +# input guards + + env_must_be="tester/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +echo "Compiling files..." + + set -x + cd $REPO_HOME/tester + javac -d scratch_pad javac/*.java + jar cf jvm/TestBench"$PROJECT".jar -C scratch_pad . + set +x + +echo "Creating shell wrappers..." + mkdir -p shell + # wrapper is a space separated list + wrapper=TestTestBench + for file in $wrapper;do + cat > shell/$file << EOL +#!/bin/env bash +java com.ReasoningTechnology."$PROJECT".Test.$file +EOL + chmod +x shell/$file + done + +echo "$(script_fp) done." diff --git a/tool/env b/tool/env new file mode 100644 index 0000000..830913d --- /dev/null +++ b/tool/env @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +script_name=$(basename ${BASH_SOURCE[0]}) +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_name 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_PM=true + +PROJECT="$PROJECT"_administrator + +export PATH=\ +"$REPO_HOME"/tool\ +:"$PATH" + +# no sneaky hidden files +alias ls="ls -a" + +export ENV_PM=true +echo "$script_name done." + diff --git a/tool_shared/bespoke/cat_w_fn b/tool_shared/bespoke/cat_w_fn new file mode 100755 index 0000000..09931d1 --- /dev/null +++ b/tool_shared/bespoke/cat_w_fn @@ -0,0 +1,29 @@ +#!/bin/bash + +# Check if at least one file is provided +if [ $# -eq 0 ]; then + echo "Usage: $0 [filename2] ..." + exit 1 +fi + +# Loop through all the provided files +for file in "$@"; do + # Check if the file exists + if [ ! -f "$file" ]; then + echo "Error: File '$file' not found!" + continue + fi + + # Print 80 dashes + printf '%.0s-' {1..80} + echo + + # Print the filename and a colon + echo "$file:" + + # Print the contents of the file + cat "$file" + + # Print a newline for spacing between files + echo +done diff --git a/tool_shared/bespoke/deprecate b/tool_shared/bespoke/deprecate new file mode 100755 index 0000000..821e7ab --- /dev/null +++ b/tool_shared/bespoke/deprecate @@ -0,0 +1,20 @@ +#!/bin/bash + +# cp subtree at under file path , and make all the copied +# files read-only. The intended use case is for moving files to a `deprecated` +# directory. This helps prevent subsequent accidental editing. + +SCRIPT_NAME=$(basename "$0") +if [ "$#" -lt 2 ]; then + echo "Usage: $SCRIPT_NAME " + exit 1 +fi +SRC="$1" +DEST="$2" + +mkdir -p "$DEST" +mv "$SRC" "$DEST" + +# make stuff readonly +cd "$DEST" || exit +chmod -R u-w,go-rwx "$DEST" diff --git a/tool_shared/bespoke/env b/tool_shared/bespoke/env new file mode 100644 index 0000000..f36023e --- /dev/null +++ b/tool_shared/bespoke/env @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# environment shared by entire project +# number one task, establish REPO_HOME +# this is specific to this script being in the .../tools_shared/env directory + + export PROJECT=$(basename "$REPO_HOME") + + ## set the shell prompt to show the project + PPS1="\n[$PROJECT]\n\u@\h§$(pwd)§\n> " + PPS2=">> " + +# some useful functions for environment scripts + + ## path to script file + script_fp() { + eval " + local script_dp=\$(dirname \$(realpath \${BASH_SOURCE[1]})) + echo \$(realpath --relative-to=\"$REPO_HOME\" \"\$script_dp\")/\$(script_fn) + " + } + + ## path to script directory + script_dp() { + eval " + local script_dp=\$(dirname \$(realpath \${BASH_SOURCE[1]})) + echo \$(realpath --relative-to=\"$REPO_HOME\" \"\$script_dp\") + " + } + + ## an env script will be in workspace/tool/env, so + workspace(){ + eval "echo \$(dirname \$(script_dp))" + } + + ## script's filename + script_fn() { + eval "echo \$(basename \${BASH_SOURCE[1]})" + } + + export -f script_fp script_dp script_fn workspace + +# note to the programs which environment they are running. + + export ENV=$(script_fp) + +# The project administrator setup these tools and environment settings for all +# on the project to use: + +export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-11" + +# some feedback to show all went well + +echo ENV "$ENV" +echo PROJECT "$PROJECT" + + + diff --git a/tool_shared/bespoke/version b/tool_shared/bespoke/version new file mode 100755 index 0000000..53a64a6 --- /dev/null +++ b/tool_shared/bespoke/version @@ -0,0 +1,6 @@ +#!/bin/env bash + +# 2024-10-24T14:56:09Z extracted from Ariadne + +echo 0.1 + diff --git a/tool_shared/bespoke/vl b/tool_shared/bespoke/vl new file mode 100755 index 0000000..94fe14d --- /dev/null +++ b/tool_shared/bespoke/vl @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# vl 'vertical list' + +# Check if the command is provided +if [ -z "$1" ]; then + echo "Usage: vl [args...]" + exit 1 +fi + +# Capture the command and its arguments +cmd=$1 +shift + +# Run the command with the remaining arguments and replace colons or spaces with newlines +"$cmd" "$@" | tr ' :' '\n' + +exit 0 diff --git a/tool_shared/bespoke/wipe_release b/tool_shared/bespoke/wipe_release new file mode 100755 index 0000000..4b92b4b --- /dev/null +++ b/tool_shared/bespoke/wipe_release @@ -0,0 +1,17 @@ +#!/bin/bash +# remove all files in the release directory +set -e + +script_name=$(basename ${BASH_SOURCE[0]}) +if [ -z "$REPO_HOME" ]; then + echo "$script_name:: REPO_HOME is not set." + exit 1 +fi + +set -x +cd "$REPO_HOME" +rm -rf release/* +set +x + +echo "$script_name done." + diff --git a/tool_shared/customized/.githolder b/tool_shared/customized/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/tool_shared/document/#install_java.txt# b/tool_shared/document/#install_java.txt# new file mode 100644 index 0000000..0091eac --- /dev/null +++ b/tool_shared/document/#install_java.txt# @@ -0,0 +1,11 @@ + +#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_java.txt b/tool_shared/document/install_java.txt new file mode 100644 index 0000000..c9e5743 --- /dev/null +++ b/tool_shared/document/install_java.txt @@ -0,0 +1,11 @@ + +#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 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/third_party/.gitignore b/tool_shared/third_party/.gitignore new file mode 100644 index 0000000..525ec6b --- /dev/null +++ b/tool_shared/third_party/.gitignore @@ -0,0 +1,4 @@ +* +!/.gitignore +# upstream has a .gitignore file in it, edit to keep anything precious +!/upstream diff --git a/tool_shared/third_party/upstream/.gitignore b/tool_shared/third_party/upstream/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/tool_shared/third_party/upstream/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore -- 2.20.1