Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lsif-java command-line tool with Gradle and Maven support. #100

Merged
merged 9 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/ubuntu/.devcontainer/base.Dockerfile

# [Choice] Ubuntu version: bionic, focal
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends default-jdk gradle maven golang-go \
&& go get github.com/sourcegraph/lsif-semanticdb/cmd/lsif-semanticdb


27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/ubuntu
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic
"args": { "VARIANT": "focal" }
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
- uses: actions/setup-go@v2
with:
java-version: [email protected]
go-version: '^1.13.1'
- run: go get github.com/sourcegraph/lsif-semanticdb/cmd/lsif-semanticdb
- run: sbt test
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
with:
java-version: [email protected]
- run: sbt checkAll
58 changes: 58 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Native Image
on:
push:
branches:
- master
release:
types: [published]
jobs:
unix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
include:
- os: macOS-latest
uploaded_filename: lsif-java-x86_64-apple-darwin
local_path: lsif-java/target/native-image/lsif-java
- os: ubuntu-latest
uploaded_filename: lsif-java-x86_64-pc-linux
local_path: lsif-java/target/native-image/lsif-java
- os: windows-latest
uploaded_filename: lsif-java-x86_64-pc-win32.exe
local_path: lsif-java\target\native-image\lsif-java.exe
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
- uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
- run: go get github.com/sourcegraph/lsif-semanticdb/cmd/lsif-semanticdb
- run: git fetch --tags || true
- name: sbt nativeImage
shell: bash
if: ${{ matrix.os != 'windows-latest' }}
run: |
sbt cli/nativeImage "cli/nativeImageRun --cwd tests/gradle-example"
- name: sbt nativeImage
shell: cmd
if: ${{ matrix.os == 'windows-latest' }}
run: >-
"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && sbt
cli/nativeImage
- uses: actions/upload-artifact@master
with:
path: ${{ matrix.local_path }}
name: ${{ matrix.uploaded_filename }}
- name: Upload release
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ matrix.local_path }}
asset_name: ${{ matrix.uploaded_filename }}
asset_content_type: application/zip
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@ Currently, only Java 8 with the build tool sbt is supported. We hope to increase
compatibility with more Java language versions and build tools as the project
evolves.

| Language version | Support |
| ---------------- | ------- |
| Java 7 | ❌ |
| Java 8 | ✅ |
| Java 11+ | ❌ |
| Language version | Support |
| ---------------- | --------------------------------- |
| Java 7 | ❌ |
| Java 8 | ✅ |
| Java 11 | ✅ |
| Java 12 | Not tested in CI, but should work |
| Java 13 | Not tested in CI, but should work |
| Java 14 | Not tested in CI, but should work |
| Java 15 | ✅ |
| Java 16 | Not tested in CI, but should work |
| Java 17 | Not tested in CI, but should work |

| Build tool | Support |
| ---------- | ------- |
| Gradle | |
| Maven | |
| Gradle | |
| Maven | |
| Bazel | ❌ |
| Buck | ❌ |
| sbt | ✅ |

## Overview
Expand Down Expand Up @@ -82,6 +89,17 @@ using SemanticDB as an intermediary representation for LSIF:

The following sections provide tips on how to contribute to this codebase.

### System dependencies

- `java`: any version should work
- `git`: any version should work
- `lsif-semanticdb`:
`go get github.com/sourcegraph/lsif-semanticdb/cmd/lsif-semanticdb`
- `gradle`: `brew install gradle`, or see
[general installation guide](https://gradle.org/install/).
- `mvn`: `brew install maven`, or see
[general installation guide](https://www.baeldung.com/install-maven-on-windows-linux-mac).

### Project structure

These are the main components of the project.
Expand All @@ -100,17 +118,19 @@ These are the main components of the project.

### Helpful commands

| Command | Where | Description |
| ------------------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------- |
| `./sbt` | terminal | Start interactive sbt shell with Java 8. Takes a while to load on the first run. |
| `unit/test` | sbt | Run fast unit tests. |
| `~unit/test` | sbt | Start watch mode to run tests on file save, good for local edit-and-test workflows. |
| Command | Where | Description |
| ------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------- |
| `./sbt` | terminal | Start interactive sbt shell with Java 11. Takes a while to load on the first run. |
| `unit/test` | sbt | Run fast unit tests. |
| `~unit/test` | sbt | Start watch mode to run tests on file save, good for local edit-and-test workflows. |
| `buildTools/test` | sbt | Run slow build tool tests (Gradle, Maven). |
| `snapshots/testOnly tests.MinimizedSnapshotSuite` | sbt | Runs fast snapshot tests. Indexes a small set of files under `tests/minimized`. |
| `snapshots/testOnly tests.MinimizedSnapshotSuite -- *InnerClasses*` | sbt | Runs only individual tests cases matching the name "InnerClasses". |
| `snapshots/testOnly tests.LibrarySnapshotSuite` | sbt | Runs slow snapshot tests. Indexes a corpus of external Java libraries. |
| `snapshots/test` | sbt | Runs all snapshot tests. |
| `snapshots/run` | sbt | Update snapshot tests. Use this command after you have fixed a bug. |
| `fixAll` | sbt | Run Scalafmt, Scalafix and Javafmt on all sources. Run this before opening a PR. |
| `cli/run --cwd DIRECTORY` | sbt | Run `lsif-java` command-line tool against a given Gradle/Maven build. |
| `fixAll` | sbt | Run Scalafmt, Scalafix and Javafmt on all sources. Run this before opening a PR. |

### Import the project into IntelliJ

Expand Down
Loading