Skip to content

Commit

Permalink
Update corral to work with latest ponyc nightly
Browse files Browse the repository at this point in the history
Changes are all related to RFC 70.

Once the next version of ponyc is released, PR CI tasks need to be
switched back from using nightly to release.
  • Loading branch information
SeanTAllen committed Sep 3, 2021
1 parent 9691b43 commit f77ce3d
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 39 deletions.
15 changes: 14 additions & 1 deletion .ci-scripts/freebsd-13.0-install-pony-tools.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
#!/bin/bash

case "${1}" in
"release")
;;
"nightly")
;;
*)
echo "invalid ponyc version"
echo "Options:"
echo "release"
echo "nightly"
exit 1
esac

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/latest-release/ponyup-init.sh | sh

export PATH="$HOME/.local/share/ponyup/bin/:$PATH"

ponyup update ponyc release
ponyup update ponyc "${1}"

6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ task:
- echo "IGNORE_OSVERSION = yes" >> /usr/local/etc/pkg.conf
- pkg update
- pkg install -y bash git gmake
- bash .ci-scripts/freebsd-13.0-install-pony-tools.bash
- bash .ci-scripts/freebsd-13.0-install-pony-tools.bash nightly

test_script:
- export PATH="$HOME/.local/share/ponyup/bin/:$PATH"
Expand Down Expand Up @@ -47,7 +47,7 @@ task:

nightly_script:
- export PATH="$HOME/.local/share/ponyup/bin/:$PATH"
- bash .ci-scripts/release/x86-64-unknown-freebsd-13.0-nightly.bash
- bash .ci-scripts/release/x86-64-unknown-freebsd-13.0-nightly.bash nightly

#
# Release build tasks
Expand All @@ -71,7 +71,7 @@ task:
- pkg update
- pkg install -y bash gmake git py38-pip
- pip install --upgrade cloudsmith-cli
- bash .ci-scripts/freebsd-13.0-install-pony-tools.bash
- bash .ci-scripts/freebsd-13.0-install-pony-tools.bash nightly

release_script:
- export PATH="$HOME/.local/share/ponyup/bin/:$PATH"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Build and upload x86-64-unknown-linux-nightly to Cloudsmith
runs-on: ubuntu-latest
container:
image: ponylang/shared-docker-ci-x86-64-unknown-linux-builder:release
image: ponylang/shared-docker-ci-x86-64-unknown-linux-builder:latest
steps:
- uses: actions/checkout@v1
- name: Build and upload
Expand All @@ -34,7 +34,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: install ponyc
run: bash .ci-scripts/macOS-install-pony-tools.bash release
run: bash .ci-scripts/macOS-install-pony-tools.bash nightly
- name: brew install dependencies
run: brew install coreutils
- name: pip install dependencies
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Build and upload
run: |
python.exe -m pip install --upgrade cloudsmith-cli
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/ponyc-x86-64-pc-windows-msvc.zip -OutFile C:\ponyc.zip;
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/nightlies/raw/versions/latest/ponyc-x86-64-pc-windows-msvc.zip -OutFile C:\ponyc.zip;
Expand-Archive -Path C:\ponyc.zip -DestinationPath C:\ponyc;
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
.\make.ps1 -Command build;
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
name: Verify PR builds most recent ponyc release on Linux
runs-on: ubuntu-latest
container:
image: ponylang/shared-docker-ci-x86-64-unknown-linux-builder:release
image: ponylang/shared-docker-ci-x86-64-unknown-linux-builder:latest
steps:
- uses: actions/checkout@v1
- name: Test with most recent ponyc release
Expand All @@ -52,7 +52,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: install ponyc
run: bash .ci-scripts/macOS-install-pony-tools.bash release
run: bash .ci-scripts/macOS-install-pony-tools.bash nightly
- name: brew install dependencies
run: brew install coreutils
- name: Test with most recent ponyc release
Expand All @@ -67,7 +67,7 @@ jobs:
- uses: actions/checkout@v1
- name: Test with most recent ponyc release
run: |
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/ponyc-x86-64-pc-windows-msvc.zip -OutFile C:\ponyc.zip;
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/nightlies/raw/versions/latest/ponyc-x86-64-pc-windows-msvc.zip -OutFile C:\ponyc.zip;
Expand-Archive -Path C:\ponyc.zip -DestinationPath C:\ponyc;
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
.\make.ps1 -Command test 2>&1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ponylang/ponyc:release-alpine AS build
FROM ponylang/ponyc:alpine AS build

WORKDIR /src/corral

Expand Down
6 changes: 3 additions & 3 deletions corral/bundle/project.pony
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ primitive BundleDir
while dir'.size() > 0 do
log(Info) and log.log("Looking for " + Files.bundle_filename() + " in: '" + dir' + "'")
try
let dir_path = FilePath(auth, dir')?
let dir_path = FilePath(auth, dir')
let bundle_file = dir_path.join(Files.bundle_filename())?
if bundle_file.exists() then
return dir_path
Expand All @@ -32,7 +32,7 @@ primitive BundleDir
fun resolve(auth: AmbientAuth, dir: String, log: Logger[String]): (FilePath | None) =>
log(Info) and log.log("Checking for " + Files.bundle_filename() + " in: '" + dir + "'")
try
let dir_path = FilePath(auth, dir)?
let dir_path = FilePath(auth, dir)
let bundle_file = dir_path.join(Files.bundle_filename())?
if bundle_file.exists() then
return dir_path
Expand Down Expand Up @@ -81,7 +81,7 @@ class val Project

fun dep_bundle_root(locator: Locator): FilePath ? =>
let root = if locator.is_local_direct() then
FilePath(auth, Path.join(dir.path, locator.bundle_path))?
FilePath(auth, Path.join(dir.path, locator.bundle_path))
else
corral_dirpath()?.join(Path.join(locator.flat_name(), locator.bundle_path))?
end
Expand Down
8 changes: 4 additions & 4 deletions corral/cmd/_test_cmd_update.pony
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ primitive _OpsRecorderTestRunner
let auth = h.env.root as AmbientAuth
let log = StringLogger(Error, h.env.err, SimpleLogFormatter)
let fp: FilePath = _TestData.file_path_from(h, dep_path)?
let repo_cache = _TestRepoCache(auth)?
let repo_cache = _TestRepoCache(auth)
let ctx = Context(h.env, log, log, false, repo_cache)
let project = Project(auth, log, fp)
let bundle = Bundle.load(fp, log)?
Expand Down Expand Up @@ -204,8 +204,8 @@ class val _RecordedCheckout is RepoOperation
primitive _TestData
fun file_path_from(h: TestHelper, subdir: String = ""): FilePath ? =>
let auth = h.env.root as AmbientAuth
FilePath(auth, "corral/test/testdata")?.join(subdir)?
FilePath(auth, "corral/test/testdata").join(subdir)?

primitive _TestRepoCache
fun apply(auth: AmbientAuth): FilePath ? =>
FilePath(auth,"_test_cmd_update_repo_cache")?
fun apply(auth: AmbientAuth): FilePath =>
FilePath(auth,"_test_cmd_update_repo_cache")
6 changes: 3 additions & 3 deletions corral/cmd/cmd_pack.pony
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class CmdPack is CmdType
match project.load_bundle()
| let bundle: Bundle =>
try
let path = FilePath(project.auth, _output)?
let path = FilePath(project.auth, _output)
if not path.mkdir() then
ctx.uout(Error) and
ctx.uout.log("pack: unable to create " + _output)
end

let car_name: String = bundle.info.name + "-" + bundle.info.version + ".car"
let car_path = Path.join(_output, car_name)
let car_file_path = FilePath(project.auth, car_path)?
let car_file_path = FilePath(project.auth, car_path)

let corral_file = project.dir.join(Files.bundle_filename())?

Expand All @@ -40,7 +40,7 @@ class CmdPack is CmdType

let sorted_packages = Sort[Array[String], String](bundle.packages)
for package in sorted_packages.values() do
encoder.add(FilePath(project.dir, package)?)?
encoder.add(FilePath.from(project.dir, package)?)?
end

encoder.write(car_file_path)?
Expand Down
10 changes: 2 additions & 8 deletions corral/cmd/executor.pony
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ primitive Executor
return
else
try
let fp = FilePath(auth, bundle_dir_str)?
let fp = FilePath(auth, bundle_dir_str)
if not FileInfo(fp)?.directory then error end
else
uout(Error) and uout.log("Error: could not access directory for new bundle: " + bundle_dir_str)
Expand All @@ -81,13 +81,7 @@ primitive Executor
let bundle_dir: FilePath =
match bundle_dir_maybe
| let fp: FilePath => fp
| None => try
FilePath(auth, bundle_dir_str)? // placeholder for create
else
log(Error) and log.log("Internal error: unexpected state.")
env.exitcode(2)
return
end
| None => FilePath(auth, bundle_dir_str) // placeholder for create
end

// Make a FilePath for the repo cache dir
Expand Down
6 changes: 3 additions & 3 deletions corral/cmd/repo.pony
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ primitive RepoForDep
// Local-direct (non-vcs) locator points to the workspace directly
if dep.locator.is_local_direct() then
let ws_str = Path.join(dep.bundle.dir.path, dep.locator.bundle_path)
let workspace = FilePath(auth, ws_str)?
Repo("", FilePath(auth, "")?, workspace)
let workspace = FilePath(auth, ws_str)
Repo("", FilePath(auth, ""), workspace)
else
let workspace = project.dep_workspace_root(dep.locator)?

// Local-vcs has no remote component, just local repo and workspace
if dep.locator.is_local_vcs() then
Repo("", FilePath(auth, dep.locator.repo_path)?, workspace)
Repo("", FilePath(auth, dep.locator.repo_path), workspace)

// Remote-vcs has remote repo, local repo, and workspace
elseif dep.locator.is_remote_vcs() then
Expand Down
4 changes: 2 additions & 2 deletions corral/test/util.pony
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ primitive Execute
primitive Data
fun apply(h: TestHelper, subdir: String = ""): FilePath ? =>
let auth = h.env.root as AmbientAuth
FilePath(auth, "corral/test/testdata")?.join(subdir)?
FilePath(auth, "corral/test/testdata").join(subdir)?


class val DataClone
Expand All @@ -41,7 +41,7 @@ class val DataClone

new val create(h: TestHelper, subdirs: (Array[String] val | String | None) = None) ? =>
let auth = h.env.root as AmbientAuth
let src_root = FilePath(auth, "corral/test/testdata")?
let src_root = FilePath(auth, "corral/test/testdata")

_root = FilePath.mkdtemp(auth, "test_scratch.")?

Expand Down
10 changes: 5 additions & 5 deletions corral/util/action.pony
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class val Program
=>
auth = env.root as AmbientAuth
path = if Path.is_abs(name) then
FilePath(auth, name)?
FilePath(auth, name)
else
(let evars, let pathkey) =
ifdef windows then
Expand All @@ -32,14 +32,14 @@ class val Program
=>
for bindir in Path.split_list(binpath).values() do
try
let bd = FilePath(auth', bindir)?
let bd = FilePath(auth', bindir)
ifdef windows then
let bin_bare = FilePath(bd, name)?
let bin_bare = FilePath.from(bd, name)?
if bin_bare.exists() then return bin_bare end
let bin_exe = FilePath(bd, name + ".exe")?
let bin_exe = FilePath.from(bd, name + ".exe")?
if bin_exe.exists() then return bin_exe end
else
let bin = FilePath(bd, name)?
let bin = FilePath.from(bd, name)?
if bin.exists() then
// TODO: should also stat for executable. FileInfo(bin)
return bin
Expand Down

0 comments on commit f77ce3d

Please sign in to comment.