#!/bin/bash

current_path=$(dirname $(cd `dirname $0`;pwd))

mvn deploy -N -D skipTests -P local -s ~/.m2/settings-development.xml
mvn -pl service-common,service-dependencies,service-configuration,service-forest,service-cli,service-cli/service-cli-core,service-executor,service-executor/service-executor-core,utils/executor clean source:jar deploy -D skipTests -P local -s ~/.m2/settings-development.xml
mvn -pl service-api,service-check,service-cli/service-cli-runner,service-cloud-query,service-command,service-exporter,service-flink-query,service-gateway,service-info-query,service-loki-query,service-pulsar-query,service-queue,service-scheduler,service-web,service-yarn-query,service-zookeeper-query clean package spring-boot:repackage -D skipTests -s ~/.m2/settings-development.xml -P b2b12
mvn -pl service-executor/service-executor-manager,service-executor/service-executor-task,service-hudi-query,utils/sync clean package -D skipTests -s ~/.m2/settings-development.xml -P b2b12

mvn -pl service-launcher clean package -D skipTests -s ~/.m2/settings-development.xml -P b2a4
${current_path}/bin/upload-rm.sh ${current_path}/service-launcher/target/service-launcher-b2a4-1.0.0-SNAPSHOT.jar

mvn -pl service-launcher clean package -D skipTests -s ~/.m2/settings-development.xml -P b2b1
${current_path}/bin/upload-rm.sh ${current_path}/service-launcher/target/service-launcher-b2b1-1.0.0-SNAPSHOT.jar

mvn -pl service-launcher clean package -D skipTests -s ~/.m2/settings-development.xml -P b2b5
${current_path}/bin/upload-rm.sh ${current_path}/service-launcher/target/service-launcher-b2b5-1.0.0-SNAPSHOT.jar

mvn -pl service-launcher clean package -D skipTests -s ~/.m2/settings-development.xml -P b2b12
${current_path}/bin/upload-rm.sh ${current_path}/service-launcher/target/service-launcher-b2b12-1.0.0-SNAPSHOT.jar

${current_path}/bin/upload-rm.sh ${current_path}/service-api/target/service-api-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-check/target/service-check-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-cli/service-cli-runner/target/service-cli-runner-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-cloud-query/target/service-cloud-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-command/target/service-command-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-executor/service-executor-manager/target/service-executor-manager-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-executor/service-executor-task/target/service-executor-task-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-flink-query/target/service-flink-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-gateway/target/service-gateway-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-hudi-query/target/service-hudi-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-info-query/target/service-info-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-loki-query/target/service-loki-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-pulsar-query/target/service-pulsar-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-queue/target/service-queue-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-scheduler/target/service-scheduler-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-web/target/service-web-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-yarn-query/target/service-yarn-query-1.0.0-SNAPSHOT.jar
${current_path}/bin/upload-rm.sh ${current_path}/service-zookeeper-query/target/service-zookeeper-query-1.0.0-SNAPSHOT.jar
