diff --git a/.idea/runConfigurations/Build_Redist.xml b/.idea/runConfigurations/Build_Redist.xml new file mode 100644 index 0000000..fdfc836 --- /dev/null +++ b/.idea/runConfigurations/Build_Redist.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Build_Tarball.xml b/.idea/runConfigurations/Build_Tarball.xml new file mode 100644 index 0000000..7ec879f --- /dev/null +++ b/.idea/runConfigurations/Build_Tarball.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Clean.xml b/.idea/runConfigurations/Clean.xml new file mode 100644 index 0000000..e088b48 --- /dev/null +++ b/.idea/runConfigurations/Clean.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Rebuild_Autoloaders.xml b/.idea/runConfigurations/Rebuild_Autoloaders.xml new file mode 100644 index 0000000..730b2df --- /dev/null +++ b/.idea/runConfigurations/Rebuild_Autoloaders.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 68683e4..717000d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactored `\ncc\Objects > PackageLock` - Updated `defuse\php-encryption` to version 2.4.0 - Updated `\ncc\Classes > GitClient > cloneRepositor()` to clone submodules recursively by default + - Updated `\ncc\Classes > GitClient > checkout()` to update submoudles. ### Fixed - Fixed issue in `\ncc\Managers > ExecutionPointerManager > executeUnit()` where if ttyMode is enabled in a non-tty diff --git a/Makefile b/Makefile index f2a4382..428bd20 100644 --- a/Makefile +++ b/Makefile @@ -1,75 +1,42 @@ -PHPCC:=$(shell which php) -PHPAB:=$(shell which phpab) -BUILD_PATH=build -SRC_PATH=src +# Variables +PHPCC := $(shell which php) +PHPAB := $(shell which phpab) +BUILD_PATH := build +SRC_PATH := src +INSTALLER_PATH := $(SRC_PATH)/installer +CONFIG_PATH := $(SRC_PATH)/config +TIMESTAMP := $(shell date +%Y%m%d%H%M%S) -autoload: - # Generates/creates all the autoloader files - make $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php - make $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php - make $(SRC_PATH)/ncc/autoload_spl.php - cp $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php +# List of paths for autoloading +AUTOLOAD_PATHS := $(addprefix $(SRC_PATH)/ncc/ThirdParty/, \ + defuse/php-encryption \ + jelix/version \ + nikic/PhpParser \ + Symfony/polyfill-ctype \ + Symfony/polyfill-mbstring \ + Symfony/polyfill-uuid \ + Symfony/Process \ + Symfony/Uid \ + Symfony/Filesystem \ + Symfony/Yaml \ + theseer/Autoload \ + theseer/DirectoryScanner \ +) -$(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption +# Check for necessary binaries +ifndef PHPCC + $(error "PHP binary not found. Please install PHP or check your PATH") +endif +ifndef PHPAB + $(error "phpab (PHP Autoload Builder) binary not found. Please install phpab or check your PATH") +endif -$(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/jelix/version - -$(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring - -$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Process - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php: - $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem - -$(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml - -$(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload - -$(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php \ - $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner +# Build rules +$(SRC_PATH)/%/autoload_spl.php: + $(PHPCC) $(PHPAB) --output $@ $(SRC_PATH)/$* $(SRC_PATH)/ncc/autoload_spl.php: - $(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/autoload_spl.php \ + $(PHPCC) $(PHPAB) --output $@ \ $(SRC_PATH)/ncc/Abstracts \ $(SRC_PATH)/ncc/Classes \ $(SRC_PATH)/ncc/CLI \ @@ -83,38 +50,49 @@ $(SRC_PATH)/ncc/autoload_spl.php: $(SRC_PATH)/ncc/ncc.php \ $(SRC_PATH)/ncc/Runtime.php +# Phony targets +.PHONY: autoload +autoload: $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS)) $(SRC_PATH)/ncc/autoload_spl.php + cp -f $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php + +.PHONY: redist redist: autoload rm -rf $(BUILD_PATH)/src mkdir -p $(BUILD_PATH)/src cp -rf $(SRC_PATH)/ncc/* $(BUILD_PATH)/src - cp $(SRC_PATH)/installer/installer $(BUILD_PATH)/src/INSTALL - cp $(SRC_PATH)/installer/ncc.sh $(BUILD_PATH)/src/ncc.sh - cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/default_config.yaml; - cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml; - cp $(SRC_PATH)/installer/extension $(BUILD_PATH)/src/extension + cp -f $(INSTALLER_PATH)/installer $(BUILD_PATH)/src/INSTALL + cp -f $(INSTALLER_PATH)/ncc.sh $(BUILD_PATH)/src/ncc.sh + cp -f $(CONFIG_PATH)/ncc.yaml $(BUILD_PATH)/src/default_config.yaml + cp -f $(CONFIG_PATH)/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml + cp -f $(INSTALLER_PATH)/extension $(BUILD_PATH)/src/extension chmod +x $(BUILD_PATH)/src/INSTALL - cp LICENSE $(BUILD_PATH)/src/LICENSE - cp README.md $(BUILD_PATH)/src/README.md - cp $(SRC_PATH)/installer/hash_check.php $(BUILD_PATH)/src/hash_check.php; $(PHPCC) $(BUILD_PATH)/src/hash_check.php; rm $(BUILD_PATH)/src/hash_check.php - cp $(SRC_PATH)/installer/generate_build_files.php $(BUILD_PATH)/src/generate_build_files.php; $(PHPCC) $(BUILD_PATH)/src/generate_build_files.php; rm $(BUILD_PATH)/src/generate_build_files.php + cp -f LICENSE $(BUILD_PATH)/src/LICENSE + cp -f README.md $(BUILD_PATH)/src/README.md + cp -f $(INSTALLER_PATH)/hash_check.php $(BUILD_PATH)/src/hash_check.php + $(PHPCC) $(BUILD_PATH)/src/hash_check.php + rm $(BUILD_PATH)/src/hash_check.php + cp -f $(INSTALLER_PATH)/generate_build_files.php $(BUILD_PATH)/src/generate_build_files.php + $(PHPCC) $(BUILD_PATH)/src/generate_build_files.php + rm $(BUILD_PATH)/src/generate_build_files.php mkdir -p $(BUILD_PATH)/src/repositories cp -rf $(SRC_PATH)/default_repositories/*.json $(BUILD_PATH)/src/repositories -tar: redist - cd $(BUILD_PATH)/src; tar -czvf ../build.tar.gz * +$(BUILD_PATH)/build_$(TIMESTAMP).tar.gz: redist + cd $(BUILD_PATH)/src; tar -czvf ../build_$(TIMESTAMP).tar.gz * +.PHONY: tar +tar: $(BUILD_PATH)/build_$(TIMESTAMP).tar.gz + +.PHONY: clean clean: rm -rf $(BUILD_PATH) rm -f $(SRC_PATH)/ncc/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php - rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php + rm -f $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS)) + +.PHONY: help +help: + @echo "Available commands:" + @echo " make autoload - Generate autoload files" + @echo " make redist - Prepare the project for redistribution" + @echo " make tar - Package the project into a tarball with timestamp" + @echo " make clean - Clean the build artifacts" \ No newline at end of file diff --git a/README.md b/README.md index cbdabda..8f807a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ![NCC](assets/icon/ncc_32px.png "NCC") NCC +# ![NCC](assets/icon/ncc@32px.png "NCC") NCC Nosial Code Compiler is a program written in PHP designed to be a multi-purpose compiler, package manager and toolkit. This program is a complete re-write of the now defunct [PHP Package Manager (PPM)](https://git.n64.cc/intellivoid/ppm) @@ -24,6 +24,7 @@ community powered mirrors. (more to come) - [git.it-kuny.ch](https://git.it-kuny.ch) - [git.martinvlba.eu](https://git.martinvlba.eu/Nosial/ncc) + - [github.com](https://github.com/Nosial/ncc) # Contributing diff --git a/assets/icon/ncc.ai b/assets/icon/ncc.ai deleted file mode 100644 index 3ac5699..0000000 Binary files a/assets/icon/ncc.ai and /dev/null differ diff --git a/assets/icon/ncc.icns b/assets/icon/ncc.icns deleted file mode 100644 index 8c4f022..0000000 Binary files a/assets/icon/ncc.icns and /dev/null differ diff --git a/assets/icon/ncc.ico b/assets/icon/ncc.ico deleted file mode 100644 index 0e1baf6..0000000 Binary files a/assets/icon/ncc.ico and /dev/null differ diff --git a/assets/icon/ncc.svg b/assets/icon/ncc.svg index 710e976..89461df 100644 --- a/assets/icon/ncc.svg +++ b/assets/icon/ncc.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/assets/icon/ncc@1024px.png b/assets/icon/ncc@1024px.png new file mode 100644 index 0000000..e6ac83f Binary files /dev/null and b/assets/icon/ncc@1024px.png differ diff --git a/assets/icon/ncc@128px.png b/assets/icon/ncc@128px.png new file mode 100644 index 0000000..c0c7ecb Binary files /dev/null and b/assets/icon/ncc@128px.png differ diff --git a/assets/icon/ncc@16px.png b/assets/icon/ncc@16px.png new file mode 100644 index 0000000..ae6c643 Binary files /dev/null and b/assets/icon/ncc@16px.png differ diff --git a/assets/icon/ncc@256px.png b/assets/icon/ncc@256px.png new file mode 100644 index 0000000..61fce8c Binary files /dev/null and b/assets/icon/ncc@256px.png differ diff --git a/assets/icon/ncc@32px.png b/assets/icon/ncc@32px.png new file mode 100644 index 0000000..8692e33 Binary files /dev/null and b/assets/icon/ncc@32px.png differ diff --git a/assets/icon/ncc@512px.png b/assets/icon/ncc@512px.png new file mode 100644 index 0000000..cd0898a Binary files /dev/null and b/assets/icon/ncc@512px.png differ diff --git a/assets/icon/ncc@64px.png b/assets/icon/ncc@64px.png new file mode 100644 index 0000000..0acd19b Binary files /dev/null and b/assets/icon/ncc@64px.png differ diff --git a/assets/icon/ncc_1024px.png b/assets/icon/ncc_1024px.png deleted file mode 100644 index 3174a54..0000000 Binary files a/assets/icon/ncc_1024px.png and /dev/null differ diff --git a/assets/icon/ncc_128px.png b/assets/icon/ncc_128px.png deleted file mode 100644 index 51ef39c..0000000 Binary files a/assets/icon/ncc_128px.png and /dev/null differ diff --git a/assets/icon/ncc_16px.png b/assets/icon/ncc_16px.png deleted file mode 100644 index fbaee4f..0000000 Binary files a/assets/icon/ncc_16px.png and /dev/null differ diff --git a/assets/icon/ncc_2048px.png b/assets/icon/ncc_2048px.png deleted file mode 100644 index 3d2aa43..0000000 Binary files a/assets/icon/ncc_2048px.png and /dev/null differ diff --git a/assets/icon/ncc_20px.png b/assets/icon/ncc_20px.png deleted file mode 100644 index b1415c2..0000000 Binary files a/assets/icon/ncc_20px.png and /dev/null differ diff --git a/assets/icon/ncc_24px.png b/assets/icon/ncc_24px.png deleted file mode 100644 index 955ee5c..0000000 Binary files a/assets/icon/ncc_24px.png and /dev/null differ diff --git a/assets/icon/ncc_256px.png b/assets/icon/ncc_256px.png deleted file mode 100644 index f47e394..0000000 Binary files a/assets/icon/ncc_256px.png and /dev/null differ diff --git a/assets/icon/ncc_32px.png b/assets/icon/ncc_32px.png deleted file mode 100644 index 197a68d..0000000 Binary files a/assets/icon/ncc_32px.png and /dev/null differ diff --git a/assets/icon/ncc_4096px.png b/assets/icon/ncc_4096px.png deleted file mode 100644 index 266dd20..0000000 Binary files a/assets/icon/ncc_4096px.png and /dev/null differ diff --git a/assets/icon/ncc_48px.png b/assets/icon/ncc_48px.png deleted file mode 100644 index 53ea11f..0000000 Binary files a/assets/icon/ncc_48px.png and /dev/null differ diff --git a/assets/icon/ncc_512px.png b/assets/icon/ncc_512px.png deleted file mode 100644 index 0c416ce..0000000 Binary files a/assets/icon/ncc_512px.png and /dev/null differ diff --git a/assets/icon/ncc_64px.png b/assets/icon/ncc_64px.png deleted file mode 100644 index 0a98fbe..0000000 Binary files a/assets/icon/ncc_64px.png and /dev/null differ diff --git a/src/ncc/Classes/GitClient.php b/src/ncc/Classes/GitClient.php index a8cdd68..c1ece12 100644 --- a/src/ncc/Classes/GitClient.php +++ b/src/ncc/Classes/GitClient.php @@ -84,9 +84,33 @@ namespace ncc\Classes; }); if (!$process->isSuccessful()) + { throw new GitCheckoutException($process->getErrorOutput()); + } Console::outVerbose('Checked out branch: ' . $branch); + + Console::outVerbose('Updating submodules'); + $process = new Process(["git", "submodule", "update", "--init", "--recursive"], $path); + $process->setTimeout(3600); // 1 hour + $process->run(function ($type, $buffer) + { + if (Process::ERR === $type) + { + Console::outWarning($buffer); + } + else + { + Console::outVerbose($buffer); + } + }); + + if (!$process->isSuccessful()) + { + throw new GitCheckoutException($process->getErrorOutput()); + } + + Console::outVerbose('Submodules updated'); } /**