Giter Site home page Giter Site logo

bazelbuild / eclipse Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 19.0 4.27 MB

Eclipse For Bazel (deprecated, see https://github.com/salesforce/bazel-eclipse instead)

License: Apache License 2.0

Python 5.66% Java 76.33% Shell 1.69% Starlark 16.32%
bazel build-tool eclipse eclipse-plugin ide

eclipse's People

Contributors

asclepiusaka avatar brychcy avatar buchgr avatar damienmg avatar dslomov avatar elharo avatar hanwen avatar hildrum avatar huijunwu avatar jin avatar kchodorow avatar psaville-google avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eclipse's Issues

Bazel Classpath Container appears misconfigured

Hello again,

First, I really appreciate all your help; this'll be my third issue in a row. My project now is created without error, but the classpath is messed up. Viewing the classpath in eclipse, I get the following:

Bazel Classpath Container
    > hamcrest--all-1.3.jar - /home/user/.cache/bazel/_bazel_user/00bb1210de2173919b75bf7db0a13118/execroot/hamcrestall/jar (missing)
      <about 15 more, equivalent missing jars>

The jar in question is actually located at /home/user/.cache/bazel/_bazel_user/00bb1210de2173919b75bf7db0a13118/execroot/Project/external/hamcrestall/jar

$ ls /home/user/.cache/bazel/_bazel_user/00bb1210de2173919b75bf7db0a13118/execroot/Project/external/hamcrestall/jar
BUILD  hamcrest-all-1.3.jar

The relevant portion of my WORKSPACE file:

maven_jar(
  name = "hamcrestall",
  artifact = "org.hamcrest:hamcrest-all:1.3",
)
bind(
  name = "org/hamcrest/all",
  actual = "@hamcrestall//jar",
)

And a relevant bit of a BUILD file:

java_test(
    name = "Thingy3Test",
    srcs = ["Thingy3Test.java"],
    deps = [
        "//external:com/google/guava",
        "//external:com/google/truth",
        "//src/main/path/to",
        "//src/main/path/other",
        "//external:junit/junit",
        "//external:org/hamcrest/all",
        "//external:org/jocl",
    ],
    data = [":smoke_test_data"],
    test_class = "path.to.Thingy3Test",
)

Indexer for eclipse CDT (C++)

Hello,
Thanks a lot e4b! I have a C++ based bazel project correctly imported into eclipse. The whole workspace can be built correctly from within eclipse using build all targets but the indexer still doesn't work. Is this a known issue or is there a known fix for this?

Please move from native to Starlark rules for external git/http repositories

From version 0.20 onwards, bazel by default will no longer support the native http and git repositories. Please switch to the Starlark versions of those rules.

For more background, see

Once migrated, please also file an issue against http://github.com/bazelbuild/continuous-integration to reenable testing of your project as a bazel downstream project.

Thanks,
Klaus

Change repo name to be bazelbuild/eclipse

e4b is a cryptic name.
We should make everything possible to make it clear that this is the Bazel Eclipse IDE plugin.
Using eclipse in the repo name should help.

folders sorted incorrectly ubuntu 14.04 and import hangs.

On Ubuntu 14.04 when attempting to select folders to import, the folders are not listed alphabetically. This does not seem to happen on Darwin.

Also, I think because of this, the load hangs for a directory with a lot of folders. I think some logic elsewhere may be assuming sorted folders as again this project loads correctly on Darwin. On Ubuntu it locks after pressing Finish on the import.

Improve the support of building eclipse plugin for Bazel

PR #38 is finishing the build with Bazel, there are several things that can be done to improve this support:

  • Document the support
  • Make it more configurable (e.g. better dependencies support)
  • Make it compatible with Eclipse PDE so you can develop e4b using e4b :)
  • Tests the support

object of type 'Target' has no field 'intellij_info_files'

While trying to setup an eclipse workspace for bazel according to https://bazel.build/contributing.html,
an error is reported in the console and the Bazel Classpath Container is not initialized.:
[...]
File "/private/var/tmp/_bazel_till/1bf5324772cb2353440eae7781088d92/external/local_eclipse_aspect/e4b_aspect.bzl", line 96, in _aspect_impl
dep.intellij_info_files
object of type 'Target' has no field 'intellij_info_files'
[...]

I'll send a PR that adds a check if the attribute exists

Error compiling project with config_setting that supports "local" or "maven" alias to jar deps

I have a bazel project in which I am using an alias rule to choose "local" java_import rules or the WORKSPACE maven_jar, based on a config_setting rule. The default is to use the maven_jar rule.

I get no errors when building with bazel directly. I get the following error in e4b:

Unhandled exception thrown during build; message: Unrecoverable error while evaluating node 'ASPECT://{subfolder:alias rule}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}' (requested by nodes 'ASPECT://external{bind rule pointing at alias}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}')
____Elapsed time: 0.838s
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ASPECT://{subfolder:alias rule}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}' (requested by nodes 'ASPECT://external:{bind rule pointing at alias}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}')
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:1070)
    at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: com.google.devtools.build.lib.rules.AliasConfiguredTarget cannot be cast to com.google.devtools.build.lib.analysis.RuleConfiguredTarget
    at com.google.devtools.build.lib.skyframe.AspectFunction.compute(AspectFunction.java:207)
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:1016)
    ... 4 more
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ASPECT://{subfolder:alias rule}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}' (requested by nodes 'ASPECT://external:{bind rule pointing at alias}#//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect ba834f18793b6e939eecba4f092f775f ba834f18793b6e939eecba4f092f775f {}')
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:1070)
    at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: com.google.devtools.build.lib.rules.AliasConfiguredTarget cannot be cast to com.google.devtools.build.lib.analysis.RuleConfiguredTarget
    at com.google.devtools.build.lib.skyframe.AspectFunction.compute(AspectFunction.java:207)
    at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:1016)
    ... 4 more

Build and Workspace files look as follows

WORKSPACE:
  maven_jar:maven_library
  bind(library to <subfolder:alias_library>

  subfolder:
    BUILD:
      config_setting(alias_local_mode: define="localjars=true")
      java_import(local_library from a file in subfolder)
      alias(alias_library, select(alias_local_mode: local_library, default: @maven_library//jar))

  java/package_path:
    BUILD:
      java_library( deps: [//external:library])

Cannot create project

Hello,

First time user, here. I'm running

Eclipse IDE for Java Developers
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600

on Ubuntu GNOME 16.04.1 LTS 64bit.

I'm hitting WorkspaceWizardPage.java:166 when I try to create a project, at /home/user/Source/Project. Yet,

 $ ls
/home/user/Source/Project
 $ bazel --watchfs info workspace
/home/user/Source/Project

Let me know if there's any other info I can provide.

Project fails to build immediately after generation

Hello,

I have created a new project via Other > Import Bazel Workspace. The output in the console then indicates failure.

The output is rather confusing to me, so I've pasted it ~verbatim, along with the BUILD file it references.

BUILD file in question ("/home/user/Source/Project/src/main/path/to/code/BUILD")

package(default_visibility = ["//visibility:public"])

load("@org_pubref_rules_protobuf//java:rules.bzl", "java_proto_library")

java_proto_library(
  name = "myproto",
  protos = ["myproto.proto"],
)

java_library(
  name = "code",
  srcs = glob(
    ["*.java"],
    exclude = ["Main.java", "Other.java"]),
  deps = [
    ":myproto",
    ":myproto_compile_imports",
    "//external:com/google/auto/value",
    "//external:com/google/guava",
    "//external:org/objenesis",
    "//external:net/bytebuddy",
    "//src/main/path/component",
    "//src/main/path:another",
  ],
  javacopts = ["-parameters"],
)

java_binary(
  name = "main",
  srcs = ["Main.java", "Other.java"],
  deps = [
    ":code",
    ":myproto",
    ":myproto_compile_imports",
    "//external:com/google/guava",
    "//external:org/ow2/asm",
    "//external:org/objenesis",
    "//external:net/bytebuddy",
    "//src/main/path/component",
  ],
  main_class = "path.to.code.Main",
)

Tool output

*** Running [/usr/local/bin/bazel, --watchfs, build, --package_path, %workspace%:/home/user/Source/Open/github.com/google/bazel/base_workspace:/home/user/bin/eclipse-install/java-mars2/eclipse/plugins/com.google.devtools.bazel.e4b_0.0.1/resources, --experimental_interleave_loading_and_analysis, --strategy=Javac=worker, --noexperimental_check_output_files, --aspects=tools/must/be/unique/e4b_aspect.bzl%e4b_aspect, -k, --output_groups=ide-info-text,ide-resolve,-_,-defaults, --experimental_show_artifacts, //src/test/path/..., //src/main/path/...] from /home/user/Source/Project ***
WARNING: Option 'experimental_interleave_loading_and_analysis' is deprecated.
____Loading...
WARNING: /home/user/.cache/bazel/_bazel_user/00bb1210de2173919b75bf7db0a13118/external/com_github_google_protobuf/protobuf.bzl:90:19: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
ERROR: /home/user/Source/Project/src/main/path/to/code/BUILD:5:1: in //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect aspect on proto_language_deps rule //src/main/path/to/code:myproto_compile_deps: 
Traceback (most recent call last):
    File "/home/user/Source/Project/src/main/path/to/code/BUILD", line 5
        //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect(...)
    File "/home/user/bin/eclipse-install/java-mars2/eclipse/plugins/com.google.devtools.bazel.e4b_0.0.1/resources/tools/must/be/unique/e4b_aspect.bzl", line 95, in _aspect_impl
        for dep in deps: ...
type 'bool' is not iterable.
WARNING: /home/user/.cache/bazel/_bazel_user/00bb1210de2173919b75bf7db0a13118/external/com_github_google_protobuf/protobuf.bzl:96:28: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
____Found 18 targets...
____[0 / 1] BazelWorkspaceStatusAction stable-status.txt
Build artifacts:
ERROR: command succeeded, but not all targets were analyzed.
____Elapsed time: 0.114s, Critical Path: 0.00s

Plugin doesn't work against recent Bazel version

Trying to follow the instructions and set up Eclipse project on Bazel master is failing with:

ERROR: /home/davido/projects/bazel/src/test/java/com/google/devtools/build/android/desugar/BUILD:696:1: in //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect aspect on java_library rule //src/test/java/com/google/devtools/build/android/desugar:testdata_like_in_android_studio: 
Traceback (most recent call last):
	File "/home/davido/projects/bazel/src/test/java/com/google/devtools/build/android/desugar/BUILD", line 696
		//tools/must/be/unique:e4b_aspect.bzl%e4b_aspect(...)
	File "/home/davido/pgm/eclipse-oxygen/eclipse/plugins/com.google.devtools.bazel.e4b_0.0.2/resources/tools/must/be/unique/e4b_aspect.bzl", line 97, in _aspect_impl
		dep.intellij_info_files
object of type 'Target' has no field 'intellij_info_files'.
ERROR: Analysis of aspect '/tools/must/be/unique/e4b_aspect%e4b_aspect of //src/test/java/com/google/devtools/build/android/desugar:testdata_like_in_android_studio' failed; build aborted.
____Elapsed time: 1.688s

Bazel is on: bf96c50e0c9afd3da8d937948c3636f09a0e80d7

Side not: It is not clear how to compile this Eclipse plugin from master.
I tried with "bazel build //...", but this command was looping over downloading different bazel versions (?) and I cancelled it.

An error occurred while collecting items to be installed

I follow the instruction, but an error occurred here.
An error occurred while collecting items to be installed session context was:(profile=epp.package.cpp, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). Unable to read repository at http://bazelbuild.github.io/e4b/p2updatesite/plugins/com.google.devtools.bazel.e4b_0.0.2.jar. Connection reset Unable to read repository at http://bazelbuild.github.io/e4b/p2updatesite/features/com.google.devtools.bazel.e4b.feature_0.0.2.jar. Connection reset

Is it possible to reconfigure an e4b project without deleting and recreating?

Our code base has many (thousands of) targets. It seems likely to me that someone would do an import and perhaps specify targets A and B, only to realize they also need to touch C, D, etc.

I don't see any obvious way to relaunch the "wizard" and adjust the configuration of the project. Is the only option to delete and rerun the wizard/reimport the workspace?

Problems loading bazel itself from eclipse

When importing the current bazel repository, I get an error that the root is not a workspace; apparently it still works, but when adding targets, enter does not add the target, one needs to see the small + at the side.

No way to add optional arguments to build command

I've had a go at utilizing this for building tensorflow serving, I can build and run okay but I cannot debug as ill need to add the --compilation_mode=dbg flag to the bazel build string. is there a way to do this? Short of forking and appending in BAZEL Command?

e4b tools error compiling project with config_setting that controls a bind rule to an alias rule

I pulled a local bazel repo clone and built bazel from HEAD yesterday in order to test if #6 fixed my issue with e4b builds.

Sadly, it still doesn't work - see Issue 6 for WORKSPACE and BUILD files for issue reproduction.

*** Running [/usr/local/bin/bazel, --watchfs, build, --package_path, %workspace%:/Users/psaville/eclipse/java-neon/Eclipse.app/Contents/Eclipse/../../../../../.p2/pool/plugins/com.google.devtools.bazel.e4b_0.0.1.201604271316/resources, --experimental_interleave_loading_and_analysis, --strategy=Javac=worker, --noexperimental_check_output_files, --aspects=tools/must/be/unique/e4b_aspect.bzl%e4b_aspect, //java/..., //javatests/..., //example/java/..., //scripts/testing/tee:setup_tee, //production/kubernetes/..., //example/java/..., //scs/rapidsync:all] from /Users/psaville/git-gerrit/skybox3 ***
WARNING: Option 'experimental_interleave_loading_and_analysis' is deprecated.
____Loading...
ERROR: /private/var/tmp/_bazel_psaville/33cf99881007ceae82889b09c83f121b/external/maven_prodx_libprodx/jar/BUILD:2:1: in //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect aspect on java_import rule @maven_prodx_libprodx//jar:jar: 
Traceback (most recent call last):
    File "/private/var/tmp/_bazel_psaville/33cf99881007ceae82889b09c83f121b/external/maven_prodx_libprodx/jar/BUILD", line 2
        //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect(...)
    File "/Users/psaville/.p2/pool/plugins/com.google.devtools.bazel.e4b_0.0.1.201604271316/resources/tools/must/be/unique/e4b_aspect.bzl", line 101, in _aspect_impl
        (java_rule_ide_info, java_ide_resol...) = java_rule_ide_info(target, ctx)
Variable 'java_rule_ide_info' is referenced before assignment. The variable is defined in the global scope..
ERROR: /private/var/tmp/_bazel_psaville/33cf99881007ceae82889b09c83f121b/external/maven_prodx_flags/jar/BUILD:2:1: in //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect aspect on java_import rule @maven_prodx_flags//jar:jar: 
Traceback (most recent call last):
    File "/private/var/tmp/_bazel_psaville/33cf99881007ceae82889b09c83f121b/external/maven_prodx_flags/jar/BUILD", line 2
        //tools/must/be/unique:e4b_aspect.bzl%e4b_aspect(...)
    File "/Users/psaville/.p2/pool/plugins/com.google.devtools.bazel.e4b_0.0.1.201604271316/resources/tools/must/be/unique/e4b_aspect.bzl", line 101, in _aspect_impl
        (java_rule_ide_info, java_ide_resol...) = java_rule_ide_info(target, ctx)
Variable 'java_rule_ide_info' is referenced before assignment. The variable is defined in the global scope..
ERROR: Analysis of aspect '/tools/must/be/unique/e4b_aspect.bzl%e4b_aspect of //example/java:ExampleServer' failed; build aborted.

Eclipse for bazel, how to run project?

Creating a bazel project according to https://bazel.build/versions/master/docs/tutorial/cpp.html works

Running "bazel build main:hello-world" in ~/project works with the output "hello world + time" in console

Importing the project into eclipse using "import bazel workspace" works

However, in elcipse menu, "Project/Build project" is greyed out.

Pressing the green run button does not run the application

Right clicking on the project and selecting "Run as" only gives the "run configuration" option with a greyed out run button

How to run and debug this application like normally when using eclipse CDT?

Error Installing

About Eclipse

Eclipse IDE for Java Developers
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600

Error upon installation

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Artifact not found: http://bazelbuild.github.io/e4b/p2updatesite/plugins/com.google.devtools.bazel.e4b_0.0.1.201604271311.jar.
http://bazelbuild.github.io/e4b/p2updatesite/plugins/com.google.devtools.bazel.e4b_0.0.1.201604271311.jar
Artifact not found: http://bazelbuild.github.io/e4b/p2updatesite/features/com.google.devtools.bazel.e4b.feature_0.0.1.201604271311.jar.
http://bazelbuild.github.io/e4b/p2updatesite/features/com.google.devtools.bazel.e4b.feature_0.0.1.201604271311.jar

New release?

Could we please have a new release? There are a couple of improvements which have gone in since the 0.0.2 release a year ago. It would be great to enjoy them.

AutoValue annotation processor support

I've added in my base BUILD a java_plugin definition to support compiling java rules with @autovalue support.
AutoValue github

I found this example that makes bazel build work:
Bazel AutoValue java_plugin example

I'm still using a setup-eclipse script that manages the project classpath for building etc. And everything has been working great as I add new external dependencies. I've been manually editing the e4b settings file as I need (only editing target? entries).

The problem is now, eclipse cannot understand the AutoValue generated class name, even though the bazel build successfully creates it. I suppose I could custom add a bazel-genfiles dependency manually?

Any ideas how to move forward with this?
Thanks.

How to use this plugin in Eclipse neon

I just followed the installation instructions, but cannot figure out how to use it in Eclipse neon. I don't see any difference after installing this plugin. And I cannot click build icon anymore after the installation. Can someone please provide a more detailed step by step instructions on how to use it? And also, the indexer in eclipse doesn't work.

Add more tests

This is a meta bug for the list of tests to add. Ping here if you are interested in contributing in unit testing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.