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

Change the order of haxelib git submodule installation #638

Merged
merged 22 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fad7a32
submodule stuff in progress
ninjamuffin99 Jul 30, 2024
cd3bbe3
perhaps a submodule fix?
ninjamuffin99 Jul 31, 2024
65cf568
revert the dipshit logging
ninjamuffin99 Jul 31, 2024
25987e2
update run.n
ninjamuffin99 Jul 31, 2024
a336575
we dont need to spit out every log, but we should use the threads?
ninjamuffin99 Jul 31, 2024
b95e11c
comment out the unneeded git fetch
ninjamuffin99 Jul 31, 2024
ad1f05a
small reorder / remove redundant `git submodule init`
ninjamuffin99 Aug 16, 2024
6936c80
uncomment the lib deletion, since we've ran into issues related
ninjamuffin99 Aug 16, 2024
e3545f0
fix for stderr/stdout related hangs on non-windows when installing gi…
ninjamuffin99 Aug 16, 2024
3380e59
remove git progress code
ninjamuffin99 Aug 17, 2024
5c488cd
run.n
ninjamuffin99 Aug 17, 2024
b46b12d
remove whitespace
ninjamuffin99 Aug 17, 2024
f2d6be1
Merge branch 'development' of github.com:HaxeFoundation/haxelib into …
ninjamuffin99 Aug 26, 2024
0ea4cc9
proper non-cli coupled logging
ninjamuffin99 Aug 31, 2024
4469b97
remove unneeded logging/git --quiet flag code for the time being
ninjamuffin99 Aug 31, 2024
75a56a6
run.n
ninjamuffin99 Aug 31, 2024
3f15935
remove unneeded FsUtils.deleteRec()
ninjamuffin99 Aug 31, 2024
491c72d
run.n
ninjamuffin99 Aug 31, 2024
cdc4cbd
remove testing print
ninjamuffin99 Aug 31, 2024
9b6ce51
run.n
ninjamuffin99 Aug 31, 2024
984fa6b
removed unused import and throw an exception on submodule error
ninjamuffin99 Aug 31, 2024
0fdf946
add message for SubmoduleError
ninjamuffin99 Aug 31, 2024
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
Binary file modified run.n
Binary file not shown.
4 changes: 4 additions & 0 deletions src/haxelib/api/Installer.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package haxelib.api;

import haxelib.client.Cli;
ninjamuffin99 marked this conversation as resolved.
Show resolved Hide resolved
import sys.FileSystem;
import sys.io.File;
import haxe.ds.Option;
Expand Down Expand Up @@ -767,6 +768,7 @@ class Installer {
userInterface.log('Installing $library from $url' + (branch != null ? " branch: " + branch : ""));
final tag = vcsData.tag;
try {
FsUtils.deleteRec(libPath);
ninjamuffin99 marked this conversation as resolved.
Show resolved Hide resolved
vcs.clone(libPath, url, branch, tag, userInterface.log.bind(_, Debug));
} catch (error:VcsError) {
FsUtils.deleteRec(libPath);
Expand All @@ -793,6 +795,8 @@ class Installer {

final currentBranch = vcsBranchesByLibraryName[library];

Cli.print(id);

// TODO check different urls as well
if (branch != null && (!wasUpdated || currentBranch != branch)) {
final currentBranchStr = currentBranch != null ? currentBranch : "<unspecified>";
Expand Down
28 changes: 25 additions & 3 deletions src/haxelib/api/Vcs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package haxelib.api;

import haxelib.client.Cli;
import haxelib.VersionData.VcsData;
import sys.FileSystem;
import sys.thread.Thread;
Expand Down Expand Up @@ -323,30 +324,51 @@ class Git extends Vcs {
public function clone(libPath:String, url:String, ?branch:String, ?version:String, ?debugLog:(msg:String)->Void):Void {
final oldCwd = Sys.getCwd();

final vcsArgs = ["clone", url, libPath];
var vcsArgs = ["clone", url, libPath];

if (!Vcs.flat)
vcsArgs.push('--recursive');
Cli.printOptional('Cloning ${name} from ${url}');
tobil4sk marked this conversation as resolved.
Show resolved Hide resolved

if (run(vcsArgs, debugLog).code != 0)
throw VcsError.CantCloneRepo(this, url/*, ret.out*/);

Sys.setCwd(libPath);

if (version != null && version != "") {
Cli.printOptional('Checking out tag/version ${version} of ${name}');

final ret = run(["checkout", "tags/" + version], debugLog);
if (ret.code != 0) {
Sys.setCwd(oldCwd);
throw VcsError.CantCheckoutVersion(this, version, ret.out);
}
} else if (branch != null) {
Cli.printOptional('Checking out branch/commit ${branch} of ${libPath}');

final ret = run(["checkout", branch], debugLog);
if (ret.code != 0){
Sys.setCwd(oldCwd);
throw VcsError.CantCheckoutBranch(this, branch, ret.out);
}
}

if (!Vcs.flat)
{
Cli.printOptional('Syncing submodules for ${name}');
run(["submodule", "sync", "--recursive"], debugLog);

var submoduleArgs = ["submodule", "update", "--init", "--recursive"];

if (Cli.mode == Quiet)
submoduleArgs.push("--quiet");

Cli.printOptional('Downloading/updating submodules for ${name}');
final ret = run(submoduleArgs, debugLog);
if (ret.code != 0)
{
Sys.setCwd(oldCwd);
}
ninjamuffin99 marked this conversation as resolved.
Show resolved Hide resolved
}

// return prev. cwd:
Sys.setCwd(oldCwd);
}
Expand Down