diff --git a/.clang-format-ignore b/.clang-format-ignore index 65c5a2b5..de02e700 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -1,4 +1,3 @@ # ignore generated files ext/api.h ext/*_arginfo.h -src/api.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66da21e..4586e223 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,12 +30,6 @@ jobs: with: submodules: recursive - - name: Install ancient PHPUnit - run: composer require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - - - name: Install dependencies - run: composer update --no-interaction - - name: Build for PHP 5.5 env: CC: clang @@ -45,6 +39,12 @@ jobs: ./configure make + - name: Install dependencies + # get path to composer.phar so we can run it with custom php.ini + run: | + COMPOSER_PHAR=$(realpath $(which composer)) + php -c php.ini $COMPOSER_PHAR update --no-interaction + php-linux-x64: runs-on: ubuntu-latest strategy: @@ -71,9 +71,6 @@ jobs: with: submodules: recursive - - name: Install dependencies - run: composer update --no-interaction - - name: Run tests env: CC: clang @@ -82,37 +79,50 @@ jobs: phpize ./configure make - make test - - - # linux-arm: - # name: ARM (${{ matrix.arch }}) - # runs-on: ubuntu-latest - # strategy: - # matrix: - # arch: [armv6, armv7, arm64] - # steps: - # - name: Build ${{ env.PACKAGE_NAME }} - # run: | - # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" - # chmod a+x builder - # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream - - # windows-vc16: - # runs-on: windows-latest - # strategy: - # matrix: - # arch: [x64] - # steps: - # - uses: ilammy/msvc-dev-cmd@v1 - # with: - # arch: ${{ matrix.arch }} - # uwp: false - # spectre: true - # - name: Build ${{ env.PACKAGE_NAME }} + consumers - # run: | - # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" - # python builder.pyz build -p ${{ env.PACKAGE_NAME }} --spec=downstream + ./dev-scripts/run_tests.sh + + # linux-arm: + # name: ARM (${{ matrix.arch }}) + # runs-on: ubuntu-latest + # strategy: + # matrix: + # arch: [armv6, armv7, arm64] + # steps: + # - name: Build ${{ env.PACKAGE_NAME }} + # run: | + # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + # chmod a+x builder + # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream + + windows-vc16: + runs-on: windows-2019 + defaults: + run: + shell: cmd # use CMD instead of powershell to catch error from bat script + strategy: + matrix: + arch: [x64] + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - id: setup-php-sdk + uses: cmb69/setup-php-sdk@v0.6 + with: + version: '8.0' + arch: ${{ matrix.arch }} + ts: ts + deps: openssl + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + toolset: ${{steps.setup-php-sdk.outputs.toolset}} + # not sure why CMD can't do multiline run statements + - run: phpize + - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl + - run: nmake + - run: nmake generate-php-ini + - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest @@ -154,3 +164,25 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + + pecl-package-test: + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Test PECL package build + run: | + python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 + tar -zxf *.tgz + cd awscrt-1.0.0 + phpize + ./configure + make diff --git a/.gitignore b/.gitignore index 7b7b8bf8..f7413f5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm # Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm @@ -182,6 +181,8 @@ fabric.properties build/ configure.in configure.ac +configure.bat +configure.js mkinstalldirs run-tests.php Makefile.global @@ -191,6 +192,7 @@ modules/ *.lo config.h config.nice +config.nice.bat *.la Makefile* !Makefile.am @@ -204,6 +206,7 @@ PHP-Parser*/ src/*.so src/*.dylib src/*.dll +/x64/ # ignoring output of package.xml as it needs to be generated from ./prepare_release.sh in each publishing package.xml diff --git a/Makefile.frag b/Makefile.frag index 3eda4bc3..a1414a76 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -27,8 +27,8 @@ CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build CMAKE_BUILD_TYPE ?= RelWithDebInfo CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install -all: extension -.PHONY: all extension +all: extension +.PHONY: all extension # configure for static aws-crt-ffi.a build/aws-crt-ffi-static/CMakeCache.txt: @@ -46,19 +46,17 @@ ext/awscrt.lo: ext/awscrt.c ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h -ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php +ext/awscrt_arginfo.h: awscrt.stub.php gen_stub.php ifeq ($(GENERATE_STUBS),1) + # install awscrt.stub.php to ext/ + cp -v awscrt.stub.php ext/awscrt.stub.php # generate awscrt_arginfo.h php gen_stub.php --minimal-arginfo ext/awscrt.stub.php endif # transform/install api.h from FFI lib -src/api.h: crt/aws-crt-ffi/src/api.h - php gen_api.php crt/aws-crt-ffi/src/api.h > src/api.h - -# install api.h to ext/ as well -ext/api.h : src/api.h - cp -v src/api.h ext/api.h +ext/api.h : crt/aws-crt-ffi/src/api.h + php gen_api.php crt/aws-crt-ffi/src/api.h > ext/api.h ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 548ea4dc..441abcde 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -1,6 +1,5 @@ CMAKE=cmake.exe -COMPOSER_PHAR=C:\ProgramData\ComposerSetup\bin\composer.phar PHP_BINARY=$(PHP_PREFIX)\php.exe CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) @@ -22,14 +21,11 @@ $(BUILD_DIR)\php_awscrt.dll: $(AWSCRT_DIR)\ext\awscrt.c $(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR)\ext\api.h $(AWSCRT_DIR)\ext\awscrt_arginfo.h # transform\install api.h from FFI lib -$(AWSCRT_DIR)\src\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h - php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\src\api.h - -# install api.h to ext/ as well -$(AWSCRT_DIR)\ext\api.h : $(AWSCRT_DIR)\src\api.h - copy $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h - -# Use PHPUnit to run tests -test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll - $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) update - $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) run test-win +$(AWSCRT_DIR)\ext\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h + php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\ext\api.h + +# Get the dll directory to load +generate-php-ini: + @echo extension=$(BUILD_DIR)\php_awscrt.dll > php-win.ini + @echo extension=$(PHP_PREFIX)\ext\php_openssl.dll >> php-win.ini + @echo extension=$(PHP_PREFIX)\ext\php_mbstring.dll >> php-win.ini diff --git a/ext/awscrt.stub.php b/awscrt.stub.php similarity index 100% rename from ext/awscrt.stub.php rename to awscrt.stub.php diff --git a/builder.json b/builder.json index 2c6f0be8..ec45884b 100644 --- a/builder.json +++ b/builder.json @@ -32,6 +32,6 @@ "NO_INTERACTION": "1" }, "test_steps": [ - ["./run_tests"] + ["./dev-scripts/run_tests.sh"] ] } diff --git a/composer.json b/composer.json index 72944466..95127dd6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "config": { - "platform": {"php": "5.6"} + "platform": {"php": "7.4"} }, "minimum-stability": "alpha", "require": { @@ -26,9 +26,9 @@ ] }, "scripts": { - "test": "./run_tests", + "test": "./dev-scripts/run_tests", "test-extension": "@test", - "test-win": "run_tests" + "test-win": ".\\dev-scripts\\run_tests.bat" }, "license": "Apache-2.0" } diff --git a/dev-scripts/cleanup_build.py b/dev-scripts/cleanup_build.py new file mode 100644 index 00000000..6df535c9 --- /dev/null +++ b/dev-scripts/cleanup_build.py @@ -0,0 +1,59 @@ +import os +import glob +import shutil + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + +# Remove specified directories +DIRS_TO_REMOVE = [ + '.deps', + '.libs', + 'build', + 'include', + 'modules', + 'vendor', + 'autom4te.cache'] + +# Remove specified files +FILES_TO_REMOVE = [ + 'Makefile', + 'Makefile.fragments', + 'Makefile.global', + 'Makefile.objects', + 'config.guess', + 'config.h', + 'config.h.in', + 'config.log', + 'config.nice', + 'config.status', + 'config.sub', + 'configure', + 'configure.in', + 'configure.ac', + 'install-sh', + 'libtool', + 'ltmain.sh', + 'missing', + 'mkinstalldirs', + 'run-tests.php', + 'awscrt.la', + 'composer.lock', + 'ext/awscrt.stub.php', + 'acinclude.m4', + 'aclocal.m4', + '**/*.lo', + '**/*.o', + '**/*.la', + '**/*.a', + '*.tgz'] + +os.chdir(WORK_DIR) + + +for directory in DIRS_TO_REMOVE: + shutil.rmtree(directory, ignore_errors=True) + +for pattern in FILES_TO_REMOVE: + for filepath in glob.glob(pattern): + os.remove(filepath) diff --git a/package.xml-template_post b/dev-scripts/package.xml-template_post similarity index 100% rename from package.xml-template_post rename to dev-scripts/package.xml-template_post diff --git a/package.xml-template_pre b/dev-scripts/package.xml-template_pre similarity index 100% rename from package.xml-template_pre rename to dev-scripts/package.xml-template_pre diff --git a/dev-scripts/prepare_pecl_package_xml.py b/dev-scripts/prepare_pecl_package_xml.py new file mode 100644 index 00000000..3acbf586 --- /dev/null +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +import argparse +import os +import re +from datetime import datetime + +parser = argparse.ArgumentParser( + description="Generate package.xml file for a release bundle.") +parser.add_argument("--name", help="Name of the package", required=True) +parser.add_argument( + "--user", help="Username of the package maintainer", required=True) +parser.add_argument( + "--email", help="Email address of the package maintainer", default='aws-sdk-common-runtime@amazon.com') +parser.add_argument( + "--version", help="Version number of the package", required=True) +parser.add_argument( + "--notes", help="Release notes for the package", default='New release') +args = parser.parse_args() + + +name = args.name +user = args.user +email = args.email +version = args.version +notes = args.notes + + +tools_dir = os.path.dirname(os.path.abspath(__file__)) +work_dir = os.path.join(tools_dir, '..') + +os.chdir(work_dir) + +today = datetime.utcnow().strftime("%Y-%m-%d") + +source_ext = "(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)" +doc_ext = "(md|json|html|dot|graphml|png|gn|sha1|css|rst)" + +special_docs = "(LICENSE.*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README.*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)" +special_tests = "(ci-test.sh|format-check.sh|run_tests.*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)" +special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)" +skip_files = "(package.xml.*|prepare_release.sh|codereview.settings|.*\\.o|.*\\.a|.*\\.obj|.*\\.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|.*\\.pdf|.*\\.svg|.*\\.docx|cbmc-proof.txt|codecov.*|litani.*|.*\\.toml|module\\.modulemap|cleanup.sh|^\..*)" + + +special_scripts = "(awscrt.stub.php)" + +skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|^\..*)" + +output_file_name = os.path.join(work_dir, 'package.xml') + + +def process_file(file_name, f): + if re.match(skip_files, file_name): + # This file is not part of the release bundle + return + f.write(f'\n') + + +def process_dir(dir_name, f): + if re.match(skip_directories, dir_name): + return + + f.write(f'\n') + os.chdir(dir_name) + for file_name in os.listdir(): + if os.path.isfile(file_name): + process_file(file_name, f) + else: + process_dir(file_name, f) + + # Special cases for compiler features placed in tests directories in and s2n + if dir_name == 's2n' and os.path.isdir('tests'): + f.write('') + f.write('') + os.chdir('tests/features') + for a in os.listdir(): + process_file(a, f) + os.chdir('../..') + f.write('') + f.write('') + + f.write('') + os.chdir('..') + + +# Main code +with open(os.path.join(tools_dir, "package.xml-template_pre"), 'r') as f: + template_pre = f.read() + +template_pre = re.sub(r"{{{NAME}}}", name, template_pre) +template_pre = re.sub(r"{{{USER}}}", user, template_pre) +template_pre = re.sub(r"{{{EMAIL}}}", email, template_pre) +template_pre = re.sub(r"{{{TODAY}}}", today, template_pre) +template_pre = re.sub(r"{{{VERSION}}}", version, template_pre) +template_pre = re.sub(r"{{{NOTES}}}", notes, template_pre) + +with open(output_file_name, "w") as f: + f.write(template_pre) + f.write('\n') + +with open(output_file_name, "a") as f: + for file_name in os.listdir(): + if file_name == 'tests': + f.write('\n') + for test_file in os.listdir('tests'): + f.write( + f'\n') + f.write('\n') + continue + + if file_name == 'src': + # skip the src directory as it is not part of the native extension + continue + + if os.path.isfile(file_name): + process_file(file_name, f) + else: + process_dir(file_name, f) + +with open(output_file_name, "a") as f: + f.write('\n') + with open(os.path.join(tools_dir, "package.xml-template_post"), 'r') as template: + f.write(template.read()) diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py new file mode 100644 index 00000000..fd4874b0 --- /dev/null +++ b/dev-scripts/prepare_pecl_release.py @@ -0,0 +1,58 @@ +import argparse +import os +import subprocess +import xml.dom.minidom +import sys + + +parser = argparse.ArgumentParser(description='PECL Package generator') +parser.add_argument("--name", help="Name of the package", required=True) +parser.add_argument( + "--user", help="Username of the package maintainer", required=True) +parser.add_argument( + "--email", help="Email address of the package maintainer", default='aws-sdk-common-runtime@amazon.com') +parser.add_argument( + "--version", help="Version number of the package", required=True) +parser.add_argument( + "--notes", help="Release notes for the package", default='New release') +args = parser.parse_args() + +PACKAGE = 'awscrt' +NAME = args.name +USER = args.user +EMAIL = args.email +VERSION = args.version +NOTES = args.notes + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + + +def run(args): + print(f"$ {subprocess.list2cmdline(args)}") + subprocess.check_call(args) + + +run(['python3', f'{TOOLS_DIR}/cleanup_build.py']) + +os.chdir(WORK_DIR) + +run(['git', 'submodule', 'update', '--init', '--recursive']) + +try: + run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER, + '--email', EMAIL, '--version', VERSION, '--notes', NOTES]) +except subprocess.CalledProcessError as e: + sys.exit(f'ERROR PROCESSING review package.xml: {e}') + +with open('package.xml', 'r') as f: + package_xml = f.read() +doc = xml.dom.minidom.parse('package.xml') +doc.encoding = 'UTF-8' +xml_str = doc.toprettyxml(indent=' ', newl='') +with open('package.xml', 'w') as f: + f.write(xml_str) +run(['pear', 'package-validate']) +run(['pear', 'package']) + +print(f'Size of {PACKAGE}-{VERSION}.tgz: {os.path.getsize(f"{PACKAGE}-{VERSION}.tgz") / 1024 / 1024:.2f} MB') diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat new file mode 100644 index 00000000..a071c24c --- /dev/null +++ b/dev-scripts/run_tests.bat @@ -0,0 +1,31 @@ +@echo on +setlocal + + +set "PHP_BINARY=php" + +if not "%~1"=="" ( + set "PHP_BINARY=%~1" +) + +set "script_dir=%~dp0" +set "work_dir=%script_dir%/.." +cd %work_dir% + +set vendor_path=vendor +REM Run command to get composer_dir +set "composer_dir=" +for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" + +if not exist "%vendor_path%" ( + REM Check if composer_dir was found + if "%composer_dir%"=="" ( + echo No composer found. + exit /b 1 + ) + call %PHP_BINARY% -c php-win.ini %composer_dir% update +) + +call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug + +endlocal diff --git a/run_tests b/dev-scripts/run_tests.sh similarity index 58% rename from run_tests rename to dev-scripts/run_tests.sh index 18b449ae..848840cf 100755 --- a/run_tests +++ b/dev-scripts/run_tests.sh @@ -2,6 +2,12 @@ set -ex +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" + launcher= if command -v catchsegv; then launcher=catchsegv @@ -12,7 +18,8 @@ if [ -z $PHP_BINARY ]; then fi if [ ! -d vendor ]; then - composer update + COMPOSER_BINARY=$(which composer) + $PHP_BINARY -c php.ini $COMPOSER_BINARY update fi $launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug diff --git a/ext/.gitignore b/ext/.gitignore index 2973c979..1f0fc8df 100644 --- a/ext/.gitignore +++ b/ext/.gitignore @@ -1,2 +1,3 @@ *.so api.h +awscrt.stub.php diff --git a/php-win.ini b/php-win.ini index c6d7db8e..a1bdb788 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,2 +1,3 @@ extension=php_awscrt.dll extension=php_openssl.dll +extension=php_mbstring.dll diff --git a/prepare_package_xml.sh b/prepare_package_xml.sh deleted file mode 100755 index 9e775822..00000000 --- a/prepare_package_xml.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/zsh -zparseopts -A opts -name: -user: -email: -version: -notes: -if [[ $# -lt 10 ]] -then - echo "Usage ${0} --name NAME, --user USER --email EMAIL --version VERSION --notes NOTES" - exit 1 -fi -NAME="${opts[--name]}" -USER="${opts[--user]}" -EMAIL="${opts[--email]}" -VERSION="${opts[--version]}" -NOTES="${opts[--notes]}" - -TODAY=$(date -u +%Y-%m-%d) - -cat package.xml-template_pre \ - | sed "s/{{{NAME}}}/$NAME/g" \ - | sed "s/{{{USER}}}/$USER/g" \ - | sed "s/{{{EMAIL}}}/$EMAIL/g" \ - | sed "s/{{{TODAY}}}/$TODAY/g" \ - | sed "s/{{{VERSION}}}/$VERSION/g" \ - | sed "s/{{{NOTES}}}/$NOTES/g" - -source_ext='(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)' -doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)' - -special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config)' -special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)' -special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)' -skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml)' - -special_scripts='(awscrt.stub.php)' - -skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys)' - -process_file() { - if (( $# == 0 )) - then - echo "ERROR: filename not passed" - exit 1 - fi - if [[ $1 = $~skip_files ]] - then - # This file is not part of the release bundle - return 0 - fi - - echo -n '' - return 0 -} - - -process_dir() { - if (( $# == 0 )) - then - echo "WARNING: dirname not passed" - exit 1 - fi - if [[ "${1}" = $~skip_directories ]] - then - return 0 - fi - echo '' - cd "$1" - for a in * - do - if [[ -f ${a} ]] - then process_file "${a}" - else process_dir "${a}" - fi - done - # Special cases for compiler features placed in tests directories in and s2n - if [[ "${1}" = "s2n" && -d tests ]] - then - echo '' - echo '' - cd tests/features - for a in * - do - process_file "${a}" - done - cd ../.. - echo '' - echo '' - fi - echo '' - cd .. - return 0 -} - -echo '' -for a in * -do - if [[ ${a} == 'tests' ]] - then - echo '' - for b in tests/* - do - echo '' - done - echo '' - continue - fi - if [[ -f ${a} ]] - then process_file "${a}" - else process_dir "${a}" - fi -done -echo '' - -cat package.xml-template_post - diff --git a/prepare_release.sh b/prepare_release.sh deleted file mode 100755 index 3a9c5f47..00000000 --- a/prepare_release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/zsh -zparseopts -A opts -name: -user: -email: -version: -notes: -if [[ $# -lt 10 ]]; then - echo "Usage ${0} --name NAME --user USER --email EMAIL --version VERSION --notes NOTES" - exit 1 -fi -PACKAGE='awscrt' -NAME="${opts[--name]}" -USER="${opts[--user]}" -EMAIL="${opts[--email]}" -VERSION="${opts[--version]}" -NOTES="${opts[--notes]}" - -./prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml -if [[ $? -ne 0 ]]; then - echo "ERROR PROCESSING review package.xml" - exit 1 -fi -tidy -xml -m -i package.xml -pear package-validate -if [[ $? -ne 0 ]]; then - echo "ERROR VALIDATING review package.xml" - exit 1 -fi -pear package -if [[ $? -ne 0 ]]; then - echo "ERROR PROCESSING review package.xml" - exit 1 -fi - -echo "Size of ${PACKAGE}-${VERSION}.tgz: " $(du -h "${PACKAGE}-${VERSION}.tgz") diff --git a/run_tests.bat b/run_tests.bat deleted file mode 100644 index d3e0886d..00000000 --- a/run_tests.bat +++ /dev/null @@ -1,4 +0,0 @@ - -@echo on - -%PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug