Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jaredly/reason-language-server
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredly committed Dec 12, 2019
2 parents 9557e89 + d833879 commit 6a8d6fc
Show file tree
Hide file tree
Showing 22 changed files with 229 additions and 281 deletions.
37 changes: 37 additions & 0 deletions .ci/build-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Cross-platform set of build steps for building esy projects

parameters:
platform: "macOS"
vmImage: "macOS-10.13"

jobs:
- job: ${{ parameters.platform }}
pool:
vmImage: ${{ parameters.vmImage }}
demands: node.js
timeoutInMinutes: 120 # This is mostly for Windows
variables:
ESY__CACHE_INSTALL_PATH: ${{ parameters.ESY__CACHE_INSTALL_PATH }}
CACHE_FOLDER: $(Pipeline.Workspace)/cache
steps:
- template: utils/use-node.yml
- template: utils/use-esy.yml
- template: utils/restore-build-cache.yml
- script: "esy install"
displayName: "esy install"
- script: "esy build"
displayName: "esy build"
# - script: "esy test"
# displayName: "Test command"
- template: utils/publish-build-cache.yml
- bash: ./_build/default/src/analyze_example_tests/ExamplesTests.exe
- bash: ./_build/default/util_tests/UtilTests.exe
- bash: mkdir -p rls-release
- bash: cp _build/default/bin/Bin.exe rls-release/reason-language-server.exe
- task: PublishBuildArtifacts@1
displayName: 'Upload binary'
inputs:
pathToPublish: 'rls-release'
artifactName: 'rls-$(Agent.OS)'
parallel: true
parallelCount: 8
22 changes: 0 additions & 22 deletions .ci/esy-build-steps.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .ci/publish-build-cache.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .ci/restore-build-cache.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .ci/use-calc-esy-install-path.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .ci/utils/publish-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
steps:
- pwsh: Copy-Item -Path $(ESY__CACHE_INSTALL_PATH) -Destination $(CACHE_FOLDER) -Recurse
displayName: '[Cache][Publish] Copy builds to be cached'
45 changes: 45 additions & 0 deletions .ci/utils/restore-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The cache key is built up of the following:
# We use a string that we can change to bust the cache
# The string "esy"
# The string for the OS
# The hash of the lock file
steps:
- bash: |
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
DESIRED_LEN="86"
# Note: This will need to change when upgrading esy version
# that reenables long paths on windows.
if [ "$AGENT_OS" == "Windows_NT" ]; then
DESIRED_LEN="33"
fi
HOME_ESY3="$HOME/.esy/3"
HOME_ESY3_LEN=${#HOME_ESY3}
NUM_UNDERS=$(echo "$(($DESIRED_LEN-$HOME_ESY3_LEN))")
UNDERS=$(printf "%-${NUM_UNDERS}s" "_")
UNDERS="${UNDERS// /_}"
THE_ESY__CACHE_INSTALL_PATH=${HOME_ESY3}${UNDERS}/i
if [ "$AGENT_OS" == "Windows_NT" ]; then
THE_ESY__CACHE_INSTALL_PATH=$( cygpath --mixed --absolute "$THE_ESY__CACHE_INSTALL_PATH")
fi
echo "THE_ESY__CACHE_INSTALL_PATH: $THE_ESY__CACHE_INSTALL_PATH"
# This will be exposed as an env var ESY__CACHE_INSTALL_PATH, or an
# Azure var esy__cache_install_path
echo "##vso[task.setvariable variable=esy__cache_install_path]$THE_ESY__CACHE_INSTALL_PATH"
displayName: '[Cache] calculate esy store path'
- task: Cache@2
inputs:
# "v1" prefix added just to keep the ability to clear a cache without having to wait 7 days
key: v1 | esy | $(Agent.OS) | esy.lock/index.json
restoreKeys: v1 | esy | $(Agent.OS)
path: $(CACHE_FOLDER)
cacheHitVar: CACHE_RESTORED
displayName: '[Cache] esy packages'

- pwsh: 'New-Item $(ESY__CACHE_INSTALL_PATH) -ItemType Directory'
condition: eq(variables.CACHE_RESTORED, 'true')
displayName: '[Cache][Restore] Create esy cache directory'

- pwsh: Move-Item -Path $(CACHE_FOLDER)/* -Destination $(ESY__CACHE_INSTALL_PATH)
displayName: '[Cache][Restore] Move downloaded cache in place'
condition: eq(variables.CACHE_RESTORED, 'true')
5 changes: 5 additions & 0 deletions .ci/utils/use-esy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# steps to install esy globally

steps:
- script: "npm install -g [email protected]"
displayName: "install esy"
7 changes: 7 additions & 0 deletions .ci/utils/use-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# steps to use node on agent

steps:
- task: NodeTool@0
displayName: "Use Node 8.x"
inputs:
versionSpec: 8.x
112 changes: 41 additions & 71 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,51 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml


name: $(Build.SourceVersion)
jobs:
- job: Linux
timeoutInMinutes: 0
pool:
vmImage: 'Ubuntu 16.04'

variables:
STAGING_DIRECTORY: /home/vsts/STAGING
STAGING_DIRECTORY_UNIX: /home/vsts/STAGING
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source/i
# ESY__NPM_ROOT: /opt/hostedtoolcache/node/8.14.0/x64/lib/node_modules/esy

steps:
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml
trigger:
branches:
include:
- master

- job: MacOS
timeoutInMinutes: 0
pool:
vmImage: 'macOS 10.13'
pr:
branches:
include:
- "*"

variables:
STAGING_DIRECTORY: /Users/runner/STAGING
STAGING_DIRECTORY_UNIX: /Users/runner/STAGING
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/runner/.esy/source/i
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy

steps:
- template: .ci/use-calc-esy-install-path.yml
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml

- job: Windows
timeoutInMinutes: 0
pool:
vmImage: 'vs2017-win2016'
jobs:
- template: .ci/build-platform.yml
parameters:
platform: Linux
vmImage: ubuntu-16.04

variables:
STAGING_DIRECTORY: C:\Users\VssAdministrator\STAGING
STAGING_DIRECTORY_UNIX: /C/Users/VssAdministrator/STAGING
ESY__CACHE_INSTALL_PATH: /C/Users/VssAdministrator/.esy/3_/i
ESY__CACHE_SOURCE_TARBALL_PATH: /C/Users/VssAdministrator/.esy/source/i
# ESY__NPM_ROOT: /C/npm/prefix/node_modules/esy
- template: .ci/build-platform.yml
parameters:
platform: macOS
vmImage: macOS-10.13

steps:
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml
# Need windows-2019 to do esy import/export-dependencies
# which assumes you have bsdtar (tar.exe) in your system
# otherwise it will end up using the esy-bash tar which doesn't
# understand drives like D:/ (thinks it's an scp path).
- template: .ci/build-platform.yml
parameters:
platform: Windows
vmImage: windows-2019

- job: Release
timeoutInMinutes: 0
displayName: Release
dependsOn:
- Linux
- MacOS
- Windows
condition: succeeded()
pool:
vmImage: ubuntu-16.04
steps:
- task: PublishBuildArtifacts@1
displayName: 'Release Package'
inputs:
PathtoPublish: './editor-extensions/vscode/'
ArtifactName: npm-package
- job: Release
timeoutInMinutes: 0
displayName: Release
dependsOn:
- Linux
- MacOS
- Windows
condition: succeeded()
pool:
vmImage: ubuntu-16.04
steps:
- task: PublishBuildArtifacts@1
displayName: 'Release Package'
inputs:
PathtoPublish: './editor-extensions/vscode/'
ArtifactName: npm-package


# - name: release
Expand Down
6 changes: 3 additions & 3 deletions core/Query.re
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ let findInScope = (pos, name, stamps) => {

let rec joinPaths = (modulePath, path) => {
switch modulePath {
| Path.Pident(ident) => (Current.ident_binding_time(ident), Ident.name(ident), path)
| Path.Pident(ident) => (Current.ident_binding_time_408(ident), Ident.name(ident), path)
| Path.Papply(fnPath, _argPath) => joinPaths(fnPath, path)
| Path.Pdot(inner, name) => joinPaths(inner, Nested(name, path))
}
};

let rec makePath = (modulePath) => {
switch modulePath {
| Path.Pident(ident) when Current.ident_binding_time(ident) === 0 =>
| Path.Pident(ident) when Current.ident_binding_time_408(ident) === 0 =>
`GlobalMod(Ident.name(ident))
| Path.Pident(ident) => `Stamp(Current.ident_binding_time(ident))
| Path.Pident(ident) => `Stamp(Current.ident_binding_time_408(ident))
| Path.Papply(fnPath, _argPath) => makePath(fnPath)
| Path.Pdot(inner, name) => `Path(joinPaths(inner, Tip(name)))
}
Expand Down
6 changes: 3 additions & 3 deletions ocaml_typing/current/Current.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ type longident = Longident.t =

type abstract_ident = Ident.t

type ident =
type ident_408 =
| Local of { name: string; stamp: int }
| Scoped of { name: string; stamp: int; scope: int }
| Global of string
| Predef of { name: string; stamp: int }

let ident_binding_time ident =
let current_ident = (Obj.magic ident : ident) in
let ident_binding_time_408 (ident: Ident.t) =
let current_ident = (Obj.magic ident : ident_408) in
match current_ident with
| Predef { stamp }
| Scoped { stamp }
Expand Down
Loading

0 comments on commit 6a8d6fc

Please sign in to comment.