Permalink
Browse files

[lsp] reorganize projects

  • Loading branch information...
vladdu committed Apr 25, 2017
1 parent 082a35d commit 5b2d80956ff93d9b35f31923352bf403f3a0089e
Showing with 265 additions and 336 deletions.
  1. +2 −2 Jenkinsfile
  2. +17 −6 build
  3. +0 −257 build.gradle
  4. +1 −1 build_utils.sh
  5. +1 −1 ide/apps/erlide_ide/src/erlide_content_assist.erl
  6. +2 −3 ide/apps/erlide_ide/src/erlide_ide.app.src
  7. +0 −24 ide/apps/erlide_ide/src/erlide_ide.erl
  8. +1 −1 ide/apps/erlide_ide/src/erlide_indent.erl
  9. +1 −1 ide/apps/erlide_ide/src/erlide_open.erl
  10. +1 −1 ide/apps/erlide_ide/src/erlide_search.erl
  11. +18 −0 ide/apps/erlide_ide_core/.project
  12. 0 ide/apps/{erlide_server → erlide_ide_core}/.settings/org.eclipse.core.resources.prefs
  13. 0 ide/apps/{erlide_server → erlide_ide_core}/.settings/org.erlide.core.prefs
  14. 0 ide/apps/{erlide_server → erlide_ide_core}/.settings/org.erlide.model.prefs
  15. 0 ide/apps/{erlide_server → erlide_ide_core}/include/erlide_noparse.hrl
  16. 0 ide/apps/{erlide_server → erlide_ide_core}/include/erlide_scanner_server.hrl
  17. 0 ide/apps/{erlide_server → erlide_ide_core}/include/erlide_search.hrl
  18. 0 ide/apps/{erlide_server → erlide_ide_core}/include/erlide_token.hrl
  19. 0 ide/apps/{erlide_server → erlide_ide_core}/priv/.keep
  20. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erl_scan_local.erl
  21. +1 −1 ide/apps/{erlide_server/src/erlide_server.app.src → erlide_ide_core/src/erlide_ide_core.app.src}
  22. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_noparse.erl
  23. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_np.erl
  24. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_np_records.erl
  25. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_np_util.erl
  26. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_parse.erl
  27. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_scan.erl
  28. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_scan_model.erl
  29. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_scan_util.erl
  30. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_scanner.erl
  31. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_scanner_server.erl
  32. 0 ide/apps/{erlide_server → erlide_ide_core}/src/erlide_text.erl
  33. 0 ide/apps/{erlide_server → erlide_ide_core}/test/erlide_parse_tests.erl
  34. 0 ide/apps/{erlide_server → erlide_ide_core}/test/erlide_parsing_tests.erl
  35. 0 ide/apps/{erlide_server → erlide_ide_core}/test/erlide_scan_model_tests.erl
  36. 0 ide/apps/{erlide_server → erlide_ide_core}/test/erlide_scan_tests.erl
  37. 0 ide/apps/{erlide_server → erlide_ide_core}/test/erlide_scanner_tests.erl
  38. 0 {ide → server}/apps/erlide_server/.project
  39. +3 −0 server/apps/erlide_server/.settings/org.eclipse.core.resources.prefs
  40. +7 −0 server/apps/erlide_server/.settings/org.erlide.core.prefs
  41. +3 −0 server/apps/erlide_server/.settings/org.erlide.model.prefs
  42. 0 server/apps/erlide_server/include/.keep
  43. 0 server/apps/erlide_server/priv/.keep
  44. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/cancellable_worker.erl
  45. 0 {ide → server}/apps/erlide_server/src/erlide_db.erl
  46. 0 {ide → server}/apps/erlide_server/src/erlide_db.yaml
  47. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_doc_server.erl
  48. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_edoc.erl
  49. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_edoc_doc_provider.erl
  50. +11 −2 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_lsp_proxy.erl
  51. +23 −31 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_lsp_server.erl
  52. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_lsp_utils.erl
  53. 0 {ide → server}/apps/erlide_server/src/erlide_module.erl
  54. 0 {ide/apps/erlide_ide → server/apps/erlide_server}/src/erlide_otp_xml_doc_provider.erl
  55. +10 −0 server/apps/erlide_server/src/erlide_server.app.src
  56. +37 −0 server/apps/erlide_server/src/erlide_server.erl
  57. +19 −0 server/apps/erlide_server/src/erlide_server_app.erl
  58. +1 −1 ide/apps/erlide_ide/src/erlide_ide_core.erl → server/apps/erlide_server/src/erlide_server_core.erl
  59. +3 −4 ide/apps/erlide_ide/src/erlide_ide_sup.erl → server/apps/erlide_server/src/erlide_server_sup.erl
  60. 0 server/apps/erlide_server/test/.keep
  61. +11 −0 server/build
  62. +80 −0 server/rebar.config
  63. +12 −0 server/rebar.lock
View
@@ -123,8 +123,8 @@ def buildEclipse() {
}
def buildServer() {
sh "cd ide && ./build escriptize && cd .."
step([$class: 'ArtifactArchiver', artifacts: "ide/_build/default/bin/erlide_ide", fingerprint: true])
sh "cd server && ./build escriptize && cd .."
step([$class: 'ArtifactArchiver', artifacts: "server/_build/default/bin/erlide_server", fingerprint: true])
}
@NonCPS
View
23 build
@@ -25,16 +25,22 @@ export REBAR_COLOR="low"
#export QUIET=1
main() {
arg=$1
arg=${1:-compile}
setup_otp
find . -name build | xargs chmod u+x
if [ "$arg" != "test" ]; then
cmds="do clean -a, compile -v"
else
cmds="do eunit -c -v, cover -v"
fi
case "$arg" in
"compile")
cmds="do clean -a, compile -v"
;;
"test")
cmds="do eunit -c -v, cover -v"
;;
"verify")
cmds="do xref, dialyzer"
;;
esac
set -e
cd common
@@ -43,6 +49,11 @@ main() {
./build $cmds
cd ../ide
./build $cmds
cd ../server
./build $cmds
if [ "$arg" == "compile" ] ; then
./build escriptize
fi
cd ..
}
View
@@ -1,257 +0,0 @@
buildscript {
repositories {
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id "de.undercouch.download" version "2.1.0"
}
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.regex.Pattern
import java.util.regex.Matcher
def otpVersions = [
"17": "17.5",
"18": "18.3",
"19": "19.2"
]
subprojects {
ext {
context = detect_erlide_context(projectDir)
otp_version = detect_otp(projectDir)
codeDirs = []
otpHome = "${System.getProperty('user.home')}/erlide_tools/${otpVersions[otp_version]}"
}
task clean(type: Exec) {
dependsOn ':setup'
workingDir = projectDir
environment['ERL_LIBS'] = "${System.getProperty("user.home")}/erlide_tools:${environment['ERL_LIBS']}"
commandLine "${otpHome}/bin/escript", "${rootDir}/rebar3", 'clean'
}
task build(type: Exec) {
dependsOn ':setup'
workingDir = projectDir
environment['ERL_LIBS'] = "${System.getProperty("user.home")}/erlide_tools:${environment['ERL_LIBS']}"
commandLine "${otpHome}/bin/escript", "${rootDir}/rebar3", 'compile'
}
task test(type: Exec) {
dependsOn ':setup'
workingDir = projectDir
environment['ERL_LIBS'] = "${projectDir}/../erlide_common/_build/test/lib:${System.getProperty("user.home")}/erlide_tools:${environment['ERL_LIBS']}"
commandLine "${otpHome}/bin/escript", "${rootDir}/rebar3", 'do', 'eunit,cover'
}
}
task assemble(type: Zip) {
destinationDir file('target')
baseName 'org.erlide.kernel'
subprojects.findAll { !it.name.contains('debugger') }.each { subproject ->
dependsOn subproject.build
def app = detect_app_name(subproject.projectDir)
into("${subproject.context}") {
from subproject.file("_build/default/lib/")
include "**/*.beam"
include "**/*.app"
includeEmptyDirs = false
eachFile { fcp->
if (fcp.isDirectory()) { fcp.exclude(); println(fcp) }
fcp.path = "${subproject.context}/${fcp.name}"
}
}
subproject.codeDirs.add([
otp_version: subproject.otp_version.toUpperCase(),
path: "${subproject.context}",
context: subproject.context
])
}
subprojects.findAll { it.name.endsWith('debugger') }.each { subproject ->
dependsOn subproject.build
def app = detect_app_name(subproject.projectDir)
into("${subproject.context}") {
from subproject.file("_build/default/lib/")
include "**/*.beam"
include "**/*.app"
includeEmptyDirs = false
eachFile { fcp->
if (fcp.isDirectory()) fcp.exclude()
fcp.path = "${subproject.context}/${fcp.name}"
}
}
subproject.codeDirs.add([
otp_version: subproject.otp_version.toUpperCase(),
path: "${subproject.context}",
context: subproject.context
])
}
subprojects.findAll { it.name.contains('debugger_') }.each { subproject ->
dependsOn subproject.build
def app = detect_app_name(subproject.projectDir)
into("${subproject.context}/${subproject.otp_version}") {
from subproject.file("_build/default/lib/")
include "**/*.beam"
include "**/*.app"
includeEmptyDirs = false
eachFile { fcp->
if (fcp.isDirectory()) fcp.exclude()
fcp.path = "${subproject.context}/${subproject.otp_version}/${fcp.name}"
}
}
subproject.codeDirs.add([
otp_version: subproject.otp_version.toUpperCase(),
path: "${subproject.context}/${subproject.otp_version}",
context: subproject.context
])
}
into("") {
from file("org.erlide.kernel")
def env = loadEnvironment()
expand env
}
outputs.upToDateWhen { false }
}
def loadEnvironment() {
def properties = new Properties()
properties.codeDirs = subprojects.collect { it.codeDirs }.flatten().unique()
properties
}
String detect_otp(File dir) {
byte[] encoded = Files.readAllBytes(Paths.get("${dir}/rebar.config"))
String text = new String(encoded, 'UTF-8')
Pattern p = Pattern.compile("require_otp_vsn, *\"(R?[0-9]+).*\"")
Matcher m = p.matcher(text)
if(m.find()) {
String r = m.group(1)
return r.toLowerCase()
}
return "r17"
}
String detect_app_name(File dir) {
File srcDir = new File(dir, 'src')
File appSrc = srcDir.listFiles().find { it.name.endsWith('.app.src') }
if(appSrc==null) return "error"
java.nio.file.Path path = Paths.get(appSrc.path)
byte[] encoded = Files.readAllBytes(path)
String text = new String(encoded, 'UTF-8')
Pattern p = Pattern.compile("\\{application, *([^,]+),")
Matcher m = p.matcher(text)
if(m.find())
return m.group(1)
return "unknown"
}
String detect_erlide_context(File dir) {
File srcDir = new File(dir, 'src')
File appSrc = srcDir.listFiles().find { it.name.endsWith('.app.src') }
if(appSrc==null) return "error"
java.nio.file.Path path = Paths.get(appSrc.path)
byte[] encoded = Files.readAllBytes(path)
String text = new String(encoded, 'UTF-8')
Pattern p = Pattern.compile("\\{erlide_context, *([^\\}]+)\\}")
Matcher m = p.matcher(text)
if(m.find())
return m.group(1)
return "common"
}
String detect_version(File dir) {
File srcDir = new File(dir, 'src')
File appSrc = srcDir.listFiles().find { it.name.endsWith('.app.src') }
if(appSrc==null) return "error"
java.nio.file.Path path = Paths.get(appSrc.path)
byte[] encoded = Files.readAllBytes(path)
String text = new String(encoded, 'UTF-8')
Pattern p = Pattern.compile("\\{vsn, \"*([^\"]+)\"\\}")
Matcher m = p.matcher(text)
if(m.find())
return m.group(1)
return "0.0.0"
}
List<String> run(cmds) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine cmds
standardOutput = stdout
}
stdout.toString().readLines()
}
List<String> kerl(cmds) {
run(["${System.getProperty('user.home')}/erlide_tools/kerl"]+cmds)
}
String kerlBuildName(vsn) {
def r = kerl(['list', 'builds']).find {
def a = it.split(',')
a[0] == vsn
}
r? r.split(',')[1] : null
}
String kerlInstallationPath(name) {
def r = kerl(['list', 'installations']).find {
def a = it.split(' ')
a[0] == name
}
r? r.split(' ')[1] : null
}
task setup(){
println ("Setup Erlang tools - the first time, this might take up to 30 minutes, as we need to build 3 or 4 Erlang runtimes...")
println("Download kerl")
downloadTool('kerl', 'https://raw.githubusercontent.com/kerl/kerl/master/kerl',
true, "${System.getProperty('user.home')}/erlide_tools")
kerl(['update', 'releases'])
for(vsn in otpVersions.keySet()){
def name = kerlBuildName(otpVersions[vsn])
if(name == null) {
println("Build OTP $vsn")
name = otpVersions[vsn]
kerl(['build', name, name])
} else {
println("OTP $name already built")
}
def path = kerlInstallationPath(name)
if(path == null) {
println("Install OTP $name")
path = "${System.getProperty('user.home')}/erlide_tools/${name}"
kerl(['install', name, path])
} else {
println("OTP $name ($path) already installed")
}
}
println "Done."
}
void downloadTool(String name, String url, boolean exec, String destDir, boolean force=true) {
if(!force && new File("${destDir}/${name}").exists()) {
println "Tool $name is already downloaded."
return
}
println "Downloading tool $name..."
download {
src url
dest "$destDir/$name"
}
if(exec)
ant.chmod(dir: destDir, perm:"ug+x", includes: name)
}
View
@@ -11,7 +11,7 @@ build_project() {
shift
echo ""
echo "Building $PRJ with OTP ${OTP_VSNS[$VSN]}..."
echo "Building --$PRJ-- with OTP ${OTP_VSNS[$VSN]}..."
~/erlide_tools/${OTP_VSNS[$VSN]}/bin/escript $REBAR "$@"
}
@@ -13,7 +13,7 @@
%% -define(DEBUG, 1).
-include_lib("erlide_common/include/erlide_dbglog.hrl").
-include_lib("erlide_server/include/erlide_token.hrl").
-include_lib("erlide_ide_core/include/erlide_token.hrl").
%%
@@ -3,8 +3,7 @@
{vsn, "0.113.0"},
{erlide_context, ide},
{registered, []},
{applications, [kernel, stdlib, erlide_common, erlide_server, jsx]},
{env, []},
{mod, {erlide_ide, []}}
{applications, [kernel, stdlib, erlide_common, erlide_ide_core]},
{env, []}
]}
.
@@ -1,24 +0,0 @@
-module(erlide_ide).
-export([main/1]).
-behaviour(application).
-export([start/2, stop/1]).
main(Args) ->
io:format("Start erlide server. ~p~n", [Args]),
application:set_env(erlide_ide, main_args, Args, [{persistent, true}]),
_R = application:ensure_all_started(erlide_ide),
receive stop -> ok end,
ok.
start(_Type, _StartArgs) ->
io:format("Start app ~p~n", [application:get_all_env()]),
erlide_ide_sup:start_link().
stop(_State) ->
io:format("Stop app ~n"),
init:stop(),
ok.
@@ -21,7 +21,7 @@
%% -define(DEBUG, 1).
-include_lib("erlide_common/include/erlide_dbglog.hrl").
-include_lib("erlide_server/include/erlide_token.hrl").
-include_lib("erlide_ide_core/include/erlide_token.hrl").
%% TODO change into multiples of IndentW
default_indent_prefs() ->
@@ -31,7 +31,7 @@
-include_lib("erlide_common/include/erlide_dbglog.hrl").
-include("erlide_open.hrl").
-include_lib("erlide_server/include/erlide_token.hrl").
-include_lib("erlide_ide_core/include/erlide_token.hrl").
-define(CACHE_VERSION, 4).
@@ -11,7 +11,7 @@
-include_lib("erlide_common/include/erlide_dbglog.hrl").
-include_lib("erlide_server/include/erlide_search.hrl").
-include_lib("erlide_ide_core/include/erlide_search.hrl").
%%
%% Exported Functions
Oops, something went wrong.

0 comments on commit 5b2d809

Please sign in to comment.