<commit_before># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Determine version number from README (will include "-UNRELEASED")
VERSION := $(shell sed --expression '/^Version /!d' --expression 's/^Version //' README)

# Main directories and files
PREFIX :=
SRC_DIR := ${PREFIX}src
TESTS_DIR := ${PREFIX}tests
EXAMPLES_DIR := ${PREFIX}examples
FILES := ${PREFIX}CHANGELOG ${PREFIX}LICENSE ${PREFIX}NOTICE ${PREFIX}README

# Main binaries
PHPDOC := phpdoc
PHPUNIT := phpunit
GPG := gpg

# Distribution locations
DIST_DIR := ${PREFIX}sag-${VERSION}
DIST_FILE := ${DIST_DIR}.tar.gz
DIST_FILE_SIG := ${DIST_FILE}.sig

# PHPUnit related tools and files
TESTS_BOOTSTRAP := ${TESTS_DIR}/bootstrap.bsh
TESTS_PHP_INCLUDE_PATH := $(shell php -r 'echo ini_get("include_path");'):$(SRC_DIR)
TESTS_COVERAGE_DIR := ${TESTS_DIR}/coverage

TESTS_CONFIG_NATIVE_SOCKETS := ${TESTS_DIR}/phpunitConfig-nativeSockets.xml
TESTS_CONFIG_CURL := ${TESTS_DIR}/phpunitConfig-cURL.xml

TESTS_PHPUNIT_OPTS_BASE := -d "include_path=${TESTS_PHP_INCLUDE_PATH}"

TESTS_PHPUNIT_OPTS_NATIVE := ${TESTS_PHPUNIT_OPTS_BASE} --configuration=${TESTS_CONFIG_NATIVE_SOCKETS}
TESTS_PHPUNIT_OPTS_CURL := ${TESTS_PHPUNIT_OPTS_BASE} --configuration=${TESTS_CONFIG_CURL}

# PHPDocs related tools and files
DOCS_DIR := ${PREFIX}docs
PHPDOC_OPTS := -d ${SRC_DIR} -t ${DOCS_DIR} -o HTML:Smarty:PHP -dn Core -ti "Sag Documentation"

# Build the distribution
dist: clean ${DIST_DIR} check
	cp -r ${SRC_DIR} ${TESTS_DIR} ${EXAMPLES_DIR} ${FILES} ${DIST_DIR}

	tar -zcvvf ${DIST_FILE} ${DIST_DIR}
	rm -rf ${DIST_DIR}

# Run tests with native sockets
checkNative:
	@echo "Testing with native sockets..."

	${TESTS_BOOTSTRAP}
	${PHPUNIT} ${TESTS_PHPUNIT_OPTS_NATIVE} ${TESTS_DIR}

# Run tests with cURL
checkCURL:
	@echo "Testing with cURL..."

	${TESTS_BOOTSTRAP}
	${PHPUNIT} ${TESTS_PHPUNIT_OPTS_CURL} ${TESTS_DIR}

# Run the tests
check:
	for file in ${SRC_DIR}/*.php ${TESTS_DIR}/*.php; do \
	  php -l "$$file"; \
	done

	@echo ""
	$(MAKE) checkNative

	@echo ""
	$(MAKE) checkCURL

# Run the native socket tests with code coverage
checkCoverage:
	$(MAKE) check TESTS_PHPUNIT_OPTS="${TESTS_PHPUNIT_OPTS_NATIVE} --coverage-html=${TESTS_COVERAGE_DIR}"

# Generate documentation with PHPDocumentation
docs:
	rm -rf ${DOCS_DIR}
	${PHPDOC} ${PHPDOC_OPTS}

# Sign the distribution
sign: dist<commit_msg>Breaking out make targets for each adapter type more cleanly.<commit_after># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Determine version number from README (will include "-UNRELEASED")
VERSION := $(shell sed --expression '/^Version /!d' --expression 's/^Version //' README)

# Main directories and files
PREFIX :=
SRC_DIR := ${PREFIX}src
TESTS_DIR := ${PREFIX}tests
EXAMPLES_DIR := ${PREFIX}examples
FILES := ${PREFIX}CHANGELOG ${PREFIX}LICENSE ${PREFIX}NOTICE ${PREFIX}README

# Main binaries
PHPDOC := phpdoc
PHPUNIT := phpunit
GPG := gpg

# Distribution locations
DIST_DIR := ${PREFIX}sag-${VERSION}
DIST_FILE := ${DIST_DIR}.tar.gz
DIST_FILE_SIG := ${DIST_FILE}.sig

# PHPUnit related tools and files
TESTS_BOOTSTRAP := ${TESTS_DIR}/bootstrap.bsh
TESTS_PHP_INCLUDE_PATH := $(shell php -r 'echo ini_get("include_path");'):$(SRC_DIR)
TESTS_COVERAGE_DIR := ${TESTS_DIR}/coverage

TESTS_CONFIG_NATIVE_SOCKETS := ${TESTS_DIR}/phpunitConfig-nativeSockets.xml
TESTS_CONFIG_CURL := ${TESTS_DIR}/phpunitConfig-cURL.xml

TESTS_PHPUNIT_OPTS_BASE := -d "include_path=${TESTS_PHP_INCLUDE_PATH}"

TESTS_PHPUNIT_OPTS_NATIVE := ${TESTS_PHPUNIT_OPTS_BASE} --configuration=${TESTS_CONFIG_NATIVE_SOCKETS}
TESTS_PHPUNIT_OPTS_CURL := ${TESTS_PHPUNIT_OPTS_BASE} --configuration=${TESTS_CONFIG_CURL}

# PHPDocs related tools and files
DOCS_DIR := ${PREFIX}docs
PHPDOC_OPTS := -d ${SRC_DIR} -t ${DOCS_DIR} -o HTML:Smarty:PHP -dn Core -ti "Sag Documentation"

# Build the distribution
dist: clean ${DIST_DIR} check
	cp -r ${SRC_DIR} ${TESTS_DIR} ${EXAMPLES_DIR} ${FILES} ${DIST_DIR}

	tar -zcvvf ${DIST_FILE} ${DIST_DIR}
	rm -rf ${DIST_DIR}

lint:
	for file in ${SRC_DIR}/*.php ${TESTS_DIR}/*.php; do \
	  php -l "$$file"; \
	done

# Run tests with native sockets
checkNative:
	@echo "Testing with native sockets..."

	${TESTS_BOOTSTRAP}
	${PHPUNIT} ${TESTS_PHPUNIT_OPTS_NATIVE} ${TESTS_DIR}

# Run tests with cURL
checkCURL:
	@echo "Testing with cURL..."

	${TESTS_BOOTSTRAP}
	${PHPUNIT} ${TESTS_PHPUNIT_OPTS_CURL} ${TESTS_DIR}

# Run the tests
check: lint checkNative checkCURL

# Run the native socket tests with code coverage
checkCoverage:
	$(MAKE) check TESTS_PHPUNIT_OPTS="${TESTS_PHPUNIT_OPTS_NATIVE} --coverage-html=${TESTS_COVERAGE_DIR}"

# Generate documentation with PHPDocumentation
docs:
	rm -rf ${DOCS_DIR}
	${PHPDOC} ${PHPDOC_OPTS}

# Sign the distribution
sign: dist
{'fraction_non_alphanumeric': 0.12683952347582342, 'fraction_numerical': 0.001401541695865452, 'mean_word_length': 5.5771889400921655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '428462', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1961, 'n_words': 550}