-
Notifications
You must be signed in to change notification settings - Fork 0
/
jira.sh
executable file
·68 lines (50 loc) · 3.5 KB
/
jira.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
HELP_TEXT="This is a shortcut script to run *everything* you need related to the Jira plugin.
Arguments:
- run compile the common module, the Jira plugin, and start up Jira for development
- pack compile the Jira plugin ('pack' is skipped if 'run' is passed)
- common compile common module
- compat compile Jira 8 and JSD compatibility modules
- clean clear compiled files, except Jira home directory ('clean' is skipped if 'purge' is passed)
- purge clear all compiled files, including Jira home directory with database and everything
- deps clean the plugin's embedded dependencies, forcing them to be rebuild in the next compilation
(use when strange errors about missing classes occur - IntelliJ removes some files when rebuilding)
- ngrok with ngrok and Jira running, it updates Jira base URL with the current ngrok HTTPS URL
You pass any combination of arguments in any order. Calling the script without arguments defaults to: 'common jira'
Examples:
./jira.sh run -> compiles the Jira plugin and starts up Jira for development
./jira.sh -> compiles the common module and the Jira plugin; good for quick reloading
./jira.sh common pack -> same as above
./jira.sh clean run -> cleans all compiled files but the Jira home directory, compiles everything, and runs Jira in development mode
"
# check java 8
javaVersion=`java -version 2>&1 | head -n 1 | cut -d\" -f 2`
javaCompilerVersion=`javac -version 2>&1 | head -n 1 | cut -d\" -f 2`
[[ "$javaVersion" != "1.8."* || "$javaCompilerVersion" != *"1.8."* ]] && echo "Java 8 expected" && exit 1
# compute parameters
purge=$([[ "$*" == *"purge"* ]] && echo "yes" || echo "no")
clean=$([[ "$*" == *"clean"* ]] && ([[ "$purge" == "yes" ]] && echo "skip" || echo "yes") || echo "no")
empty=$([[ "$*" == "" ]] && echo "yes" || echo "no")
run=$([[ "$*" == *"run"* ]] && echo "yes" || echo "no")
pack=$([[ "$*" == *"pack"* || "$empty" == "yes" ]] && ([[ "$run" == "yes" ]] && echo "skip" || echo "yes") || echo "no") # enabled by default, skips if "run" is passed
common=$([[ "$*" == *"common"* || "$empty" == "yes" || "$run" == "yes" ]] && echo "yes" || echo "no") # enabled by default or when run is passed
compat=$([[ "$*" == *"compat"* ]] && echo "yes" || echo "no")
deps=$([[ "$*" == *"deps"* ]] && echo "yes" || echo "no") # it cleans dependencies when building the plugin
ngrok=$([[ "$*" == *"ngrok"* ]] && echo "yes" || echo "no") # update jira with ngrok url
help=$([[ "$*" == *"help"* ]] && echo "yes" || echo "no")
# display plan
[[ "$help" != "yes" ]] && echo "==== Build ==> clean: $clean, purge: $purge, common: $common, refresh dependencies: $deps, pack: $pack, run jira: $run, ngrok: $ngrok , compat: $compat ===="
export PLUGIN="jira-slack-server-integration/jira-slack-server-integration-plugin"
# do tasks
(
cd "$( dirname "${BASH_SOURCE[0]}")" ;
[[ "$help" == "yes" ]] && echo "${HELP_TEXT}" ;
([[ "$clean" != "yes" ]] || atlas-mvn clean) && \
([[ "$purge" != "yes" ]] || (rm -rf ${PLUGIN}/target && atlas-mvn clean)) && \
([[ "$common" != "yes" ]] || ./bin/pack-common.sh) && \
([[ "$compat" != "yes" ]] || ./bin/pack-compat-jira.sh) && \
([[ "$deps" != "yes" ]] || (rm -f ${PLUGIN}/target/dependency-maven-plugin-markers/*.marker && rm -rf ${PLUGIN}/target/classes)) && \
([[ "$pack" != "yes" ]] || ./bin/pack-plugin.sh) && \
([[ "$run" != "yes" ]] || ./bin/run-jira.sh) && \
([[ "$ngrok" != "yes" ]] || bin/set-jira-ngrok-baseurl.sh)
)