Removed unused code from setup
This commit is contained in:
parent
5c1c304d30
commit
3cde052a58
159
go.mod
159
go.mod
@ -13,12 +13,12 @@ require (
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/hashicorp/yamux v0.1.1
|
||||
github.com/onsi/ginkgo/v2 v2.11.0
|
||||
github.com/onsi/ginkgo/v2 v2.12.1
|
||||
github.com/onsi/gomega v1.27.10
|
||||
github.com/pion/stun v0.6.1
|
||||
github.com/pires/go-proxyproto v0.7.0
|
||||
github.com/prometheus/client_golang v1.16.0
|
||||
github.com/quic-go/quic-go v0.37.4
|
||||
github.com/quic-go/quic-go v0.39.0
|
||||
github.com/rodaine/table v1.1.0
|
||||
github.com/samber/lo v1.38.1
|
||||
github.com/spf13/cobra v1.7.0
|
||||
@ -33,204 +33,57 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
|
||||
4d63.com/gochecknoglobals v0.2.1 // indirect
|
||||
github.com/4meepo/tagalign v1.3.2 // indirect
|
||||
github.com/Abirdcfly/dupword v0.0.12 // indirect
|
||||
github.com/Antonboom/errname v0.1.12 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.7 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
|
||||
github.com/BurntSushi/toml v1.3.2 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
|
||||
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.6.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.1 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
|
||||
github.com/breml/bidichk v0.2.7 // indirect
|
||||
github.com/breml/errchkjson v0.3.6 // indirect
|
||||
github.com/butuzov/ireturn v0.2.0 // indirect
|
||||
github.com/butuzov/mirror v1.1.0 // indirect
|
||||
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/charithe/durationcheck v0.0.10 // indirect
|
||||
github.com/chavacava/garif v0.1.0 // indirect
|
||||
github.com/curioswitch/go-reassign v0.2.0 // indirect
|
||||
github.com/daixiang0/gci v0.11.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.4.3 // indirect
|
||||
github.com/esimonov/ifshort v1.0.4 // indirect
|
||||
github.com/ettle/strcase v0.1.1 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/go-critic/go-critic v0.9.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/go-toolsmith/astcast v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astequal v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.1.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.1.0 // indirect
|
||||
github.com/go-toolsmith/typep v1.1.0 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
|
||||
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect
|
||||
github.com/golangci/golangci-lint v1.54.2 // indirect
|
||||
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
|
||||
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
|
||||
github.com/golangci/misspell v0.4.1 // indirect
|
||||
github.com/golangci/revgrep v0.5.0 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/google/pprof v0.0.0-20230912144702-c363fe2c2ed8 // indirect
|
||||
github.com/gookit/color v1.5.4 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jgautheron/goconst v1.6.0 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
|
||||
github.com/julz/importas v0.1.0 // indirect
|
||||
github.com/kisielk/errcheck v1.6.3 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
|
||||
github.com/klauspost/reedsolomon v1.9.15 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.8 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.11 // indirect
|
||||
github.com/ldez/gomoddirectives v0.2.3 // indirect
|
||||
github.com/ldez/tagliatelle v0.5.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/leonklingele/grouper v1.1.1 // indirect
|
||||
github.com/lufeee/execinquery v1.2.1 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/maratori/testableexamples v1.0.0 // indirect
|
||||
github.com/maratori/testpackage v1.1.1 // indirect
|
||||
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
|
||||
github.com/mgechev/revive v1.3.4 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moricho/tparallel v0.3.1 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nishanths/exhaustive v0.11.0 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/nunnatsa/ginkgolinter v0.13.5 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pion/dtls/v2 v2.2.7 // indirect
|
||||
github.com/pion/logging v0.2.2 // indirect
|
||||
github.com/pion/transport/v2 v2.2.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.4.5 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.44.0 // indirect
|
||||
github.com/prometheus/procfs v0.11.1 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.4.0 // indirect
|
||||
github.com/quasilyte/gogrep v0.5.0 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/quic-go/qtls-go1-20 v0.3.4 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.3.0 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.17.0 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/sivchari/containedctx v1.0.3 // indirect
|
||||
github.com/sivchari/nosnakecase v1.7.0 // indirect
|
||||
github.com/sivchari/tenv v1.7.1 // indirect
|
||||
github.com/sonatard/noctx v0.0.2 // indirect
|
||||
github.com/sourcegraph/go-diff v0.7.0 // indirect
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.16.0 // indirect
|
||||
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
|
||||
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
|
||||
github.com/stretchr/objx v0.5.1 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
|
||||
github.com/tdakkota/asciicheck v0.2.0 // indirect
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
||||
github.com/tetafro/godot v1.4.15 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
|
||||
github.com/timonwong/loggercheck v0.9.4 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
|
||||
github.com/ultraware/funlen v0.1.0 // indirect
|
||||
github.com/ultraware/whitespace v0.0.5 // indirect
|
||||
github.com/uudashr/gocognit v1.0.7 // indirect
|
||||
github.com/xen0n/gosmopolitan v1.2.2 // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.2.0 // indirect
|
||||
github.com/ykadowak/zerologlint v0.1.3 // indirect
|
||||
gitlab.com/bosi/decorder v0.4.1 // indirect
|
||||
go.tmz.dev/musttag v0.7.2 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||
go.uber.org/mock v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.13.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
golang.org/x/tools v0.13.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/tools v0.4.6 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
mvdan.cc/gofumpt v0.5.0 // indirect
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
|
||||
mvdan.cc/unparam v0.0.0-20230917202934-3ee2d22f45fb // indirect
|
||||
)
|
||||
|
||||
// TODO(fatedier): Temporary use the modified version, update to the official version after merging into the official repository.
|
||||
|
304
setup
304
setup
@ -26,174 +26,10 @@ function get_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Define global variables or load them from yaml config
|
||||
build_dir=$(get_config .build-dir "./build")
|
||||
tools=${build_dir}/tools
|
||||
specs_dir=${build_dir}/api-specs
|
||||
clients_dir=${build_dir}/clients
|
||||
|
||||
do_not_download=false
|
||||
generate_server=false
|
||||
generate_client=false
|
||||
clients_to_generate=()
|
||||
client_api_spec_urls=""
|
||||
build_binary=false
|
||||
build_image=false
|
||||
push_image=false
|
||||
|
||||
service_name=$(get_config .service-name)
|
||||
|
||||
# Docker image
|
||||
dockerhub_org=${DOCKERHUB_ORG:-tesselldev}
|
||||
docker_image_tag_versioned=${service_name}:$(get_config .docker-image-tag "v0.0.1")
|
||||
docker_image_tag_latest=${service_name}:latest
|
||||
|
||||
# Flyway docker image
|
||||
if [[ -d ${script_dir}/flyway && $(get_config .flyway-docker-image) != null && $(get_config .flyway-docker-image.name) != null ]]; then
|
||||
build_flyway_image=true
|
||||
flyway_image=${dockerhub_org}/$(get_config .flyway-docker-image.name):$(get_config .flyway-docker-image.tag "latest")
|
||||
flyway_dir=$(get_config .flyway-docker-image.dir "${script_dir}/flyway")
|
||||
fi
|
||||
|
||||
# Github url
|
||||
github_url=https://${GITHUB_TOKEN}@raw.githubusercontent.com/TessellDevelopment/tessell-api-specifications
|
||||
service_api_spec_url=${github_url}/$(get_config .service-api-spec.branch "main")/$(get_config .service-api-spec.filepath)
|
||||
common_api_spec_url=""
|
||||
if [[ -n $(get_config '. | has("common-api-spec")') ]]; then
|
||||
common_api_spec_url=${github_url}/$(get_config .common-api-spec.branch "main")/$(get_config .common-api-spec.filepath)
|
||||
fi
|
||||
|
||||
|
||||
function item_in_array () {
|
||||
local i match="${1}"
|
||||
shift
|
||||
for i; do [[ "${i}" == "${match}" ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
function download() {
|
||||
[[ $# -ge 2 ]] || { echo "Atleast two args need for function download, the 1st arg being the dest dir"; return 1; }
|
||||
mkdir -p ${1}
|
||||
pushd ${1} > /dev/null
|
||||
while [[ $# -gt 1 ]]; do shift; curl ${1} -O; done
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
function download_generator_jars() {
|
||||
for url in ${oag_cli_jar_url_client} ${oag_cli_jar_url_server} `[[ ${1:-} == client_only ]] || echo ${oag_gofiber_jar_url}` `[[ ${1:-} == server_only ]] || echo ${oag_client_jar_url}`; do
|
||||
[[ -s ${tools}/$(basename ${url}) ]] || download ${tools} ${url}
|
||||
done
|
||||
}
|
||||
|
||||
function download_common_api_spec() {
|
||||
echo "[*] Downloading common API spec."
|
||||
download ${specs_dir} ${common_api_spec_url}
|
||||
echo "[*] Completed download of common API spec."
|
||||
}
|
||||
|
||||
function generate_gofiber_boilerplate() {
|
||||
download_generator_jars server_only
|
||||
|
||||
if ! ${do_not_download}; then
|
||||
echo "[*] Downloading service API spec for generating GoFiber server boilerplate."
|
||||
download ${specs_dir} ${service_api_spec_url}
|
||||
echo "[*] Completed download of service API spec."
|
||||
download_common_api_spec
|
||||
fi
|
||||
|
||||
echo "[*] Generating GoFiber server boilerplate from OpenAPI spec."
|
||||
rm -rf ${build_dir}/server ./server
|
||||
java -cp "${tools}/${oag_gofiber_jar}:${tools}/${oag_cli_jar_for_server}" ${oag_gen_server} \
|
||||
-e pebble \
|
||||
--enable-post-process-file \
|
||||
--package-name server \
|
||||
-o ${build_dir} \
|
||||
-i ${specs_dir}/$(basename ${service_api_spec_url})
|
||||
|
||||
echo "[*] Completed GoFiber server boilerplate generation."
|
||||
|
||||
if $(get_config .create-symlinks "false"); then
|
||||
ln -sfn ${build_dir}/server ${script_dir}/server
|
||||
fi
|
||||
}
|
||||
|
||||
function add_all_clients_to_generate() {
|
||||
local filepath branch
|
||||
while read filepath branch; do
|
||||
client_api_spec_urls+="${github_url}/${branch}/${filepath/:} "
|
||||
done < <(get_config '.clients-specs | to_entries | .[].value | {.filepath: .branch // "main"}')
|
||||
while read filepath branch; do
|
||||
client_api_spec_urls+="${github_url}/${branch}/${filepath/:} "
|
||||
done < <(get_config '.clients-specs | to_entries | .[].value.deps[] | {.filepath: .branch // "main"}' | sort | uniq)
|
||||
echo ${client_api_spec_urls[@]}
|
||||
}
|
||||
|
||||
function add_client_to_generate() {
|
||||
local k=${1}
|
||||
local v=$(get_config ".client-key-map.${k} // \"\"")
|
||||
if [[ -z ${v} ]]; then
|
||||
if $(get_config ".clients-specs | has(\"${k}\")"); then
|
||||
v=${k}
|
||||
else
|
||||
echo "Unrecognized client (${k}) provided for specifying client to generate"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
clients_to_generate+=(${v})
|
||||
filepath=$(get_config ".clients-specs.${v}.filepath")
|
||||
branch=$(get_config ".clients-specs.${v}.branch // \"main\"")
|
||||
client_api_spec_urls+="${github_url}/${branch}/${filepath} "
|
||||
|
||||
while read filepath branch; do
|
||||
client_api_spec_urls+="${github_url}/${branch}/${filepath/:} "
|
||||
done < <(get_config ".clients-specs.${v}.deps[] | {.filepath: .branch // \"main\"}")
|
||||
}
|
||||
|
||||
function generate_required_api_clients() {
|
||||
download_generator_jars client_only
|
||||
|
||||
if ! ${do_not_download}; then
|
||||
if [[ ${#clients_to_generate[@]} -gt 0 ]]; then
|
||||
echo "[*] Starting download of API specs for only the following specified clients: ${clients_to_generate[@]}"
|
||||
else
|
||||
echo "[*] Starting download of API specs for all required clients."
|
||||
fi
|
||||
download ${specs_dir} ${client_api_spec_urls}
|
||||
download_common_api_spec
|
||||
echo "[*] Completed download of API specs for all required clients."
|
||||
fi
|
||||
|
||||
if [[ ${#clients_to_generate[@]} -gt 0 ]]; then
|
||||
echo "[*] Generating only the following specified clients: ${clients_to_generate[@]}"
|
||||
else
|
||||
echo "[*] Generating all required clients."
|
||||
fi
|
||||
|
||||
mkdir -p ${clients_dir}
|
||||
|
||||
local client filepath output_dir
|
||||
while read client filepath; do
|
||||
client=${client/:}
|
||||
[[ ${#clients_to_generate[@]} -gt 0 ]] && ! item_in_array "${client}" "${clients_to_generate[@]}" && continue || :
|
||||
output_dir=${clients_dir}/${client/:}
|
||||
rm -rf ${output_dir}
|
||||
|
||||
java -cp "${tools}/${oag_client_jar}:${tools}/${oag_cli_jar_for_client}" ${oag_gen_client} \
|
||||
-g go \
|
||||
--additional-properties isGoSubmodule=true \
|
||||
--additional-properties structPrefix=true \
|
||||
-i ${specs_dir}/$(basename ${filepath}) -o ${output_dir} --package-name ${client/:}
|
||||
|
||||
if $(get_config .create-symlinks "false"); then
|
||||
ln -sfn ${output_dir} ${script_dir}/${client/:}
|
||||
fi
|
||||
|
||||
rm -f ${output_dir}/go.*
|
||||
done < <(get_config '.clients-specs | to_entries | .[].value |= .filepath | from_entries')
|
||||
echo "[*] Completed generating all required clients."
|
||||
}
|
||||
|
||||
function go_fmt() {
|
||||
go fmt ./...
|
||||
goimports -w .
|
||||
@ -212,51 +48,23 @@ function build_bin() {
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
|
||||
golangci-lint run
|
||||
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}linux ready at ./${service_name}"
|
||||
GOOS=linux GOARCH=amd64 go build -o frpc_linux_amd64 ./cmd/frpc
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}linux ready at ./${service_name}"
|
||||
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}darwin ready at ./${service_name}"
|
||||
GOOS=darwin GOARCH=amd64 go build -o frpc_darwin_amd64 ./cmd/frpc
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}darwin ready at ./${service_name}"
|
||||
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}windows ready at ./${service_name}"
|
||||
GOOS=windows GOARCH=amd64 go build -o frpc_windows_amd64 ./cmd/frpc
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for ${service_name}windows ready at ./${service_name}"
|
||||
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for frps_linux ready at ./${service_name}"
|
||||
GOOS=linux GOARCH=amd64 go build -o frps_linux_amd64 ./cmd/frps
|
||||
echo "[*] Binary for ${service_name} ready at ./${service_name}"
|
||||
echo "[*] Binary for frps_linux ready at ./${service_name}"
|
||||
}
|
||||
|
||||
function build_docker_image() {
|
||||
echo "[*] Building docker image"
|
||||
go mod tidy
|
||||
go_fmt
|
||||
docker build -t ${docker_image_tag_versioned} --build-arg GITHUB_USER=${GITHUB_USER} --build-arg GITHUB_TOKEN=${GITHUB_TOKEN} ${no_cache:-} .
|
||||
docker tag ${docker_image_tag_versioned} ${docker_image_tag_latest}
|
||||
echo "[*] Built docker image with tag ${docker_image_tag_versioned}"
|
||||
echo "[*] Tagged docker image ${docker_image_tag_versioned} as ${docker_image_tag_latest}"
|
||||
if [[ ${dockerhub_org} == tesselldev ]]; then
|
||||
docker tag ${docker_image_tag_versioned} ${dockerhub_org}/${docker_image_tag_versioned}
|
||||
echo "[*] Tagged docker image ${docker_image_tag_versioned} as ${dockerhub_org}/${docker_image_tag_versioned}"
|
||||
fi
|
||||
if ${build_flyway_image:-false}; then
|
||||
cd ${flyway_dir}
|
||||
docker build --tag ${flyway_image} .
|
||||
cd - &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function push_docker_image() {
|
||||
echo "[*] Pushing docker image with tag ${dockerhub_org}/${docker_image_tag_versioned}"
|
||||
docker push ${dockerhub_org}/${docker_image_tag_versioned} && \
|
||||
echo "[*] Successfully pushed docker image" || \
|
||||
echo "[*] Failed to push docker image"
|
||||
if ${build_flyway_image:-false}; then
|
||||
docker push ${flyway_image}
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
echo "[*] Cleaning up all generated code and downloaded artifacts."
|
||||
@ -273,42 +81,9 @@ fi
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "${1}" in
|
||||
--dnd)
|
||||
do_not_download=true
|
||||
echo "[*] Received flag --dnd for 'Do not download'. Will not download any artifact."
|
||||
echo "[*] Note: Generator Jars will still be downloaded, if not present locally."
|
||||
;;
|
||||
-g|--gen|--generate)
|
||||
gen_or_build=true
|
||||
generate_server=true
|
||||
generate_client=true
|
||||
add_all_clients_to_generate
|
||||
;;
|
||||
-s|--server)
|
||||
gen_or_build=true
|
||||
generate_server=true
|
||||
;;
|
||||
-c|--client)
|
||||
gen_or_build=true
|
||||
generate_client=true
|
||||
if [[ -n ${2:-} && ${2} != -* ]]; then
|
||||
while [[ -n ${2:-} && ${2} != -* ]]; do
|
||||
shift
|
||||
add_client_to_generate ${1}
|
||||
done
|
||||
else
|
||||
add_all_clients_to_generate
|
||||
fi
|
||||
;;
|
||||
-b|--binary)
|
||||
build_binary=true
|
||||
;;
|
||||
-i|--di|--docker-image)
|
||||
build_image=true
|
||||
;;
|
||||
-p|--push|--push-image)
|
||||
push_image=true
|
||||
;;
|
||||
--nc|--no-cache)
|
||||
no_cache=--no-cache
|
||||
;;
|
||||
@ -326,69 +101,6 @@ while [[ $# -gt 0 ]]; do
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
|
||||
if ! ${gen_or_build:-false}; then
|
||||
if ${build_image}; then
|
||||
build_docker_image
|
||||
fi
|
||||
if ${push_image}; then
|
||||
push_docker_image
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# OpenAPI Generator GoFiber
|
||||
oag_gofiber_ver=$(get_config .openapi-generator-gofiber-version "0.1.3")
|
||||
oag_gofiber_jar=openapi-generator-gofiber-generator-${oag_gofiber_ver}.jar
|
||||
oag_gofiber_jar_url=https://${GITHUB_USER}:${GITHUB_TOKEN}@nexus.tessell.cloud/repository/tessell-repos-m2-component/
|
||||
oag_gofiber_jar_url+=org/openapi/openapi-generator-gofiber-generator/${oag_gofiber_ver}/${oag_gofiber_jar}
|
||||
|
||||
# GoCLient OpenAPI Generator
|
||||
oag_client_ver=$(get_config .openapi-generator-goclient-version "1.0.4")
|
||||
oag_client_jar=go-client-openapi-generator-${oag_client_ver}.jar
|
||||
oag_client_jar_url=https://${GITHUB_USER}:${GITHUB_TOKEN}@nexus.tessell.cloud/repository/tessell-repos-m2-development/
|
||||
oag_client_jar_url+=org/openapi/go-client-openapi-generator/${oag_client_ver}/${oag_client_jar}
|
||||
|
||||
# OpenAPI CLI Jar for Client
|
||||
oag_cli_ver_for_client=$(get_config .openapi-generator-cli-version.for-client "6.1.0")
|
||||
oag_cli_jar_for_client=openapi-generator-cli-${oag_cli_ver_for_client}.jar
|
||||
oag_cli_jar_url_client=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${oag_cli_ver_for_client}/${oag_cli_jar_for_client}
|
||||
|
||||
# OpenAPI CLI Jar for Server
|
||||
oag_cli_ver_for_server=$(get_config .openapi-generator-cli-version.for-server "5.4.0")
|
||||
oag_cli_jar_for_server=openapi-generator-cli-${oag_cli_ver_for_server}.jar
|
||||
oag_cli_jar_url_server=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${oag_cli_ver_for_server}/${oag_cli_jar_for_server}
|
||||
|
||||
# OpenAPI generate cmd base
|
||||
oag_gen_server="org.openapitools.codegen.OpenAPIGenerator generate -ggo-fiber --global-property skipFormModel=false --additional-properties enumClassPrefix=true"
|
||||
oag_gen_client="org.openapitools.codegen.OpenAPIGenerator generate --global-property skipFormModel=false --additional-properties enumClassPrefix=true"
|
||||
|
||||
if ${build_binary}; then
|
||||
build_bin
|
||||
fi
|
||||
|
||||
if ${generate_server}; then
|
||||
generate_gofiber_boilerplate
|
||||
fi
|
||||
|
||||
if ${generate_client} && [[ $(get_config .clients-specs) != null ]]; then
|
||||
generate_required_api_clients
|
||||
fi
|
||||
|
||||
if ${gen_or_build:-false}; then
|
||||
patch_files=$(get_config .build-patch[])
|
||||
for patch_file in ${patch_files:-}; do
|
||||
cp build-patch/${patch_file}-patch build/${patch_file}
|
||||
done
|
||||
|
||||
go_fmt
|
||||
fi
|
||||
|
||||
if ${build_image}; then
|
||||
build_docker_image
|
||||
fi
|
||||
|
||||
if ${push_image}; then
|
||||
push_docker_image
|
||||
fi
|
Loading…
Reference in New Issue
Block a user