profile
viewpoint

android/testing-samples 8360

A collection of samples demonstrating different frameworks and techniques for automated testing

bazelbuild/starlark 1244

Starlark Language

android/android-test 961

An extensive framework for testing Android apps

bazelbuild/intellij 592

IntelliJ plugin for Bazel projects

bazelbuild/examples 521

Examples for Bazel

bazelbuild/rules_foreign_cc 486

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja)

bazelbuild/tulsi 465

An Xcode Project Generator For Bazel

chromelens/chromelens 389

Chrome DevTools extension for web accessibility development

bazelbuild/sandboxfs 312

A virtual file system for sandboxing

bazelbuild/rules_apple 287

Bazel rules to build apps for Apple platforms.

Pull request review commentbazelbuild/rules_jvm_external

Add kt_jvm_export rule

+load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

Have you tried to repro the CI-issued bazel commands locally?

I can reproduce the error from examples/simple:

jingwen-macbookpro% cd examples/simple
jingwen-macbookpro% bazelisk test ...
2022/01/21 11:12:25 Downloading https://releases.bazel.build/5.0.0/release/bazel-5.0.0-darwin-x86_64...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
ERROR: Failed to load Starlark extension '@io_bazel_rules_kotlin//kotlin:jvm.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
 - @io_bazel_rules_kotlin
This could either mean you have to add the '@io_bazel_rules_kotlin' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: cycles detected during target parsing
INFO: Elapsed time: 2.459s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

The issue is with this line:

https://github.com/bazelbuild/rules_jvm_external/blob/56246b52aceb428b7a065237d6f6c332070536e2/repositories.bzl#L1

Since //:defs.bzl now loads from rules_kotlin, the load statement is called before rules_kotlin is defined. I tried to rearrange the repo declarations, and I think we now need 3 steps/macros:

  1. http_archive for rules_kotlin
  2. call @rules_jvm_external//:defs.bzl#maven_install to create rules_jvm_external_deps
  3. call @rules_jvm_external_deps//:defs.bzl#pinned_maven_install from rules_jvm_external_deps

These 3 steps have to be sequential, and cannot be in the same .bzl file. Alternatively, if we go down the route of declaring kt_jvm_export in a separate top level (e.g.) kt_defs.bzl file, then this wouldn't be a problem, I think.

There are a few more errors.

From: https://buildkite.com/bazel/rules-jvm-external/builds/2479#b813ab50-2257-404e-a022-e3f1e2c2168d

(19:31:17) ERROR: /workdir/tests/integration/kt_jvm_export/BUILD:3:1: in kt_jvm_library rule //tests/integration/kt_jvm_export:test-lib:
--
  | Traceback (most recent call last):
  | File "/workdir/tests/integration/kt_jvm_export/BUILD", line 3
  | kt_jvm_library(name = 'test-lib')
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel_rules_kotlin/kotlin/internal/jvm/impl.bzl", line 233, in kt_jvm_library_impl
  | _make_providers(ctx, _kt_jvm_produce_jar_actions(c...))
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel_rules_kotlin/kotlin/internal/jvm/impl.bzl", line 235, in _make_providers
  | _kt_jvm_produce_jar_actions(ctx, "kt_jvm_library")
  | File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel_rules_kotlin/kotlin/internal/jvm/compile.bzl", line 532, in _kt_jvm_produce_jar_actions
  | java_common.pack_sources(ctx.actions, output_source_jar = c..., <3 more arguments>)
  | parameter 'output_jar' has no default value, for call to method pack_sources(actions, output_jar, sources = [], source_jars = [], java_toolchain, host_javabase) of 'java_common'
  | (19:31:18) ERROR: Analysis of target '//tests/integration/kt_jvm_export:check-deploy-env' failed; build aborted: Analysis of target '//tests/integration/kt_jvm_export:test-lib' failed; build aborted

I'm also getting a different error locally with bazel test //...

ERROR: /Users/jingwen/code/rules_jvm_external/BUILD:9:8: Generating proto for Starlark doc for defs failed: (Exit 1): stardoc failed: error executing command
  (cd /private/var/tmp/_bazel_jingwen/5e64b778ca5f4ff8a6ca994b3f33d8f8/sandbox/darwin-sandbox/566/execroot/rules_jvm_external && \
  exec env - \
  bazel-out/host/bin/external/io_bazel_stardoc/stardoc/stardoc '--input=//:defs.bzl' '--workspace_name=' '--symbols=javadoc' '--symbols=java_export' '--symbols=maven_install' '--dep_roots=.' '--dep_roots=external/' '--output=bazel-out/darwin-fastbuild/bin/defs.raw')
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
Stardoc documentation generation failed: File defs.bzl imported '//private/rules:kt_jvm_export.bzl', yet private/rules/kt_jvm_export.bzl was not found, even at roots [., external/].
deannagarcia

comment created time in a day

PullRequestReviewEvent

Pull request review commentbazelbuild/rules_jvm_external

Add kt_jvm_export rule

+load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

buildkite/rules-jvm-external-examples is the failing CI job that builds and tests every project in examples, so your implementation should result in some changes to each example's workspace to add the repo and setup bzl to make it pass.

deannagarcia

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentbazelbuild/examples

Creating example tests

-load("@rules_java//java:defs.bzl", "java_binary")+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")  java_binary(     name = "ProjectRunner",+    srcs = ["src/main/java/com/example/ProjectRunner.java"],+    main_class = "com.example.ProjectRunner",+    deps = [":greeter",":calculator"],+)++java_library(+    name = "java-maven-lib",     srcs = glob(["src/main/java/com/example/*.java"]), )++java_test(+    name = "runner_tests",+    srcs = glob(["src/test/java/com/example/*.java"]),+    test_class = "com.example.CalculatorTest",+    deps = [+        ":java-maven-lib",+        "@maven//:junit_junit",+    ],+)++java_library(+    name = "greeter",+    srcs = ["src/main/java/com/example/Greeting.java"],

This doesn't exist..?

KilimAnnejaro

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentbazelbuild/rules_jvm_external

Allow pinning transitive artifacts via new pinned_artifacts attribute

esthetic separation of direct dependencies + not providing public visibility for indirect artifacts

I don't think adding a new API for this makes it necessarily simpler. A new attribute is an attribute that we'd have to support ~forever. For aesthetics, it could be a project-side concatenation of lists.

re: public visibility for indirect artifacts is needed, given https://github.com/bazelbuild/rules_jvm_external/issues/147#issuecomment-493496912

makes it simpler to write a check for directly unused dependencies (which don't need their version to be manually maintained/pinned generally, except for when they do and this is unblocked by this PR). Script along such lines

Why can't this be an rdeps query?

In general, I'm not too comfortable with adding another core attribute like this, especially if it doesn't bring significant benefit over the existing mechanisms.

dmivankov

comment created time in 3 days

PullRequestReviewEvent

pull request commentbazelbuild/bazel

Add Autocomplete Integration to IDE Docs

Seems like a better home for this would be www.bazel.build (or generally, a better way for discover projects in the ecosystem not unlike awesome-bazel). But I don't think we should block this contributions on that -- the page was meant to collect all tools and rules related to IDE, anyway.

cpsauer

comment created time in 3 days

Pull request review commentbazelbuild/rules_jvm_external

Add kt_jvm_export rule

+load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

Sounds good. It was a soft requirement to add those lines, but this would cement that as a hard requirement. Let's just bite the bullet and do it then.

@deannagarcia to summarize, there's a couple of things here:

  1. Add rules_kotlin to repositories.bzl, and do any necessary setup for rules_kotlin in setup.bzl.
  2. Update all the examples to load repositories.bzl and setup.bzl.

That should make CI happy.

deannagarcia

comment created time in 3 days

PullRequestReviewEvent

push eventbazelbuild/proposals

Kevin Kress

commit sha 6006f905d615ee8e381b1f87de4f735185b5158e

Move subpackages proposal to implemented (#241)

view details

push time in 3 days

PR merged bazelbuild/proposals

Reviewers
Move subpackages proposal to implemented

Subpackages has been implemented and merged to head

+1 -1

0 comment

1 changed file

kkress

pr closed time in 3 days

PullRequestReviewEvent

Pull request review commentbazelbuild/rules_jvm_external

Add kt_jvm_export rule

+load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

Agh, the test failures in the examples CI pipeline is due to this load line adding @io_bazel_rules_kotlin as an implicit dependency of everyone using rules_jvm_external by loading //:defs.bzl -> kt_jvm_export, regardless of whether they're using kt_jvm_export or not. This is due to the non-transitive nature of repository rule deps.

This means we'll need to add rules_kotlin to //:repository.bzl to put io_bazel_rules_kotlin into the namespace and force all RJE users to call the setup/repo statements in their WORKSPACE (https://github.com/bazelbuild/rules_jvm_external#usage), instead of a single http_archive call. This is a backwards incompatible change.

Another way is to store kt_jvm_export under a different top level "defs.bzl" file, maybe "//:defs_with_deps.bzl", so users of those special symbols have to load the deps/setup macro (https://github.com/bazelbuild/rules_jvm_external/blob/master/repositories.bzl). This is a backwards compatible change.

cc @shs96c wdyt? I prefer the second approach.

deannagarcia

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventbazelbuild/rules_jvm_external

Dmitry Ivankov

commit sha cbc10cee249c40bde72a911ec7a51dd82cea2c1f

Don't use jcenter.bintray.com in test, it is sort of EOL (#657) Replace with https://repo1.maven.org/maven2 Test can time out fetching from jcenter like in https://buildkite.com/bazel/rules-jvm-external/builds/2461#c70711ec-e59f-48e9-b925-7d755a014070 It seems that in the end it is supposed to be maintained as read-only but atm times out https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

view details

push time in 4 days

PR merged bazelbuild/rules_jvm_external

Reviewers
Don't use jcenter.bintray.com in test, it is sort of EOL

Replace with https://repo1.maven.org/maven2

Test can time out fetching from jcenter like in https://buildkite.com/bazel/rules-jvm-external/builds/2461#c70711ec-e59f-48e9-b925-7d755a014070

It seems that in the end it is supposed to be maintained as read-only but atm times out https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

+4 -4

1 comment

2 changed files

dmivankov

pr closed time in 4 days

pull request commentbazelbuild/rules_jvm_external

Don't use jcenter.bintray.com in test, it is sort of EOL

thank you!

dmivankov

comment created time in 4 days

PullRequestReviewEvent

Pull request review commentbazelbuild/rules_jvm_external

Bzlmod proof of concept

+load("@bazel_tools//tools/build_defs/repo:http.bzl", bazel_http_file = "http_file")++http_download = tag_class(

Seems like this should be part of skylib or something

shs96c

comment created time in 5 days

Pull request review commentbazelbuild/rules_jvm_external

Bzlmod proof of concept

+load("@bazel_skylib//lib:sets.bzl", "sets")+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")+load("//:coursier.bzl", "pinned_coursier_fetch")+load("//:specs.bzl", _json = "json", "parse")+load(":download_deps.bzl", "download_deps")++_install = tag_class(+    attrs = {+        "name": attr.string(+            default = "maven",+        ),+        "artifacts": attr.string_list(+            default = [],+        ),+        "lock_file": attr.label(),+        "repositories": attr.string_list(+            default = ["https://repo1.maven.org/maven2"],+        ),+    }+)++def _maven_impl(mctx):+    # Gather the artifacts+    repos = {}++    for mod in mctx.modules:

This is exciting :) have you tried making this work in a transitive project environment?

shs96c

comment created time in 5 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentbazelbuild/rules_jvm_external

Bzlmod proof of concept

+module(+    name = "rules_jvm_external",+    version = "1.0"+)++bazel_dep(name = "bazel_skylib", version = "1.1.1")+bazel_dep(name = "rules_java", version = "5.0.0")

What are we using rules_java for? IIUC the Starlark rewrite uses "builtins" to manage migration now, so no need for rules_java loads.

shs96c

comment created time in 5 days

startedbazelbuild/bazel-central-registry

started time in 5 days

PullRequestReviewEvent
more