=UTF-8
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/.settings/org.eclipse.jdt.apt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.apt.aptEnabled=true
3 | org.eclipse.jdt.apt.genSrcDir=src-apt-generated
4 | org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
5 | org.eclipse.jdt.apt.reconcileEnabled=true
6 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | pluginProject.extensions=false
3 | resolve.requirebundle=false
4 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/README.md:
--------------------------------------------------------------------------------
1 | # Imported Source
2 |
3 | This project contains source code imported from Bazel and Bazel Intellij Plug-in.
4 | Both projects don't publish re-usable libraries.
5 | Therefore, we import the things we need manually.
6 |
7 | Where necessary, the code has been modified to prevent importing unneeded dependencies
8 |
9 | ## Important Settings
10 |
11 | This project does not follow the BEF project settings.
12 | Because the code is imported we do not want it to be processed (eg., formatted).
13 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/build.properties:
--------------------------------------------------------------------------------
1 | source.. = proto/src-proto-bazel/,\
2 | proto/src-proto-intellij/,\
3 | proto/src-proto-buildozer/,\
4 | src-bazel/,\
5 | src-intellij-plugin/
6 | output.. = bin/
7 | bin.includes = META-INF/,\
8 | .
9 | additional.bundles = com.google.guava,\
10 | org.jsr-305,\
11 | com.google.errorprone.annotations,\
12 | wrapped.com.google.auto.value.auto-value-annotations,\
13 | wrapped.com.google.auto.value.auto-value
14 |
15 | # as long as 'wrapped.com.google.auto.value.auto-value' is there on classpath Tycho produced the correct output (we don't need to include it in source)
16 | src.excludes = src-apt-generated/
17 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/README.md:
--------------------------------------------------------------------------------
1 | # Proto File
2 |
3 | This directory contains `.proto` files used in the Java SDK as well as the Eclipse plug-ins.
4 | When they change in their original repository, the need to be updated here.
5 |
6 | For convenience the generated Java code is checked into source control.
7 | Generators have been provided for Eclipse plugged into the *Run > External Tools* menu as shortcuts.
8 |
9 | * `intellij/intellij_ide_info.proto` [13287a2](https://github.com/bazelbuild/intellij/commits/37813e607ad26716c4d1ccf4bc3e7163b2188658/proto/intellij_ide_info.proto)
10 | * `intellij/common.proto` [46582ba](https://github.com/bazelbuild/intellij/commits/37813e607ad26716c4d1ccf4bc3e7163b2188658/proto/common.proto)
11 | * `bazel/build_event_stream.proto` and dependencies [be7458a](https://github.com/bazelbuild/bazel/blob/be7458ad7c96b590e9fdec4c3022b60bf8aa9d05/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto)
12 | * `buildozer/api.proto` [386244e](https://github.com/bazelbuild/buildtools/blob/386244e73fc446db36abd5bc9f291be7c79e2abd/api_proto/api.proto)
13 |
14 | ## Full Vendoring
15 |
16 | Note, for a easier build experience all dependencies have been included here.
17 | This requires updating `import` statements in the `proto` files when versioning them here.
18 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/bazel/java_compilation.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | // Java library manifest, for use by IDEs.
16 |
17 | syntax = "proto2";
18 |
19 | package blaze.buildjar;
20 |
21 | option java_package = "com.google.devtools.build.buildjar.proto";
22 |
23 | // Information about a single compilation unit (.java file)
24 | message CompilationUnit {
25 | // The path to the compilation unit
26 | optional string path = 1;
27 |
28 | // The package of the source file
29 | optional string pkg = 2;
30 |
31 | // Whether the source was generated by an annotation processor
32 | optional bool generated_by_annotation_processor = 3;
33 |
34 | // The list of top-level types in the compilation unit
35 | repeated string top_level = 4;
36 | }
37 |
38 | // Top-level message found in .manifest artifacts
39 | message Manifest {
40 | repeated CompilationUnit compilation_unit = 1;
41 | }
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/buildozer/api.proto:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Google Inc. All Rights Reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 | http://www.apache.org/licenses/LICENSE-2.0
7 | Unless required by applicable law or agreed to in writing, software
8 | distributed under the License is distributed on an "AS IS" BASIS,
9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | See the License for the specific language governing permissions and
11 | limitations under the License.
12 | */
13 | syntax = "proto3";
14 |
15 | package devtools.buildozer;
16 |
17 | option go_package = "api_proto";
18 |
19 | // https://github.com/bazelbuild/buildtools/pull/1193
20 | option java_package = "com.google.devtools.buildozer";
21 | option java_outer_classname = "BuildozerProtos";
22 |
23 | message Output {
24 | repeated Record records = 1;
25 | message Record {
26 | repeated Field fields = 1;
27 | message Field {
28 | oneof value {
29 | string text = 1;
30 | int32 number = 2;
31 | ERROR error = 3;
32 | RepeatedString list = 5;
33 | }
34 | // Used internally by Buildozer to decide whether a field should be quoted
35 | // when printing. This does not affect the contents of 'value'.
36 | bool quote_when_printing = 7;
37 |
38 | enum ERROR {
39 | UNKNOWN = 0;
40 | MISSING = 1;
41 | }
42 | }
43 | }
44 | }
45 |
46 | message RepeatedString {
47 | repeated string strings = 1;
48 | }
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/intellij/common.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package blaze;
18 |
19 | // option java_api_version = 2;
20 |
21 | option java_package = "com.google.devtools.intellij.aspect";
22 |
23 | message ArtifactLocation {
24 | string relative_path = 2;
25 | bool is_source = 3;
26 |
27 | // path from the execution root to the actual root:
28 | // exec_root + root_execution_path_fragment + relative_path = absolute_path
29 | string root_execution_path_fragment = 4;
30 | // whether this artifact comes from an external repository (bazel only)
31 | bool is_external = 5;
32 | }
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/protoc bazel.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/protoc buildozer.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/proto/protoc intellij_ide_info.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/annot/README.md:
--------------------------------------------------------------------------------
1 | # Starlark interface framework
2 |
3 | The classes in this package define annotations and interfaces used to enable
4 | Starlark access to data types and methods implemented in Java.
5 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/eval/JNI.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package net.starlark.java.eval;
16 |
17 | final class JNI {
18 | private JNI() {} // uninstantiable
19 |
20 | static void load() {
21 | try {
22 | System.loadLibrary("cpu_profiler");
23 | } catch (UnsatisfiedLinkError ex) {
24 | // Ignore, deferring the error until a C function is called, if ever.
25 | // Without this hack //src/test/shell/bazel:bazel_bootstrap_distfile_test
26 | // fails with an utterly uninformative error.
27 | // TODO(adonovan): remove try/catch once that test is fixed.
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/eval/NoneType.java:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package net.starlark.java.eval;
16 |
17 | import javax.annotation.concurrent.Immutable;
18 | import net.starlark.java.annot.StarlarkBuiltin;
19 |
20 | /** The type of the Starlark None value. */
21 | @StarlarkBuiltin(
22 | name = "NoneType",
23 | documented = false,
24 | doc = "The type of the Starlark None value.")
25 | @Immutable
26 | public final class NoneType implements StarlarkValue {
27 |
28 | static final NoneType NONE = new NoneType();
29 |
30 | private NoneType() {}
31 |
32 | @Override
33 | public String toString() {
34 | return "None";
35 | }
36 |
37 | @Override
38 | public boolean isImmutable() {
39 | return true;
40 | }
41 |
42 | @Override
43 | public boolean truth() {
44 | return false;
45 | }
46 |
47 | @Override
48 | public void repr(Printer printer) {
49 | printer.append("None");
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/eval/StarlarkIterable.java:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package net.starlark.java.eval;
16 |
17 | /**
18 | * A StarlarkIterable value may be iterated by Starlark language constructs such as {@code for}
19 | * loops, list and dict comprehensions, and {@code f(*args)}.
20 | *
21 | * Functionally this interface is equivalent to {@code java.lang.Iterable}, but it additionally
22 | * affirms that the iterability of a Java class should be exposed to Starlark programs.
23 | */
24 | public interface StarlarkIterable extends StarlarkValue, Iterable {}
25 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/eval/StarlarkMembershipTestable.java:
--------------------------------------------------------------------------------
1 | // Copyright 2024 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package net.starlark.java.eval;
16 |
17 | /**
18 | * A Starlark value that support membership tests ({@code key in object} and {@code key not in
19 | * object}).
20 | */
21 | public interface StarlarkMembershipTestable extends StarlarkValue {
22 | /** Returns whether the key is in the object. */
23 | boolean containsKey(StarlarkSemantics semantics, Object key) throws EvalException;
24 | }
25 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/syntax/Comment.java:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package net.starlark.java.syntax;
15 |
16 | /** Syntax node for comments. */
17 | public final class Comment extends Node {
18 |
19 | private final int offset;
20 | private final String text;
21 |
22 | Comment(FileLocations locs, int offset, String text) {
23 | super(locs);
24 | this.offset = offset;
25 | this.text = text;
26 | }
27 |
28 | /** Returns the text of the comment, including the leading '#' but not the trailing newline. */
29 | public String getText() {
30 | return text;
31 | }
32 |
33 | @Override
34 | public int getStartOffset() {
35 | return offset;
36 | }
37 |
38 | @Override
39 | public int getEndOffset() {
40 | return offset + text.length();
41 | }
42 |
43 | @Override
44 | public void accept(NodeVisitor visitor) {
45 | visitor.visit(this);
46 | }
47 |
48 | @Override
49 | public String toString() {
50 | return text;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-bazel/net/starlark/java/syntax/ExpressionStatement.java:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Bazel Authors. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package net.starlark.java.syntax;
16 |
17 | /** Syntax node for a statement consisting of an expression evaluated for effect. */
18 | public final class ExpressionStatement extends Statement {
19 |
20 | private final Expression expression;
21 |
22 | ExpressionStatement(FileLocations locs, Expression expression) {
23 | super(locs, Kind.EXPRESSION);
24 | this.expression = expression;
25 | }
26 |
27 | public Expression getExpression() {
28 | return expression;
29 | }
30 |
31 | @Override
32 | public void accept(NodeVisitor visitor) {
33 | visitor.visit(this);
34 | }
35 |
36 | @Override
37 | public int getStartOffset() {
38 | return expression.getStartOffset();
39 | }
40 |
41 | @Override
42 | public int getEndOffset() {
43 | return expression.getEndOffset();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/bazel/BazelBuildSystemProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package com.google.idea.blaze.base.bazel;
14 |
15 | import com.google.common.collect.ImmutableList;
16 | import com.google.idea.blaze.base.model.primitives.WorkspaceRoot;
17 |
18 | /** Provides the bazel build system name string. */
19 | public class BazelBuildSystemProvider implements BuildSystemProvider {
20 |
21 | public static final BazelBuildSystemProvider BAZEL = new BazelBuildSystemProvider();
22 |
23 | @Override
24 | public ImmutableList buildArtifactDirectories(WorkspaceRoot root) {
25 | var rootDirName = root.directory().getFileName().toString();
26 | return ImmutableList.of("bazel-bin", "bazel-genfiles", "bazel-out", "bazel-testlogs", "bazel-" + rootDirName);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/bazel/BuildSystemProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package com.google.idea.blaze.base.bazel;
14 |
15 | import com.google.common.collect.ImmutableList;
16 | import com.google.idea.blaze.base.model.primitives.WorkspaceRoot;
17 |
18 | /**
19 | * Extension points specify the build systems supported by this plugin.
20 | * The order of the extension points establishes a priority (highest priority first), for situations where we don't have
21 | * an existing project to use for context (e.g. the 'import project' action).
22 | *
23 | *
24 | * Note, the Eclipse plug-in and language server only supports Bazel. Therefore, this interface is a stripped down
25 | * version of the IJ one with only the things needed.
26 | *
27 | */
28 | public interface BuildSystemProvider {
29 |
30 | /** Directories containing artifacts produced during the build process. */
31 | ImmutableList buildArtifactDirectories(WorkspaceRoot root);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/command/buildresult/OutputArtifact.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package com.google.idea.blaze.base.command.buildresult;
14 |
15 | /** A blaze output artifact, generated during some build action. */
16 | public interface OutputArtifact extends BlazeArtifact {
17 |
18 | /** The path component related to the build configuration. */
19 | String getConfigurationMnemonic();
20 |
21 | /** The blaze-out-relative path. */
22 | String getRelativePath();
23 | }
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/ideinfo/Tags.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.google.idea.blaze.base.ideinfo;
17 |
18 | /** Tag constants used by our rules. */
19 | public final class Tags {
20 | /** Forces import of the target output. */
21 | public static final String TARGET_TAG_IMPORT_TARGET_OUTPUT = "intellij-import-target-output";
22 |
23 | public static final String TARGET_TAG_IMPORT_AS_LIBRARY_LEGACY = "aswb-import-as-library";
24 |
25 | /**
26 | * Signals to the import process that the output of this rule will be provided by the IntelliJ
27 | * SDK.
28 | */
29 | public static final String TARGET_TAG_PROVIDED_BY_SDK = "intellij-provided-by-sdk";
30 |
31 | /** Ignores the target. */
32 | public static final String TARGET_TAG_EXCLUDE_TARGET = "intellij-exclude-target";
33 | }
34 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/model/primitives/InvalidTargetException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package com.google.idea.blaze.base.model.primitives;
14 |
15 | /** A checked exception thrown when a {@link TargetExpression} cannot be parsed. */
16 | public class InvalidTargetException extends Exception {
17 |
18 | private static final long serialVersionUID = 1608607306078549547L;
19 |
20 | public InvalidTargetException(String message) {
21 | super(message);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/google/idea/blaze/base/model/primitives/RuleType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The Bazel Authors. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package com.google.idea.blaze.base.model.primitives;
14 |
15 | /** The general type of a rule (e.g. test, binary, etc.). */
16 | public enum RuleType {
17 | TEST, BINARY, LIBRARY, UNKNOWN,
18 | }
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/intellij/openapi/util/io/FileUtil.java:
--------------------------------------------------------------------------------
1 | package com.intellij.openapi.util.io;
2 |
3 | import static org.eclipse.core.runtime.IPath.SEPARATOR;
4 | import static org.eclipse.core.runtime.IPath.forPosix;
5 |
6 | import java.io.File;
7 |
8 | /**
9 | * This is not a copy but re-implemented to avoid changing too much of Bazel IJ plug-in code.
10 | */
11 | public class FileUtil {
12 |
13 | private static final boolean notPosix = File.separatorChar != SEPARATOR;
14 |
15 | /**
16 | * Indicates if the given path is within the ancestor.
17 | *
18 | * Note, comparison will be done entirely based on Posix
19 | *
20 | * @param ancestor
21 | * @param path
22 | * @param strict
23 | * @return
24 | */
25 | public static boolean isAncestor(String ancestor, String path, boolean strict) {
26 | // ignore strict
27 | if(notPosix) {
28 | ancestor = ancestor.replace(File.separatorChar, SEPARATOR);
29 | path = path.replace(File.separatorChar, SEPARATOR);
30 | }
31 | return forPosix(ancestor).isPrefixOf(forPosix(path));
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.importedsource/src-intellij-plugin/com/intellij/openapi/util/text/StringUtil.java:
--------------------------------------------------------------------------------
1 | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found
2 | // in the LICENSE file.
3 | package com.intellij.openapi.util.text;
4 |
5 | /**
6 | * Minimalistic version of the very long official one.
7 | */
8 | public class StringUtil {
9 |
10 | public static String trimEnd(String s, String suffix) {
11 | if (s.endsWith(suffix)) {
12 | return s.substring(0, s.length() - suffix.length());
13 | }
14 | return s;
15 | }
16 |
17 | public static String trimStart(String s, String prefix) {
18 | if (s.startsWith(prefix)) {
19 | return s.substring(prefix.length());
20 | }
21 | return s;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.logback
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Logback Configuration for Bazel Eclipse Feature
4 | Bundle-SymbolicName: com.salesforce.bazel.logback
5 | Bundle-Version: 1.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Fragment-Host: ch.qos.logback.classic;bundle-version="1.4.11"
8 | Automatic-Module-Name: com.salesforce.bazel.logback
9 | Bundle-RequiredExecutionEnvironment: JavaSE-21
10 | Require-Bundle: org.eclipse.core.runtime
11 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/META-INF/services/ch.qos.logback.classic.spi.Configurator:
--------------------------------------------------------------------------------
1 | com.salesforce.bazel.logback.configuration.BazelLogbackConfigurator
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.logback/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | defaultLogbackConfiguration/,\
6 | p2.inf
7 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.scipls
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | pluginProject.extensions=true
3 | resolve.requirebundle=false
4 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: SCIP based Language Server for Java and Bazel
4 | Bundle-SymbolicName: com.salesforce.bazel.scipls;singleton:=true
5 | Bundle-Version: 1.0.0.qualifier
6 | Bundle-Activator: com.salesforce.bazel.scipls.BazelScipLsPlugin
7 | Bundle-Vendor: Bazel Eclipse Feature
8 | Bundle-RequiredExecutionEnvironment: JavaSE-21
9 | Automatic-Module-Name: com.salesforce.bazel.eclipse.scipls
10 | Import-Package: org.osgi.framework;version="1.3.0",
11 | org.slf4j;version="2.0.0"
12 | Require-Bundle: org.eclipse.core.runtime;bundle-version="3.31.100",
13 | org.eclipse.lsp4j;bundle-version="0.23.1",
14 | org.eclipse.lsp4j.jsonrpc;bundle-version="0.23.1",
15 | com.salesforce.bazel.sdk;bundle-version="2.0.0",
16 | com.salesforce.bazel.importedsource;bundle-version="2.0.0"
17 | Bundle-ActivationPolicy: lazy
18 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | plugin.xml
6 | additional.bundles = com.google.guava,\
7 | com.google.guava.failureaccess,\
8 | wrapped.com.sourcegraph.semanticdb-java,\
9 | wrapped.com.sourcegraph.scip-java-proto,\
10 | wrapped.com.sourcegraph.scip-java_2.13,\
11 | wrapped.com.sourcegraph.scip-semanticdb
12 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
12 |
14 |
15 |
16 |
17 |
20 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.scipls/src/com/salesforce/bazel/scipls/BazelScipLsPlugin.java:
--------------------------------------------------------------------------------
1 | /*-
2 | *
3 | */
4 | package com.salesforce.bazel.scipls;
5 |
6 | import static java.util.Objects.requireNonNull;
7 |
8 | import org.eclipse.core.runtime.Plugin;
9 | import org.osgi.framework.BundleContext;
10 |
11 | /**
12 | * Plug-in (OSGi bundle) activator for SCIP bases Java LS.
13 | */
14 | public class BazelScipLsPlugin extends Plugin {
15 |
16 | private static BazelScipLsPlugin plugin;
17 |
18 | public static BazelScipLsPlugin getInstance() {
19 | return requireNonNull(plugin, "not initialized");
20 | }
21 |
22 | @Override
23 | public void start(BundleContext bundleContext) throws Exception {
24 | super.start(bundleContext);
25 | plugin = this;
26 | }
27 |
28 | @Override
29 | public void stop(BundleContext context) throws Exception {
30 | plugin = null;
31 | super.stop(context);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.options:
--------------------------------------------------------------------------------
1 | com.salesforce.bazel.sdk/debugLog=true
2 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.sdk
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.xtext.ui.shared.xtextBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.ManifestBuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.pde.SchemaBuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.jdt.core.javanature
31 | org.eclipse.pde.PluginNature
32 | org.eclipse.xtext.ui.shared.xtextNature
33 |
34 |
35 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/Import InteliJ Aspects.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/de.loskutov.anyedit.AnyEditTools.prefs:
--------------------------------------------------------------------------------
1 | activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF,.project,*.yml
2 | addNewLine=true
3 | convertActionOnSaave=AnyEdit.CnvrtSpacesToTabs
4 | eclipse.preferences.version=1
5 | fixLineDelimiters=false
6 | ignoreBlankLinesWhenTrimming=false
7 | inActiveContentFilterList=
8 | javaTabWidthForJava=true
9 | org.eclipse.jdt.ui.editor.tab.width=4
10 | projectPropsEnabled=true
11 | removeTrailingSpaces=true
12 | replaceAllSpaces=false
13 | replaceAllTabs=false
14 | saveAndAddLine=false
15 | saveAndConvert=false
16 | saveAndFixLineDelimiters=false
17 | saveAndTrim=true
18 | useModulo4Tabs=false
19 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/org.moreunit.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.moreunit.core.anyLanguage.active=true
3 | org.moreunit.core.anyLanguage.srcFolderPathTemplate=${srcProject}
4 | org.moreunit.core.anyLanguage.testFileNameTemplate=${srcFile}(Test|Spec)
5 | org.moreunit.core.anyLanguage.testFolderPathTemplate=${srcProject}.tests
6 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/.settings/org.moreunit.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.moreunit.preferences.version=2
3 | org.moreunit.test_type=junit5
4 | org.moreunit.unitsourcefolder=com.salesforce.bazel.sdk\:src\:com.salesforce.bazel.sdk.tests\:src
5 | org.moreunit.useprojectsettings=true
6 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/README.md:
--------------------------------------------------------------------------------
1 | # Bazel Java SDK and IntelliJ Helpers
2 |
3 | This directory contains the Bazel Java SDK, which is a general purpose Java library for building tools on top of Bazel in the Java programming language.
4 | It implements a number of Bazel helpers and tools, including:
5 |
6 | - Bazel commands and and executors to run Bazel processes and process outputs
7 | - Protobuf `proto` files and generated source
8 | - IntelliJ Aspects for extracting IDE information from Bazel and related Java code
9 | - Bazel primitives (also extracted from IntelliJ Bazel plug-in)
10 |
11 | The SDK will is a helpful library.
12 | It's not intended to be an abstraction for writing IDE agnostic models/code.
13 | At some point we should discuss with the Bazel IntelliJ folks if a common library can be extracted from their plug-in to be reused by BEF as well.
14 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/README.md:
--------------------------------------------------------------------------------
1 | ## IntelliJ Aspects
2 |
3 | The file contained in this directory is used at runtime within the Bazel Java SDK.
4 | It injects a [Bazel Aspect](https://docs.bazel.build/versions/master/skylark/aspects.html) into each Bazel build.
5 |
6 | It is developed by the Bazel IntelliJ plugin team, and we copy it into Bazel SDK from time to time.
7 |
8 | ### Updating from IntelliJ
9 |
10 | The update is a bit automated.
11 |
12 | 1. Grab the Git SHA you want to update to from [here](https://github.com/bazelbuild/intellij/commits/master/aspect)
13 | 2. Update `import/import-and-build.sh` with the SHA.
14 | 3. Run `import/import-and-build.sh` (` cd import && ./import-and-build.sh`)
15 | 4. Update [IntelliJAspects.java](../src/main/java/com/salesforce/bazel/sdk/aspects/intellij/IntellijAspects.java) to point to the new `aspects-.zip` file
16 |
17 | ### Notes
18 |
19 | Depending on the changes upstream you have to do quite some work to get it back going.
20 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/import/.bazelignore:
--------------------------------------------------------------------------------
1 | intellij/
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/import/.bazelversion:
--------------------------------------------------------------------------------
1 | 8.1.1
2 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/import/.gitignore:
--------------------------------------------------------------------------------
1 | # external repo and outputs
2 | intellij*
3 | aspect_*.jar
4 |
5 | # bazel symlinks
6 | bazel-*
7 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/import/MODULE.bazel:
--------------------------------------------------------------------------------
1 | module(
2 | name = "intellij_aspects_import",
3 | bazel_compatibility = [">=8.1.0"],
4 | )
5 |
6 | bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
7 | bazel_dep(name = "bazel_skylib", version = "1.7.1")
8 | bazel_dep(name = "rules_pkg", version = "1.1.0")
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/aspects/import/import-and-build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | # use proper tar
5 | if [ "$(uname)" == "Darwin" ]; then
6 | tar="gtar"
7 | else
8 | tar="tar"
9 | fi
10 | echo "Using '$tar' on $(uname)!"
11 |
12 | if ! command -v $tar &> /dev/null; then
13 | echo "$tar could not be found"
14 | echo "On macOS: brew install gnu-tar"
15 | echo "Also, check PATH environment: $PATH"
16 | exit 1
17 | fi
18 |
19 | # download & extract
20 | #
21 | # Note, wehn updating:
22 | # 1. replace the hash with the one you want to update to
23 | # 2. check WORKSPACE for any repo that needs updates
24 | #
25 | git_sha="1e99c447ee9af21d984df10ca085dadd37feba9b"
26 | git_sha_short=${git_sha::6}
27 |
28 | # abort if file already exists
29 | if test -f "../aspects-${git_sha_short}.zip"; then
30 | echo "aspects-${git_sha_short}.zip already there; delete it force re-import"
31 | exit 0
32 | fi
33 |
34 | # clean-up old left overs
35 | rm -rf bazel-*
36 | rm -rf intellij*
37 | rm -f aspect_*.jar
38 |
39 | # ensure directory exists
40 | mkdir -p intellij
41 |
42 | # download repo
43 | curl -L https://github.com/bazelbuild/intellij/archive/${git_sha}.tar.gz | ${tar} --strip-components 1 -C intellij -xz
44 |
45 | # build the aspects
46 | pushd intellij > /dev/null
47 | bazel build //aspect:all
48 | popd > /dev/null
49 |
50 | # generate tarball
51 | cp intellij/bazel-bin/aspect/aspect_lib.jar .
52 | cp intellij/bazel-bin/aspect/aspect_template_lib.jar .
53 | bazel build :aspects
54 |
55 | # copy to location
56 | cp -vf bazel-bin/aspects.zip ../aspects-${git_sha_short}.zip
57 |
58 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = .,\
4 | META-INF/,\
5 | plugin.properties,\
6 | aspects/aspects-*.zip
7 | additional.bundles = com.salesforce.bazel.importedsource,\
8 | com.google.guava,\
9 | com.google.guava.failureaccess
10 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/plugin.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/bundles/com.salesforce.bazel.sdk/plugin.properties
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/BazelJavaSdkPlugin.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk;
2 |
3 | import static java.util.Objects.requireNonNull;
4 |
5 | import org.eclipse.core.runtime.Plugin;
6 | import org.osgi.framework.BundleContext;
7 |
8 | public class BazelJavaSdkPlugin extends Plugin {
9 |
10 | private static String bundleVersion;
11 |
12 | public static String getBundleVersion() {
13 | return requireNonNull(bundleVersion,
14 | "Bundle version not initialized. If this is not running inside OSGi please implement support for an alternate way. Otherwise please ensure the SDK bundle is started properly.");
15 | }
16 |
17 | @Override
18 | public void start(BundleContext context) throws Exception {
19 | super.start(context);
20 | bundleVersion = context.getBundle().getVersion().toString();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/BazelBinary.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command;
2 |
3 | import static java.util.Objects.requireNonNull;
4 |
5 | import java.nio.file.Path;
6 |
7 | import com.salesforce.bazel.sdk.BazelVersion;
8 |
9 | /**
10 | * Record of a Bazel binary to use.
11 | */
12 | public record BazelBinary(Path executable, BazelVersion bazelVersion) {
13 |
14 | public BazelBinary(Path executable, BazelVersion bazelVersion) {
15 | this.executable = requireNonNull(executable, "executable must not be null");
16 | this.bazelVersion = requireNonNull(bazelVersion, "bazelVersion must not be null");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/BazelCQueryCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command;
2 |
3 | import java.nio.file.Path;
4 |
5 | /**
6 | * bazel cquery
7 | *
8 | * Uses --query_file
to avoid escaping issues with the query.
9 | *
10 | *
11 | * @param
12 | * the query output result
13 | */
14 | public abstract class BazelCQueryCommand extends BazelQueryCommand {
15 |
16 | public BazelCQueryCommand(Path workspaceRoot, String query, boolean keepGoing, String purpose) {
17 | super(QueryCommand.cquery, workspaceRoot, query, keepGoing, purpose);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/BazelQueryForLabelsCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command;
2 |
3 | import static java.nio.file.Files.createTempFile;
4 | import static java.nio.file.Files.readAllLines;
5 |
6 | import java.io.IOException;
7 | import java.nio.file.Path;
8 | import java.util.Collection;
9 | import java.util.List;
10 |
11 | import com.salesforce.bazel.sdk.BazelVersion;
12 |
13 | /**
14 | * bazel query --output label
15 | */
16 | public class BazelQueryForLabelsCommand extends BazelQueryCommand> {
17 |
18 | public BazelQueryForLabelsCommand(Path workspaceRoot, String query, boolean keepGoing, String purpose) {
19 | super(workspaceRoot, query, keepGoing, purpose);
20 | setCommandArgs("--output", "label");
21 | }
22 |
23 | @Override
24 | protected Collection doGenerateResult() throws IOException {
25 | return readAllLines(getStdOutFile());
26 | }
27 |
28 | @Override
29 | public List prepareCommandLine(BazelVersion bazelVersion) throws IOException {
30 | // redirect output to file for parsing
31 | var stdoutFile = createTempFile("bazel_query_stdout_", ".bin");
32 | setRedirectStdOutToFile(stdoutFile);
33 |
34 | // prepare regular query command line
35 | return super.prepareCommandLine(bazelVersion);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/BazelQueryForPackagesCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command;
2 |
3 | import static java.nio.file.Files.createTempFile;
4 | import static java.nio.file.Files.readAllLines;
5 |
6 | import java.io.IOException;
7 | import java.nio.file.Path;
8 | import java.util.Collection;
9 | import java.util.List;
10 |
11 | import com.salesforce.bazel.sdk.BazelVersion;
12 |
13 | /**
14 | * bazel query --output package
15 | */
16 | public class BazelQueryForPackagesCommand extends BazelQueryCommand> {
17 |
18 | public BazelQueryForPackagesCommand(Path workspaceRoot, String query, boolean keepGoing, String purpose) {
19 | super(workspaceRoot, query, keepGoing, purpose);
20 | setCommandArgs("--output", "package");
21 | }
22 |
23 | @Override
24 | protected Collection doGenerateResult() throws IOException {
25 | return readAllLines(getStdOutFile());
26 | }
27 |
28 | @Override
29 | public List prepareCommandLine(BazelVersion bazelVersion) throws IOException {
30 | // redirect output to file for parsing
31 | var stdoutFile = createTempFile("bazel_query_stdout_", ".bin");
32 | setRedirectStdOutToFile(stdoutFile);
33 |
34 | // prepare regular query command line
35 | return super.prepareCommandLine(bazelVersion);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/querylight/Attribute.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2024 Salesforce and others.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License 2.0
6 | * which accompanies this distribution, and is available at
7 | * https://www.eclipse.org/legal/epl-2.0/
8 | *
9 | * SPDX-License-Identifier: EPL-2.0
10 | *
11 | * Contributors:
12 | * Salesforce - adapted from M2E, JDT or other Eclipse project
13 | */
14 | package com.salesforce.bazel.sdk.command.querylight;
15 |
16 | import java.util.List;
17 |
18 | import com.google.devtools.build.lib.query2.proto.proto2api.Build;
19 | import com.google.devtools.build.lib.query2.proto.proto2api.Build.Attribute.Discriminator;
20 |
21 | /**
22 | * Internal representation of a Bazel Attribute. Used to capture only required data to reduce memory footprint
23 | */
24 | public record Attribute(String stringValue, List stringListValue, boolean booleanValue, Discriminator type) {
25 |
26 | Attribute(Build.Attribute from) {
27 | this(from.getStringValue(), from.getStringListValueList(), from.getBooleanValue(), from.getType());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/querylight/BazelRuleAttribute.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2024 Salesforce and others.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License 2.0
6 | * which accompanies this distribution, and is available at
7 | * https://www.eclipse.org/legal/epl-2.0/
8 | *
9 | * SPDX-License-Identifier: EPL-2.0
10 | *
11 | * Contributors:
12 | * Salesforce - adapted from M2E, JDT or other Eclipse project
13 | */
14 | package com.salesforce.bazel.sdk.command.querylight;
15 |
16 | import java.util.Arrays;
17 | import java.util.Set;
18 | import java.util.stream.Collectors;
19 |
20 | /**
21 | * Rule attribute names we depend on during sync
22 | */
23 | public enum BazelRuleAttribute {
24 |
25 | SRCS("srcs"),
26 | EXPORTS("exports"),
27 | TEST_ONLY("testonly"),
28 | JAVAC_OPTS("javacopts"),
29 | RESOURCES("resources"),
30 | RESOURCES_STRIP_PREFIX("resource_strip_prefix"),
31 | STRIP_PREFIX("strip_prefix"),
32 | PLUGINS("plugins"),
33 | JARS("jars"),
34 | SRC_JAR("srcjar"),
35 | TAGS("tags"),
36 | NAME("name"),
37 | VISIBILITY("visibility"),
38 | PATH("path"),
39 | DEPS("deps");
40 |
41 | public static final Set KNOWN_ATTRIBUTES =
42 | Arrays.stream(BazelRuleAttribute.values()).map(attr -> attr.key).collect(Collectors.toSet());
43 |
44 | public final String key;
45 |
46 | BazelRuleAttribute(String key) {
47 | this.key = key;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/querylight/GeneratedFile.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2024 Salesforce and others.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License 2.0
6 | * which accompanies this distribution, and is available at
7 | * https://www.eclipse.org/legal/epl-2.0/
8 | *
9 | * SPDX-License-Identifier: EPL-2.0
10 | *
11 | * Contributors:
12 | * Salesforce - adapted from M2E, JDT or other Eclipse project
13 | */
14 | package com.salesforce.bazel.sdk.command.querylight;
15 |
16 | import com.google.devtools.build.lib.query2.proto.proto2api.Build;
17 |
18 | /**
19 | * Internal representation of a Bazel GeneratedFile. Used to capture only required data to reduce memory footprint
20 | */
21 | public record GeneratedFile(String name, String generatingRule) {
22 |
23 | GeneratedFile(Build.GeneratedFile file) {
24 | this(file.getName(), file.getGeneratingRule());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/command/querylight/Target.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2024 Salesforce and others.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License 2.0
6 | * which accompanies this distribution, and is available at
7 | * https://www.eclipse.org/legal/epl-2.0/
8 | *
9 | * SPDX-License-Identifier: EPL-2.0
10 | *
11 | * Contributors:
12 | * Salesforce - adapted from M2E, JDT or other Eclipse project
13 | */
14 | package com.salesforce.bazel.sdk.command.querylight;
15 |
16 | import com.google.devtools.build.lib.query2.proto.proto2api.Build;
17 |
18 | /**
19 | * Internal representation of a Bazel target. Used to capture only required data to reduce memory footprint
20 | */
21 | public record Target(Rule rule, GeneratedFile generatedFile) {
22 | public Target(Build.Target from) {
23 | this(new Rule(from.getRule()), from.hasGeneratedFile() ? new GeneratedFile(from.getGeneratedFile()) : null);
24 | }
25 |
26 | public boolean hasRule() {
27 | return rule != null;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/util/DurationUtil.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2024 Salesforce and others.
3 | *
4 | * All rights reserved. This program and the accompanying materials
5 | * are made available under the terms of the Eclipse Public License 2.0
6 | * which accompanies this distribution, and is available at
7 | * https://www.eclipse.org/legal/epl-2.0/
8 | *
9 | * SPDX-License-Identifier: EPL-2.0
10 | *
11 | * Contributors:
12 | * Salesforce - adapted from M2E, JDT or other Eclipse project
13 | */
14 | package com.salesforce.bazel.sdk.util;
15 |
16 | import java.time.Duration;
17 | import java.time.temporal.ChronoUnit;
18 |
19 | /**
20 | * Utility for {@link Duration}
21 | */
22 | public class DurationUtil {
23 |
24 | public static String humanReadableFormat(Duration duration) {
25 | return duration.truncatedTo(ChronoUnit.MILLIS)
26 | .toString()
27 | .substring(2)
28 | .replaceAll("(\\d[HMS])(?!$)", "$1 ")
29 | .toLowerCase();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/bundles/com.salesforce.bazel.sdk/src/com/salesforce/bazel/sdk/util/SystemUtil.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.util;
2 |
3 | /**
4 | * A utility for system level items.
5 | */
6 | public class SystemUtil {
7 |
8 | private static final SystemUtil instance = new SystemUtil();
9 |
10 | public static final SystemUtil getInstance() {
11 | return instance;
12 | }
13 |
14 | public String getOs() {
15 | return System.getProperty("os.name").toLowerCase();
16 | }
17 |
18 | public boolean isMac() {
19 | return getOs().indexOf("mac") >= 0;
20 | }
21 |
22 | public boolean isUnix() {
23 | var os = getOs();
24 | return (os.indexOf("nix") >= 0) || (os.indexOf("nux") >= 0) || (os.indexOf("aix") > 0);
25 | }
26 |
27 | public boolean isWindows() {
28 | return getOs().indexOf("win") >= 0;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/bundles/testdata/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/bundles/testdata/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | testdata
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bundles/testdata/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/bundles/testdata/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/bundles/testdata/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/bundles/testdata/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Bazel Eclipe Test Data Plug-in (only for testing, never deploy!!!)
4 | Bundle-SymbolicName: testdata
5 | Bundle-Version: 1.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Automatic-Module-Name: testdata
8 | Bundle-RequiredExecutionEnvironment: JavaSE-21
9 | Eclipse-BundleShape: dir
10 | Export-Package: testdata;x-friends:="com.salesforce.bazel.eclipse.core.tests,com.salesforce.bazel.eclipse.jdtls.tests,com.salesforce.bazel.eclipse.ui.tests",
11 | testdata.utils
12 | Import-Package: org.hamcrest;version="2.2.0",
13 | org.hamcrest.collection;version="2.2.0",
14 | org.junit.jupiter.api;version="5.9.2",
15 | org.junit.jupiter.api.extension;version="5.9.2",
16 | org.junit.jupiter.api.io;version="5.9.2",
17 | org.slf4j;version="1.7.30"
18 | Require-Bundle: org.eclipse.core.runtime;bundle-version="3.26.100",
19 | org.eclipse.core.resources;bundle-version="3.18.200",
20 | com.salesforce.bazel.sdk;bundle-version="2.0.0",
21 | com.salesforce.bazel.eclipse.core;bundle-version="2.0.0"
22 |
--------------------------------------------------------------------------------
/bundles/testdata/README.md:
--------------------------------------------------------------------------------
1 | # Test Data
2 |
3 | Special bundle to be used by tests.
4 | The bundle contains test workspaces and API to provision them.
5 | It's intended to be used by tests.
6 |
--------------------------------------------------------------------------------
/bundles/testdata/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .,\
5 | workspaces/
6 | additional.bundles = junit-jupiter-api,\
7 | org.hamcrest
8 |
--------------------------------------------------------------------------------
/bundles/testdata/src/testdata/SharedTestData.java:
--------------------------------------------------------------------------------
1 | package testdata;
2 |
3 | import org.eclipse.core.runtime.IPath;
4 | import org.eclipse.core.runtime.Path;
5 |
6 | /**
7 | * Convenience access to shared test data
8 | */
9 | public interface SharedTestData {
10 |
11 | String WORKSPACE_001 = "/workspaces/001";
12 |
13 | IPath BAZELPROJECT_FILE = new Path(".bazelproject");
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/.bazelproject:
--------------------------------------------------------------------------------
1 | # The project view file (.bazelproject) is used to import targets into the IDE.
2 | #
3 | # See: https://ij.bazel.build/docs/project-views.html
4 | #
5 | # This files provides a default experience for developers working with the project
6 |
7 |
8 | directories:
9 | .
10 | module1
11 | module2
12 | module3
13 | -not_visible
14 |
15 | derive_targets_from_directories: true
16 |
17 | java_language_level: 11
18 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse metadata
2 | .classpath
3 | .project
4 | .settings/
5 | .eclipse/
6 |
7 | # Bazel folder
8 | /bazel-*
9 |
10 | # ignore the Bazel version file
11 | .bazelversion
12 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/WORKSPACE:
--------------------------------------------------------------------------------
1 | workspace(name = "testdata_workspaces_001")
2 |
3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4 |
5 | # bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0)
6 | skylib_version = "0.8.0"
7 | http_archive(
8 | name = "bazel_skylib",
9 | type = "tar.gz",
10 | url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version),
11 | sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
12 | )
13 |
14 | # check minimum Bazel version
15 | load("@bazel_skylib//lib:versions.bzl", "versions")
16 | versions.check(minimum_bazel_version= "5.0.0")
17 |
18 | http_archive(
19 | name = "salesforce_rules_mybuilder",
20 | url = "https://github.com/salesforce/bazel-java-builder-template/archive/c443e2391ff547c01f5ca3f14a1e84d85c13d16d.zip",
21 | strip_prefix = "bazel-java-builder-template-c443e2391ff547c01f5ca3f14a1e84d85c13d16d",
22 | sha256 = "8e0aac87c235744884161e69346d6a6d3d729ef8072e33a9883fbb27735d01d8",
23 | )
24 |
25 | load("@salesforce_rules_mybuilder//mybuilder:repositories.bzl", "rules_mybuilder_dependencies", "rules_mybuilder_toolchains")
26 | rules_mybuilder_dependencies()
27 | rules_mybuilder_toolchains()
28 |
29 | # Maven dependencies
30 | load("//third_party/maven:dependencies.bzl", "maven_dependencies")
31 | maven_dependencies()
32 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module1/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_binary")
2 | load("@salesforce_rules_mybuilder//mybuilder:defs.bzl", "mybuilder_gen_java_library")
3 |
4 | filegroup(
5 | name = "mybuilder_input",
6 | srcs = glob(
7 | [
8 | "java/resources/**/*.txt",
9 | ],
10 | ),
11 | )
12 |
13 | filegroup(
14 | name = "module1_sources",
15 | srcs = glob(
16 | [
17 | "java/src/**/*.java",
18 | ],
19 | ),
20 | )
21 |
22 | mybuilder_gen_java_library(
23 | name = "mybuilder_sources",
24 | srcs = [":mybuilder_input"],
25 | )
26 |
27 |
28 | java_binary(
29 | name = "module1",
30 | srcs = [
31 | "module1_sources",
32 | ],
33 | resources = [":mybuilder_input"],
34 | deps = [
35 | "//module2",
36 | "//module3",
37 | "@com_google_guava//jar",
38 | "mybuilder_sources",
39 | ],
40 | main_class = "hello.Hello",
41 | )
42 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module1/java/resources/hello.txt:
--------------------------------------------------------------------------------
1 | Hi there!
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module1/java/src/hello/Hello.java:
--------------------------------------------------------------------------------
1 | package hello;
2 |
3 | import library.Greeting;
4 |
5 | import log.Logger;
6 |
7 | import java.util.List;
8 |
9 | import com.google.common.collect.Lists;
10 | import com.google.common.collect.Iterables;
11 |
12 |
13 |
14 | public class Hello {
15 |
16 |
17 | public static void main(String[] args) {
18 | Logger.logDebug("Hello.main");
19 |
20 | Greeting greeter = new Greeting();
21 | System.out.println(new mybuilder_sources.MybuilderSources());
22 |
23 | List modules = Lists.newArrayList("module1", "module2");
24 |
25 | Iterable result = Iterables.transform(modules, greeter::greet);
26 |
27 | result.forEach(System.out::println);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module2/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_library")
2 |
3 | java_library (
4 | name = "module2",
5 | srcs = glob(["java/src/**/*.java"]),
6 | visibility = ["//module1:__pkg__"],
7 | deps = [
8 | "//module3",
9 | "@org_apache_commons_commons_lang3"
10 | ]
11 | )
12 |
13 | java_test(
14 | name = "module2-test",
15 | srcs = ["java/test/library/GreetingTest.java"],
16 | test_class = "library.GreetingTest",
17 | deps = [
18 | "module2",
19 | "@junit//jar",
20 | ],
21 | )
22 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module2/java/src/library/Greeting.java:
--------------------------------------------------------------------------------
1 | package library;
2 |
3 | import log.Logger;
4 |
5 | public class Greeting {
6 |
7 | public String greet(String name) {
8 | Logger.logDebug("Greeting.greet");
9 | return "Hello ".concat(name);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module2/java/test/library/GreetingTest.java:
--------------------------------------------------------------------------------
1 | package library;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class GreetingTest {
7 | @Test
8 | public void testGreet() {
9 | Assert.assertEquals("Hello JUnit", new Greeting().greet("JUnit"));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module3/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_library")
2 |
3 | java_library (
4 | name = "module3",
5 | srcs = glob(["java/src/**/*.java"]),
6 | visibility = ["//module1:__pkg__", "//module2:__pkg__"]
7 | )
8 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/module3/java/src/log/Logger.java:
--------------------------------------------------------------------------------
1 | package log;
2 |
3 | import java.time.Instant;
4 |
5 | public final class Logger {
6 |
7 | private Logger() {
8 | throw new RuntimeException();
9 | }
10 |
11 | public static void logDebug(String message) {
12 | String output = String.format("[DEBUG] %s", message);
13 | System.out.println(output);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/not_visible/this_should_not_be_seen_in_Eclipse.txt:
--------------------------------------------------------------------------------
1 | The project view is configured to exclude this folder.
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/third_party/maven/BUILD:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/bundles/testdata/workspaces/001/third_party/maven/BUILD
--------------------------------------------------------------------------------
/bundles/testdata/workspaces/001/third_party/maven/dependencies.bzl:
--------------------------------------------------------------------------------
1 | load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
2 |
3 | def maven_dependencies(
4 | maven_servers = ["https://repo1.maven.org/maven2/"]):
5 |
6 | jvm_maven_import_external(
7 | name = "com_google_guava",
8 | artifact = "com.google.guava:guava:28.2-jre",
9 | artifact_sha256 = "fc3aa363ad87223d1fbea584eee015a862150f6d34c71f24dc74088a635f08ef",
10 | fetch_sources = True,
11 | licenses = ["notice"],
12 | server_urls = maven_servers,
13 | )
14 |
15 | jvm_maven_import_external(
16 | name = "junit",
17 | artifact = "junit:junit:4.13",
18 | artifact_sha256 = "4b8532f63bdc0e0661507f947eb324a954d1dbac631ad19c8aa9a00feed1d863",
19 | fetch_sources = True,
20 | licenses = ["notice"],
21 | server_urls = maven_servers,
22 | )
23 |
24 | jvm_maven_import_external(
25 | name = "org_apache_commons_commons_lang3",
26 | artifact = "org.apache.commons:commons-lang3:jar:3.12.0",
27 | artifact_sha256 = "d919d904486c037f8d193412da0c92e22a9fa24230b9d67a57855c5c31c7e94e",
28 | fetch_sources = True,
29 | licenses = ["notice"],
30 | server_urls = maven_servers,
31 | )
--------------------------------------------------------------------------------
/docs/bef/README.md:
--------------------------------------------------------------------------------
1 | ## Bazel Eclipse Feature 
2 |
3 | ## Using the Bazel Eclipse Feature
4 |
5 | ### Supported Environments
6 |
7 | BEF is supported on Linux and Macos.
8 | Windows is not guaranteed.
9 | Please contribute PRs (bug fixes) for Windows.
10 |
11 |
12 | ### Installation and User's Guides
13 |
14 | For detailed manual installation and setup instructions, and the User's Guide, see these pages:
15 |
16 | - [Installing Eclipse and the Bazel Eclipse Feature](install.md)
17 | - [Bazel Eclipse Feature User's Guide](using_the_feature.md)
18 |
19 | 
20 |
21 |
22 | ## History and Credit
23 |
24 | Full history and credit is explained in the [history and credit document](history.md).
25 |
26 |
27 | ## Developing BEF
28 |
29 | For developers that want to contribute to BEF:
30 | - [Contribution Guide](../../CONTRIBUTING.md)
31 |
32 |
--------------------------------------------------------------------------------
/docs/bef/bazel_eclipse_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/bef/bazel_eclipse_icon.png
--------------------------------------------------------------------------------
/docs/bef/bef_fullimage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/bef/bef_fullimage.png
--------------------------------------------------------------------------------
/docs/bef/import_wizard_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/bef/import_wizard_1.png
--------------------------------------------------------------------------------
/docs/bef/import_wizard_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/bef/import_wizard_2.png
--------------------------------------------------------------------------------
/docs/bef/using_the_feature.md:
--------------------------------------------------------------------------------
1 | ## Bazel Eclipse Feature Users Guide 
2 |
3 | This page provides links to documentation on how to use the Bazel Eclipse Feature.
4 | All of them assume you have already [installed your toolchain](install.md).
5 |
6 | **Using the Bazel Eclipse Feature:**
7 |
8 | - [Import your Bazel workspace into the IDE](import_workspace.md)
9 | - [Sync and Building your project](sync_and_build.md)
10 | - [Understanding the Java Classpath with the Bazel Eclipse Feature](../common/classpath.md)
11 |
12 | **Modifying the Bazel Eclipse Feature**
13 |
14 | Once you are comfortable with using the feature, you may want to contribute to it.
15 | If so, please see our [Contribution Guide](../../CONTRIBUTING.md) for instructions.
16 |
17 |
18 | **Issues**
19 |
20 | If you have any problems using BEF, please review these pages:
21 |
22 | - [BEF Issues on GitHub](https://github.com/salesforce/bazel-eclipse/issues)
23 |
24 | If you don't see your issue listed, please file a new Issue on GitHub and we will try to help.
25 |
--------------------------------------------------------------------------------
/docs/bjls/README.md:
--------------------------------------------------------------------------------
1 | # Bazel Java Language Server
2 |
3 | This is the home of the Language Server project docs.
4 |
5 | There is a BazelCon presentation you can watch that covers the ideas.
6 | Start at the 12 minute mark to see the Language Server portion of the talk:
7 | - [Eclipse and VS Code IDE Support for Java packages in Bazel](https://www.youtube.com/watch?v=oLnfv2-aGwk)
8 |
9 |
10 | ## Architecture & Features
11 |
12 | The Bazel Java Language Server (BJLS) is a plug-in for Eclipse, which extends the [Eclipse Java Language Server](https://github.com/eclipse/eclipse.jdt.ls) with project import and classpath resolution capabilities for Bazel workspaces.
13 |
14 | For more details about the supported Java features please see:
15 | - [Eclipse Java Language Server](https://github.com/redhat-developer/vscode-java)
16 | - [Language support for Java for Visual Studio Code](https://github.com/eclipse/eclipse.jdt.ls)
17 |
18 | ## VS Code Support
19 |
20 | You **cannot** *install* the BJLS into VS Code.
21 | You have to install an extension for your editor/IDE bundling it.
22 |
23 | We are working on integrating it directly into [Language support for Java for Visual Studio Code](https://github.com/eclipse/eclipse.jdt.ls).
24 | Until then please use [Bazel support for Java for Visual Studio Code](https://github.com/salesforce/bazel-vscode-java).
25 |
--------------------------------------------------------------------------------
/docs/dev/BEF_Arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/dev/BEF_Arch.png
--------------------------------------------------------------------------------
/docs/dev/release.md:
--------------------------------------------------------------------------------
1 | ## Releasing Bazel Eclipse
2 |
3 | This document is for maintainers.
4 | This is the set of steps for releasing a new version of BEF.
5 |
6 | Currently a CD workflow exists which publishes the latest repository automatically.
7 |
8 | TODO: add workflow when a tag is pushed to publish a GitHub release as well as update site
9 |
--------------------------------------------------------------------------------
/docs/logos/README.md:
--------------------------------------------------------------------------------
1 | ## BEF Logos
2 |
3 | These logos were created by VJ Abraham, and reflect the identity of BEF as the merger of
4 | the Eclipse IDE and Bazel.
5 | He used a combination of the color schemes from both projects, and design elements of each logo.
6 |
7 | Thank you VJ!
8 |
--------------------------------------------------------------------------------
/docs/logos/bef_developers_full.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_developers_full.jpg
--------------------------------------------------------------------------------
/docs/logos/bef_developers_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_developers_full.png
--------------------------------------------------------------------------------
/docs/logos/bef_developers_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_developers_small.png
--------------------------------------------------------------------------------
/docs/logos/bef_logo_full.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_logo_full.jpg
--------------------------------------------------------------------------------
/docs/logos/bef_logo_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_logo_full.png
--------------------------------------------------------------------------------
/docs/logos/bef_logo_marketplace.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_logo_marketplace.jpg
--------------------------------------------------------------------------------
/docs/logos/bef_logo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bef_logo_small.png
--------------------------------------------------------------------------------
/docs/logos/bjls_logo_full.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bjls_logo_full.jpg
--------------------------------------------------------------------------------
/docs/logos/bjls_logo_small.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/docs/logos/bjls_logo_small.jpeg
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.eclipse.feature
4 |
5 |
6 | bazel-java-sdk
7 | plugin-deps
8 | plugin-testdeps
9 |
10 |
11 |
12 | org.eclipse.pde.FeatureBuilder
13 |
14 |
15 |
16 |
17 | org.eclipse.pde.UpdateSiteBuilder
18 |
19 |
20 |
21 |
22 |
23 | org.eclipse.pde.FeatureNature
24 | org.eclipse.pde.UpdateSiteNature
25 |
26 |
27 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/README.md:
--------------------------------------------------------------------------------
1 | ## Bazel Eclipse Feature
2 |
3 | This is the logical container of all the plugins related to the Bazel integration with Eclipse.
4 | In Eclipse, such a container is known as a *feature*.
5 | See the [architecture document](../../docs/dev/architecture.md) for more information about features.
6 |
7 | ### Static Files
8 |
9 | This packages contains a number of static files that are used by the Eclipse SDK to manage the feature.
10 |
11 | - [feature.xml](feature.xml)
12 | - [build.properties](build.properties)
13 |
14 | As you develop the Bazel Eclipse Feature, you may need to update these files.
15 | Make sure to commit them back to the Git repo.
16 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml,\
2 | build.properties,\
3 | p2.inf
4 | src.includes = feature.xml,\
5 | build.properties,\
6 | .project
7 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.feature/p2.inf:
--------------------------------------------------------------------------------
1 | #The purpose of the following advices is to configure ch.qos.logback.classic as auto-started with start-level 2 when installing this feature
2 | #Create a requirement on the fragment we are creating
3 | requires.0.namespace=org.eclipse.equinox.p2.iu
4 | requires.0.name=configure.logback.classic
5 | requires.0.range=[$version$,$version$]
6 | requires.0.greedy=true
7 |
8 | #Create a IU fragment named configure.logback.classic
9 | units.0.id=configure.logback.classic
10 | units.0.version=$version$
11 | units.0.provides.0.namespace=org.eclipse.equinox.p2.iu
12 | units.0.provides.0.name=configure.logback.classic
13 | units.0.provides.0.version=$version$
14 | units.0.instructions.install=org.eclipse.equinox.p2.touchpoint.eclipse.installBundle(bundle:${artifact});
15 | units.0.instructions.uninstall=org.eclipse.equinox.p2.touchpoint.eclipse.uninstallBundle(bundle:${artifact});
16 | units.0.instructions.configure= \
17 | org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:2); \
18 | org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:true);
19 | units.0.instructions.unconfigure= \
20 | org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:-1); \
21 | org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:false);
22 | units.0.hostRequirements.0.namespace=osgi.bundle
23 | units.0.hostRequirements.0.name=ch.qos.logback.classic
24 | units.0.hostRequirements.0.range=[1.3,2)
25 | units.0.hostRequirements.0.greedy=false
26 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.jdtls.feature/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.eclipse.jdtls.feature
4 |
5 |
6 | bazel-java-sdk
7 | plugin-deps
8 | plugin-testdeps
9 |
10 |
11 |
12 | org.eclipse.pde.FeatureBuilder
13 |
14 |
15 |
16 |
17 | org.eclipse.pde.UpdateSiteBuilder
18 |
19 |
20 |
21 |
22 |
23 | org.eclipse.pde.FeatureNature
24 | org.eclipse.pde.UpdateSiteNature
25 |
26 |
27 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.jdtls.feature/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.jdtls.feature/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.jdtls.feature/README.md:
--------------------------------------------------------------------------------
1 | ## Bazel JDT LS Eclipse Feature
2 |
3 | This is the logical container of all the plugins related to the Bazel integration with Eclipse.
4 | In Eclipse, such a container is known as a *feature*.
5 | See the [architecture document](../../docs/dev/architecture.md) for more information about features.
6 |
7 | ### Static Files
8 |
9 | This packages contains a number of static files that are used by the Eclipse SDK to manage the feature.
10 |
11 | - [feature.xml](feature.xml)
12 | - [build.properties](build.properties)
13 |
14 | As you develop the Bazel Eclipse Feature, you may need to update these files.
15 | Make sure to commit them back to the Git repo.
16 |
--------------------------------------------------------------------------------
/features/com.salesforce.bazel.eclipse.jdtls.feature/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml,\
2 | build.properties
3 | src.includes = feature.xml,\
4 | build.properties,\
5 | .project
6 |
--------------------------------------------------------------------------------
/javaConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "projects": [
3 | "bundles/com.salesforce.bazel.eclipse.core",
4 | "bundles/com.salesforce.bazel.eclipse.jdtls",
5 | "bundles/com.salesforce.bazel.eclipse.ui",
6 | "bundles/com.salesforce.bazel.importedsource",
7 | "bundles/com.salesforce.bazel.logback",
8 | "bundles/com.salesforce.bazel.sdk"
9 | ],
10 |
11 | "targetPlatform": "releng/target-platform/target-platform-dev.target"
12 | }
13 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 4.0.0
6 |
7 |
8 | com.salesforce.bazel.eclipse.feature.releng
9 | bazel-eclipse-feature-maven-parent
10 |
14 | 2.0.0-SNAPSHOT
15 | releng/mavenparent
16 |
17 |
18 | bazel-eclipse-plugins
19 | pom
20 |
21 |
22 | bundles
23 | tests
24 | features
25 |
26 | releng
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/releng/p2repository/category.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Bazel Eclipse Feature provides support for the Bazel build system in Eclipse. https://github.com/salesforce/bazel-eclipse
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.eclipse.core.tests
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Bazel Eclipse Feature Core Plug-In Tests
4 | Bundle-SymbolicName: com.salesforce.bazel.eclipse.core.tests
5 | Bundle-Version: 2.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Fragment-Host: com.salesforce.bazel.eclipse.core;bundle-version="2.0.0"
8 | Automatic-Module-Name: com.salesforce.bazel.eclipse.core.tests
9 | Bundle-RequiredExecutionEnvironment: JavaSE-21
10 | Import-Package: org.hamcrest;version="2.2.0",
11 | org.hamcrest.collection;version="2.2.0",
12 | org.junit.jupiter.api;version="5.9.2",
13 | org.junit.jupiter.api.extension;version="5.9.2",
14 | org.junit.jupiter.api.io;version="5.9.2"
15 | Require-Bundle: testdata;bundle-version="1.0.0",
16 | com.salesforce.bazel.sdk
17 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .
5 | additional.bundles = org.mockito.mockito-core,\
6 | junit-jupiter-api,\
7 | junit-jupiter-params,\
8 | org.hamcrest
9 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/src/com/salesforce/bazel/eclipse/core/extensions/TestCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.eclipse.core.extensions;
2 |
3 | import static org.junit.jupiter.api.Assertions.fail;
4 |
5 | import java.io.IOException;
6 | import java.nio.file.Path;
7 |
8 | import com.salesforce.bazel.sdk.command.BazelCommand;
9 |
10 | /**
11 | * A command to be used by testing an executor.
12 | */
13 | class TestCommand extends BazelCommand {
14 | public TestCommand() {
15 | this(Path.of(System.getProperty("user.home")));
16 | }
17 |
18 | public TestCommand(Path workingDirectory, String... commandArgs) {
19 | super("dummy", workingDirectory, "test command");
20 | setCommandArgs(commandArgs);
21 | }
22 |
23 | @Override
24 | protected Integer doGenerateResult() throws IOException {
25 | fail("This should never be called!");
26 | return null;
27 | }
28 |
29 | @Override
30 | public Integer generateResult(int exitCode) throws IOException {
31 | return exitCode;
32 | }
33 |
34 | @Override
35 | public void setRedirectStdOutToFile(Path stdOutFile) {
36 | super.setRedirectStdOutToFile(stdOutFile);
37 | }
38 | }
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/src/com/salesforce/bazel/eclipse/core/model/BazelModelTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.eclipse.core.model;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import static org.junit.jupiter.api.Assertions.assertNotSame;
5 |
6 | import org.junit.jupiter.api.Test;
7 |
8 | public class BazelModelTest {
9 |
10 | @Test
11 | void equals_and_hashCode() throws Exception {
12 | var m1 = new BazelModel(null);
13 | var m2 = new BazelModel(null);
14 |
15 | assertEquals(m1, m2);
16 | assertEquals(m2, m1);
17 |
18 | assertEquals(m1.hashCode(), m2.hashCode());
19 | assertEquals(m2.hashCode(), m1.hashCode());
20 |
21 | assertEquals(m1.hashCode(), BazelModel.class.hashCode());
22 |
23 | assertNotSame(m1, m2);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.core.tests/src/com/salesforce/bazel/eclipse/core/model/BazelWorkspaceTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.eclipse.core.model;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import static org.junit.jupiter.api.Assertions.assertNotEquals;
5 | import static org.junit.jupiter.api.Assertions.assertNotSame;
6 |
7 | import org.eclipse.core.runtime.Path;
8 | import org.junit.jupiter.api.Test;
9 |
10 | public class BazelWorkspaceTest {
11 |
12 | @Test
13 | void equals_and_hashCode() throws Exception {
14 | var m = new BazelModel(null);
15 |
16 | var r1 = new Path("/root1");
17 | var r2 = new Path("/root2");
18 |
19 | var w_r1 = new BazelWorkspace(r1, m);
20 | var w_r2 = new BazelWorkspace(r2, m);
21 |
22 | assertEquals(w_r1, new BazelWorkspace(r1, m));
23 | assertEquals(w_r2, new BazelWorkspace(r2, m));
24 |
25 | assertEquals(w_r1.hashCode(), new BazelWorkspace(r1, m).hashCode());
26 | assertEquals(w_r2.hashCode(), new BazelWorkspace(r2, m).hashCode());
27 |
28 | assertNotSame(w_r1, new BazelWorkspace(r1, m));
29 | assertNotSame(w_r2, new BazelWorkspace(r2, m));
30 |
31 | assertNotEquals(w_r1, w_r2);
32 | assertNotEquals(w_r1.hashCode(), w_r2.hashCode());
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.eclipse.jdtls.tests
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Automatic-Module-Name: com.salesforce.bazel.eclipse.jdtls.tests
4 | Bundle-Name: Bazel Java Lanaguage Server Plug-In Tests
5 | Bundle-SymbolicName: com.salesforce.bazel.eclipse.jdtls.tests;singleton:=true
6 | Bundle-Version: 2.0.0.qualifier
7 | Fragment-Host: com.salesforce.bazel.eclipse.jdtls;bundle-version="2.0.0"
8 | Bundle-Vendor: Bazel Eclipse Feature
9 | Bundle-RequiredExecutionEnvironment: JavaSE-21
10 | Import-Package: org.hamcrest;version="2.2.0",
11 | org.hamcrest.collection;version="2.2.0",
12 | org.junit.jupiter.api;version="5.9.2",
13 | org.junit.jupiter.api.extension;version="5.9.2",
14 | org.junit.jupiter.api.io;version="5.9.2"
15 | Require-Bundle: testdata;bundle-version="1.0.0"
16 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/main/java/
2 | output.. = target/classes/
3 | bin.includes = .,\
4 | META-INF/,\
5 | plugin.xml
6 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/.gitignore:
--------------------------------------------------------------------------------
1 | # Bazel build result
2 | **/bazel-*
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/BUILD:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/BUILD
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/WORKSPACE:
--------------------------------------------------------------------------------
1 | workspace(name = "bazel_ls_demo_project")
2 |
3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4 |
5 | # bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0)
6 | skylib_version = "0.8.0"
7 | http_archive(
8 | name = "bazel_skylib",
9 | type = "tar.gz",
10 | url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version),
11 | sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
12 | )
13 |
14 | # check minimum Bazel version
15 | load("@bazel_skylib//lib:versions.bzl", "versions")
16 | versions.check(minimum_bazel_version= "2.0.0")
17 |
18 | http_archive(
19 | name = "salesforce_rules_mybuilder",
20 | url = "https://github.com/salesforce/bazel-java-builder-template/archive/6d7cc260d50225432758d88bea9d7dd332f89352.zip",
21 | strip_prefix = "bazel-java-builder-template-6d7cc260d50225432758d88bea9d7dd332f89352"
22 | )
23 |
24 | load("@salesforce_rules_mybuilder//mybuilder:repositories.bzl", "rules_mybuilder_dependencies", "rules_mybuilder_toolchains")
25 | rules_mybuilder_dependencies()
26 | rules_mybuilder_toolchains()
27 |
28 | # Maven dependencies
29 | load("//third_party/maven:dependencies.bzl", "maven_dependencies")
30 | maven_dependencies()
31 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module1/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_binary")
2 | load("@salesforce_rules_mybuilder//mybuilder:defs.bzl", "mybuilder_gen_java_library")
3 |
4 | filegroup(
5 | name = "mybuilder_input",
6 | srcs = glob(
7 | [
8 | "java/resources/**/*.txt",
9 | ],
10 | ),
11 | )
12 |
13 | filegroup(
14 | name = "module1_sources",
15 | srcs = glob(
16 | [
17 | "java/src/**/*.java",
18 | ],
19 | ),
20 | )
21 |
22 | mybuilder_gen_java_library(
23 | name = "mybuilder_sources",
24 | srcs = [":mybuilder_input"],
25 | )
26 |
27 |
28 | java_binary(
29 | name = "module1",
30 | srcs = [
31 | "module1_sources",
32 | ],
33 | resources = [":mybuilder_input"],
34 | deps = [
35 | "//module2",
36 | "//module3",
37 | "@com_google_guava//jar",
38 | "mybuilder_sources",
39 | ],
40 | main_class = "hello.Hello",
41 | )
42 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module1/java/resources/hello.txt:
--------------------------------------------------------------------------------
1 | Hi there!
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module1/java/src/hello/Hello.java:
--------------------------------------------------------------------------------
1 | package hello;
2 |
3 | import library.Greeting;
4 |
5 | import log.Logger;
6 |
7 | import java.util.List;
8 |
9 | import com.google.common.collect.Lists;
10 | import com.google.common.collect.Iterables;
11 |
12 |
13 |
14 | public class Hello {
15 |
16 |
17 | public static void main(String[] args) {
18 | Logger.logDebug("Hello.main");
19 |
20 | Greeting greeter = new Greeting();
21 | System.out.println(new mybuilder_sources.MybuilderSources());
22 |
23 | List modules = Lists.newArrayList("module1", "module2");
24 |
25 | Iterable result = Iterables.transform(modules, greeter::greet);
26 |
27 | result.forEach(System.out::println);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module2/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_library")
2 |
3 | java_library (
4 | name = "module2",
5 | srcs = glob(["java/src/**/*.java"]),
6 | visibility = ["//module1:__pkg__"],
7 | deps = ["//module3"]
8 | )
9 |
10 | java_test(
11 | name = "module2-test",
12 | srcs = ["java/test/library/GreetingTest.java"],
13 | test_class = "library.GreetingTest",
14 | deps = [
15 | "module2",
16 | "@junit//jar",
17 | ],
18 | )
19 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module2/java/src/library/Greeting.java:
--------------------------------------------------------------------------------
1 | package library;
2 |
3 | import log.Logger;
4 |
5 | public class Greeting {
6 |
7 | public String greet(String name) {
8 | Logger.logDebug("Greeting.greet");
9 | return "Hello ".concat(name);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module2/java/test/library/GreetingTest.java:
--------------------------------------------------------------------------------
1 | package library;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class GreetingTest {
7 | @Test
8 | public void testGreet() {
9 | Assert.assertEquals("Hello JUnit", new Greeting().greet("JUnit"));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module3/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_library")
2 |
3 | java_library (
4 | name = "module3",
5 | srcs = glob(["java/src/**/*.java"]),
6 | visibility = ["//module1:__pkg__", "//module2:__pkg__"]
7 | )
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/module3/java/src/log/Logger.java:
--------------------------------------------------------------------------------
1 | package log;
2 |
3 | import java.time.Instant;
4 |
5 | public final class Logger {
6 |
7 | private Logger() {
8 | throw new RuntimeException();
9 | }
10 |
11 | public static void logDebug(String message) {
12 | String output = String.format("[DEBUG] %s", message);
13 | System.out.println(output);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/third_party/maven/BUILD:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/third_party/maven/BUILD
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/bazel-ls-demo-project/third_party/maven/dependencies.bzl:
--------------------------------------------------------------------------------
1 | load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
2 |
3 | def maven_dependencies(
4 | maven_servers = ["https://repo1.maven.org/maven2/"]):
5 |
6 | jvm_maven_import_external(
7 | name = "com_google_guava",
8 | artifact = "com.google.guava:guava:28.2-jre",
9 | artifact_sha256 = "fc3aa363ad87223d1fbea584eee015a862150f6d34c71f24dc74088a635f08ef",
10 | licenses = ["notice"],
11 | server_urls = maven_servers,
12 | )
13 |
14 | jvm_maven_import_external(
15 | name = "junit",
16 | artifact = "junit:junit:4.13",
17 | artifact_sha256 = "4b8532f63bdc0e0661507f947eb324a954d1dbac631ad19c8aa9a00feed1d863",
18 | licenses = ["notice"],
19 | server_urls = maven_servers,
20 | )
21 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-class/WORKSPACE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-class/WORKSPACE
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-class/module1/java/src/example/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_binary")
2 |
3 | java_binary(
4 | name = "ProjectRunner",
5 | srcs = glob(["*.java"]),
6 | main_class = "com.example.ProjectRunner",
7 | deps = [":greeter"],
8 | )
9 |
10 | java_library(
11 | name = "greeter",
12 | srcs = ["Greeting.java"],
13 | )
14 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-class/module1/java/src/example/Greeting.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | public class Greeting {
4 | public static void sayHi() {
5 | System.out.println("Hi!");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-class/module1/java/src/example/ProjectRunner.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | public class ProjectRunner {
4 | public static void main(String args[]) {
5 | Greeting.sayHi();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/WORKSPACE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/WORKSPACE
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/module/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_binary")
2 |
3 | java_binary(
4 | name = "ProjectRunner",
5 | srcs = glob(["java/src/example/ProjectRunner.java"]),
6 | main_class = "example.ProjectRunner",
7 | deps = ["//module/submodule:greeter"],
8 | )
9 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/module/java/src/example/ProjectRunner.java:
--------------------------------------------------------------------------------
1 | package example;
2 |
3 | import greeting.SayHi;
4 |
5 | public class ProjectRunner {
6 | public static void main(String args[]) {
7 | SayHi.sayHi();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/module/submodule/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_library")
2 |
3 | java_library(
4 | name = "greeter",
5 | srcs = glob(["java/src/greeting/SayHi.java"]),
6 | visibility = ["//visibility:public"],
7 | )
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-subpackage/module/submodule/java/src/greeting/SayHi.java:
--------------------------------------------------------------------------------
1 | package greeting;
2 |
3 | public class SayHi {
4 | public static void sayHi() {
5 | System.out.println("Hi!");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/BUILD:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/BUILD
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/WORKSPACE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/salesforce/bazel-eclipse/8e717d176a9e228537f9f867ef808bab4a7fb485/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/WORKSPACE
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/module1/BUILD:
--------------------------------------------------------------------------------
1 | load("@rules_java//java:defs.bzl", "java_binary")
2 |
3 | java_binary(
4 | name = "ProjectRunner",
5 | srcs = glob(["src/main/java/com/example/ProjectRunner.java"]),
6 | main_class = "com.example.ProjectRunner",
7 | deps = [":greeter"],
8 | )
9 |
10 | java_library(
11 | name = "greeter",
12 | srcs = ["src/main/java/com/example/Greeting.java"],
13 | )
14 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/module1/java/src/example/Greeting.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | public class Greeting {
4 | public static void sayHi() {
5 | System.out.println("Hi!");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.jdtls.tests/projects/build-with-workspace/module1/java/src/example/ProjectRunner.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | public class ProjectRunner {
4 | public static void main(String args[]) {
5 | Greeting.sayHi();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.eclipse.ui.tests
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Bazel Eclipse Feature UI Plug-In Tests
4 | Bundle-SymbolicName: com.salesforce.bazel.eclipse.ui.tests;singleton:=true
5 | Bundle-Version: 2.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Automatic-Module-Name: com.salesforce.bazel.eclipse.ui.tests
8 | Fragment-Host: com.salesforce.bazel.eclipse.ui;bundle-version="2.0.0.qualifier"
9 | Bundle-RequiredExecutionEnvironment: JavaSE-21
10 | Import-Package: net.bytebuddy.agent;version="1.14.0",
11 | org.hamcrest;version="2.2.0",
12 | org.hamcrest.collection;version="2.2.0",
13 | org.junit.jupiter.api;version="5.9.2",
14 | org.junit.jupiter.api.extension;version="5.9.2",
15 | org.junit.jupiter.api.function;version="5.9.2",
16 | org.junit.jupiter.api.io;version="5.9.2",
17 | org.junit.jupiter.params;version="5.9.2",
18 | org.junit.jupiter.params.provider;version="5.9.2",
19 | org.mockito;version="5.1.1"
20 | Require-Bundle: testdata;bundle-version="1.0.0"
21 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .
5 | additional.bundles = org.mockito.mockito-core,\
6 | junit-jupiter-params,\
7 | org.hamcrest
8 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/src/com/salesforce/bazel/eclipse/ui/execution/BazelQueryTestCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.eclipse.ui.execution;
2 |
3 | import static java.nio.file.Files.createTempFile;
4 | import static java.nio.file.Files.readAllLines;
5 |
6 | import java.io.IOException;
7 | import java.nio.charset.Charset;
8 | import java.nio.file.Path;
9 | import java.util.Collection;
10 | import java.util.List;
11 |
12 | import com.salesforce.bazel.sdk.BazelVersion;
13 | import com.salesforce.bazel.sdk.command.BazelQueryCommand;
14 |
15 | /**
16 | * bazel query --output streamed_proto --order_output=no
17 | */
18 | public class BazelQueryTestCommand extends BazelQueryCommand> {
19 |
20 | public BazelQueryTestCommand(Path workspaceRoot, String query, boolean keepGoing) {
21 | super(workspaceRoot, query, keepGoing, "query test command");
22 | }
23 |
24 | @Override
25 | protected Collection doGenerateResult() throws IOException {
26 | return readAllLines(getStdOutFile(), Charset.defaultCharset());
27 | }
28 |
29 | @Override
30 | public List prepareCommandLine(BazelVersion bazelVersion) throws IOException {
31 | // redirect output to file for parsing
32 | var stdoutFile = createTempFile("bazel_test_query_stdout_", ".bin");
33 | setRedirectStdOutToFile(stdoutFile);
34 |
35 | // prepare regular query command line
36 | return super.prepareCommandLine(bazelVersion);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.eclipse.ui.tests/src/com/salesforce/bazel/eclipse/ui/execution/TestCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.eclipse.ui.execution;
2 |
3 | import static org.junit.jupiter.api.Assertions.fail;
4 |
5 | import java.io.IOException;
6 | import java.nio.file.Path;
7 |
8 | import com.salesforce.bazel.sdk.command.BazelCommand;
9 |
10 | /**
11 | * A command to be used by testing an executor.
12 | */
13 | class TestCommand extends BazelCommand {
14 | public TestCommand() {
15 | this(Path.of(System.getProperty("user.home")));
16 | }
17 |
18 | public TestCommand(Path workingDirectory, String... commandArgs) {
19 | super("dummy", workingDirectory, "test command");
20 | setCommandArgs(commandArgs);
21 | }
22 |
23 | @Override
24 | protected Integer doGenerateResult() throws IOException {
25 | fail("This should never be called!");
26 | return null;
27 | }
28 |
29 | @Override
30 | public Integer generateResult(int exitCode) throws IOException {
31 | return exitCode;
32 | }
33 |
34 | @Override
35 | public void setRedirectStdOutToFile(Path stdOutFile) {
36 | super.setRedirectStdOutToFile(stdOutFile);
37 | }
38 | }
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.importedsource.tests
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | pluginProject.extensions=false
3 | resolve.requirebundle=false
4 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Tests for Imported Sources
4 | Bundle-SymbolicName: com.salesforce.bazel.importedsource.tests
5 | Bundle-Version: 2.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Fragment-Host: com.salesforce.bazel.importedsource;bundle-version="2.0.0.qualifier"
8 | Import-Package: com.google.common.truth;version="[1.4.0,2.0.0)",
9 | org.junit.jupiter.api;version="[5.11.0,6.0.0)",
10 | org.junit.jupiter.api.condition;version="[5.11.0,6.0.0)"
11 | Automatic-Module-Name: com.salesforce.bazel.java.sdk.tests
12 | Bundle-RequiredExecutionEnvironment: JavaSE-17
13 | Bundle-ClassPath: .
14 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.importedsource.tests/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .
5 | additional.bundles = org.mockito.mockito-core,\
6 | junit-jupiter-api,\
7 | org.hamcrest,\
8 | net.bytebuddy.byte-buddy,\
9 | wrapped.com.google.truth.truth
10 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.salesforce.bazel.sdk.tests
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/.settings/org.eclipse.pde.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | resolve.requirebundle=false
3 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Bazel Java SDK and IntelliJ Helper Tests
4 | Bundle-SymbolicName: com.salesforce.bazel.sdk.tests
5 | Bundle-Version: 2.0.0.qualifier
6 | Bundle-Vendor: Bazel Eclipse Feature
7 | Fragment-Host: com.salesforce.bazel.sdk;bundle-version="2.0.0.qualifier"
8 | Import-Package: org.junit.jupiter.api;version="[5.11.0,6.0.0)",
9 | org.junit.jupiter.api.condition;version="[5.11.0,6.0.0)",
10 | org.junit.jupiter.api.function;version="[5.11.0,6.0.0)",
11 | org.junit.jupiter.api.io;version="[5.11.0,6.0.0)"
12 | Automatic-Module-Name: com.salesforce.bazel.java.sdk.tests
13 | Bundle-RequiredExecutionEnvironment: JavaSE-21
14 | Bundle-ClassPath: .
15 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/
2 | output.. = bin/
3 | bin.includes = META-INF/,\
4 | .
5 | additional.bundles = org.mockito.mockito-core,\
6 | junit-jupiter-api,\
7 | org.hamcrest,\
8 | net.bytebuddy.byte-buddy
9 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/src/com/salesforce/bazel/sdk/command/TestCommand.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command;
2 |
3 | import static org.junit.jupiter.api.Assertions.fail;
4 |
5 | import java.io.IOException;
6 | import java.nio.file.Path;
7 |
8 | /**
9 | * A command to be used by testing an executor.
10 | */
11 | class TestCommand extends BazelCommand {
12 | public TestCommand() {
13 | this(Path.of(System.getProperty("user.home")));
14 | }
15 |
16 | public TestCommand(Path workingDirectory, String... commandArgs) {
17 | super("dummy", workingDirectory, "testing");
18 | setCommandArgs(commandArgs);
19 | }
20 |
21 | @Override
22 | protected Integer doGenerateResult() throws IOException {
23 | fail("This should never be called!");
24 | return null;
25 | }
26 |
27 | @Override
28 | public Integer generateResult(int exitCode) throws IOException {
29 | return exitCode;
30 | }
31 | }
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/src/com/salesforce/bazel/sdk/command/shell/MacOsLoginShellFinderTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command.shell;
2 |
3 | import static java.lang.String.format;
4 | import static java.nio.file.Files.isExecutable;
5 | import static org.junit.jupiter.api.Assertions.assertNotNull;
6 | import static org.junit.jupiter.api.Assertions.assertThrows;
7 | import static org.junit.jupiter.api.Assertions.assertTrue;
8 |
9 | import java.io.IOException;
10 |
11 | import org.junit.jupiter.api.Test;
12 | import org.junit.jupiter.api.condition.EnabledOnOs;
13 | import org.junit.jupiter.api.condition.OS;
14 |
15 | @EnabledOnOs(OS.MAC)
16 | public class MacOsLoginShellFinderTest {
17 |
18 | @Test
19 | void detectLoginShell() throws Exception {
20 | var detectLoginShell = new MacOsLoginShellFinder().detectLoginShell();
21 | assertNotNull(detectLoginShell);
22 | assertTrue(isExecutable(detectLoginShell), () -> format("not executable: '%s'", detectLoginShell));
23 | }
24 |
25 | @Test
26 | void detectLoginShell_unknonw_users() throws Exception {
27 | assertThrows(IOException.class, () -> {
28 | new MacOsLoginShellFinder().detectLoginShell("foo-bar-" + System.nanoTime());
29 | });
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/src/com/salesforce/bazel/sdk/command/shell/UnixLoginShellFinderTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.command.shell;
2 |
3 | import static java.lang.String.format;
4 | import static java.nio.file.Files.isExecutable;
5 | import static org.junit.jupiter.api.Assertions.assertNotNull;
6 | import static org.junit.jupiter.api.Assertions.assertThrows;
7 | import static org.junit.jupiter.api.Assertions.assertTrue;
8 |
9 | import java.io.IOException;
10 |
11 | import org.junit.jupiter.api.Test;
12 | import org.junit.jupiter.api.condition.EnabledOnOs;
13 | import org.junit.jupiter.api.condition.OS;
14 |
15 | @EnabledOnOs(OS.LINUX)
16 | public class UnixLoginShellFinderTest {
17 |
18 | @Test
19 | void detectLoginShell() throws Exception {
20 | var detectLoginShell = new UnixLoginShellFinder().detectLoginShell();
21 | assertNotNull(detectLoginShell);
22 | assertTrue(isExecutable(detectLoginShell), () -> format("not executable: '%s'", detectLoginShell));
23 | }
24 |
25 | @Test
26 | void detectLoginShell_unknonw_users() throws Exception {
27 | assertThrows(IOException.class, () -> {
28 | new UnixLoginShellFinder().detectLoginShell("foo-bar-" + System.nanoTime());
29 | });
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/src/com/salesforce/bazel/sdk/model/BazelLabelTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.model;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertTrue;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | public class BazelLabelTest {
8 |
9 | @Test
10 | void isConcrete_positive_test() {
11 | assertTrue(new BazelLabel("//src/main/java/com/google/devtools/build/lib/runtime/mobileinstall:mobileinstall")
12 | .isConcrete());
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/tests/com.salesforce.bazel.sdk.tests/src/com/salesforce/bazel/sdk/util/SystemUtilTest.java:
--------------------------------------------------------------------------------
1 | package com.salesforce.bazel.sdk.util;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertFalse;
4 | import static org.junit.jupiter.api.Assertions.assertTrue;
5 |
6 | import org.junit.jupiter.api.Test;
7 | import org.junit.jupiter.api.condition.DisabledOnOs;
8 | import org.junit.jupiter.api.condition.EnabledOnOs;
9 | import org.junit.jupiter.api.condition.OS;
10 |
11 | public class SystemUtilTest {
12 |
13 | @Test
14 | @DisabledOnOs(OS.MAC)
15 | void isMac_returns_false_on_none_Mac() throws Exception {
16 | assertFalse(new SystemUtil().isMac());
17 | }
18 |
19 | @Test
20 | @EnabledOnOs(OS.MAC)
21 | void isMac_returns_true_on_Mac() throws Exception {
22 | assertTrue(new SystemUtil().isMac());
23 | }
24 |
25 | @Test
26 | @DisabledOnOs(OS.LINUX)
27 | void isUnix_returns_false_on_none_Linux() throws Exception {
28 | assertFalse(new SystemUtil().isUnix());
29 | }
30 |
31 | @Test
32 | @EnabledOnOs(OS.LINUX)
33 | void isUnix_returns_true_on_Linux() throws Exception {
34 | assertTrue(new SystemUtil().isUnix());
35 | }
36 |
37 | @Test
38 | @DisabledOnOs(OS.WINDOWS)
39 | void isWindows_returns_false_on_none_Windows() throws Exception {
40 | assertFalse(new SystemUtil().isWindows());
41 | }
42 |
43 | @Test
44 | @EnabledOnOs(OS.WINDOWS)
45 | void isWindows_returns_true_on_Windows() throws Exception {
46 | assertTrue(new SystemUtil().isWindows());
47 | }
48 | }
49 |
--------------------------------------------------------------------------------