You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add includes option to ruby_bundle rule for per-gem load path customization (#102)
* Add register_gem support for non-standard gemspecs
* cleanup and workaround
* debug
* Add includes option to bundle_build
* Add description about includes/excludes optional parameters for
ruby_bundle
* Trim extra whitespace characters
* Add example usage of ruby_bundle.includes to README
* Add a test for includes option of ruby_bundle rule
* tidy up
* Fix the default value of ruby_bundle rule
* Bump up Ruby version of ruby_bundle includes sample code
* Fix new test workspace
* Fix bundle build rule path injection
* Fix usage of ruby_bundle rule's includes option
* More clarification in comments
* Clarify that folders in spec.require_paths do not need to be listed in includes hash
Co-authored-by: Konstantin Gredeskoul <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+52-15Lines changed: 52 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@
20
20
21
21
Note: we have a short guide on [Building your first Ruby Project](https://github.com/bazelruby/rules_ruby/wiki/Build-your-ruby-project) on the Wiki. We encourage you to check it out.
22
22
23
-
## Table of Contents
23
+
## Table of Contents
24
24
25
25
-[Ruby Rules® for Bazel Build System](#ruby-rules-for-bazelhttpsbazelbuild-build-system)
26
26
-[Build Status & Activity](#build-status-activity)
@@ -99,6 +99,12 @@ load(
99
99
100
100
ruby_bundle(
101
101
name="bundle",
102
+
# Specify additional paths to be loaded from the gems at runtime, if any.
103
+
# Since spec.require_paths in Gem specifications are auto-included, directory paths
104
+
# in spec.require_paths do not need to be listed in includes hash.
105
+
includes= {
106
+
"grpc": ["etc"],
107
+
},
102
108
excludes= {
103
109
"mini_portile": ["test/**/*"],
104
110
},
@@ -200,7 +206,7 @@ ruby_gem(
200
206
"rubocop": "",
201
207
},
202
208
srcs= [
203
-
glob("{bin,exe,lib,spec}/**/*.rb")
209
+
glob("{bin,exe,lib,spec}/**/*.rb")
204
210
],
205
211
deps= [
206
212
"//lib:example_gem",
@@ -224,7 +230,7 @@ You will have to be sure to export the `ASDF_DATA_DIR` in your profile since it'
224
230
225
231
### Rule Dependency Diagram
226
232
227
-
>NOTE: this diagram isslightly outdated.
233
+
>NOTE: this diagram issomewhat outdated.
228
234
229
235
The following diagram attempts to capture the implementation behind `ruby_library` that depends on the result of `bundle install`, and a `ruby_binary` that depends on both:
<p>NOTE: This rule never updates the <code>Gemfile.lock</code>. It is your responsibility to generate/update <code>Gemfile.lock</code></p>
599
606
</td>
600
607
</tr>
608
+
<tr>
609
+
<td><code>includes</code></td>
610
+
<td>
611
+
<code>Dictionary of key-value-pairs (key: string, value: list of strings), optional</code>
612
+
<p>
613
+
List of glob patterns per gem to be additionally loaded from the library.
614
+
Keys are the names of the gems which require some file/directory paths not listed in the <code>require_paths</code> attribute of the gemspecs to be also added to <code>$LOAD_PATH</code> at runtime.
615
+
Values are lists of blob path patterns, which are relative to the root directories of the gems.
616
+
</p>
617
+
</td>
618
+
</tr>
619
+
<tr>
620
+
<td><code>excludes</code></td>
621
+
<td>
622
+
<code>Dictionary of key-value-pairs (key: string, value: list of strings), optional</code>
623
+
<p>
624
+
List of glob patterns per gem to be excluded from the library.
625
+
Keys are the names of the gems.
626
+
Values are lists of blob path patterns, which are relative to the root directories of the gems.
627
+
The default value is<code>["**/* *.*", "**/* */*"]</code>
628
+
</p>
629
+
</td>
630
+
</tr>
601
631
</tbody>
602
632
</table>
603
633
@@ -857,17 +887,17 @@ ruby_gem(
857
887
<tr>
858
888
<td><code>gem_description</code></td>
859
889
<td>
860
-
<code>String, required</code>
890
+
<code>String, required</code>
861
891
<p>Single-line, paragraph-sized description text for the gem.</p>
862
892
</td>
863
893
</tr>
864
894
<tr>
865
895
<td><code>gem_homepage</code></td>
866
896
<td>
867
-
<code>String, optional</code>
897
+
<code>String, optional</code>
868
898
<p>Homepage URL of the gem.</p>
869
899
</td>
870
-
</tr>
900
+
</tr>
871
901
<tr>
872
902
<td><code>gem_authors</code></td>
873
903
<td>
@@ -886,7 +916,7 @@ ruby_gem(
886
916
List of email addresses of the authors.
887
917
</p>
888
918
</td>
889
-
</tr>
919
+
</tr>
890
920
<tr>
891
921
<td><code>srcs</code></td>
892
922
<td>
@@ -917,7 +947,7 @@ ruby_gem(
917
947
Typically this value is just `lib` (which is also the default).
918
948
</p>
919
949
</td>
920
-
</tr>
950
+
</tr>
921
951
<tr>
922
952
<td><code>gem_runtime_dependencies</code></td>
923
953
<td>
@@ -938,8 +968,8 @@ ruby_gem(
938
968
testing gems, linters, code coverage and more.
939
969
</p>
940
970
</td>
941
-
</tr>
942
-
971
+
</tr>
972
+
943
973
</tbody>
944
974
</table>
945
975
@@ -972,13 +1002,14 @@ After that, cd into the top level folder and run the setup script in your Termin
972
1002
This runs a complete setup, shouldn't take too long. You can explore various script options with the `help` command:
973
1003
974
1004
```bash
975
-
❯ bin/setup help
1005
+
❯ bin/setup -h
1006
+
976
1007
USAGE
977
1008
# without any arguments runs a complete setup.
978
1009
bin/setup
979
1010
980
1011
# alternatively, a sub-setup function name can be passed:
0 commit comments