<commit_before>DIST := CLASS
JFLAGS := -g:source,lines,vars -encoding utf8
BUILD_DIR := build
GENERATED_DIR := generated
DIST_DIR := dist
SOURCE_VERSION := 1.7
TARGET_VERSION := $(SOURCE_VERSION)
ifeq "$(JAVAC)" ""
	JAVAC := javac
endif
JAR := $(shell dirname `which $(JAVAC)`)/jar
SRC_DIRS := src/ test/
PROCESSOR_PATH := $(BUILD_DIR)/net.aeten.core

$(info Make command goals\: $(MAKECMDGOALS))

all: src test

# Sources
SRC = jcip.annotations core alert stream messenger messenger.stream parsing.properties parsing.xml parsing.yaml
src: $(SRC)
jcip.annotations:; $(COMPILE)
core: jcip.annotations; $(COMPILE)
alert: core; $(COMPILE)
stream: core; $(COMPILE)
messenger: core; $(COMPILE)
messenger.stream: messenger stream; $(COMPILE)
parsing.properties: core; $(COMPILE)
parsing.xml: core; $(COMPILE)
parsing.yaml: core; $(COMPILE)

# Tests
TEST = messenger.test parsing.test stream.test spi.test
test: $(TEST)
messenger.test: messenger.stream parsing.yaml; $(COMPILE)
parsing.test: parsing.properties parsing.xml parsing.yaml; $(COMPILE)
stream.test: stream; $(COMPILE)
spi.test: core; $(COMPILE)

.PHONY: all src test $(SRC) $(TEST)

clean:
	$(RM) -rf $(BUILD_DIR) $(DIST_DIR) $(GENERATED_DIR)


# Do not touch the following
define COMPILE
@echo Compile module $@ $(shell [ ! -z "$^" ] && echo wich depends on $(shell echo $^|sed -r 's/\s+/, /g'))

$(eval SOURCE_PATH = $(shell find $(SRC_DIRS) -maxdepth 1 -type d -name \*.$(@) | awk 'BEGIN {source=""} {if (length(source) == 0 || length($$0) < length(source)) {source=$$0}} END {print source}'))
$(eval MODULE = $(shell basename $(SOURCE_PATH)))
$(eval CLASS_PATH =)
$(foreach dependence, $^,
	$(eval DEPEPEDENCE = $(shell basename $$(find $(SRC_DIRS) -maxdepth 1 -type d -name \*.$(dependence) | awk 'BEGIN {source=""} {if (length(source) == 0 || length($$0) < length(source)) {source=$$0}} END {print source}')))
	$(eval DEPEPEDENCIES_$@ += $(BUILD_DIR)/$(DEPEPEDENCE) $(DEPEPEDENCIES_$(dependence)))
)
$(eval CLASS_PATH_OPT = $(shell if [ ! -z "$(DEPEPEDENCIES_$@)" ]; then echo -classpath $(shell echo $(DEPEPEDENCIES_$@)|sed -r 's/\s+/:/g'); fi))
$(eval BUILD_PATH = $(BUILD_DIR)/$(MODULE))
$(eval GENERATED_PATH = $(GENERATED_DIR)/$(MODULE))
-rm -rf $(GENERATED_PATH)
-mkdir --parent $(GENERATED_PATH) $(BUILD_PATH) dist
$(eval CLASSES = $(shell find $(SOURCE_PATH) -type f -name *.java))
$(eval PROCESSOR_OPT = $(shell ([ $(MODULE) = "net.aeten.core" ] || [ $(MODULE) = "net.jcip.annotations" ]) && echo -proc:none || echo -processorpath $(PROCESSOR_PATH)))
$(JAVAC) $(JFLAGS) $(CLASS_PATH_OPT) -d $(BUILD_PATH) -s $(GENERATED_PATH) -source $(SOURCE_VERSION) -target $(TARGET_VERSION) $(PROCESSOR_OPT) -sourcepath $(SOURCE_PATH) $(CLASSES)
$(foreach resource, $(shell find $(SOURCE_PATH) -type f ! -name \*.java|sed "s@$(SOURCE_PATH)/@@"),
	@-mkdir --parent $(BUILD_PATH)/`dirname $(resource)`
	cp $(SOURCE_PATH)/$(resource) $(BUILD_PATH)/`dirname $(resource)`
)
$(if ifeq($(DIST)==JAR),
	$(JAR) cf $(DIST_DIR)/$(MODULE).jar -C $(BUILD_PATH) . &
)
endef # COMPILE
<commit_msg>Prepare running tests<commit_after>DIST := CLASS
JFLAGS := -g:source,lines,vars -encoding utf8
BUILD_DIR := build
GENERATED_DIR := generated
DIST_DIR := dist
SOURCE_VERSION := 1.7
TARGET_VERSION := $(SOURCE_VERSION)
ifeq "$(JAVAC)" ""
	JAVAC := javac
endif
JAR := $(shell dirname `which $(JAVAC)`)/jar
SRC_DIRS := src/ test/
PROCESSOR_PATH := $(BUILD_DIR)/net.aeten.core

$(info Make command goals\: $(MAKECMDGOALS))

all: src test

# Sources
SRC = jcip.annotations core alert stream messenger messenger.stream parsing.properties parsing.xml parsing.yaml
src: $(SRC)
jcip.annotations:   ;                 $(COMPILE)
core:               jcip.annotations; $(COMPILE)
alert:              core;             $(COMPILE)
stream:             core;             $(COMPILE)
messenger:          core;             $(COMPILE)
messenger.stream:   messenger stream; $(COMPILE)
parsing.properties: core;             $(COMPILE)
parsing.xml:        core;             $(COMPILE)
parsing.yaml:       core;             $(COMPILE)

# Tests
TEST = messenger.test parsing.test stream.test spi.test
test: $(TEST)
messenger.test: messenger.stream parsing.yaml;               $(COMPILE) $(RUN_TEST)
parsing.test:   parsing.properties parsing.xml parsing.yaml; $(COMPILE) $(RUN_TEST)
stream.test:    stream;                                      $(COMPILE) $(RUN_TEST)
spi.test:       core;                                        $(COMPILE) $(RUN_TEST)

.PHONY: all src test $(SRC) $(TEST)

clean:
	$(RM) -rf $(BUILD_DIR) $(DIST_DIR) $(GENERATED_DIR)


# Do not touch the following
define COMPILE
@echo Compile module $@ $(shell [ ! -z "$^" ] && echo wich depends on $(shell echo $^|sed -r 's/\s+/, /g'))

$(eval SOURCE_PATH = $(shell find $(SRC_DIRS) -maxdepth 1 -type d -name \*.$(@) | awk 'BEGIN {source=""} {if (length(source) == 0 || length($$0) < length(source)) {source=$$0}} END {print source}'))
$(eval MODULE = $(shell basename $(SOURCE_PATH)))
$(eval CLASS_PATH =)
$(foreach dependence, $^,
	$(eval DEPEPEDENCE = $(shell basename $$(find $(SRC_DIRS) -maxdepth 1 -type d -name \*.$(dependence) | awk 'BEGIN {source=""} {if (length(source) == 0 || length($$0) < length(source)) {source=$$0}} END {print source}')))
	$(eval DEPEPEDENCIES_$@ += $(BUILD_DIR)/$(DEPEPEDENCE) $(DEPEPEDENCIES_$(dependence)))
)
$(eval CLASS_PATH_OPT = $(shell if [ ! -z "$(DEPEPEDENCIES_$@)" ]; then echo -classpath $(shell echo $(DEPEPEDENCIES_$@)|sed -r 's/\s+/:/g'); fi))
$(eval BUILD_PATH = $(BUILD_DIR)/$(MODULE))
$(eval GENERATED_PATH = $(GENERATED_DIR)/$(MODULE))
-rm -rf $(GENERATED_PATH)
-mkdir --parent $(GENERATED_PATH) $(BUILD_PATH) dist
$(eval CLASSES = $(shell find $(SOURCE_PATH) -type f -name *.java))
$(eval PROCESSOR_OPT = $(shell ([ $(MODULE) = "net.aeten.core" ] || [ $(MODULE) = "net.jcip.annotations" ]) && echo -proc:none || echo -processorpath $(PROCESSOR_PATH)))
$(JAVAC) $(JFLAGS) $(CLASS_PATH_OPT) -d $(BUILD_PATH) -s $(GENERATED_PATH) -source $(SOURCE_VERSION) -target $(TARGET_VERSION) $(PROCESSOR_OPT) -sourcepath $(SOURCE_PATH) $(CLASSES)
$(foreach resource, $(shell find $(SOURCE_PATH) -type f ! -name \*.java|sed "s@$(SOURCE_PATH)/@@"),
	@-mkdir --parent $(BUILD_PATH)/`dirname $(resource)`
	cp $(SOURCE_PATH)/$(resource) $(BUILD_PATH)/`dirname $(resource)`
)
$(if ifeq($(DIST)==JAR),
	$(JAR) cf $(DIST_DIR)/$(MODULE).jar -C $(BUILD_PATH) . &
)
endef # COMPILE


# TODO
define RUN_TEST
@echo Run test $@
endef
{'fraction_non_alphanumeric': 0.1951219512195122, 'fraction_numerical': 0.0034177411837812647, 'mean_word_length': 4.391959798994975, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '27508', 'n_tokens_mistral': 2320, 'n_tokens_neox': 2231, 'n_words': 587}