Compare commits

..

No commits in common. "ace80e39ce51ced5d2df865209b28be38374856c" and "8bb07d8f7bb2d752611cf3f604e9ef32f5ac7983" have entirely different histories.

11 changed files with 4 additions and 148 deletions

View File

@ -6,7 +6,6 @@ Clean
Log
LogTerm
LogFile
modules/
ProcessBuildFile
BuildProject
InitProject
@ -16,7 +15,6 @@ PrintInfo
SubInit
SubBump
SubBuild
SubGet
SubHelp
SubCommand
Main

View File

@ -1,5 +1,5 @@
projectName='LINAC'
projectDescription='LINAC is not a compiler'
projectVersion=0.10.0
projectVersion=0.9.4
projectAuthor='Joe <joe@thisisjoes.site>'
projectLicense='GPLv3'

View File

@ -33,14 +33,10 @@ BuildProject() {
esac
Log debug "Using target '$target'"
MakeStub "$target"
local -a paths
local -a module_paths
GetModulePaths module_paths
local -a local_paths
mapfile -t local_paths < <(ProcessBuildFile "$target")
paths+=(${module_paths[@]})
paths+=(${local_paths[@]})
local paths
mapfile -t paths < <(ProcessBuildFile "$target")
Log debug "Paths are '${paths[*]}'"
local files
@ -57,11 +53,6 @@ BuildProject() {
local strip_comments=false
;;
m ) Log info "Got option '$option', building as submodule without stub or entrypoint."
local is_submodule=true
local strip_comments=true
;;
'' ) Log debug "No option passed, stripping comments."
local strip_comments=true
;;
@ -71,14 +62,6 @@ BuildProject() {
;;
esac
if [[ ! "$is_submodule" == true ]]; then
Log info "Creating stub..."
MakeStub
else
local name="${projectName,,}"
[[ -f "${config[build_path]}$name" ]] && rm "${config[build_path]}$name"
fi
if [[ "$strip_comments" == true ]]; then
local args='-Ehrv'
local pattern='^\s*#'

View File

@ -9,6 +9,5 @@ Configure() {
[log_file]="linac.log"
[src_path]="src/"
[build_path]="build/"
[module_path]="modules"
)
}

View File

@ -2,7 +2,6 @@ CreateFiles() {
if [ ! -d "${config[config_path]}" ]; then
mkdir "${config[config_path]}"
mkdir "${config[src_path]}"
mkdir "${config[module_path]}"
mkdir "${config[build_path]}"
touch "${config[config_path]}"/"${config[config_file]}"
fi

View File

@ -1,4 +0,0 @@
SubGet() {
InitCheck
GetModuleDependencies "$@"
}

View File

@ -1,10 +0,0 @@
BuildModule() {
Log debug "Got args '$*'"
local module="$1"
local version="$2"
local module_path="${config[module_path]}"
cd "$module_path/${module}/${version}"
linac get && linac build -m "${module}.build"
}

View File

@ -1,20 +0,0 @@
CheckModuleCache() {
local module="$1"
local version="$2"
local url="$3"
local module_path="${config[module_path]}"
if [[ ! -d "$module_path" ]]; then
mkdir "$module_path"
# Log error "Module cache directory missing. Aborting."
# exit 1
fi
if [[ -d "${module_path}/${module}/${version}" ]]; then
Log info "Module '$module', version '$version' found in local cache."
else
Log info "Module '$module', version '$version' not in local cache."
return 1
fi
}

View File

@ -1,38 +0,0 @@
GetModuleDependencies() {
local module_file="${projectName,,}.module"
local -A depends
if [[ -f "$module_file" ]]; then
. "$module_file" ||
{
Log error "Failed to load LINAC module file '$module_file'"
return 1
}
else
Log info "'${projectName}' has no module file, skipping"
return 0
fi
local module
for module in "${!depends[@]}"; do
Log debug "$module"
Log debug "${depends[$module]}"
declare -A "$module"'='"${depends[$module]}"
done
for module in "${!depends[@]}"; do
local -n ref
ref=${module}
local version
version="${ref[v]}"
local url
url="${ref[u]}"
CheckModuleCache "$module" "$version" || {
RetrieveModule "$module" "$version" "$url"
}
BuildModule "$module" "$version"
# WriteModuleInfo "$module" "$url"
unset -n ref
done
}

View File

@ -1,35 +0,0 @@
GetModulePaths() {
local -n __GetModulePaths_paths="$1"
local module_file="${projectName,,}.module"
local -A depends
if [[ -f "$module_file" ]]; then
. "$module_file" ||
{
Log error "Failed to load LINAC module file '$module_file'"
return 1
}
else
Log info "'${projectName}' has no module file, skipping"
return 0
fi
local module
for module in "${!depends[@]}"; do
Log debug "$module"
Log debug "${depends[$module]}"
declare -Ag "$module"'='"${depends[$module]}"
done
for module in "${!depends[@]}"; do
local -n ref
ref=${module}
local version
version="${ref[v]}"
__GetModulePaths_paths+=("${config[module_path]}/${module}/${version}/build/")
unset -n ref
done
}

View File

@ -1,16 +0,0 @@
RetrieveModule() {
local module="$1"
local version="$2"
local url="https://$3"
Log info "Retreiving module '$module' version '$version' from '$url'"
if [[ "$version" =~ ^[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}.*$ ]]; then
local clone_version="v${version}"
else
local clone_version="$version"
fi
git clone -b "$clone_version" --depth 1 "$url" "${config[module_path]}/$module/$version" -c advice.detachedHead=false --quiet >/dev/null || {
Log error "Failed to retrieve module '$module' version '$version'. Aborting."
exit 1
}
}