Skip to content

Commit 7a8df57

Browse files
committed
downstream rescript changes
1 parent cae6c53 commit 7a8df57

File tree

19 files changed

+81
-54
lines changed

19 files changed

+81
-54
lines changed

src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn get_compiler_args(
7373
rescript_version
7474
} else {
7575
let bsc_path = match bsc_path {
76-
Some(bsc_path) => bsc_path,
76+
Some(bsc_path) => helpers::get_abs_path(&bsc_path),
7777
None => helpers::get_bsc(&package_root, workspace_root.to_owned()),
7878
};
7979
helpers::get_rescript_version(&bsc_path)

src/build/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub fn clean(path: &str, show_progress: bool, bsc_path: Option<String>) -> Resul
344344
let packages = packages::make(&None, &project_root, &workspace_root, show_progress)?;
345345
let root_config_name = packages::read_package_name(&project_root)?;
346346
let bsc_path = match bsc_path {
347-
Some(bsc_path) => bsc_path,
347+
Some(bsc_path) => helpers::get_abs_path(&bsc_path),
348348
None => helpers::get_bsc(&project_root, workspace_root.to_owned()),
349349
};
350350

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ fn main() -> Result<()> {
149149
args.after_build,
150150
args.create_sourcedirs,
151151
args.dev,
152+
args.bsc_path,
152153
);
153154

154155
Ok(())

src/watcher.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ async fn async_watch(
5454
after_build: Option<String>,
5555
create_sourcedirs: bool,
5656
build_dev_deps: bool,
57+
bsc_path: Option<String>,
5758
) -> notify::Result<()> {
58-
let mut build_state =
59-
build::initialize_build(None, filter, show_progress, path, None).expect("Can't initialize build");
59+
let mut build_state = build::initialize_build(None, filter, show_progress, path, bsc_path.clone())
60+
.expect("Can't initialize build");
6061
let mut needs_compile_type = CompileType::Incremental;
6162
// create a mutex to capture if ctrl-c was pressed
6263
let ctrlc_pressed = Arc::new(Mutex::new(false));
@@ -91,6 +92,20 @@ async fn async_watch(
9192
}
9293

9394
for event in events {
95+
// if there is a file named rewatch.lock in the events path, we can quit the watcher
96+
if let Some(_) = event.paths.iter().find(|path| path.ends_with("rewatch.lock")) {
97+
match event.kind {
98+
EventKind::Remove(_) => {
99+
if show_progress {
100+
println!("\nExiting... (lockfile removed)");
101+
}
102+
clean::cleanup_after_build(&build_state);
103+
return Ok(());
104+
}
105+
_ => (),
106+
}
107+
}
108+
94109
let paths = event
95110
.paths
96111
.iter()
@@ -214,7 +229,7 @@ async fn async_watch(
214229
}
215230
CompileType::Full => {
216231
let timing_total = Instant::now();
217-
build_state = build::initialize_build(None, filter, show_progress, path, None)
232+
build_state = build::initialize_build(None, filter, show_progress, path, bsc_path.clone())
218233
.expect("Can't initialize build");
219234
let _ = build::incremental_build(
220235
&mut build_state,
@@ -259,6 +274,7 @@ pub fn start(
259274
after_build: Option<String>,
260275
create_sourcedirs: bool,
261276
build_dev_deps: bool,
277+
bsc_path: Option<String>,
262278
) {
263279
futures::executor::block_on(async {
264280
let queue = Arc::new(FifoQueue::<Result<Event, Error>>::new());
@@ -279,6 +295,7 @@ pub fn start(
279295
after_build,
280296
create_sourcedirs,
281297
build_dev_deps,
298+
bsc_path,
282299
)
283300
.await
284301
{

testrepo/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"packages/new-namespace"
1010
]
1111
},
12+
"dependencies": {
13+
"rescript": "11.1.4"
14+
},
1215
"scripts": {
1316
"build": "../target/release/rewatch build .",
1417
"build:rescript": "rescript build -with-deps",

testrepo/packages/dep01/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"author": "",
1313
"license": "MIT",
1414
"dependencies": {
15-
"@testrepo/dep02": "*",
16-
"rescript": "*"
15+
"@testrepo/dep02": "*"
1716
}
1817
}

testrepo/packages/dep02/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@
1010
"rescript"
1111
],
1212
"author": "",
13-
"license": "MIT",
14-
"dependencies": {
15-
"rescript": "*"
16-
}
13+
"license": "MIT"
1714
}

testrepo/packages/main/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"author": "",
1313
"license": "MIT",
1414
"dependencies": {
15-
"@testrepo/dep01": "*",
16-
"rescript": "*"
15+
"@testrepo/dep01": "*"
1716
}
1817
}

testrepo/packages/new-namespace/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
"rescript"
66
],
77
"author": "",
8-
"license": "MIT",
9-
"dependencies": {
10-
"rescript": "*"
11-
}
8+
"license": "MIT"
129
}

testrepo/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# yarn lockfile v1
33

44

5-
rescript@*:
6-
version "11.0.0"
7-
resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.0.0.tgz#9a0b6fc998c360543c459aba49b77a572a0306cd"
8-
integrity sha512-uIUwDZZmDUb7ymGkBiiGioxMg8hXh1mze/2k/qhYQcZGgi7PrLHQIW9AksM7gb9WnpjCAvFsA8U2VgC0nA468w==
5+
rescript@11.1.4:
6+
version "11.1.4"
7+
resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.1.4.tgz#9a42ebc4fc5363707e39cef5b3188160b63bee42"
8+
integrity sha512-0bGU0bocihjSC6MsE3TMjHjY0EUpchyrREquLS8VsZ3ohSMD+VHUEwimEfB3kpBI1vYkw3UFZ3WD8R28guz/Vw==

0 commit comments

Comments
 (0)