Skip to content
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

Fix mason bug that occurred Mason.toml has no dependencies table #16602

Merged
merged 4 commits into from Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/mason/build/CLEANFILES
1 change: 1 addition & 0 deletions test/mason/build/COMPOPTS
1 change: 1 addition & 0 deletions test/mason/build/EXECENV
1 change: 1 addition & 0 deletions test/mason/build/SKIPIF
Empty file added test/mason/build/_noDeps.notest
Empty file.
2 changes: 2 additions & 0 deletions test/mason/build/_noDeps/.gitignore
@@ -0,0 +1,2 @@
target/
Mason.lock
6 changes: 6 additions & 0 deletions test/mason/build/_noDeps/Mason.toml
@@ -0,0 +1,6 @@
[brick]
name = "noDeps"
version = "0.1.0"
chplVersion = "1.24.0"
license = "None"

4 changes: 4 additions & 0 deletions test/mason/build/_noDeps/src/noDeps.chpl
@@ -0,0 +1,4 @@
/* Documentation for noDeps */
module noDeps {
writeln("New library: noDeps");
}
24 changes: 24 additions & 0 deletions test/mason/build/noDeps.chpl
@@ -0,0 +1,24 @@
/* Test a package with Manifest.toml without [dependencies] table */
use MasonBuild;
use MasonNew;
use MasonUtils;

use FileSystem;
use SysCTypes;

extern proc setenv(name : c_string, envval : c_string, overwrite : c_int) : c_int;

// chdir and reset PWD env (some mason internals rely on this)
proc changeDir(relPath: string) {
const oldPWD = getEnv('PWD');
here.chdir(relPath);
const newPWD = '/'.join(oldPWD, relPath);
setenv("PWD", newPWD.c_str(), 1);
}

proc main() {
const package = '_noDeps';
changeDir(package);
const args = ["mason", "build"];
masonBuild(args);
}
1 change: 1 addition & 0 deletions test/mason/build/noDeps.cleanfiles
@@ -0,0 +1 @@
_noDeps/target
4 changes: 4 additions & 0 deletions test/mason/build/noDeps.good
@@ -0,0 +1,4 @@
Skipping registry update since no dependency found in manifest file.
Compiling [debug] target: noDeps
Build Successful

12 changes: 10 additions & 2 deletions tools/mason/MasonUpdate.chpl
Expand Up @@ -86,9 +86,17 @@ proc updateLock(skipUpdate: bool, tf="Mason.toml", lf="Mason.lock") {
const lockPath = projectHome + "/" + lf;
const openFile = openreader(tomlPath);
const TomlFile = parseToml(openFile);
var updated = false;
if isFile(tomlPath) {
if TomlFile['dependencies']!.A.size > 0 then updateRegistry(skipUpdate);
else writeln("Skipping registry update since no dependency found in manifest file.");
if TomlFile.pathExists('dependencies') {
if TomlFile['dependencies']!.A.size > 0 {
updateRegistry(skipUpdate);
updated = true;
}
}
if !updated {
writeln("Skipping registry update since no dependency found in manifest file.");
}
}
if isDir(SPACK_ROOT) && TomlFile.pathExists('external') {
if getSpackVersion != spackVersion then
Expand Down