<commit_before>#!/bin/bash

#TeamCity Build $PROJECT script.

#######TODO : Read latest build log on TC and (probably) see that building the elasticsearch-java-client just fails outright.
########CURRENT THEORY TO TEST:
# I believe that bob is genuinely confused about the directory structure that it is being asked to build in.
# Therefore, to fully test this theory, I will rsync the Teamcity 'work/$PROJECT' directories, to /home/winterwell/$PROJECT so
# that bob can run in a more normal directory structure.   This essentially turns TeamCity into a "Git-Trigger -> Build Now" system.
# Which makes this 1 degree off of a traditional TeamCity Setup.

#GLOBAL RULES
#No matter which sub-directory has been altered, they are all inter-dependent for any and all good-loop/winterwell projects
#No matter which project, the build order must start with a new bob-all.jar creation
#Because the purpose of this script is to auto-publish, a new winterwell.webappbase.jar will have to be created, as it contains the methods for publishing.
#->winterwell.webappbase.jar needs freshly compiled elasticsearch-java-client.jar AND youagain-java-client.jar created first.




#DIRECTORY MAPS
OPEN_CODE='/home/winterwell/open-code'
ES_JAVA_CLIENT='/home/winterwell/elasticsearch-java-client'
WWAPPBASE_DIR='/home/winterwell/TeamCity/buildAgent/work/9307b27f248c307'


#########################
### Pull on Flexi-Gson
#########################
printf "\nPulling on Flexi-Gson repo\n"
cd /home/winterwell/TeamCity/buildAgent/work/80e533dc8a610115/ && \
git gc --prune=now && \
git pull origin master && \
git reset --hard FETCH_HEAD


############################
## Update the wwappbase.js repo
## because there might be a change
## to the publishing script
############################
printf "\nEnsuring that the teamcity wwappbase.js repo is up-to-date\n"
cd $WWAPPBASE_DIR && \
git gc --prune=now && \
git pull origin master && \
git reset --hard FETCH_HEAD



#RSYNC the projects on the disk to mimic a semi-traditional devbox directory structure.
## SUBTASK: Clean out the existing contents of the /home/winterwell/$PROJECT structure.
rm -rf /home/winterwell/elasticsearch-java-client/*
rm -rf /home/winterwell/flexi-gson/*
rm -rf /home/winterwell/open-code/*
rm -rf /home/winterwell/wwappbase.js/*
## NOW do the rsync
rsync -r /home/winterwell/TeamCity/buildAgent/work/ff7665b6f2ca318e/* /home/winterwell/elasticsearch-java-client/
rsync -r /home/winterwell/TeamCity/buildAgent/work/80e533dc8a610115/* /home/winterwell/flexi-gson/
rsync -r /home/winterwell/TeamCity/buildAgent/work/c7a16811424bee11/* /home/winterwell/open-code/
rsync -r /home/winterwell/TeamCity/buildAgent/work/9307b27f248c307/* /home/winterwell/wwappbase.js/




########################
### Step 00: Get existing bob-all.jar
########################
if [[ -f $OPEN_CODE/winterwell.bob/bob-all.jar ]]; then
    rm $OPEN_CODE/winterwell.bob/bob-all.jar
fi

wget -cO - 'https://www.winterwell.com/software/downloads/bob-all.jar' >> $OPEN_CODE/winterwell.bob/bob-all.jar


##########################
### QuarterStep: Build Flexi-Gson
##########################
printf "\nBuilding flexi-gson.jar\n"
cd /home/winterwell/flexi-gson
java -jar $OPEN_CODE/winterwell.bob/bob-all.jar jobs.BuildFlexiGson



#######################
### Step 01: Build a new bob-all.jar
#######################
printf "\nBuilding a new bob-all.jar\n"
cd $OPEN_CODE/winterwell.bob
java -jar bob-all.jar jobs.BuildBob<commit_msg>making rsync sync hidden files as well as regular files<commit_after>#!/bin/bash

#TeamCity Build $PROJECT script.

#######TODO : Read latest build log on TC and (probably) see that building the elasticsearch-java-client just fails outright.
########CURRENT THEORY TO TEST:
# I believe that bob is genuinely confused about the directory structure that it is being asked to build in.
# Therefore, to fully test this theory, I will rsync the Teamcity 'work/$PROJECT' directories, to /home/winterwell/$PROJECT so
# that bob can run in a more normal directory structure.   This essentially turns TeamCity into a "Git-Trigger -> Build Now" system.
# Which makes this 1 degree off of a traditional TeamCity Setup.

#GLOBAL RULES
#No matter which sub-directory has been altered, they are all inter-dependent for any and all good-loop/winterwell projects
#No matter which project, the build order must start with a new bob-all.jar creation
#Because the purpose of this script is to auto-publish, a new winterwell.webappbase.jar will have to be created, as it contains the methods for publishing.
#->winterwell.webappbase.jar needs freshly compiled elasticsearch-java-client.jar AND youagain-java-client.jar created first.




#DIRECTORY MAPS
OPEN_CODE='/home/winterwell/open-code'
ES_JAVA_CLIENT='/home/winterwell/elasticsearch-java-client'
WWAPPBASE_DIR='/home/winterwell/TeamCity/buildAgent/work/9307b27f248c307'


#########################
### Pull on Flexi-Gson
#########################
printf "\nPulling on Flexi-Gson repo\n"
cd /home/winterwell/TeamCity/buildAgent/work/80e533dc8a610115/ && \
git gc --prune=now && \
git pull origin master && \
git reset --hard FETCH_HEAD


############################
## Update the wwappbase.js repo
## because there might be a change
## to the publishing script
############################
printf "\nEnsuring that the teamcity wwappbase.js repo is up-to-date\n"
cd $WWAPPBASE_DIR && \
git gc --prune=now && \
git pull origin master && \
git reset --hard FETCH_HEAD



#RSYNC the projects on the disk to mimic a semi-traditional devbox directory structure.
## SUBTASK: Clean out the existing contents of the /home/winterwell/$PROJECT structure.
rm -rf /home/winterwell/elasticsearch-java-client/*
rm -rf /home/winterwell/flexi-gson/*
rm -rf /home/winterwell/open-code/*
rm -rf /home/winterwell/wwappbase.js/*
## NOW do the rsync
rsync -ravz /home/winterwell/TeamCity/buildAgent/work/ff7665b6f2ca318e/* /home/winterwell/elasticsearch-java-client/
rsync -ravz /home/winterwell/TeamCity/buildAgent/work/80e533dc8a610115/* /home/winterwell/flexi-gson/
rsync -ravz /home/winterwell/TeamCity/buildAgent/work/c7a16811424bee11/* /home/winterwell/open-code/
rsync -ravz /home/winterwell/TeamCity/buildAgent/work/9307b27f248c307/* /home/winterwell/wwappbase.js/




########################
### Step 00: Get existing bob-all.jar
########################
if [[ -f $OPEN_CODE/winterwell.bob/bob-all.jar ]]; then
    rm $OPEN_CODE/winterwell.bob/bob-all.jar
fi

wget -cO - 'https://www.winterwell.com/software/downloads/bob-all.jar' >> $OPEN_CODE/winterwell.bob/bob-all.jar


##########################
### QuarterStep: Build Flexi-Gson
##########################
printf "\nBuilding flexi-gson.jar\n"
cd /home/winterwell/flexi-gson
java -jar $OPEN_CODE/winterwell.bob/bob-all.jar jobs.BuildFlexiGson



#######################
### Step 01: Build a new bob-all.jar
#######################
printf "\nBuilding a new bob-all.jar\n"
cd $OPEN_CODE/winterwell.bob
java -jar bob-all.jar jobs.BuildBob
{'fraction_non_alphanumeric': 0.174598623853211, 'fraction_numerical': 0.020928899082568807, 'mean_word_length': 4.644822006472492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '1529454', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2218, 'n_words': 648}