|
| 1 | +# scala_inlined_library |
| 2 | + |
| 3 | +```py |
| 4 | +scala_inlined_library( |
| 5 | + name, |
| 6 | + srcs, |
| 7 | + deps, |
| 8 | + runtime_deps, |
| 9 | + exports, |
| 10 | + data, |
| 11 | + main_class, |
| 12 | + resources, |
| 13 | + resource_strip_prefix, |
| 14 | + scalacopts, |
| 15 | + jvm_flags, |
| 16 | + scalac_jvm_flags, |
| 17 | + javac_jvm_flags, |
| 18 | + unused_dependency_checker_mode |
| 19 | +) |
| 20 | +``` |
| 21 | + |
| 22 | +`scala_inlined_library` generates a `.jar` file from `.scala` source files. This rule |
| 23 | +has the interface jar (`ijar`) functionality disabled. |
| 24 | +This is to enable inlining the compiled code, when it is given as a dependency for another Scala target (`ijar` |
| 25 | +does not contain an implementation, so it cannot be used for inlining). |
| 26 | + |
| 27 | +In order to have a Java rule use this jar file, use the `java_import` rule. |
| 28 | + |
| 29 | +<table class="table table-condensed table-bordered table-params"> |
| 30 | + <colgroup> |
| 31 | + <col class="col-param" /> |
| 32 | + <col class="param-description" /> |
| 33 | + </colgroup> |
| 34 | + <thead> |
| 35 | + <tr> |
| 36 | + <th colspan="2">Attributes</th> |
| 37 | + </tr> |
| 38 | + </thead> |
| 39 | + <tbody> |
| 40 | + <tr> |
| 41 | + <td><code>name</code></td> |
| 42 | + <td> |
| 43 | + <p><code>Name, required</code></p> |
| 44 | + <p>A unique name for this target</p> |
| 45 | + </td> |
| 46 | + </tr> |
| 47 | + <td><code>srcs</code></td> |
| 48 | + <td> |
| 49 | + <p><code>List of labels, required</code></p> |
| 50 | + <p>List of Scala <code>.scala</code> source files used to build the |
| 51 | + library. These may be .srcjar jar files that contain source code.</p> |
| 52 | + </td> |
| 53 | + </tr> |
| 54 | + <tr> |
| 55 | + <td><code>deps</code></td> |
| 56 | + <td> |
| 57 | + <p><code>List of labels, optional</code></p> |
| 58 | + <p>List of other libraries to linked to this library target. |
| 59 | + These must be jvm targets (scala_library, java_library, java_import, etc...)</p> |
| 60 | + </td> |
| 61 | + </tr> |
| 62 | + <tr> |
| 63 | + <td><code>runtime_deps</code></td> |
| 64 | + <td> |
| 65 | + <p><code>List of labels, optional</code></p> |
| 66 | + <p>List of other libraries to put on the classpath only at runtime. This is rarely needed in Scala. |
| 67 | + These must be jvm targets (scala_library, java_library, java_import, etc...)</p> |
| 68 | + </td> |
| 69 | + </tr> |
| 70 | + <tr> |
| 71 | + <td><code>exports</code></td> |
| 72 | + <td> |
| 73 | + <p><code>List of labels, optional</code></p> |
| 74 | + <p>List of targets to add to the dependencies of those that depend on this target. Similar |
| 75 | + to the `java_library` parameter of the same name. Use this sparingly as it weakens the |
| 76 | + precision of the build graph. |
| 77 | + These must be jvm targets (scala_library, java_library, java_import, etc...)</p> |
| 78 | + </td> |
| 79 | + </tr> |
| 80 | + <tr> |
| 81 | + <td><code>data</code></td> |
| 82 | + <td> |
| 83 | + <p><code>List of labels, optional</code></p> |
| 84 | + <p>List of files needed by this rule at runtime.</p> |
| 85 | + </td> |
| 86 | + </tr> |
| 87 | + <tr> |
| 88 | + <td><code>main_class</code></td> |
| 89 | + <td> |
| 90 | + <p><code>String, optional</code></p> |
| 91 | + <p>Name of class with main() method to use as an entry point</p> |
| 92 | + <p> |
| 93 | + The value of this attribute is a class name, not a source file. The |
| 94 | + class must be available at runtime: it may be compiled by this rule |
| 95 | + (from <code>srcs</code>) or provided by direct or transitive |
| 96 | + dependencies (through <code>deps</code>). If the class is unavailable, |
| 97 | + the binary will fail at runtime; there is no build-time check. |
| 98 | + </p> |
| 99 | + </td> |
| 100 | + </tr> |
| 101 | + <tr> |
| 102 | + <td><code>resources</code></td> |
| 103 | + <td> |
| 104 | + <p><code>List of labels; optional</code></p> |
| 105 | + <p>A list of data files to be included in the JAR.</p> |
| 106 | + </td> |
| 107 | + </tr> |
| 108 | + <tr> |
| 109 | + <td><code>resource_strip_prefix</code></td> |
| 110 | + <td> |
| 111 | + <p><code>String; optional</code></p> |
| 112 | + <p> |
| 113 | + The path prefix to strip from Java resources. If specified, |
| 114 | + this path prefix is stripped from every file in the `resources` attribute. |
| 115 | + It is an error for a resource file not to be under this directory. |
| 116 | + </p> |
| 117 | + </td> |
| 118 | + </tr> |
| 119 | + <tr> |
| 120 | + <td><code>scalacopts</code></td> |
| 121 | + <td> |
| 122 | + <p><code>List of strings; optional</code></p> |
| 123 | + <p> |
| 124 | + Extra compiler options for this library to be passed to scalac. Subject to |
| 125 | + <a href="https://bazel.build/reference/be/make-variables.html">Make variable |
| 126 | + substitution</a> and |
| 127 | + <a href="https://bazel.build/reference/be/common-definitions.html#sh-tokenization">Bourne shell tokenization.</a> |
| 128 | + </p> |
| 129 | + </td> |
| 130 | + </tr> |
| 131 | + <tr> |
| 132 | + <td><code>jvm_flags</code></td> |
| 133 | + <td> |
| 134 | + <p><code>List of strings; optional; deprecated</code></p> |
| 135 | + <p> |
| 136 | + Deprecated, superseded by scalac_jvm_flags and javac_jvm_flags. Is not used and is kept as backwards compatibility for the near future. Effectively jvm_flags is now an executable target attribute only. |
| 137 | + </p> |
| 138 | + </td> |
| 139 | + </tr> |
| 140 | + <tr> |
| 141 | + <td><code>scalac_jvm_flags</code></td> |
| 142 | + <td> |
| 143 | + <p><code>List of strings; optional</code></p> |
| 144 | + <p> |
| 145 | + List of JVM flags to be passed to scalac after the |
| 146 | + <code>scalacopts</code>. Subject to |
| 147 | + <a href="https://bazel.build/reference/be/make-variables.html">Make variable |
| 148 | + substitution</a> and |
| 149 | + <a href="https://bazel.build/reference/be/common-definitions.html#sh-tokenization">Bourne shell tokenization.</a> |
| 150 | + </p> |
| 151 | + </td> |
| 152 | + </tr> |
| 153 | + <tr> |
| 154 | + <td><code>javac_jvm_flags</code></td> |
| 155 | + <td> |
| 156 | + <p><code>List of strings; optional</code></p> |
| 157 | + <p> |
| 158 | + List of JVM flags to be passed to javac after the |
| 159 | + <code>javacopts</code>. Subject to |
| 160 | + <a href="https://bazel.build/reference/be/make-variables.html">Make variable |
| 161 | + substitution</a> and |
| 162 | + <a href="https://bazel.build/reference/be/common-definitions.html#sh-tokenization">Bourne shell tokenization.</a> |
| 163 | + </p> |
| 164 | + </td> |
| 165 | + </tr> |
| 166 | + <tr> |
| 167 | + <td><code>unused_dependency_checker_mode</code></td> |
| 168 | + <td> |
| 169 | + <p><code>String; optional</code></p> |
| 170 | + <p> |
| 171 | + Enable unused dependency checking (see <a href="https://github.com/bazelbuild/rules_scala#experimental-unused-dependency-checking">Unused dependency checking</a>). |
| 172 | + Possible values are: <code>off</code>, <code>warn</code> and <code>error</code>. |
| 173 | + </p> |
| 174 | + </td> |
| 175 | + </tr> |
| 176 | + </tbody> |
| 177 | +</table> |
0 commit comments