Update README, include sample build program, setup custom build options and sample variables

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago committed by GitHub
parent b9135dc0aa
commit 796595aaa6
  1. 2
      C/scripts/build.sh
  2. BIN
      CProjectTemplate
  3. 17
      Java/scripts/build.sh
  4. 17
      Java/scripts/build2.sh
  5. 4
      Java/scripts/clean.sh
  6. 20
      Java/scripts/commit.sh
  7. 10
      Java/scripts/filelist
  8. 17
      Java/scripts/jar.sh
  9. 17
      Java/scripts/jar2.sh
  10. 9
      Java/scripts/md5
  11. 28
      Java/scripts/release.sh
  12. 3
      Java/scripts/update.sh
  13. 3
      Java/scripts/version_info
  14. 14
      Java/scripts/zip.sh
  15. 48
      README.md
  16. 5
      main.c
  17. 32
      scripts/commit.sh
  18. 2
      scripts/filelist
  19. 2
      scripts/md5
  20. 3
      scripts/update.sh
  21. 14
      sig

@ -1,5 +1,5 @@
#Compiles the entire program then runs it, producing an executable.
#C
if gcc $(find . -type f -name "*.c") -lncurses -o ${PROJECT_NAME}; then
if gcc $(find . -type f -name "*.c") ${BUILD_OPTIONS} -o ${PROJECT_NAME}; then
./${PROJECT_NAME}
fi

Binary file not shown.

@ -1,17 +0,0 @@
#Builds and runs the project.
#Java
source ${LANGUAGE}/scripts/version_info
javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/*.java
printf "\n\n\nRunning Program...\n\n"
ORIGINAL_LOC=$(pwd)
cd $OUT_DIR
if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
exit
fi
if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
exit
fi
java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+PrintCommandLineFlags -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh

@ -1,17 +0,0 @@
#Builds and runs the project for Windows.
#Java
source ${LANGUAGE}/scripts/version_info
javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH_WINDOWS} -d ${OUT_DIR} ${PROJECT_DIR}/*.java
printf "\n\n\nRunning Program...\n\n"
ORIGINAL_LOC=$(pwd)
cd $OUT_DIR
if java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+UseZGC "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
exit
fi
if java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+UnlockExperimentalVMOptions -XX:+UseZGC "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
exit
fi
java ${CUSTOM_PARAMS} -cp ".;../lib/bin/" -XX:+PrintCommandLineFlags "-Djava.library.path=${LIBRARY_PATH}" ${MAIN_CLASS} "$@"
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh

@ -1,4 +0,0 @@
#Cleans up and removes unused files.
#Java
find -type f -name *.class -delete
find -type f -name manifest -delete

@ -1,20 +0,0 @@
#Adds a commit message and pushes project to github repository.
#Java
COMMIT_MESSAGE="$*"
FIRST_LINE=true
while IFS= read -r line
do
if [ "$FIRST_LINE" = true ]; then
COMMIT_MESSAGE+="
Co-authored-by: $line"
FIRST_LINE=false
else
COMMIT_MESSAGE+="
Co-authored-by: $line"
fi
done < utils/.coauthors
git add -u
git add *
git commit -m "$COMMIT_MESSAGE"
git push

@ -1,10 +0,0 @@
build2.sh
build.sh
clean.sh
commit.sh
jar2.sh
jar.sh
release.sh
update.sh
version_info
zip.sh

@ -1,17 +0,0 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
#Java
source ${LANGUAGE}/scripts/version_info
rm -Rf bin/*
javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java
printf "\n\n\nGenerating Manifest...\n\n"
touch manifest
echo "Main-Class: ${MAIN_CLASS}" > manifest
printf "\n\n\nCreating Jar...\n\n"
ORIGINAL_LOC=$(pwd)
cd ${OUT_DIR}
jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig
jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ .
printf "\n\n\nRunning Program...\n\n"
java ${CUSTOM_PARAMS} -cp .:../lib/bin -Djava.library.path="${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@"
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
cd ..

@ -1,17 +0,0 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar for Windows.
#Java
source ${LANGUAGE}/scripts/version_info
rm -Rf bin/*
javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH_WINDOWS} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java
printf "\n\n\nGenerating Manifest...\n\n"
touch manifest
echo "Main-Class: ${MAIN_CLASS}" > manifest
printf "\n\n\nCreating Jar...\n\n"
ORIGINAL_LOC=$(pwd)
cd ${OUT_DIR}
jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig
jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ .
printf "\n\n\nRunning Program...\n\n"
java ${CUSTOM_PARAMS} -cp .;../lib/bin "-Djava.library.path=${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@"
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh
cd ..

@ -1,9 +0,0 @@
build2.sh:b1c6b7c6b2eb19ba54be6824bda8805b -
build.sh:5df470d49036bf7565493739aeebeaa8 -
clean.sh:668a2f9b568c55f6a044a509315032f6 -
commit.sh:5e4448db9ad48e72ec3a1ff4f5763b41 -
jar2.sh:7977fc138ee5db798d08c34734f0be93 -
jar.sh:821d5a109324d405f05c35c4bb129375 -
release.sh:027178aa6da76180401a188d8f03af64 -
update.sh:3be721658983183efa395984acd96b03 -
zip.sh:273f5a83b80a8e54022d60514dfeec0a -

@ -1,28 +0,0 @@
#Use ./sig release <windows|mac|linux> to create a custom installer based on OS.
#Java
source ${LANGUAGE}/scripts/version_info
FILES=$(cat ${LANGUAGE}/scripts/.package.files)
if [ "$1" = "windows" ];then
echo "Creating a package for Windows..."
echo "Not implemented yet."
elif [ "$1" = "mac" ];then
echo "Creating a package for Mac..."
echo "Not implemented yet."
elif [ "$1" = "linux" ];then
echo "Creating a package for Linux..."
cd ..
mkdir -vp RabiCloneOut/in
for f in $FILES
do
cp -Rv --parents $PROJECT_NAME/$f RabiCloneOut/in
done
jpackage --verbose --input RabiCloneOut/in/RabiClone --main-jar bin/RabiClone.jar --main-class sig.RabiClone --type app-image --dest RabiCloneOut
cp -Rv RabiCloneOut/RabiClone/lib/app/* RabiCloneOut/RabiClone
jpackage --verbose --app-image RabiCloneOut/RabiClone --name RabiClone
rm -Rfv RabiCloneOut
cd RabiClone
echo "Done!"
else
echo "Usage: "
echo " ./sig release <windows|mac|linux>"
fi

@ -1,3 +0,0 @@
#Pulls the latest version of the repository.
#Java
git pull

@ -1,3 +0,0 @@
export SOURCE_VERSION="8"
export TARGET_VERSION="8"
export RELEASE_VERSION="0.0a"

@ -1,14 +0,0 @@
#Create a zip folder containing all dependencies. For quick release.
#Java
source ${LANGUAGE}/scripts/version_info
TARGET_FILE="${PROJECT_NAME}_${RELEASE_VERSION}.zip"
FILES=$(cat ${LANGUAGE}/scripts/.package.files)
echo "Creating Package $TARGET_FILE..."
for f in $FILES
do
zip -ur $TARGET_FILE $f
done
echo "Complete!"
echo ""
echo ""
echo ""

@ -1,33 +1,19 @@
This repository contains general build scripts and pipelines for all languages that I incorporate in my projects. The goal is to provide an easy retrieval and update system for the project. Each script will be a shell script containing the following template:
```bash
#Short description about what I do
#Language[Folder]
# #The script's code goes in here.
# rm -Rf out/*
# javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java
# printf "\n\n\nRunning Program...\n\n"
# cd $OUT_DIR
# java ${MAIN_CLASS} "$@"
# ../scripts/clean.sh
```
Each language will be in the following structure:
```
-<Language>
--<scripts>
---[script files.sh]
```
This repository provides a template for starting a new C project using Sig's build system! Updates are automatically propogated. Run `./sig` for a list of commands and then use follow the instructions given to invoke them. Adjust variables as necessary in the `sig` command file.
The `sig` script will display by default any scripts in the `scripts` folder, therefore when creating a project, copy over the scripts folder of the desired language into your project then the `sig` script handles the rest appropriately. If your project requires multiple languages and build setups, then you can use the `sig2` command, which has an additional parameter to specify the language when running it. When setting up a multi-language setup, you'll just copy the entire folder to include the programming language itself. So a multi-language project structure may look something like this:
```
-C
--scripts
---build.sh
---clean.sh
---make.sh
-Java
--scripts
---build.sh
---clean.sh
---jar.sh
```
@sigonasr2 ➜ /workspaces/CProjectTemplate (main) $ ./sig
Dev build, no checks required.
Usage: ./sig <command> {args}
==== Current Configuration =====================
PROJECT_NAME CProjectTemplate
BUILD_OPTIONS -lncurses
LANGUAGE C
=====================================================
Command List:
build Compiles the entire program then runs it, producing an executable.
commit Adds a commit message and pushes project to github repository.
'``

@ -0,0 +1,5 @@
#include <stdio.h>
int main(int argc,char**argv) {
printf("Hello World!");
}

@ -1,32 +0,0 @@
#Adds a commit message and pushes project to github repository.
#
source utils/search.sh
find . -type f -name md5 -delete
find . -type f -name filelist -delete
#Generate a new hash for every sub-directory, which may require an update.
FILES=$(cat utils/.updateDirectories)
COMMIT_MESSAGE="$*"
FIRST_LINE=true
while IFS= read -r line
do
if [ "$FIRST_LINE" = true ]; then
COMMIT_MESSAGE+="
Co-authored-by: $line"
FIRST_LINE=false
else
COMMIT_MESSAGE+="
Co-authored-by: $line"
fi
done < utils/.coauthors
for f in $FILES
do
search $f
done
git add -u
git add *
git commit -m "$COMMIT_MESSAGE"
git push

@ -1,2 +0,0 @@
commit.sh
update.sh

@ -1,2 +0,0 @@
commit.sh:ea122668a72b4445c10b6e9070f7bbd8 -
update.sh:7fda194f24fbd8779221066cbbc04b3f -

@ -1,3 +0,0 @@
#Pulls the latest version of the repository.
#
git pull

14
sig

@ -1,15 +1,9 @@
export AUTO_UPDATE=true
export AUTO_UPDATE=false
source utils/define.sh
define PROJECT_NAME "JavaProjectTemplate"
define PROJECT_DIR "src/sig"
define MAIN_CLASS "sig.${PROJECT_NAME}"
define OUT_DIR "bin"
define LIBRARY_PATH "../lib"
define CLASS_PATH "${PROJECT_DIR}/..:lib/bin"
define CLASS_PATH_WINDOWS "${PROJECT_DIR}/..;lib/bin"
define CUSTOM_PARAMS ""
define LANGUAGE ""
define PROJECT_NAME "CProjectTemplate"
define BUILD_OPTIONS "-lncurses"
define LANGUAGE "C"
source utils/main.sh
Loading…
Cancel
Save