Skip to content

add file-casing test repo to rewatch tests #7700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .devcontainer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
*~
_build
*.obj
*.out
*.compile
*.native
*.byte
*.cmo
*.annot
*.cmi
*.cmx
*.cmt
*.cmti
*.cma
*.a
*.cmxa
*.obj
*~
*.annot
*.mj
*.bak
*.swp
*.swo
*.flambda
*.jsx
*.lambda
*.rawlambda
*.s
*.o
*.lam
*.0.js
*#
*.log
.#*
*.cmj
*.rawlambda
*.lambda
*.zip
*.mlast
*.mliast

.idea
.DS_Store

node_modules
*.dump
coverage

.ninja_log
.bsdeps
.bsbuild
lib/ocaml
tests/build_tests/*/lib/
#ignore temporary directory
*.goog.js
*.jsoo.js
*.so
tmp/
tracing*.json

_opam

.env
playground/packages/
playground/stdlib/
playground/*.cmj
playground/*.cmi
playground/.netrc
playground/compiler.*js

rewatch/target/
rewatch/rewatch

tests/tools_tests/**/*.res.js
tests/tools_tests/lib
tests/analysis_tests*/lib
tests/analysis_tests/**/*.bs.js

/linux/*.exe
/linuxarm64/*.exe
/darwin/*.exe
/darwinarm64/*.exe
/win32/*.exe

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

*.tsbuildinfo

# package tarballs
package.tgz
*.exe

/ninja/ninja
/ninja/build.ninja
10 changes: 7 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
LABEL org.opencontainers.image.authors="Christoph Knittel <[email protected]>"
LABEL org.opencontainers.image.description="Docker image for ReScript development."

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
yarn \
opam \
cmake \
ninja-build \
musl-tools \
python-is-python3 \
&& rm -rf /var/lib/apt/lists/*

# Install OPAM
ARG OPAM_VERSION=2.4.1
RUN printf '\n\n' | bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version $OPAM_VERSION"
10 changes: 8 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "ReScript Compiler",
"build": {
"context": ".",
"dockerfile": "Dockerfile"
"dockerfile": "Dockerfile",
"args": {
"USER_UID": "${localEnv:UID}",
"USER_GID": "${localEnv:GID}"
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
Expand All @@ -23,5 +27,7 @@
]
}
},
"postCreateCommand": ".devcontainer/postCreate.sh"
"postCreateCommand": ".devcontainer/postCreate.sh",
"remoteUser": "vscode",
"containerUser": "vscode"
}
12 changes: 6 additions & 6 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

# Install dev dependencies from OPAM
opam init -y --bare --disable-sandboxing
opam switch create 5.3.0 --packages ocaml-option-static
opam install . --deps-only -y

# For IDE support, install the OCaml language server
opam install ocaml-lsp-server -y
opam switch create 5.3.0
opam install . --deps-only --with-test --with-dev-setup -y

# Add OPAM environment setup to shell startup script
echo 'eval $(opam env)' >> ~/.zshrc
echo 'eval $(opam env)' >> ~/.bashrc

npm install --ignore-scripts
nvm install

corepack enable
printf "\n" | yarn
3 changes: 2 additions & 1 deletion rewatch/testrepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"packages/with-dev-deps",
"packages/compiled-by-legacy",
"packages/nonexisting-dev-files",
"packages/deprecated-config"
"packages/deprecated-config",
"packages/file-casing"
]
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions rewatch/testrepo/packages/file-casing/rescript.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@testrepo/file-casing",
"namespace": "FileCasing",
"sources": [
{
"dir": "src",
Expand Down
4 changes: 2 additions & 2 deletions rewatch/testrepo/packages/file-casing/src/Consume.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Produce$NamespaceCasingAPI from "./produce.mjs";
import * as Produce$FileCasing from "./produce.mjs";

let x = Produce$NamespaceCasingAPI.meh(1);
let x = Produce$FileCasing.meh(1);

export {
x,
Expand Down
3 changes: 2 additions & 1 deletion rewatch/testrepo/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@testrepo/with-dev-deps",
"@testrepo/compiled-by-legacy",
"@testrepo/nonexisting-dev-files",
"@testrepo/deprecated-config"
"@testrepo/deprecated-config",
"@testrepo/file-casing"
]
}
6 changes: 6 additions & 0 deletions rewatch/testrepo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ __metadata:
languageName: unknown
linkType: soft

"@testrepo/file-casing@workspace:packages/file-casing":
version: 0.0.0-use.local
resolution: "@testrepo/file-casing@workspace:packages/file-casing"
languageName: unknown
linkType: soft

"@testrepo/main@workspace:packages/main":
version: 0.0.0-use.local
resolution: "@testrepo/main@workspace:packages/main"
Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bold "Test: It should format all files"
git diff --name-only ./
error_output=$("$REWATCH_EXECUTABLE" format --all)
git_diff_file_count=$(git diff --name-only ./ | wc -l | xargs)
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 4 ];
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 6 ];
then
success "Test package formatted. Got $git_diff_file_count changed files."
git restore .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 0/16
Cleaned 0/18
Parsed 2 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/dependency-cycle.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 0/16
Cleaned 0/18
Parsed 1 source files
Compiled 0 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/remove-file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 1/16
Cleaned 1/18
Parsed 0 source files
Compiled 1 modules

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 2/16
Cleaned 2/18
Parsed 2 source files
Compiled 3 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file-internal-dep.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 2/16
Cleaned 2/18
Parsed 2 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file-with-interface.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
 No implementation file found for interface file (skipping): src/ModuleWithInterface.resi
Cleaned 2/16
Cleaned 2/18
Parsed 1 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 1/16
Cleaned 1/18
Parsed 1 source files
Compiled 1 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-interface-file.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
 No implementation file found for interface file (skipping): src/ModuleWithInterface2.resi
Cleaned 1/16
Cleaned 1/18
Parsed 1 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/suffix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
# Count files with new extension
file_count=$(find ./packages -name *.res.js | wc -l)

if [ "$file_count" -eq 28 ];
if [ "$file_count" -eq 32 ];
then
success "Found files with correct suffix"
else
Expand Down
Loading