Permalink
Browse files

Remove homebrew and bash scripts. (#905)

For v1.0, I want to simplify the publish steps. Currently, publishing
takes a lot of time because it involves several flaky steps including

- assembling fatjar (15 mb)
- upload fatjar to github
- download fatjar from github to get sha (I can't run sha against
  original local copy because it changes after uploading to github)
- automatically update homebrew script with dowload url + sha

Almost every time I publish, something in this process breaks and it
takes me 5-10 minutes to fix. After almost 70 scalafmt releases I want
to find a more sustainable release process. From now on, I want to
publish only to Maven/Bintray and use coursier as the main way to
install the cli.

So, instead of `homebrew upgrade scalafmt`, people can run the following
command on any platform (Windows, Linux or Mac)

```
sudo coursier bootstrap --standalone com.geirsson:scalafmt-cli_2.12:0.7.0-RC1 -o /usr/local/bin/scalafmt -f --main org.scalafmt.cli.Cli
```

This command builds a fatjar from maven published artifacts. A nice
side-effect is that coursier will use the existing cache to minimize
downloads. This means that if you upgrade from scalafmt 1.0 to 1.1 and
the underlying scala.meta dependency hasn't changed, you only need to
download the new scalafmt artifacts, saving several megabytes in
downloads.

Another nice benefit to coursier is that users can more easily configure
the JVM options.

I admit that that coursier command is harder to remember than `homebrew
upgrade scalafmt`.  I would like to open a discussion in
coursier/coursier about adding a simpler syntax or support for a
`coursier.conf` configuration to alias maven coordinates, etc. I believe
it will be possible to turn that long command into something like
`coursier install scalafmt` and `coursier upgrade scalafmt 0.7.0`.
  • Loading branch information...
olafurpg committed Apr 23, 2017
1 parent ba00601 commit 0cf3b79be32ed084875e167a52af31272c577570
Showing with 0 additions and 203 deletions.
  1. +0 −3 .gitmodules
  2. +0 −9 bin/issue492.sh
  3. +0 −54 bin/publish.sh
  4. +0 −2 bin/scalafmt
  5. +0 −1 bin/scalafmt.bat
  6. +0 −132 bin/scalafmt_auto
  7. +0 −1 homebrew
  8. +0 −1 scalafmt-tests/src/test/scala/org/scalafmt/FidelityTest.scala
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -4,7 +4,6 @@ set -eux
version=$1
test -n $version
tag="v${version}"
tarfile="scalafmt-cli/target/scalafmt.tar.gz"
current_branch=$(git rev-parse --abbrev-ref HEAD)
function assert-installed() {
@@ -14,9 +13,6 @@ function assert-installed() {
function assert-dependencies-are-installed() {
assert-installed sbt
assert-installed github-release
assert-installed shasum
assert-installed tar
}
function assert-preconditions() {
@@ -36,10 +32,6 @@ function confirm-release() {
fi
}
function assemble-jar() {
sbt -Dpublish.sonatype=true cli/assembly
}
function tag-create() {
git tag ${tag} -m "See changelog."
}
@@ -52,57 +44,11 @@ function maven-publish() {
}
function update-github-release() {
rm -f ${tarfile}
tar -cvzf ${tarfile} bin/scalafmt bin/scalafmt.bat bin/scalafmt_auto scalafmt-cli/target/scala-2.12/scalafmt.jar bin/configure
echo "Creating github release..."
github-release release \
--user scalameta \
--repo scalafmt \
--tag ${tag} \
--name "${tag}" \
--description "Changelog: http://scalameta.org/scalafmt/#${version}"
echo "Uploading tar..."
github-release upload \
--user scalameta \
--repo scalafmt \
--tag ${tag} \
--name "scalafmt.tar.gz" \
--file ${tarfile}
}
function update-homebrew-release() {
# Update version
brew_file="homebrew/scalafmt.rb"
sed -i '' -e "s/\(version \"\).*\"/\1${version}\"/" ${brew_file}
# Update url
tar_url=$(sed -n -e "s/ url \"\(.*\)\"/\1/p" ${brew_file})
curl -L -o target/sha.tar.gz ${tar_url}
sed -i '' -e "s/\(download\/\)[^\\]*\(\/scalafmt.tar.gz\)/\1${tag}\2/" homebrew/scalafmt.rb
# Update sha
tar_sha256=$(shasum -a 256 ${tarfile} | cut -f1 -d" ")
sed -i '' -e "s/\(sha256 \"\).*\"/\1${tar_sha256}\"/" ${brew_file}
cd homebrew
git add .
git commit -m "Update to ${tag}"
git push origin master
cd ..
git commit -am "Update homebrew submodule."
git push origin master
}
assert-preconditions
if [[ ! $1 == "-q" ]]; then
confirm-release
fi
tag-create
assemble-jar
maven-publish
update-github-release
update-homebrew-release
tag-push
echo "Released ${tag}!"
#./update-gh-pages.sh
# TODO(olafur) update-intellij-plugin
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
Submodule homebrew deleted from 5ea41b
@@ -33,7 +33,6 @@ class FidelityTest extends FunSuite with FormatAssertions {
"ConfigReader.scala",
"BuildTime.scala",
"GitCommit.scala",
"issue492.scala",
"/target/",
"/resources/",
"/gh-pages/"

0 comments on commit 0cf3b79

Please sign in to comment.