Buck: Remove non working local_jar rule and documentation
Since If336ea8697 and since: [1] local_jar() is broken and cannot be
fixed. It was always a hack that relied on the ability to define two
different targets with the same output artifact name. Since: [1] it
cannot be done any more.
This rule was not used, but was provided by the build toolchain to
allow to switch from maven_jar() to local_jar().
* [1] c92ef212b5
Change-Id: I0900d7f17bb1fcf6c91c13d3d845293f805cc5ca
This commit is contained in:
@@ -371,62 +371,6 @@ that artifact:
|
||||
)
|
||||
----
|
||||
|
||||
== Building against unpublished JARs, that change frequently
|
||||
|
||||
If a dependent Gerrit library is undergoing active development it must be
|
||||
recompiled and the change must be reflected in the Buck build process. For
|
||||
example testing Gerrit against changed JGit snapshot version. After building
|
||||
JGit library, the artifacts are created in local Maven build directory, e. g.:
|
||||
|
||||
----
|
||||
mvn package
|
||||
/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar
|
||||
/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT-sources.jar
|
||||
----
|
||||
|
||||
If as usual, installation of the build artifacts takes place in local maven
|
||||
repository, then the Buck build must fetch them from there with normal
|
||||
`download_file.py` process. Disadvantage of this approach is that Buck cache
|
||||
invalidation must occur to refresh the artifacts after next
|
||||
change-compile-install round trip.
|
||||
|
||||
To shorten that workflow and take the installation of the artifacts to the
|
||||
local Maven repository and fetching it again from there out of the picture,
|
||||
`local_jar()` method is used instead of `maven_jar()`:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
local_jar(
|
||||
name = 'jgit',
|
||||
jar = '/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar',
|
||||
src = '/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT-sources.jar',
|
||||
deps = [':ewah']
|
||||
)
|
||||
----
|
||||
|
||||
This creates a symlink to the Buck targets direct against artifacts in
|
||||
another project's Maven target directory:
|
||||
|
||||
----
|
||||
buck-out/gen/lib/jgit/jgit.jar ->
|
||||
/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar
|
||||
----
|
||||
|
||||
After `buck clean` and `buck build lib/jgit:jgit` the symbolic link that was
|
||||
created the first time is lost due to Buck's caching mechanism. This means that
|
||||
when a new version of the local artifact is deployed (by running `mvn package`
|
||||
in the JGit project in the example above), Buck is not aware of it, because it
|
||||
still has a stale version of it in its cache.
|
||||
|
||||
To solve this problem and re-create the symbolic link, you don't need to wipe out
|
||||
the entire Buck cache. Just rebuilding the target with the `--no-cache` option
|
||||
does the job:
|
||||
|
||||
----
|
||||
buck clean
|
||||
buck build --no-cache lib/jgit:jgit
|
||||
----
|
||||
|
||||
== Building against artifacts from custom Maven repositories
|
||||
|
||||
To build against custom Maven repositories, two modes of operations are
|
||||
|
@@ -1,33 +0,0 @@
|
||||
def local_jar(
|
||||
name,
|
||||
jar,
|
||||
src = None,
|
||||
deps = [],
|
||||
visibility = ['PUBLIC']):
|
||||
binjar = name + '.jar'
|
||||
srcjar = name + '-src.jar'
|
||||
genrule(
|
||||
name = '%s__local_bin' % name,
|
||||
cmd = 'ln -s %s $OUT' % jar,
|
||||
out = binjar)
|
||||
if src:
|
||||
genrule(
|
||||
name = '%s__local_src' % name,
|
||||
cmd = 'ln -s %s $OUT' % src,
|
||||
out = srcjar)
|
||||
prebuilt_jar(
|
||||
name = '%s_src' % name,
|
||||
binary_jar = ':%s__local_src' % name,
|
||||
visibility = visibility,
|
||||
)
|
||||
else:
|
||||
srcjar = None
|
||||
|
||||
prebuilt_jar(
|
||||
name = name,
|
||||
deps = deps,
|
||||
binary_jar = ':%s__local_bin' % name,
|
||||
source_jar = ':%s__local_src' % name if srcjar else None,
|
||||
visibility = visibility,
|
||||
)
|
||||
|
@@ -12,8 +12,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_defs('//lib/local.defs')
|
||||
|
||||
GERRIT = 'GERRIT:'
|
||||
GERRIT_API = 'GERRIT_API:'
|
||||
MAVEN_CENTRAL = 'MAVEN_CENTRAL:'
|
||||
|
Reference in New Issue
Block a user