Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Merge bazel build master #9

Merged
merged 87 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
1cffc5f
Fix code for Bazel change --incompatible_no_support_tools_in_action_i…
laurentlb May 24, 2019
300b436
Specs2 filtering runner now filters test cases according to filter. (…
May 27, 2019
014101b
Add scala_doc rule (#760)
long-stripe May 31, 2019
52b036f
Update scala_doc.md
johnynek May 31, 2019
7ffc700
Explicitly convert depset to list (#761)
laurentlb May 31, 2019
73e266b
Make sure that plus-one-deps from exports of direct deps also propaga…
ittaiz Jun 6, 2019
4a1a10b
fix grpc opencensus stats integration (#762)
mackenziestarr Jun 14, 2019
24b06ee
Add Canva to the adopters list (#770)
Jun 16, 2019
dc5a793
Depset is not iterable (#773)
ianoc-stripe Jun 19, 2019
a1c3b58
Specify which version of bazel is required. (#772)
Parth Jun 19, 2019
69d3c5b
Specs2 filtering of JUnit descriptions (#766)
Jun 20, 2019
8092d5f
Update "Getting started" WORKSPACE block (#778)
tenorviol Jun 30, 2019
3404be0
Migrate from java_common.create_provider to JavaInfo() (#781)
iirina Jul 12, 2019
86c392d
Passing source-jar into JavaInfo (#783)
ittaiz Jul 13, 2019
0b6cff3
remove usage of attr scala with JavaInfo outputs (#784)
ittaiz Jul 14, 2019
e1f6697
Port bazelbuild/bazel#8196 : improve java_stub_template MANIFEST.MF c…
joshrosen-stripe Jul 15, 2019
ce42208
JavaInfo provider should be given for deps (#774)
long-stripe Jul 17, 2019
d9c6da6
remove print warning if dep has no JavaInfo since it's required now (…
long-stripe Jul 18, 2019
e4d55ed
Handle FileAlreadyExistsException in ScalaPBGenerator (#789)
ptarjan Jul 18, 2019
62e5d87
Exclude jmh from reproducibility test, since the code generator is no…
benjaminp Jul 19, 2019
4a8e476
warn if jvm_flags is used in scala_library (#795)
ittaiz Jul 22, 2019
b3a75fd
Allow for code coverage to be run on 0.27.1 (#780)
d-haxton Jul 24, 2019
5db90f9
Replace jar_sha256 with artifact_sha256. (#792)
benjaminp Jul 25, 2019
c8bde22
Simplify _jacoco_offline_instrument. (#790)
benjaminp Jul 25, 2019
acac888
silence tut (#799)
ptarjan Jul 26, 2019
697e5f3
Due to limitations in the toolchains implementation this is required …
ianoc-stripe Jul 30, 2019
17892bf
Add scalac_jvm_flags option to toolchain (#803)
beala-stripe Aug 5, 2019
ca655e5
Add `scala_test_jvm_flags` to toolchain (#804)
beala-stripe Aug 6, 2019
c3315bf
Remove the deprecated attribute proto_source_root. (#793)
lberki Aug 7, 2019
ff41ec6
update README.md
johnynek Aug 7, 2019
96176ae
Fix a regression that breaks scalapb when jvm_flags are set on the to…
beala-stripe Aug 8, 2019
aa4f8ae
Migrate from old-style .java provider to JavaInfo. (#807)
iirina Aug 12, 2019
b30f2cb
Flip these around to be correct (#810)
ianoc-stripe Aug 12, 2019
7fd142c
Clean up jmh rule a bit (#811)
johnynek Aug 12, 2019
8a5ca6b
Move scala_repositories macro out to its own file + move scala_doc.bz…
long-stripe Aug 13, 2019
3fe7dee
Pin Bazel versions (#812)
andyscott Aug 15, 2019
98dd05e
Move scala_binary to its own file (#813)
long-stripe Aug 16, 2019
c314c45
Delurk Powershell for a more unified test setup (#814)
andyscott Aug 17, 2019
c6571f2
Add a basic PR template (#817)
andyscott Aug 18, 2019
082ebe8
Move scala_test/scala_test_suite to their own file (#815)
long-stripe Aug 18, 2019
516a2bf
move scala_repl rule to its own file (#820)
long-stripe Aug 19, 2019
b4dad94
remove long-deprecated 'suites' attr in scala_test (#819)
long-stripe Aug 19, 2019
247fce9
move scala_junit_test rule to its own file (#822)
long-stripe Aug 19, 2019
93433cf
rename proto rule while maintaining backwards compat (#821)
andyscott Aug 19, 2019
0d8b2d7
Disable windows CI (#823)
johnynek Aug 20, 2019
0328df3
Move library rules (#827)
long-stripe Aug 21, 2019
1e25872
Buildifier as the only lint (#826)
andyscott Aug 21, 2019
f261f4c
fix an unformatted file that breaks ci (#830)
andyscott Aug 21, 2019
d04543a
use travis job pipelines (#829)
andyscott Aug 21, 2019
8426026
Default to usage of scala_proto_library instead of scalapb_proto_libr…
andyscott Aug 22, 2019
b3fc6a2
Refactor build_deployable (#832)
long-stripe Aug 23, 2019
5261499
Update README.md to include Grand Rounds (#835)
tian000 Aug 27, 2019
3edf15d
Minor fix to error message (#841)
Sep 3, 2019
f1e689c
Remove jvm_flags debug print for scala_library (#840)
long-stripe Sep 3, 2019
f4a24fe
Improve classpath manifest file construction (#842)
Sep 5, 2019
177e2ee
use java_common.merge instead of manual _collect util functions (#838)
long-stripe Sep 17, 2019
548bce9
Fix paths in --proto_path and avoid copying proto files (#850)
ignasl Sep 30, 2019
e7cce69
Split sh test (#849)
borkaehw Oct 3, 2019
63cb47f
Fix scala_library_jar_without_srcs_must_fail_on_mismatching_resource_…
borkaehw Oct 3, 2019
f985e5e
Fix test_scala_import_source_jar_should_not_be_fetched_when_env_bazel…
borkaehw Oct 4, 2019
b2273e7
Add a test build for bazel 1.0 (#861)
ianoc-stripe Oct 12, 2019
0f89c21
include Bazel 1.0.0 in compatibility table (#863)
thundergolfer-two Oct 17, 2019
26cf9b7
fix typo in codeowners github handle
ittaiz Nov 11, 2019
46a2bec
Mirror all http_archives. (#878)
philwo Nov 19, 2019
ff57530
Bump v1.0.0 compatibility test to v1.1.0 (#882)
chenrui333 Nov 22, 2019
faa89d5
Bump v1.1.0 compatibility test to v1.2.1 (#883)
chenrui333 Nov 27, 2019
ecb5639
Explicitly label bazel 0.28.1 (#885)
chenrui333 Nov 27, 2019
e568402
Bump scala 2.12 to v2.12.10 (#886)
chenrui333 Nov 28, 2019
886bc9c
Convert maven_jar to jvm_maven_import_external (#889)
jin Dec 2, 2019
7b63609
Bump Bazel to v2.0.0 (#902)
chenrui333 Dec 19, 2019
cfff088
authorship attribution for higherkindness/rules_scala design (#903)
andyscott Dec 21, 2019
937d469
Refactor rules into configurable phases (#865)
borkaehw Dec 25, 2019
5c966ee
expand locations in scalacopts (#890)
andyscott Dec 25, 2019
29db4f4
Revert "expand locations in scalacopts (#890)" (#904)
ittaiz Dec 26, 2019
313e975
expand locations in scalacptops, take 2 (#907)
andyscott Dec 27, 2019
bd0c388
Plugin expansion- Use input plugins param instead of ctx (#909)
ittaiz Dec 28, 2019
be70324
Remove phase scala provider (#913)
ittaiz Jan 14, 2020
a676633
Use https to access central.maven.org (#920)
aherrmann Jan 15, 2020
2ea8dba
remove me from codeowners
johnynek Jan 15, 2020
358ab82
Return providers array instead of legacy struct (#916)
ittaiz Jan 16, 2020
6c16cff
Move declare_executable to phase file (#919)
borkaehw Jan 16, 2020
c81d7cd
chore(docs): update WORKSPACE setup for skylib (#926)
chenrui333 Jan 16, 2020
d367bdb
scalatest final-remove redundant coverage handling (#923)
ittaiz Jan 17, 2020
2f0ce50
update bazel-toolchains version (#937)
ittaiz Jan 17, 2020
2fcb2cb
Move code from rule impls/common to phases (#930)
ittaiz Jan 17, 2020
0e6daee
Merge remote-tracking branch 'bazelbuild/master'
Jan 17, 2020
0755601
add default for fetch sources
Jan 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Description
<!-- Mandatory: A crisp one or two line description of your proposed change. -->


<!-- Optional:
A longer explanation of your proposed changes..
This includes listing any breaking changes, if there are any.
-->

### Motivation
<!-- Mandatory: A summary of why you are making this change. -->
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ hash1
hash2
.DS_store
.bazel_cache
.ijwb
105 changes: 61 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,83 @@
# trusty beta image has jdk8, gcc4.8.4
dist: trusty
dist: xenial
sudo: required
# xcode8 has jdk8
osx_image: xcode8
# Not technically required but suppresses 'Ruby' in Job status message.
language: sh

addons:
apt:
packages:
- libxml2-utils

cache:
directories:
- .bazel_cache
- ~/.bazel_binaries

os:
- linux
- osx
- windows
_linux: &linux
os: linux
_osx: &osx
os: osx
osx_image: xcode10.1
_windows:
os: windows

env:
# Linting is broken. Disable until fixed.
# See https://github.com/bazelbuild/rules_scala/pull/622
# we want to test the last release
#- V=0.16.1 TEST_SCRIPT=test_lint.sh
- V=0.23.1 TEST_SCRIPT=test_rules_scala
#- V=0.14.1 TEST_SCRIPT=test_intellij_aspect.sh
- V=0.23.1 TEST_SCRIPT=test_reproducibility
###
#
# Want to update/change bazel versions?
#
# 1. Update the bazel_version case statement in
# ./tools/bazel to include hashes for the bazel version
# you're targeting.
#
# 2. either
# - If you're updating the default bazel version, change
# default_bazel_version in ./tools/bazel.
# or
# - If you want to add an additional bazel version to the build
# matrix, set BAZEL_VERSION=<desired-version> along side
# TEST_SCRIPT below.
#
# 3. If you need to update the Windows version, adjust
# the windows specific install code below.
#
###

jobs:
include:
# Lint
- stage: test
<<: *linux
env: TEST_SCRIPT=test_lint
# Test
- <<: *linux
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=1.1.0
- <<: *linux
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=2.0.0
- <<: *linux
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=1.1.0
- <<: *linux
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=2.0.0
- <<: *osx
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=1.1.0
- <<: *osx
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=2.0.0
- <<: *osx
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=1.1.0
- <<: *osx
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=2.0.0

before_install:
- |
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
choco install jdk8 -params 'installdir=c:\\java8'
choco install bazel --version ${V}
else
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
OS=darwin
else
sudo sysctl kernel.unprivileged_userns_clone=1
sudo add-apt-repository -y ppa:openjdk-r/ppa
sudo apt-get update -q
sudo apt-get install openjdk-8-jdk -y
sudo apt-get install libxml2-utils -y
OS=linux
fi

if [[ $V =~ .*rc[0-9]+.* ]]; then
PRE_RC=$(expr "$V" : '\([0-9.]*\)rc.*')
RC_PRC=$(expr "$V" : '[0-9.]*\(rc.*\)')
URL="https://storage.googleapis.com/bazel/${PRE_RC}/${RC_PRC}/bazel-${V}-installer-${OS}-x86_64.sh"
else
URL="https://github.com/bazelbuild/bazel/releases/download/${V}/bazel-${V}-installer-${OS}-x86_64.sh"
fi
wget -O install.sh "${URL}"
chmod +x install.sh
./install.sh --user
rm -f install.sh
choco install bazel --version 0.28.0
fi
- cat .bazelrc.travis >> .bazelrc

script:
- |
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
powershell -Command 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'
powershell -File ./${TEST_SCRIPT}.ps1
else
bash ./${TEST_SCRIPT}.sh ci
export JAVA_HOME='c:\\\\java8'
export BAZEL_VERSION=host
fi
bash ./${TEST_SCRIPT}.sh ci
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Google Inc.
Dino Wernli <dinowernli@gmail.com>
Oscar Boykin <oscar.boykin@gmail.com>
John T. Sullivan <john.t.sullivan@gmail.com>
Andy Scott <andy.g.scott@gmail.com>
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @iitaiz @johnynek @dinowernil
* @ittaiz @dinowernil
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Before you start working on a larger contribution, you should get in touch
with us first. Use the issue tracker to explain your idea so we can help and
possibly guide you.

### Code organization

Core Scala rules (including their implementations) and macros go in [./scala/private/rules/](./scala/private/rules/)
and [./scala/private/macros/](./scala/private/macros/), respectively, and are re-exported for public use
in [./scala/scala.bzl](./scala/scala.bzl).

### Code reviews and other contributions.
**All submissions, including submissions by project members, require review.**
Please follow the instructions in [the contributors documentation](http://bazel.io/contributing.html).
Expand Down
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,30 @@ This project defines core build rules for [Scala](https://www.scala-lang.org/) t
* [scala_library_suite](docs/scala_library_suite.md)
* [scala_test_suite](docs/scala_test_suite.md)
* [thrift_library](docs/thrift_library.md)
* [scalapb_proto_library](docs/scalapb_proto_library.md)
* [scala_proto_library](docs/scala_proto_library.md)
* [scala_toolchain](docs/scala_toolchain.md)
* [scala_import](docs/scala_import.md)
* [scala_doc](docs/scala_doc.md)

## Getting started

In order to use these rules you must have bazel 0.23 or later and add the
following to your WORKSPACE file:
1. [Install Bazel](https://docs.bazel.build/versions/master/install.html), see the [compatibility table](#bazel-compatible-versions).
2. Add the following to your `WORKSPACE` file and update the `githash` if needed:

```python
rules_scala_version="a89d44f7ef67d93dedfc9888630f48d7723516f7" # update this as needed

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0)
skylib_version = "0.8.0"
http_archive(
name = "bazel_skylib",
type = "tar.gz",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version),
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
)

rules_scala_version="69d3c5b5d9b51537231746e93b4383384c9ebcf4" # update this as needed

http_archive(
name = "io_bazel_rules_scala",
strip_prefix = "rules_scala-%s" % rules_scala_version,
Expand All @@ -44,8 +55,8 @@ scala_register_toolchains()
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()

protobuf_version="66dc42d891a4fc8e9190c524fd67961688a37bbe"
protobuf_version_sha256="983975ab66113cbaabea4b8ec9f3a73406d89ed74db9ae75c74888e685f956f8"
protobuf_version="09745575a923640154bcf307fba8aedff47f240a"
protobuf_version_sha256="416212e14481cff8fd4849b1c1c1200a7f34808a54377e22d7447efdf54ad758"

http_archive(
name = "com_google_protobuf",
Expand All @@ -54,6 +65,7 @@ http_archive(
sha256 = protobuf_version_sha256,
)
```

This will load the `rules_scala` repository at the commit sha
`rules_scala_version` into your Bazel project and register a [Scala
toolchain](#scala_toolchain) at the default Scala version (2.11.12)
Expand All @@ -77,17 +89,19 @@ Rules scala supports all minor versions of Scala 2.11/2.12. By default `Scala 2.
version you need to
specify it when calling `scala_repositories`. `scala_repositories` takes a tuple `(scala_version, scala_version_jar_shas)`
as a parameter where `scala_version` is the scala version and `scala_version_jar_shas` is a `dict` with
`sha256` hashes for the maven artifacts `scala_library`, `scala_reflect` and `scala_compiler`:
`sha256` hashes for the maven artifacts `scala_compiler`, `scala_library`, and `scala_reflect`:

```python
scala_repositories((
"2.12.8",
"2.12.10",
{
"scala_compiler": "f34e9119f45abd41e85b9e121ba19dd9288b3b4af7f7047e86dc70236708d170",
"scala_library": "321fb55685635c931eba4bc0d7668349da3f2c09aee2de93a70566066ff25c28",
"scala_reflect": "4d6405395c4599ce04cea08ba082339e3e42135de9aae2923c9f5367e957315a"
"scala_compiler": "cedc3b9c39d215a9a3ffc0cc75a1d784b51e9edc7f13051a1b4ad5ae22cfbc0c",
"scala_library": "0a57044d10895f8d3dd66ad4286891f607169d948845ac51e17b4c1cf0ab569d",
"scala_reflect": "56b609e1bab9144fb51525bfa01ccd72028154fc40a58685a1e9adcbe7835730"
}
))
```

If you're using any of the rules `twitter_scrooge`, `tut_repositories`, `scala_proto_repositories`
or `specs2_junit_repositories` you also need to specify `scala_version` for them. See `./test_version/WORKSPACE.template`
for an example workspace using another scala version.
Expand All @@ -97,7 +111,10 @@ for an example workspace using another scala version.

| bazel | rules_scala gitsha |
|--------|--------------------|
| 0.23.x | HEAD |
| 2.0.0 | HEAD |
| 1.1.0 | HEAD |
| 0.28.1 | bd0c388125e12f4f173648fc4474f73160a5c628 |
| 0.23.x | ca655e5a330cbf1d66ce1d9baa63522752ec6011 |
| 0.22.x | f3113fb6e9e35cb8f441d2305542026d98afc0a2 |
| 0.16.x | f3113fb6e9e35cb8f441d2305542026d98afc0a2 |
| 0.15.x | 3b9ab9be31ac217d3337c709cb6bfeb89c8dcbb1 |
Expand Down Expand Up @@ -174,6 +191,16 @@ Unused dependency checking can either be enabled globally for all targets using
in these cases you can enable unused dependency checking globally through a toolchain and override individual misbehaving targets
using the attribute.

## Advanced configurable rules
To make the ruleset more flexible and configurable, we introduce a phase architecture. By using a phase architecture, where rule implementations are defined as a list of phases that are executed sequentially, functionality can easily be added (or modified) by adding (or swapping) phases.

Phases provide 3 major benefits:
- Consumers are able to configure the rules to their specific use cases by defining new phases within their workspace without impacting other consumers.
- Contributors are able to implement new functionalities by creating additional default phases.
- Phases give us more clear idea what steps are shared across rules.

See [Customizable Phase](docs/customizable_phase.md) for more info.

## Building from source
Test & Build:
```
Expand Down Expand Up @@ -204,7 +231,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more info.
Here's a (non-exhaustive) list of companies that use `rules_scala` in production. Don't see yours? [You can add it in a PR](https://github.com/bazelbuild/rules_scala/edit/master/README.md)!

* [Ascend](https://ascend.io/)
* [Canva](https://www.canva.com/)
* [Etsy](https://www.etsy.com/)
* [Grand Rounds](http://grandrounds.com/)
* [Kitty Hawk](https://kittyhawk.aero/)
* [Meetup](https://meetup.com/)
* [Spotify](https://www.spotify.com/)
Expand Down
Loading