Skip to content

Commit

Permalink
Merge remote-tracking branch 'devops/master' into cs/migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo committed Apr 15, 2019
2 parents caa718b + b421025 commit 1600f59
Show file tree
Hide file tree
Showing 91 changed files with 8,441 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Tab indentation
[*]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@
*.zip
*.tar.gz
*.rar
*.tgz

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Build files
target/
bin/

# NPM package
**/node_modules/
cmd/repository/
cmd/workspace/

# Mac OS
.DS_Store
110 changes: 110 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
1 change: 1 addition & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.import.exclusions": [
"**/org.eclipse.jdt.ls.tests/projects"
],
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.classpath" : true,
"**/.project": true
}
}
27 changes: 27 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Package",
"type": "shell",
"command": "./mvnw clean -B package",
"windows": {
"command": ".\\mvnw.cmd clean -B package"
},
"group": "build",
"problemMatcher": []
},
{
"label": "Verify",
"type": "shell",
"command": "./mvnw -B verify",
"windows": {
"command": ".\\mvnw.cmd -B verify"
},
"group": "test",
"problemMatcher": []
}
]
}
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Change Log

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 0.1.4
### Fixed
- Fix an NPE in ImplementationsVisitor when get the implementation ranges

### Changed
- Visit SimpleType and SimpleName in HoverVisitor and ReferencesVisitor

## 0.1.3
### Added
- Add SimpleType, SingleVariableDeclaration, VariableDeclarationFragment and MethodInvocation into ReferencesVisitor

### Fixed
- Stop enlisting the vertices and edges if the element does not have hover information

## 0.1.2
### Changed
- Change the output format

## 0.1.1
### Fixed
- Fix the typo for `metaData`.
- Remove the duplicated `hoverResults`

## 0.1.0
Initialize the Java LSIF Indexer
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Java Language Server Indexer

# Contributing
## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
Expand Down
4 changes: 4 additions & 0 deletions cmd/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
workspace/
gulpfile.js
*.tgz
2 changes: 2 additions & 0 deletions cmd/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@lsif:registry=https://devdiv.pkgs.visualstudio.com/_packaging/CloudKernel/npm/registry/
always-auth=true
23 changes: 23 additions & 0 deletions cmd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# LSIF for Java

## Prerequisite
The LSIF Java Indexer currently supports Maven or Gradle managed project. You can find `pom.xml` or `build.gradle` file in the project's base path.

## Parameters
- `-Dintellinav.repo.path`=`[path of repo]`

- `-Dintellinav.output.format`=`[format]`
- Supported values: line, json. Default: line

## Example
Invoke the `index.bat` with the path of the target repo:
```bat
> ./index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic"
```

```bat
> ./index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic" "-Dintellinav.output.format=json"
```

## Changelog
See [CHANGELOG.md](https://dev.azure.com/mseng/VSJava/_git/lsif-java?path=%2FCHANGELOG.md&version=GBmaster)
35 changes: 35 additions & 0 deletions cmd/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const gulp = require('gulp');
const cp = require('child_process');
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const rimraf = require("rimraf");

const rootPath = path.join(__dirname, '..');

gulp.task('clean', (done) => {
rimraf.sync(path.join(__dirname, 'repository'));
rimraf.sync(path.join(__dirname, 'workspace'));
const packages = glob.sync('*.tgz');
for (const package of packages) {
fs.unlinkSync(package);
}
done();
});

gulp.task('build-indexer', (done) => {
cp.execSync(`${mvnw()} clean verify`, { cwd: rootPath, stdio: [0, 1, 2] });
gulp.src(path.join(rootPath, 'com.microsoft.java.lsif.product', 'target', 'repository', '**/*'))
.pipe(gulp.dest(path.join(rootPath, 'cmd', 'repository')));
done();
});

gulp.task('build', gulp.series('clean', 'build-indexer'));

function isWin() {
return /^win/.test(process.platform);
}

function mvnw() {
return isWin() ? 'mvnw.cmd' : './mvnw';
}
29 changes: 29 additions & 0 deletions cmd/index.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@echo off
set basePath=%cd%\repository

IF "%~1" == "" GOTO Help
set input=%*

:Main

java ^
-Dlog.level=ALL ^
%input% ^
-noverify ^
-jar %basePath%\plugins\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar ^
-configuration %basePath%\config_win
goto End

:Help
@echo Parameters:
@echo. -Dintellinav.repo.path=[path of repo]
@echo.
@echo. -Dintellinav.output.format=[format]
@echo. Supported values: line, json. Default: line
@echo.
@echo Example:
@echo. index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic"
@echo.
@echo. index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic" "-Dintellinav.output.format=json"

:End
Loading

0 comments on commit 1600f59

Please sign in to comment.