From b2e1e1796d03fd30041d7a98bed17fe09417b11f Mon Sep 17 00:00:00 2001 From: Uli Heller Date: Sat, 27 Jun 2015 06:14:06 +0200 Subject: [PATCH 1/5] Fixed bashism 'source' --- README-bashism.md | 13 +++++++++++++ release/deploy-assembly-jar.sh | 2 +- release/make-release-war.sh | 2 +- sbt.sh | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 README-bashism.md diff --git a/README-bashism.md b/README-bashism.md new file mode 100644 index 000000000..804bf0edc --- /dev/null +++ b/README-bashism.md @@ -0,0 +1,13 @@ +Running `./sbt.sh` emits `./sbt.sh: 2: ./sbt.sh: source: not found` +==== + +This is due to the usage of `source` within the scripts. + +There are two potential fixes: + +* Change `#!/bin/sh` to `#!/bin/bash` +* Change `source` to `.` + +I'm doing the ladder one... + +* `find . -name "*.sh*|xargs -n1 sed -i "s/source /. /"` diff --git a/release/deploy-assembly-jar.sh b/release/deploy-assembly-jar.sh index a1de29b12..bcb59c93b 100755 --- a/release/deploy-assembly-jar.sh +++ b/release/deploy-assembly-jar.sh @@ -1,5 +1,5 @@ #!/bin/sh -source ../env.sh +. ../env.sh cd ../ ./sbt.sh clean assembly diff --git a/release/make-release-war.sh b/release/make-release-war.sh index 62457189f..c276cf933 100755 --- a/release/make-release-war.sh +++ b/release/make-release-war.sh @@ -1,3 +1,3 @@ #!/bin/sh -source ../env.sh +. ../env.sh ant -f build.xml all diff --git a/sbt.sh b/sbt.sh index 6119129d1..151e545b1 100755 --- a/sbt.sh +++ b/sbt.sh @@ -1,3 +1,3 @@ #!/bin/sh -source ./env.sh +. ./env.sh java -Dsbt.log.noformat=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar `dirname $0`/sbt-launch-0.13.8.jar "$@" From 33dde75ae1de51ebeb76248e94b53d1677de2b59 Mon Sep 17 00:00:00 2001 From: Uli Heller Date: Sat, 27 Jun 2015 06:31:21 +0200 Subject: [PATCH 2/5] doc change: build.xml -> release/build.xml --- doc/how_to_run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index bb14bbcfe..833321584 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -35,4 +35,4 @@ C:\gitbucket> sbt package `gitbucket_2.11-x.x.x.war` is generated into `target/scala-2.11`. -To build executable war file, run Ant at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. Please note the current build.xml works on Windows only. Replace `sbt.bat` with `sbt.sh` in build.xml if you want to run it on Linux. +To build executable war file, run `ant -f release/build.xml` at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. Please note the current build.xml works on Windows only. Replace `sbt.bat` with `sbt.sh` in release/build.xml if you want to run it on Linux. From daae9ae1e773af25f5393c79fe8c6228b04f2b69 Mon Sep 17 00:00:00 2001 From: uli-heller Date: Sat, 27 Jun 2015 06:38:33 +0200 Subject: [PATCH 3/5] Update how_to_run.md Once "bashism-source" is applied, the build runs smoothly on linux, no need to change anything... --- doc/how_to_run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index 833321584..95fe492fa 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -35,4 +35,4 @@ C:\gitbucket> sbt package `gitbucket_2.11-x.x.x.war` is generated into `target/scala-2.11`. -To build executable war file, run `ant -f release/build.xml` at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. Please note the current build.xml works on Windows only. Replace `sbt.bat` with `sbt.sh` in release/build.xml if you want to run it on Linux. +To build executable war file, run `ant -f release/build.xml` at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. From c68dd6c891020d40316c52c3e740af7d216dfe5e Mon Sep 17 00:00:00 2001 From: Uli Heller Date: Sat, 27 Jun 2015 06:53:44 +0200 Subject: [PATCH 4/5] Another change to make it work on linux - now linux and windows commands are mixed up unfortunately... --- doc/how_to_run.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index 95fe492fa..3a4961fc9 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -35,4 +35,9 @@ C:\gitbucket> sbt package `gitbucket_2.11-x.x.x.war` is generated into `target/scala-2.11`. -To build executable war file, run `ant -f release/build.xml` at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. +To build executable war file, run + +* `. ./env.sh` +* `ant -f release/build.xml all` + +at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. From bd0589576166984b815efcc40a3e551b67d60d29 Mon Sep 17 00:00:00 2001 From: Uli Heller Date: Sat, 27 Jun 2015 07:11:23 +0200 Subject: [PATCH 5/5] Make the release process work on linux --- doc/how_to_run.md | 24 ++++++++++++++++++++++-- release/make-release-war.sh | 16 ++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/how_to_run.md b/doc/how_to_run.md index 3a4961fc9..6773b3d92 100644 --- a/doc/how_to_run.md +++ b/doc/how_to_run.md @@ -16,6 +16,8 @@ for Developers -------- If you want to modify source code and confirm it, you can run GitBucket in auto reloading mode as following: +Windows: + ``` C:\gitbucket> sbt ... @@ -24,20 +26,38 @@ C:\gitbucket> sbt > ~ ;copy-resources;aux-compile ``` +Linux: + +``` +~/gitbucket$ ./sbt.sh +... +> container:start +... +> ~ ;copy-resources;aux-compile +``` + Build war file -------- To build war file, run the following command: +Windows: + ``` C:\gitbucket> sbt package ``` +Linux: + +``` +~/gitbucket$ ./sbt.sh package +``` + `gitbucket_2.11-x.x.x.war` is generated into `target/scala-2.11`. To build executable war file, run -* `. ./env.sh` -* `ant -f release/build.xml all` +* Windows: `???` +* Linux: `./release/make-release-war.sh` at the top of the source tree. It generates executable `gitbucket.war` into `target/scala-2.11`. We release this war file as release artifact. diff --git a/release/make-release-war.sh b/release/make-release-war.sh index c276cf933..b9aacecc8 100755 --- a/release/make-release-war.sh +++ b/release/make-release-war.sh @@ -1,3 +1,15 @@ #!/bin/sh -. ../env.sh -ant -f build.xml all +D="$(dirname "$0")" +D="$(cd "${D}"; pwd)" +DD="$(dirname "${D}")" +( + for f in "${DD}/env.sh" "${D}/build.xml"; do + if [ ! -s "${f}" ]; then + echo >&2 "$0: Unable to access file '${f}'" + exit 1 + fi + done + cd "${DD}" + . "${DD}/env.sh" + ant -f "${D}/build.xml" all +)