mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-11 06:05:12 +03:00
Merge remote-tracking branch 'origin/trunk' into cp/project-branch-list
This commit is contained in:
commit
979a948405
33
.github/workflows/nix-dev-cache.yaml
vendored
Normal file
33
.github/workflows/nix-dev-cache.yaml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: Nix development cache
|
||||
|
||||
on:
|
||||
# Build on every pull request (and new PR commit)
|
||||
pull_request:
|
||||
# Build on new pushes to trunk (E.g. Merge commits)
|
||||
# Without the branch filter, each commit on a branch with a PR is triggered twice.
|
||||
# See: https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
|
||||
jobs:
|
||||
nix:
|
||||
name: ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
# Run each build to completion, regardless of if any have failed
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-20.04
|
||||
- macOS-12
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v22
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: unison
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: build all packages and development shells
|
||||
run: nix -L build --accept-flake-config --no-link --keep-going '.#all'
|
||||
|
17
.github/workflows/release.yaml
vendored
17
.github/workflows/release.yaml
vendored
@ -11,10 +11,6 @@ on:
|
||||
description: 'Release Version (E.g. M4 or M4a)'
|
||||
required: true
|
||||
type: string
|
||||
share_base_path:
|
||||
description: 'Path to base version that UCM should pull by default (E.g. `unison.public.base.releases.M4`)'
|
||||
required: true
|
||||
type: string
|
||||
target:
|
||||
description: 'Ref to use for this release, defaults to trunk'
|
||||
required: true
|
||||
@ -61,8 +57,6 @@ jobs:
|
||||
|
||||
name: "build_linux"
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@ -109,7 +103,7 @@ jobs:
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
# unison-cli checks env vars for which base version to automatically pull,
|
||||
# unison-cli embeds version numbers using TH
|
||||
# so it needs to be forced to rebuild to ensure those are updated.
|
||||
stack clean unison-cli
|
||||
stack --no-terminal build --flag unison-parser-typechecker:optimized
|
||||
@ -133,8 +127,6 @@ jobs:
|
||||
build_macos:
|
||||
name: "build_macos"
|
||||
runs-on: macos-12
|
||||
env:
|
||||
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@ -184,7 +176,7 @@ jobs:
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
# unison-cli checks env vars for which base version to automatically pull,
|
||||
# unison-cli embeds version numbers using TH
|
||||
# so it needs to be forced to rebuild to ensure those are updated.
|
||||
stack clean unison-cli
|
||||
stack --no-terminal build --flag unison-parser-typechecker:optimized
|
||||
@ -208,9 +200,6 @@ jobs:
|
||||
build_windows:
|
||||
name: "build_windows"
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
UNISON_BASE_PATH: "${{inputs.share_base_path}}"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@ -257,7 +246,7 @@ jobs:
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
# unison-cli checks env vars for which base version to automatically pull,
|
||||
# unison-cli embeds version numbers using TH
|
||||
# so it needs to be forced to rebuild to ensure those are updated.
|
||||
stack clean unison-cli
|
||||
|
||||
|
@ -76,3 +76,4 @@ The format for this list: name, GitHub handle
|
||||
* Mario Bašić (@mabasic)
|
||||
* Chris Krycho (@chriskrycho)
|
||||
* Hatim Khambati (@hatimkhambati26)
|
||||
* Kyle Goetz (@kylegoetz)
|
||||
|
14
flake.nix
14
flake.nix
@ -1,9 +1,8 @@
|
||||
{
|
||||
description = "Unison";
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.iog.io" "https://unison.cachix.org" ];
|
||||
extra-substituters = [ "https://unison.cachix.org" ];
|
||||
extra-trusted-public-keys = [
|
||||
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
||||
"unison.cachix.org-1:i1DUFkisRPVOyLp/vblDsbsObmyCviq/zs6eRuzth3k="
|
||||
];
|
||||
};
|
||||
@ -163,5 +162,16 @@
|
||||
defaultPackage = flake.packages."unison-cli:exe:unison";
|
||||
inherit (pkgs) unison-project;
|
||||
inherit devShells localPackageNames;
|
||||
packages = flake.packages // {
|
||||
all = pkgs.symlinkJoin {
|
||||
name = "all-packages";
|
||||
paths =
|
||||
let
|
||||
all-other-packages = builtins.attrValues (builtins.removeAttrs self.packages."${system}" [ "all" ]);
|
||||
devshell-inputs = builtins.concatMap (devShell: devShell.buildInputs ++ devShell.nativeBuildInputs) [ devShells.only-tools ];
|
||||
in
|
||||
all-other-packages ++ devshell-inputs;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ infixAppOrBooleanOp = chainl1 term4 (or <|> and <|> infixApp)
|
||||
typedecl :: (Monad m, Var v) => P v m (L.Token v, Type v Ann)
|
||||
typedecl =
|
||||
(,)
|
||||
<$> P.try (prefixDefinitionName <* reserved ":")
|
||||
<$> P.try (prefixTermName <* reserved ":")
|
||||
<*> TypeParser.valueType
|
||||
<* semi
|
||||
|
||||
@ -1053,8 +1053,8 @@ binding = label "binding" do
|
||||
arg2 <- prefixDefinitionName
|
||||
pure (ann arg1, op, [arg1, arg2])
|
||||
let prefixLhs = do
|
||||
v <- prefixDefinitionName
|
||||
vs <- many prefixDefinitionName
|
||||
v <- prefixTermName
|
||||
vs <- many prefixTermName
|
||||
pure (ann v, v, vs)
|
||||
let lhs :: P v m (Ann, L.Token v, [L.Token v])
|
||||
lhs = infixLhs <|> prefixLhs
|
||||
|
@ -9,16 +9,15 @@ fi
|
||||
|
||||
usage() {
|
||||
echo "NOTE: must be run from the root of the project."
|
||||
echo "Usage: $0 VERSION SHARE_BASE_PATH [TARGET]"
|
||||
echo "Usage: $0 VERSION [TARGET]"
|
||||
echo "VERSION: The version you're releasing, e.g. M4a"
|
||||
echo "SHARE_BASE_PATH: Which base version to pull from share, e.g. 'unison.public.base.releases.M4'"
|
||||
echo "TARGET: The revision to make the release from, defaults to 'trunk'"
|
||||
echo ""
|
||||
echo "E.g."
|
||||
echo "$0 M4a"
|
||||
}
|
||||
|
||||
if [[ -z "$1" || -z "$2" ]] ; then
|
||||
if [[ -z "$1" ]] ; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
@ -36,8 +35,7 @@ fi
|
||||
|
||||
version="${1}"
|
||||
prev_version=$(./scripts/previous-tag.sh "$version")
|
||||
share_base_path=${2}
|
||||
target=${3:-trunk}
|
||||
target=${2:-trunk}
|
||||
tag="release/${version}"
|
||||
|
||||
echo "Creating release in unison-local-ui..."
|
||||
@ -46,7 +44,7 @@ gh release create "release/${version}" --repo unisonweb/unison-local-ui --target
|
||||
echo "Kicking off release workflow in unisonweb/unison"
|
||||
git tag "${tag}" "${target}"
|
||||
git push origin "${tag}"
|
||||
gh workflow run release --repo unisonweb/unison --field "version=${version}" --field "share_base_path=${share_base_path}"
|
||||
gh workflow run release --repo unisonweb/unison --field "version=${version}"
|
||||
|
||||
echo "Kicking off Homebrew update task"
|
||||
gh workflow run release --repo unisonweb/homebrew-unison --field "version=${version}"
|
||||
|
@ -6,6 +6,7 @@ module Unison.CommandLine.InputPatterns where
|
||||
import Control.Lens (preview, (^.))
|
||||
import Control.Lens.Cons qualified as Cons
|
||||
import Data.List (intercalate)
|
||||
import Data.List.Extra qualified as List
|
||||
import Data.List.NonEmpty qualified as NE
|
||||
import Data.Map qualified as Map
|
||||
import Data.Maybe (fromJust)
|
||||
@ -452,7 +453,7 @@ ui =
|
||||
{ patternName = "ui",
|
||||
aliases = [],
|
||||
visibility = I.Visible,
|
||||
argTypes = [],
|
||||
argTypes = [(Optional, namespaceOrDefinitionArg)],
|
||||
help = P.wrap "`ui` opens the Local UI in the default browser.",
|
||||
parse = \case
|
||||
[] -> pure $ Input.UiI Path.relativeEmpty'
|
||||
@ -2963,6 +2964,17 @@ namespaceArg =
|
||||
globTargets = Set.fromList [Globbing.Namespace]
|
||||
}
|
||||
|
||||
namespaceOrDefinitionArg :: ArgumentType
|
||||
namespaceOrDefinitionArg =
|
||||
ArgumentType
|
||||
{ typeName = "term, type, or namespace",
|
||||
suggestions = \q cb _http p -> Codebase.runTransaction cb do
|
||||
namespaces <- prefixCompleteNamespace q p
|
||||
termsTypes <- prefixCompleteTermOrType q p
|
||||
pure (List.nubOrd $ namespaces <> termsTypes),
|
||||
globTargets = Set.fromList [Globbing.Namespace, Globbing.Term, Globbing.Type]
|
||||
}
|
||||
|
||||
-- | Names of child branches of the branch, only gives options for one 'layer' deeper at a time.
|
||||
childNamespaceNames :: Branch.Branch0 m -> [Text]
|
||||
childNamespaceNames b = NameSegment.toText <$> Map.keys (Branch.nonEmptyChildren b)
|
||||
|
8
unison-src/transcripts/no-hash-in-term-declaration.md
Normal file
8
unison-src/transcripts/no-hash-in-term-declaration.md
Normal file
@ -0,0 +1,8 @@
|
||||
# No Hashes in Term Declarations
|
||||
|
||||
There should not be hashes in the names used in term declarations, either in the type signature or the type definition.
|
||||
|
||||
```unison:hide:all:error
|
||||
x##Nat : Int -> Int -> Boolean
|
||||
x##Nat = 5
|
||||
```
|
@ -0,0 +1,4 @@
|
||||
# No Hashes in Term Declarations
|
||||
|
||||
There should not be hashes in the names used in term declarations, either in the type signature or the type definition.
|
||||
|
@ -31,6 +31,7 @@ module Unison.Syntax.Parser
|
||||
peekAny,
|
||||
positionalVar,
|
||||
prefixDefinitionName,
|
||||
prefixTermName,
|
||||
queryToken,
|
||||
reserved,
|
||||
root,
|
||||
@ -297,6 +298,19 @@ prefixDefinitionName :: (Var v) => P v m (L.Token v)
|
||||
prefixDefinitionName =
|
||||
wordyDefinitionName <|> parenthesize symbolyDefinitionName
|
||||
|
||||
-- Parse a prefix identifier e.g. Foo or (+), rejecting any hash
|
||||
-- This is useful for term declarations, where type signatures and term names should not have hashes.
|
||||
prefixTermName :: (Var v) => P v m (L.Token v)
|
||||
prefixTermName = wordyTermName <|> parenthesize symbolyTermName
|
||||
where
|
||||
wordyTermName = queryToken $ \case
|
||||
L.WordyId s Nothing -> Just $ Var.nameds s
|
||||
L.Blank s -> Just $ Var.nameds ("_" <> s)
|
||||
_ -> Nothing
|
||||
symbolyTermName = queryToken $ \case
|
||||
L.SymbolyId s Nothing -> Just $ Var.nameds s
|
||||
_ -> Nothing
|
||||
|
||||
-- Parse a wordy identifier e.g. Foo, discarding any hash
|
||||
wordyDefinitionName :: (Var v) => P v m (L.Token v)
|
||||
wordyDefinitionName = queryToken $ \case
|
||||
|
Loading…
Reference in New Issue
Block a user