diff --git a/.bazelversion b/.bazelversion index ee74734..91ff572 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.1.0 +5.2.0 diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index cff3ce5..24df40b 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,7 +1,7 @@ # # rules_ruby circleci Docker file. # -FROM ruby:3.0.2 +FROM ruby:3.1.2 # make Apt non-interactive RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \ @@ -92,7 +92,7 @@ RUN apt-get update && apt-get upgrade RUN apt-get install -y openjdk-11-jdk python2.7 python3 golang-go -RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.3.0/bazelisk-linux-amd64 \ +RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \ && sudo chmod +x /usr/bin/bazel RUN cd /usr/bin && ln -s python3 python diff --git a/.circleci/README.md b/.circleci/README.md new file mode 100644 index 0000000..97bfa5d --- /dev/null +++ b/.circleci/README.md @@ -0,0 +1,14 @@ +## `build.sh` + +Anytime you change the Ruby version you must push a new image to Docker Hub. + +Email kigster@gmail.com to be added to bazelruby org on hub.docker.com. + +### To Upgrade + +Change the ruby version in the `Dockerfile` and run: + +```bash +cd .circleci +./build.sh +``` diff --git a/.circleci/build.sh b/.circleci/build.sh index b775eea..9492db6 100755 --- a/.circleci/build.sh +++ b/.circleci/build.sh @@ -12,7 +12,7 @@ echo set -x -docker build . -t bazelruby/ruby-$RUBY_VERSION +docker build --platform linux/x86_64 . -t bazelruby/ruby-$RUBY_VERSION docker push bazelruby/ruby-$RUBY_VERSION diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ee0d7e..367abdd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: working_directory: /home/circleci/repo resource_class: medium docker: - - image: bazelruby/ruby-3.0.2 + - image: bazelruby/ruby-3.1.2 environment: PATH: "/usr/local/bin:/usr/bin:/sbin:/opt/bin:/home/circleci/repo/bin:/bin:/sbin:/usr/sbin" BUNDLE_PATH: /home/circleci/.bundle_cache diff --git a/.ruby-version b/.ruby-version index b502146..ef538c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.2 +3.1.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d1c3af..bc3c466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [Unreleased](https://github.com/bazelruby/rules_ruby/tree/HEAD) + +[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.6.0...HEAD) + +**Merged pull requests:** + +- Bump nokogiri from 1.13.3 to 1.13.4 in /examples/simple\_rails\_api [\#130](https://github.com/bazelruby/rules_ruby/pull/130) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump puma from 4.3.11 to 4.3.12 in /examples/simple\_rails\_api [\#126](https://github.com/bazelruby/rules_ruby/pull/126) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Add SDK versions: 2.6.9,2.7.5,3.0.3,3.1.0,3.1.0 [\#123](https://github.com/bazelruby/rules_ruby/pull/123) ([matsubara0507](https://github.com/matsubara0507)) +- Bump nokogiri from 1.12.5 to 1.13.3 in /examples/simple\_rails\_api [\#122](https://github.com/bazelruby/rules_ruby/pull/122) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump puma from 4.3.9 to 4.3.11 in /examples/simple\_rails\_api [\#121](https://github.com/bazelruby/rules_ruby/pull/121) ([dependabot[bot]](https://github.com/apps/dependabot)) + ## [v0.6.0](https://github.com/bazelruby/rules_ruby/tree/v0.6.0) (2021-11-09) [Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.5.2...v0.6.0) diff --git a/README.pdf b/README.pdf index 87bfb50..2b1a1ed 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/WORKSPACE b/WORKSPACE index e08c5ee..5926be2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,7 +12,7 @@ load("@bazel_skylib//lib:versions.bzl", "versions") versions.check("3.4.1") -rules_ruby_select_sdk("3.0.2") +rules_ruby_select_sdk("3.1.2") local_repository( name = "bazelruby_rules_ruby_ruby_tests_testdata_another_workspace", diff --git a/bin/setup b/bin/setup index c0799ca..71b8e97 100755 --- a/bin/setup +++ b/bin/setup @@ -16,6 +16,8 @@ source "bin/deps" +export ruby_version="$(cat .ruby-version | tr -d '\n')" + #————————————————————————————————————————————————————————————————————————————————————————————————————————————— # Private Functions #————————————————————————————————————————————————————————————————————————————————————————————————————————————— @@ -30,8 +32,19 @@ __setup.actions() { #————————————————————————————————————————————————————————————————————————————————————————————————————————————— setup.rbenv() { + command -v rbenv >/dev/null || { + if [[ $(uname -s) == "Darwin" ]]; then + command -v brew>/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew.install.packages rbenv ruby-build + brew.upgrade.packages rbenv ruby-build + else + setup.local-rbenv + fi + } +} + +setup.local-rbenv() { local rbenv_home="${HOME}/.rbenv" - local ruby_version="$(cat .ruby-version | tr -d '\n')" if [[ -n $(command -v ruby) ]]; then local installed_version="$(ruby -e 'puts RUBY_VERSION' | tr -d '\n')" @@ -65,9 +78,10 @@ setup.rbenv() { error "PATH: ${PATH}" return 1 } +} - # Set our current ruby version to the desired one, even if it's not yet there. - # This allows the next block to auto-detect it and skip the remainder. +setup.ruby() { + run "rbenv install -s ${ruby_version}" run "rbenv global ${ruby_version} || true" # see if we even need to install anything: local ruby_sdk_marker="$(rbenv versions | grep "${ruby_version}" | cut -d ' ' -f 1)" @@ -171,6 +185,7 @@ setup.main() { set +e h2 "Installing required development dependencies for working with rules_ruby and Bazel." setup.rbenv + setup.ruby setup.gems [[ -z ${CI} ]] && setup.git-hook setup.os-specific "$@" diff --git a/bin/setup-darwin b/bin/setup-darwin index 3327bb4..eefa38a 100755 --- a/bin/setup-darwin +++ b/bin/setup-darwin @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# vim: ft=bash # ————————————————————————————————————————————————————————————————————————————————————— # NOTE: These setup scripts rely on an open source BASH framework BashMatic. # https://github.com/kigster/bashmatic @@ -52,15 +53,14 @@ setup.xcode-tools() { info: "xcode-select tools are already installed." fi - info "Next command requires sudo privileges to accept XCode License" - run.set-next show-output-on - run "sudo xcodebuild -license accept" + info "Next command may require a sudo privileges to accept XCode License" + bin/xcode-accept } setup.bazel() { brew.package.is-installed bazelisk && - brew.uninstall.package bazelisk && - run "brew unlink bazel" + brew.uninstall.package bazelisk 1>/dev/null 2>/dev/null && + run "brew unlink bazel 2>/dev/null || true" if __setup.is-bazelisk-installed && __setup.is-bazel-installed ; then info: "Bazel & bazelisk are already installed." @@ -68,8 +68,6 @@ setup.bazel() { brew.install.packages bazel bazelisk run "brew link bazel || true" fi - - } setup.darwin() { diff --git a/bin/xcode-accept b/bin/xcode-accept new file mode 100755 index 0000000..ab05ff1 --- /dev/null +++ b/bin/xcode-accept @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# vim: ft=bash + +# https://stackoverflow.com/questions/58632629/how-to-check-if-xcode-license-needs-to-be-accepted + +XCODE_VERSION=$(xcodebuild -version | grep '^Xcode\s' | sed -E 's/^Xcode[[:space:]]+([0-9\.]+)/\1/') +ACCEPTED_LICENSE_VERSION=$(defaults read /Library/Preferences/com.apple.dt.Xcode 2> /dev/null | grep IDEXcodeVersionForAgreedToGMLicense | cut -d '"' -f 2) + +if [[ "$XCODE_VERSION" = "$ACCEPTED_LICENSE_VERSION" ]]; then + exit 0 +else + exit 1 +fi diff --git a/examples/simple_rails_api/WORKSPACE b/examples/simple_rails_api/WORKSPACE index 8585cfe..39e0004 100644 --- a/examples/simple_rails_api/WORKSPACE +++ b/examples/simple_rails_api/WORKSPACE @@ -15,7 +15,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.2") +rules_ruby_select_sdk(version = "3.1.2") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") diff --git a/examples/simple_script/.ruby-version b/examples/simple_script/.ruby-version index b502146..ef538c2 100644 --- a/examples/simple_script/.ruby-version +++ b/examples/simple_script/.ruby-version @@ -1 +1 @@ -3.0.2 +3.1.2 diff --git a/examples/simple_script/WORKSPACE b/examples/simple_script/WORKSPACE index 4ad11d1..482d59f 100644 --- a/examples/simple_script/WORKSPACE +++ b/examples/simple_script/WORKSPACE @@ -15,7 +15,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.2") +rules_ruby_select_sdk(version = "3.1.2") load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle") diff --git a/ruby/private/sdk.bzl b/ruby/private/sdk.bzl index 7123575..ab2ca50 100644 --- a/ruby/private/sdk.bzl +++ b/ruby/private/sdk.bzl @@ -28,6 +28,7 @@ def rules_ruby_select_sdk(version = "host"): "3.0.3", "3.1.0", "3.1.1", + "3.1.2", ] if version in supported_versions: diff --git a/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE b/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE index 00a3bb4..40ff57c 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE +++ b/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE @@ -13,7 +13,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.2") +rules_ruby_select_sdk(version = "3.1.2") load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle")