diff --git a/scripts/shell/job/gp/explode-java-files.sh b/scripts/shell/job/gp/explode-java-files.sh index 3931dca..c18b9a7 100755 --- a/scripts/shell/job/gp/explode-java-files.sh +++ b/scripts/shell/job/gp/explode-java-files.sh @@ -42,10 +42,6 @@ else files=(`find * -maxdepth 0 -type f -regextype sed -regex $regex_search`) fi -if ! $revert; then - echo "[INFO] Exploding files" -fi - for f in ${files[@]}; do if [ ! -f "$f" ]; then continue @@ -64,8 +60,6 @@ for f in ${files[@]}; do # for removal of files after else f=$file_without_old_suffix else - echo " `basename $f`" - mv $f $f.old unzip -qq -d $f $f.old touch $f.dodeploy diff --git a/scripts/shell/job/gp/install-gp.sh b/scripts/shell/job/gp/install-gp.sh index a1aa0c9..fee02fb 100755 --- a/scripts/shell/job/gp/install-gp.sh +++ b/scripts/shell/job/gp/install-gp.sh @@ -258,6 +258,7 @@ $msgs_package_dir/geoserverConfigurator/bin/setup.sh unzip -qq -d $wildfly15_folder/standalone server/installation/deployments/mapserver/mapserver-geoserver-data_dir.zip +# TODO, quebra aqui unzip -qq -d $wildfly15_folder/standalone/data_dir/www/map $msgs_map_filename sed -i 's/8788/8789/g' $wildfly15_folder/bin/runstandalone.sh diff --git a/scripts/shell/job/gp/team-pipeline-local.sh b/scripts/shell/job/gp/team-pipeline-local.sh index 73cc39e..53da964 100755 --- a/scripts/shell/job/gp/team-pipeline-local.sh +++ b/scripts/shell/job/gp/team-pipeline-local.sh @@ -15,7 +15,6 @@ show_help() { echo " --no-build | --nb (Optional) If selected, the script will NOT build the maven components in order to generate the target/ folder" echo " --use-git-status | -g (Optional) Will add the files with differences from the \"git status\" command" echo " --no-substitution | --ns (Optional) If selected, the script will NOT build the maven components in order to generate the target/ folder" - echo " --start-server | -s (Optional) Will run the server after the script finishes copying the files" } commit_hashes_arg='' @@ -26,7 +25,6 @@ file_paths_arg='' build_maven=true use_git_status=false should_substitute=true -should_start_server=false while [ "$#" -gt 0 ]; do case "$1" in @@ -39,7 +37,6 @@ while [ "$#" -gt 0 ]; do --no-build|--nb) build_maven=false; shift 2;; --use-git-status|-g) use_git_status=true; shift 2;; --no-substitution|--ns) should_substitute=false; shift 2;; - --start-server|-s) should_start_server=true; shift 2;; *) shift ;; esac done @@ -57,7 +54,9 @@ convert_csv_to_array() { commit_exists() { commit_hash=$1 - if git cat-file -t $commit_hash; then + git cat-file -t $commit_hash 1> /dev/null 2> /dev/null + + if [ $? -eq 0 ]; then return 0 else return 1 @@ -67,7 +66,9 @@ commit_exists() { get_target_paths_from_commit_hash() { commit_hash=$1 - echo `git show --oneline --name-only $c | tail -n +2` + # TODO, fazer tratativa exclusiva para diff filter com A (added) + # TODO, fazer tratativa exclusiva para diff filter com D (deleted) + echo `git show --oneline --name-only --diff-filter=MA $c | tail -n +2` } find_pom_xml_file_recursively() { @@ -88,13 +89,6 @@ find_pom_xml_file_recursively() { echo $pom_path } -# don't use -arr_uniq() { - arr=$1 - - echo $(for i in "${arr[@]}"; do echo $i; done | sort -u) -} - build_mvn() { build_cur=`pwd` @@ -216,6 +210,7 @@ if [ ! -d "$scripts_folder" ]; then fi cur=`pwd` +wildfly_files_suffix_regex='-[0-9].*\.[jew]ar' target_paths=() @@ -250,6 +245,8 @@ if [ ! -z "$commits_between_arg" ]; then done fi +exit 0 + if [ ! -z "$file_paths_arg" ]; then file_paths=`convert_csv_to_array "$file_paths_arg"` @@ -277,6 +274,11 @@ target_paths_uniq=$(for i in "${target_paths[@]}"; do echo $i; done | sort -u) dot_java_files=() pom_paths=() +# TODO, add support for html, js and Messages_*.properties files +# html_files=() +# js_files=() +# msg_files=() + for i in ${target_paths_uniq[@]}; do if [[ $i == *.java ]]; then dot_java_files+=("$i") @@ -303,8 +305,9 @@ for p in ${sorted_pom_paths_uniq[@]}; do [ $build_maven == true ] && build_mvn done -non_root_deployments_files_to_explode=() -non_root_deployments_files_to_explode_full_path=() +# alternative for artifactId search +# non_root_deployments_files_to_explode=() +# non_root_deployments_files_to_explode_full_path=() artifact_ids_to_explode=() for p in ${sorted_pom_paths_uniq[@]}; do @@ -319,71 +322,65 @@ for p in ${sorted_pom_paths_uniq[@]}; do build_mvn fi - cd $pom_dir/target - non_root_deployments_files_to_explode=`find * -maxdepth 0 -type f -regextype sed -regex ".*[jew]ar" ! -name '*-client.jar' ! -name '*-sources.jar'` + # cd $pom_dir/target + # non_root_deployments_files_to_explode+=(`find * -maxdepth 0 -type f -regextype sed -regex ".*[jew]ar" ! -name '*-client.jar' ! -name '*-sources.jar'`) +done + +echo "artifact_ids_to_explode" +for i in "${artifact_ids_to_explode[@]}"; do + echo " $i" done # adding some artifact IDs because "cpqd-application" might have a sibling called "cpqd-etics" extra_artifact_ids_to_explode=() for a in ${artifact_ids_to_explode[@]}; do - extra_artifact_ids_to_explode+=(a) - extra_artifact_ids_to_explode+=("${a/-application-/-etics-}") + extra_artifact_id="${a/-application-/-etics-}" + + # this way I don't have to create a "extra_artifact_ids_to_explode_uniq" variable + if [ "$a" != "$extra_artifact_id" ]; then + extra_artifact_ids_to_explode+=($extra_artifact_id) + fi +done + +printf "\n" + +echo "extra_artifact_ids_to_explode" +for i in "${extra_artifact_ids_to_explode[@]}"; do + echo " $i" done if $should_substitute; then cd $deployments_path - root_deployments_files_to_explode=`find * -maxdepth 0 -type f -regextype sed -regex ".*[jew]ar"` + root_deployments_files_to_explode=`find * -maxdepth 0 -type f -regex ".*$wildfly_files_suffix_regex"` if [ ! -z "$root_deployments_files_to_explode" ]; then $scripts_folder/explode-java-files.sh --files `join_by , ${root_deployments_files_to_explode}` # webdeskmapreport, etc. fi - # extra paths because "cpqd-application-renderer-api-*" was inside another non-sense path - - extra_paths_to_explode=(`find * -maxdepth 1 -type f -wholename "**/cpqd-application-admweb-web*.war"`) - if [ ! -z "$extra_paths_to_explode" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${extra_paths_to_explode}` - fi + printf "\n" - extra_paths_to_explode+=(`find * -maxdepth 1 -type f -wholename "**/cpqd-etics-admweb-web*.war"`) - if [ ! -z "$extra_paths_to_explode" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${extra_paths_to_explode}` - fi - - extra_paths_to_explode=(`find * -type f -wholename "**/cpqd-application-admweb-web*.war/**/cpqd-*-api-*.jar"`) - if [ ! -z "$extra_paths_to_explode" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${extra_paths_to_explode}` - fi - - extra_paths_to_explode=(`find * -type f -wholename "**/cpqd-etics-admweb-web*.war/**/cpqd-*-api-*.jar"`) - if [ ! -z "$extra_paths_to_explode" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${extra_paths_to_explode}` - fi - - for f in ${non_root_deployments_files_to_explode[@]}; do - f_prefix=`remove_suffix "$f"` - file_path=`find * -maxdepth 1 -type f -name "$f_prefix*.jar"` - - non_root_deployments_files_to_explode_full_path+=("$file_path") + echo "extra artifactId_paths_to_explode" + for a in ${extra_artifact_ids_to_explode[@]}; do + echo "find * -type f -regex \".*$a$wildfly_files_suffix_regex\"" + artifactId_paths_to_explode=(`find * -type f -regex ".*$a$wildfly_files_suffix_regex"`) + echo " $artifactId_paths_to_explode" + # if [ ! -z "$artifactId_paths_to_explode" ]; then + # $scripts_folder/explode-java-files.sh --files `join_by , ${artifactId_paths_to_explode}` + # fi done - if [ ! -z "$non_root_deployments_files_to_explode_full_path" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${non_root_deployments_files_to_explode_full_path}` # **/cpqd-geo-renderer-ejb, etc. - fi + printf "\n" + echo "artifactId_paths_to_explode" # exploding files by found artifactIds for a in ${artifact_ids_to_explode[@]}; do - artifactId_paths_to_explode=(`find * -type f -wholename "**/$a*"`) - if [ ! -z "$artifactId_paths_to_explode" ]; then - $scripts_folder/explode-java-files.sh --files `join_by , ${artifactId_paths_to_explode}` - fi + artifactId_paths_to_explode=(`find * -type f -regex ".*$a$wildfly_files_suffix_regex"`) + echo " $artifactId_paths_to_explode" + # if [ ! -z "$artifactId_paths_to_explode" ]; then + # $scripts_folder/explode-java-files.sh --files `join_by , ${artifactId_paths_to_explode}` + # fi done - # TODO, remover - # cd $deployments_path - # $scripts_folder/explode-java-files.sh --revert true - # exit 0 - src_path_const='src/main/java/' # TODO, add known exceptions to automatically search for alternative target paths and deployment paths @@ -396,9 +393,6 @@ if $should_substitute; then f_dirname=`dirname $f` f_basename=`basename $f` - # TODO, remover - # if [ $f_basename != "CacheGeneratorCleanupStartupBean.java" ]; then continue; fi - class_filename=`echo ${f_basename%".java"}.class` path_in_deployments=`get_substring_after_string "$f_dirname" "$src_path_const"` @@ -461,20 +455,19 @@ if $should_substitute; then else unsuccessful_copies+=($f_basename) printf "\n" - echo "Pulando cópia no mesmo diretório do arquivo vizinho..." + echo "[INFO] Pulando cópia no mesmo diretório do arquivo vizinho..." fi fi else unsuccessful_copies+=($f_basename) - printf "\n" - echo "Pulando cópia..." + echo "[INFO] Pulando cópia..." fi fi for p in ${class_file_paths_in_deployments[@]}; do if [ -z "$class_file_path_in_target" ]; then printf "\n" - echo "[WARN] O arquivo \"$f_basename\" não foi encontrado em uma pasta \"target\" fixa (\"$middle_path_subst\") do repositório. Pulando cópia..." + echo "[WARN] O arquivo \"$f_basename\" não foi encontrado em uma pasta \"target\" fixa (\"$middle_path_subst\") do repositório" echo "[ASK] Deseja tentar fazer uma busca mais abrangente?" if confirm; then @@ -498,7 +491,7 @@ if $should_substitute; then else unsuccessful_copies+=($f_basename) printf "\n" - echo "Não foi possível encontrar um caminho válido, mais abrangente, para o arquivo. Pulando cópia..." + echo "[INFO] Não foi possível encontrar um caminho válido, mais abrangente, para o arquivo. Pulando cópia..." continue fi else @@ -518,7 +511,6 @@ if $should_substitute; then cp --force $class_file_path_in_target $cp_dest if [ $? -eq 0 ]; then - printf "\n" echo "[INFO] Concluído." else printf "\n" @@ -534,13 +526,9 @@ if $should_substitute; then printf "\n" echo "[WARN] Houveram arquivos que não puderam ser atualizados. Consulte o log do script." - echo "Arquivo mal-sucedidos: $i" + echo "Arquivo mal-sucedidos" for i in ${unsuccessful_copies_uniq[@]}; do echo " $i" done fi fi - -if $should_start_server; then - "$cur/debugports-01.sh" -fi