mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Start of package management
This commit is contained in:
parent
e517a9745a
commit
e6c4a95ccd
25 changed files with 4316 additions and 692 deletions
|
@ -1,5 +1,5 @@
|
|||
FileVersion = 1
|
||||
Dependencies = {Beefy2D = "*", corlib = "*"}
|
||||
Dependencies = {Beefy2D = "*", corlib = "*", libgit2 = "*"}
|
||||
|
||||
[Project]
|
||||
Name = "BeefBuild"
|
||||
|
@ -75,6 +75,9 @@ DebugWorkingDirectory = "$(ProjectDir)\\dist"
|
|||
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
|
||||
PreprocessorMacros = ["RELEASE", "CLI"]
|
||||
|
||||
[Configs.Release.Win64z]
|
||||
BuildKind = "StaticLib"
|
||||
|
||||
[Configs.Debug2.Win32]
|
||||
TargetName = ""
|
||||
OtherLinkFlags = ""
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
FileVersion = 1
|
||||
Projects = {BeefBuild = {Path = "."}, corlib = "*", Beefy2D = {Path = "../BeefLibs/Beefy2D"}, IDEHelper = {Path = "../IDEHelper"}, Debugger64 = {Path = "../Debugger64"}, BeefySysLib = {Path = "../BeefySysLib"}}
|
||||
Projects = {BeefBuild = {Path = "."}, corlib = "*", Beefy2D = {Path = "../BeefLibs/Beefy2D"}, IDEHelper = {Path = "../IDEHelper"}, Debugger64 = {Path = "../Debugger64"}, BeefySysLib = {Path = "../BeefySysLib"}, libgit2 = "*"}
|
||||
Unlocked = ["corlib"]
|
||||
ExtraPlatforms = ["Linux64"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "BeefBuild"
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace System
|
|||
typealias c_ulonglong = uint64;
|
||||
typealias c_intptr = int;
|
||||
typealias c_uintptr = uint;
|
||||
typealias c_size = uint;
|
||||
typealias c_char = char8;
|
||||
typealias c_uchar = uint8;
|
||||
|
||||
|
|
5
BeefLibs/libgit2/BeefProj.toml
Normal file
5
BeefLibs/libgit2/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "libgit2"
|
||||
TargetType = "BeefLib"
|
3948
BeefLibs/libgit2/src/Git.bf
Normal file
3948
BeefLibs/libgit2/src/Git.bf
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
FileVersion = 1
|
||||
Dependencies = {Beefy2D = "*", corlib = "*", curl = "*"}
|
||||
Dependencies = {Beefy2D = "*", corlib = "*", curl = "*", libgit2 = "*"}
|
||||
|
||||
[Project]
|
||||
Name = "IDE"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FileVersion = 1
|
||||
Projects = {IDE = {Path = "."}, Beefy2D = {Path = "../BeefLibs/Beefy2D"}, IDEHelper = {Path = "../IDEHelper"}, Debugger64 = {Path = "../Debugger64"}, BeefySysLib = {Path = "../BeefySysLib"}, curl = {Path = "../BeefLibs/curl"}}
|
||||
Unlocked = ["corlib"]
|
||||
Projects = {IDE = {Path = "."}, Beefy2D = {Path = "../BeefLibs/Beefy2D"}, IDEHelper = {Path = "../IDEHelper"}, Debugger64 = {Path = "../Debugger64"}, BeefySysLib = {Path = "../BeefySysLib"}, curl = {Path = "../BeefLibs/curl"}, libgit2 = "*"}
|
||||
Unlocked = ["corlib", "libgit2"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "IDE"
|
||||
|
|
2
IDE/dist/IDE_CreateStable.bat
vendored
2
IDE/dist/IDE_CreateStable.bat
vendored
|
@ -31,7 +31,7 @@ CALL ../../bin/build_rt.bat
|
|||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||
|
||||
@ECHO ---- Building BeefBuild (bootstrapped) ----
|
||||
BeefBoot_d.exe --out="BeefBuild_boot.exe" --src=..\src --src=..\..\BeefBuild\src --src=..\..\BeefLibs\corlib\src --src=..\..\BeefLibs\Beefy2D\src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib Beef042RT64_d.lib IDEHelper64_d.lib BeefySysLib64_d.lib"
|
||||
BeefBoot_d.exe --out="BeefBuild_boot.exe" --src=..\src --src=..\..\BeefBuild\src --src=..\..\BeefLibs\corlib\src --src=..\..\BeefLibs\Beefy2D\src --src=..\..\BeefLibs\libgit2\src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib Beef042RT64_d.lib IDEHelper64_d.lib BeefySysLib64_d.lib"
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||
|
||||
@ECHO ---- Building BeefBuild (Debug) ----
|
||||
|
|
BIN
IDE/dist/git2.dll
vendored
Normal file
BIN
IDE/dist/git2.dll
vendored
Normal file
Binary file not shown.
BIN
IDE/dist/git2.lib
vendored
Normal file
BIN
IDE/dist/git2.lib
vendored
Normal file
Binary file not shown.
|
@ -14,7 +14,7 @@ namespace IDE
|
|||
{
|
||||
public String mProjName ~ delete _;
|
||||
public SemVer mVersion ~ delete _;
|
||||
public VerSpecRecord mLocation ~ delete _;
|
||||
public VerSpec mLocation ~ _.Dispose();
|
||||
public ConfigFile mConfigFile;
|
||||
|
||||
public bool mParsedConfig;
|
||||
|
@ -35,7 +35,7 @@ namespace IDE
|
|||
{
|
||||
entry.mParsedConfig = true;
|
||||
|
||||
if (entry.mLocation.mVerSpec case .Path(let path))
|
||||
if (entry.mLocation case .Path(let path))
|
||||
{
|
||||
String configPath = scope String()..AppendF("{}/BeefProj.toml", path);
|
||||
StructuredData sd = scope .();
|
||||
|
@ -129,7 +129,6 @@ namespace IDE
|
|||
regEntry.mVersion = new SemVer();
|
||||
regEntry.mVersion.Parse(verString).IgnoreError();
|
||||
|
||||
regEntry.mLocation = new VerSpecRecord();
|
||||
using (data.Open("Location"))
|
||||
regEntry.mLocation.Parse(data).IgnoreError();
|
||||
}
|
||||
|
@ -158,8 +157,7 @@ namespace IDE
|
|||
regEntry.mVersion = new SemVer();
|
||||
regEntry.mVersion.Parse("0.0.0");
|
||||
|
||||
regEntry.mLocation = new VerSpecRecord();
|
||||
regEntry.mLocation.SetPath(filePath);
|
||||
regEntry.mLocation = .Path(new String(filePath));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -216,6 +216,7 @@ namespace IDE
|
|||
public BFWindow.ShowKind mRequestedShowKind;
|
||||
public WakaTime mWakaTime ~ delete _;
|
||||
|
||||
public PackMan mPackMan = new PackMan() ~ delete _;
|
||||
public Settings mSettings = new Settings() ~ delete _;
|
||||
public Workspace mWorkspace = new Workspace() ~ delete _;
|
||||
public FileWatcher mFileWatcher = new FileWatcher() ~ delete _;
|
||||
|
@ -2165,7 +2166,7 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
public void AddNewProjectToWorkspace(Project project, VerSpecRecord verSpec = null)
|
||||
public void AddNewProjectToWorkspace(Project project, VerSpec verSpec = .None)
|
||||
{
|
||||
AddProjectToWorkspace(project);
|
||||
mWorkspace.SetChanged();
|
||||
|
@ -2186,21 +2187,19 @@ namespace IDE
|
|||
|
||||
var projectSpec = new Workspace.ProjectSpec();
|
||||
projectSpec.mProjectName = new .(project.mProjectName);
|
||||
if (verSpec != null)
|
||||
if (verSpec != .None)
|
||||
{
|
||||
projectSpec.mVerSpec = verSpec;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectSpec.mVerSpec = new .();
|
||||
projectSpec.mVerSpec.SetPath(relPath);
|
||||
projectSpec.mVerSpec = .Path(new String(relPath));
|
||||
}
|
||||
mWorkspace.mProjectSpecs.Add(projectSpec);
|
||||
|
||||
var dep = new Project.Dependency();
|
||||
dep.mProjectName = new .("corlib");
|
||||
dep.mVerSpec = new .();
|
||||
dep.mVerSpec.SetSemVer("*");
|
||||
dep.mVerSpec = .SemVer(new .("*"));
|
||||
project.mDependencies.Add(dep);
|
||||
}
|
||||
|
||||
|
@ -2457,12 +2456,16 @@ namespace IDE
|
|||
for (int projectIdx = 0; projectIdx < mWorkspace.mProjects.Count; projectIdx++)
|
||||
{
|
||||
var project = mWorkspace.mProjects[projectIdx];
|
||||
if (project.mLoadDeferred)
|
||||
if ((project.mDeferState == .ReadyToLoad) || (project.mDeferState == .Pending))
|
||||
{
|
||||
hadLoad = true;
|
||||
|
||||
var projectPath = project.mProjectPath;
|
||||
if (!project.Load(projectPath))
|
||||
if (project.mDeferState == .Pending)
|
||||
{
|
||||
project.mDeferState = .Searching;
|
||||
}
|
||||
else if (!project.Load(projectPath))
|
||||
{
|
||||
OutputErrorLine("Failed to load project '{0}' from '{1}'", project.mProjectName, projectPath);
|
||||
LoadFailed();
|
||||
|
@ -2570,25 +2573,23 @@ namespace IDE
|
|||
|
||||
project.FinishCreate(false);
|
||||
|
||||
var verSpec = new VerSpecRecord();
|
||||
verSpec.SetSemVer("*");
|
||||
VerSpec verSpec = .SemVer(new .("*"));
|
||||
defer verSpec.Dispose();
|
||||
|
||||
switch (AddProject("corlib", verSpec))
|
||||
{
|
||||
case .Ok(let libProject):
|
||||
var dep = new Project.Dependency();
|
||||
dep.mProjectName = new String("corlib");
|
||||
dep.mVerSpec = verSpec;
|
||||
dep.mVerSpec = verSpec.Duplicate();
|
||||
project.mDependencies.Add(dep);
|
||||
default:
|
||||
delete verSpec;
|
||||
}
|
||||
}
|
||||
|
||||
var projSpec = new Workspace.ProjectSpec();
|
||||
projSpec.mProjectName = new String(project.mProjectName);
|
||||
projSpec.mVerSpec = new VerSpecRecord();
|
||||
projSpec.mVerSpec.SetPath(".");
|
||||
projSpec.mVerSpec = .Path(new String("."));
|
||||
mWorkspace.mProjectSpecs.Add(projSpec);
|
||||
|
||||
mWorkspace.mStartupProject = project;
|
||||
|
@ -2645,7 +2646,6 @@ namespace IDE
|
|||
{
|
||||
var projSpec = new Workspace.ProjectSpec();
|
||||
projSpec.mProjectName = new String(projectName);
|
||||
projSpec.mVerSpec = new VerSpecRecord();
|
||||
mWorkspace.mProjectSpecs.Add(projSpec);
|
||||
|
||||
if (projSpec.mVerSpec.Parse(data) case .Err)
|
||||
|
@ -2734,15 +2734,15 @@ namespace IDE
|
|||
NotFound
|
||||
}
|
||||
|
||||
public Result<Project, ProjectAddError> AddProject(StringView projectName, VerSpecRecord verSpecRecord)
|
||||
public Result<Project, ProjectAddError> AddProject(StringView projectName, VerSpec verSpec)
|
||||
{
|
||||
VerSpecRecord useVerSpecRecord = verSpecRecord;
|
||||
VerSpec useVerSpec = verSpec;
|
||||
String verConfigDir = mWorkspace.mDir;
|
||||
|
||||
if (let project = mWorkspace.FindProject(projectName))
|
||||
return project;
|
||||
|
||||
if (useVerSpecRecord.mVerSpec case .SemVer)
|
||||
if (useVerSpec case .SemVer)
|
||||
{
|
||||
// First pass we just try to use the 'expected' project name
|
||||
FindLoop: for (int pass < 2)
|
||||
|
@ -2758,7 +2758,7 @@ namespace IDE
|
|||
|
||||
if (regEntry.mProjName == projectName)
|
||||
{
|
||||
useVerSpecRecord = regEntry.mLocation;
|
||||
useVerSpec = regEntry.mLocation;
|
||||
verConfigDir = regEntry.mConfigFile.mConfigDir;
|
||||
break FindLoop;
|
||||
}
|
||||
|
@ -2771,7 +2771,7 @@ namespace IDE
|
|||
var project = new Project();
|
||||
|
||||
// For project locking, assume that only anything that is referenced with a path is editable
|
||||
project.mLockedDefault = !(verSpecRecord.mVerSpec case .Path);
|
||||
project.mLockedDefault = !(verSpec case .Path);
|
||||
project.mLocked = project.mLockedDefault;
|
||||
|
||||
mWorkspace.mProjects.Add(project);
|
||||
|
@ -2786,8 +2786,9 @@ namespace IDE
|
|||
}
|
||||
|
||||
String projectFilePath = null;
|
||||
bool isDeferredLoad = false;
|
||||
|
||||
switch (useVerSpecRecord.mVerSpec)
|
||||
switch (useVerSpec)
|
||||
{
|
||||
case .Path(let path):
|
||||
var relPath = scope String(path);
|
||||
|
@ -2801,16 +2802,34 @@ namespace IDE
|
|||
projectFilePath.Append(absPath, "BeefProj.toml");
|
||||
case .SemVer(let semVer):
|
||||
//
|
||||
case .Git(let url, let ver):
|
||||
var verReference = new Project.VerReference();
|
||||
verReference.mSrcProjectName = new String(projectName);
|
||||
verReference.mVerSpec = _.Duplicate();
|
||||
project.mVerReferences.Add(verReference);
|
||||
|
||||
var checkPath = scope String();
|
||||
if (mPackMan.CheckLock(projectName, checkPath))
|
||||
{
|
||||
projectFilePath = scope:: String(checkPath);
|
||||
}
|
||||
else
|
||||
isDeferredLoad = true;
|
||||
default:
|
||||
Fail("Invalid version specifier");
|
||||
return .Err(.InvalidVersionSpec);
|
||||
}
|
||||
|
||||
if (projectFilePath == null)
|
||||
if ((projectFilePath == null) && (!isDeferredLoad))
|
||||
{
|
||||
return .Err(.NotFound);
|
||||
}
|
||||
|
||||
if (isDeferredLoad)
|
||||
{
|
||||
mWorkspace.mProjectLoadState = .Preparing;
|
||||
}
|
||||
|
||||
project.mProjectName.Set(projectName);
|
||||
project.DeferLoad(projectFilePath);
|
||||
success = true;
|
||||
|
|
|
@ -10,6 +10,8 @@ using Beefy;
|
|||
using Beefy.utils;
|
||||
using IDE.Util;
|
||||
|
||||
|
||||
|
||||
namespace IDE
|
||||
{
|
||||
public class Program
|
||||
|
@ -17,6 +19,31 @@ namespace IDE
|
|||
//System.Collections.List<System.String> list;
|
||||
static int32 Main(String[] args)
|
||||
{
|
||||
/*Git.GitApi.git_libgit2_init();
|
||||
|
||||
|
||||
var result = Git.GitApi.git_remote_create_detached(var remote, "https://github.com/beefytech/Beef");
|
||||
result = Git.GitApi.git_remote_connect(remote, .GIT_DIRECTION_FETCH, null, null, null);
|
||||
result = Git.GitApi.git_remote_ls(var remoteHead, var headCount, remote);
|
||||
for (int headIdx < (.)headCount)
|
||||
{
|
||||
StringView name = .(remoteHead[headIdx].name);
|
||||
if (name.StartsWith("refs/tags/"))
|
||||
{
|
||||
StringView tagStr = name.Substring("refs/tags/".Length);
|
||||
Debug.WriteLine($"Tag: {tagStr}");
|
||||
}
|
||||
}
|
||||
|
||||
//Git.GitApi.git_repository_open(var repo, "c:\\Beef");
|
||||
Git.GitApi.git_repository_open(var repo, "https://github.com/beefytech/Beef");
|
||||
Git.GitApi.git_tag_foreach(repo, (name, oid, payload) =>
|
||||
{
|
||||
Debug.WriteLine("Tag {}", StringView(name));
|
||||
return 0;
|
||||
}, null);
|
||||
Git.GitApi.git_libgit2_shutdown();*/
|
||||
|
||||
#if SMALLTEST
|
||||
Debug.WriteLine("Hey!\n");
|
||||
#else
|
||||
|
|
|
@ -1266,16 +1266,32 @@ namespace IDE
|
|||
|
||||
public class Dependency
|
||||
{
|
||||
public VerSpecRecord mVerSpec ~ delete _;
|
||||
public VerSpec mVerSpec ~ _.Dispose();
|
||||
public String mProjectName ~ delete _;
|
||||
}
|
||||
|
||||
public enum DeferState
|
||||
{
|
||||
None,
|
||||
ReadyToLoad,
|
||||
Pending,
|
||||
Searching
|
||||
}
|
||||
|
||||
public class VerReference
|
||||
{
|
||||
public String mSrcProjectName ~ delete _;
|
||||
public VerSpec mVerSpec ~ _.Dispose();
|
||||
}
|
||||
|
||||
public Monitor mMonitor = new Monitor() ~ delete _;
|
||||
public String mNamespace = new String() ~ delete _;
|
||||
public String mProjectDir = new String() ~ delete _;
|
||||
public String mProjectName = new String() ~ delete _;
|
||||
public String mProjectPath = new String() ~ delete _;
|
||||
public bool mLoadDeferred;
|
||||
public DeferState mDeferState;
|
||||
public List<VerReference> mVerReferences = new .() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
//public String mLastImportDir = new String() ~ delete _;
|
||||
public bool mHasChanged;
|
||||
public bool mNeedsTargetRebuild;
|
||||
|
@ -1411,16 +1427,21 @@ namespace IDE
|
|||
}
|
||||
|
||||
public void DeferLoad(StringView path)
|
||||
{
|
||||
if (!path.IsEmpty)
|
||||
{
|
||||
mProjectPath.Set(path);
|
||||
mLoadDeferred = true;
|
||||
mDeferState = .ReadyToLoad;
|
||||
}
|
||||
else
|
||||
mDeferState = .Pending;
|
||||
}
|
||||
|
||||
public bool Load(StringView path)
|
||||
{
|
||||
scope AutoBeefPerf("Project.Load");
|
||||
|
||||
mLoadDeferred = false;
|
||||
mDeferState = .None;
|
||||
|
||||
mLastGeneratedResVer = 0;
|
||||
mCurResVer = 0;
|
||||
|
@ -1546,7 +1567,7 @@ namespace IDE
|
|||
{
|
||||
var dep = mDependencies[0];
|
||||
if ((dep.mProjectName == "corlib") &&
|
||||
(dep.mVerSpec.mVerSpec case .SemVer(let semVer)) &&
|
||||
(dep.mVerSpec case .SemVer(let semVer)) &&
|
||||
(semVer.mVersion == "*"))
|
||||
{
|
||||
isDefaultDependencies = true;
|
||||
|
@ -1885,8 +1906,7 @@ namespace IDE
|
|||
{
|
||||
var dep = new Project.Dependency();
|
||||
dep.mProjectName = new .("corlib");
|
||||
dep.mVerSpec = new .();
|
||||
dep.mVerSpec.SetSemVer("*");
|
||||
dep.mVerSpec = .SemVer(new .("*"));
|
||||
mDependencies.Add(dep);
|
||||
}
|
||||
else
|
||||
|
@ -1896,7 +1916,6 @@ namespace IDE
|
|||
var dep = new Dependency();
|
||||
defer { delete dep; }
|
||||
|
||||
dep.mVerSpec = new VerSpecRecord();
|
||||
if (dep.mVerSpec.Parse(data) case .Err)
|
||||
{
|
||||
var err = scope String();
|
||||
|
|
|
@ -134,6 +134,14 @@ namespace IDE
|
|||
Og,
|
||||
}
|
||||
|
||||
public enum ProjectLoadState
|
||||
{
|
||||
None,
|
||||
Loaded,
|
||||
ReadyToLoad,
|
||||
Preparing
|
||||
}
|
||||
|
||||
public class ConfigSelection : IHashable, IEquatable
|
||||
{
|
||||
public bool mEnabled = true;
|
||||
|
@ -368,7 +376,29 @@ namespace IDE
|
|||
public class ProjectSpec
|
||||
{
|
||||
public String mProjectName ~ delete _;
|
||||
public VerSpecRecord mVerSpec ~ delete _;
|
||||
public VerSpec mVerSpec ~ _.Dispose();
|
||||
}
|
||||
|
||||
public class Lock
|
||||
{
|
||||
public enum Location
|
||||
{
|
||||
case Cache;
|
||||
case Local(String path);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .Cache:
|
||||
case .Local(let path):
|
||||
delete path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String mVersion ~ delete _;
|
||||
public Location mLocation ~ _.Dispose();
|
||||
}
|
||||
|
||||
public Monitor mMonitor = new Monitor() ~ delete _;
|
||||
|
@ -378,6 +408,7 @@ namespace IDE
|
|||
public List<Project> mProjects = new List<Project>() ~ DeleteContainerAndItems!(_);
|
||||
public List<ProjectSpec> mProjectSpecs = new .() ~ DeleteContainerAndItems!(_);
|
||||
public Dictionary<String, Project> mProjectNameMap = new .() ~ DeleteDictionaryAndKeys!(_);
|
||||
public Dictionary<String, Lock> mProjectLockMap = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
|
||||
public Project mStartupProject;
|
||||
public bool mLoading;
|
||||
public bool mNeedsCreate;
|
||||
|
@ -387,6 +418,7 @@ namespace IDE
|
|||
public List<CompileInstance> mCompileInstanceList = new List<CompileInstance>() ~ DeleteContainerAndItems!(_); // First item is primary compile, secondaries are hot reloads
|
||||
public List<String> mPlatforms = new List<String>() ~ DeleteContainerAndItems!(_);
|
||||
public bool mIsDebugSession;
|
||||
public ProjectLoadState mProjectLoadState;
|
||||
|
||||
public int32 HotCompileIdx
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace IDE.ui
|
|||
{
|
||||
InstalledProject installedProject = new .();
|
||||
installedProject.mName = new String(registryEntry.mProjName);
|
||||
switch (registryEntry.mLocation.mVerSpec)
|
||||
switch (registryEntry.mLocation)
|
||||
{
|
||||
case .Path(let path):
|
||||
installedProject.mPath = new String();
|
||||
|
@ -176,13 +176,12 @@ namespace IDE.ui
|
|||
|
||||
let entry = mFilteredList[idx];
|
||||
|
||||
let verSpec = new VerSpecRecord();
|
||||
verSpec.SetSemVer("*");
|
||||
VerSpec verSpec = .SemVer(new .("*"));
|
||||
defer verSpec.Dispose();
|
||||
|
||||
let project = gApp.mProjectPanel.ImportProject(entry.mPath, verSpec);
|
||||
if (project == null)
|
||||
{
|
||||
delete verSpec;
|
||||
return;
|
||||
}
|
||||
if (project.mProjectName != entry.mName)
|
||||
|
@ -195,7 +194,7 @@ namespace IDE.ui
|
|||
{
|
||||
if (projectSpec.mProjectName == project.mProjectName)
|
||||
{
|
||||
projectSpec.mVerSpec.SetPath(relProjectPath);
|
||||
projectSpec.mVerSpec = .Path(new String(relProjectPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,13 @@ namespace IDE.ui
|
|||
if (project != null)
|
||||
{
|
||||
hasChanged = project.mHasChanged;
|
||||
if (project.mLocked)
|
||||
if (project.mDeferState != .None)
|
||||
{
|
||||
//g.Draw(DarkTheme.sDarkTheme.GetImage(.LockIcon), g.mFont.GetWidth(mLabel) + mLabelOffset + LabelX + GS!(-3), 0);
|
||||
g.DrawString(scope String()..Append('.', 1 + (mUpdateCnt / 20) % 3), g.mFont.GetWidth(mLabel) + mLabelOffset + LabelX + GS!(3), 0);
|
||||
changeX += GS!(12);
|
||||
}
|
||||
else if (project.mLocked)
|
||||
{
|
||||
g.Draw(DarkTheme.sDarkTheme.GetImage(.LockIcon), g.mFont.GetWidth(mLabel) + mLabelOffset + LabelX + GS!(-3), 0);
|
||||
changeX += GS!(12);
|
||||
|
@ -1986,7 +1992,7 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
public Project ImportProject(String filePath, VerSpecRecord verSpec = null)
|
||||
public Project ImportProject(String filePath, VerSpec verSpec = .None)
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
|
|
|
@ -741,8 +741,7 @@ namespace IDE.ui
|
|||
{
|
||||
var dep = new Project.Dependency();
|
||||
dep.mProjectName = new String(listViewItem.mLabel);
|
||||
dep.mVerSpec = new .();
|
||||
dep.mVerSpec.SetSemVer("*");
|
||||
dep.mVerSpec = .SemVer(new .("*"));
|
||||
mProject.mDependencies.Add(dep);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace IDE.ui
|
|||
mConfigComboBox.mDisabled = !canChangeConfig;
|
||||
mPlatformComboBox.mDisabled = !canChangeConfig;
|
||||
|
||||
if ((gApp.IsCompiling || gApp.mRunningTestScript) && (mUpdateCnt % 8 == 0))
|
||||
if ((gApp.IsCompiling || gApp.mRunningTestScript || (gApp.mWorkspace.mProjectLoadState == .Preparing)) && (mUpdateCnt % 8 == 0))
|
||||
MarkDirtyEx(8);
|
||||
|
||||
var debugState = gApp.mDebugger.GetRunState();
|
||||
|
@ -398,6 +398,10 @@ namespace IDE.ui
|
|||
{
|
||||
DrawStatusBox("Const Evaluation");
|
||||
}
|
||||
else if (gApp.mWorkspace.mProjectLoadState == .Preparing)
|
||||
{
|
||||
DrawStatusBox("Loading Projects");
|
||||
}
|
||||
else
|
||||
mStatusBoxUpdateCnt = -1;
|
||||
|
||||
|
|
|
@ -1,621 +0,0 @@
|
|||
#if true
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDE.Util
|
||||
{
|
||||
typealias git_time_t = int64;
|
||||
typealias git_off_t = int64;
|
||||
|
||||
class Git
|
||||
{
|
||||
|
||||
|
||||
public struct git_repository {}
|
||||
public struct git_index {}
|
||||
public struct git_note {}
|
||||
public struct git_tree {}
|
||||
public struct git_cred {}
|
||||
public struct git_oid {}
|
||||
public struct git_cert {}
|
||||
public struct git_push_update {}
|
||||
public struct git_transport {}
|
||||
public struct git_remote {}
|
||||
|
||||
public function int32 git_transport_certificate_check_cb(git_cert *cert, int32 valid, char8* host, void* payload);
|
||||
public function int32 git_packbuilder_progress(
|
||||
int32 stage,
|
||||
uint32 current,
|
||||
uint32 total,
|
||||
void* payload);
|
||||
public function int32 git_push_transfer_progress(
|
||||
uint32 current,
|
||||
uint32 total,
|
||||
int bytes,
|
||||
void* payload);
|
||||
public function int32 git_push_negotiation(git_push_update** updates, int len, void *payload);
|
||||
public function int32 git_transport_cb(git_transport** outTrans, git_remote *owner, void *param);
|
||||
|
||||
public enum git_fetch_prune_t : int32
|
||||
{
|
||||
/**
|
||||
* Use the setting from the configuration
|
||||
*/
|
||||
GIT_FETCH_PRUNE_UNSPECIFIED,
|
||||
/**
|
||||
* Force pruning on
|
||||
*/
|
||||
GIT_FETCH_PRUNE,
|
||||
/**
|
||||
* Force pruning off
|
||||
*/
|
||||
GIT_FETCH_NO_PRUNE,
|
||||
}
|
||||
|
||||
public enum git_remote_autotag_option_t : int32
|
||||
{
|
||||
/**
|
||||
* Use the setting from the configuration.
|
||||
*/
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED = 0,
|
||||
/**
|
||||
* Ask the server for tags pointing to objects we're already
|
||||
* downloading.
|
||||
*/
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
|
||||
/**
|
||||
* Don't ask for any tags beyond the refspecs.
|
||||
*/
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_NONE,
|
||||
/**
|
||||
* Ask for the all the tags.
|
||||
*/
|
||||
GIT_REMOTE_DOWNLOAD_TAGS_ALL,
|
||||
}
|
||||
|
||||
public enum git_proxy_t : int32
|
||||
{
|
||||
/**
|
||||
* Do not attempt to connect through a proxy
|
||||
*
|
||||
* If built against libcurl, it itself may attempt to connect
|
||||
* to a proxy if the environment variables specify it.
|
||||
*/
|
||||
GIT_PROXY_NONE,
|
||||
/**
|
||||
* Try to auto-detect the proxy from the git configuration.
|
||||
*/
|
||||
GIT_PROXY_AUTO,
|
||||
/**
|
||||
* Connect via the URL given in the options
|
||||
*/
|
||||
GIT_PROXY_SPECIFIED,
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
public struct git_proxy_options
|
||||
{
|
||||
public uint32 version;
|
||||
|
||||
/**
|
||||
* The type of proxy to use, by URL, auto-detect.
|
||||
*/
|
||||
public git_proxy_t type;
|
||||
|
||||
/**
|
||||
* The URL of the proxy.
|
||||
*/
|
||||
public char8* url;
|
||||
|
||||
/**
|
||||
* This will be called if the remote host requires
|
||||
* authentication in order to connect to it.
|
||||
*
|
||||
* Returning GIT_PASSTHROUGH will make libgit2 behave as
|
||||
* though this field isn't set.
|
||||
*/
|
||||
public git_cred_acquire_cb credentials;
|
||||
|
||||
/**
|
||||
* If cert verification fails, this will be called to let the
|
||||
* user make the final decision of whether to allow the
|
||||
* connection to proceed. Returns 1 to allow the connection, 0
|
||||
* to disallow it or a negative value to indicate an error.
|
||||
*/
|
||||
public git_transport_certificate_check_cb certificate_check;
|
||||
|
||||
/**
|
||||
* Payload to be provided to the credentials and certificate
|
||||
* check callbacks.
|
||||
*/
|
||||
public void *payload;
|
||||
}
|
||||
|
||||
public enum git_clone_local_t : int32
|
||||
{
|
||||
/**
|
||||
* Auto-detect (default), libgit2 will bypass the git-aware
|
||||
* transport for local paths, but use a normal fetch for
|
||||
* `file://` urls.
|
||||
*/
|
||||
GIT_CLONE_LOCAL_AUTO,
|
||||
/**
|
||||
* Bypass the git-aware transport even for a `file://` url.
|
||||
*/
|
||||
GIT_CLONE_LOCAL,
|
||||
/**
|
||||
* Do no bypass the git-aware transport
|
||||
*/
|
||||
GIT_CLONE_NO_LOCAL,
|
||||
/**
|
||||
* Bypass the git-aware transport, but do not try to use
|
||||
* hardlinks.
|
||||
*/
|
||||
GIT_CLONE_LOCAL_NO_LINKS,
|
||||
}
|
||||
|
||||
public function int32 git_repository_create_cb(
|
||||
git_repository** outRepo,
|
||||
char8* path,
|
||||
int32 bare,
|
||||
void *payload);
|
||||
|
||||
public function int32 git_remote_create_cb(
|
||||
git_remote** outRemote,
|
||||
git_repository* repo,
|
||||
char8* name,
|
||||
char8* url,
|
||||
void* payload);
|
||||
|
||||
/** Basic type (loose or packed) of any Git object. */
|
||||
public enum git_otype
|
||||
{
|
||||
GIT_OBJ_ANY = -2, /**< Object can be any of the following */
|
||||
GIT_OBJ_BAD = -1, /**< Object is invalid. */
|
||||
GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
|
||||
GIT_OBJ_COMMIT = 1, /**< A commit object. */
|
||||
GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
|
||||
GIT_OBJ_BLOB = 3, /**< A file revision object. */
|
||||
GIT_OBJ_TAG = 4, /**< An annotated tag object. */
|
||||
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
|
||||
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
|
||||
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
public struct git_strarray
|
||||
{
|
||||
char8** strings;
|
||||
int count;
|
||||
}
|
||||
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
public static extern void git_strarray_free(git_strarray *array);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
public static extern int32 git_strarray_copy(git_strarray *tgt, git_strarray *src);
|
||||
|
||||
/** Time in a signature */
|
||||
[CRepr]
|
||||
public struct git_time
|
||||
{
|
||||
git_time_t time; /**< time in seconds from epoch */
|
||||
int32 offset; /**< timezone offset, in minutes */
|
||||
}
|
||||
|
||||
/** An action signature (e.g. for committers, taggers, etc) */
|
||||
[CRepr]
|
||||
public struct git_signature
|
||||
{
|
||||
char8* name; /**< full name of the author */
|
||||
char8* email; /**< email of the author */
|
||||
git_time timeWhen; /**< time when the action happened */
|
||||
}
|
||||
|
||||
/** Basic type of any Git reference. */
|
||||
public enum git_ref_t : int32
|
||||
{
|
||||
GIT_REF_INVALID = 0, /**< Invalid reference */
|
||||
GIT_REF_OID = 1, /**< A reference which points at an object id */
|
||||
GIT_REF_SYMBOLIC = 2, /**< A reference which points at another reference */
|
||||
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC,
|
||||
}
|
||||
|
||||
/** Basic type of any Git branch. */
|
||||
public enum git_branch_t : int32
|
||||
{
|
||||
GIT_BRANCH_LOCAL = 1,
|
||||
GIT_BRANCH_REMOTE = 2,
|
||||
GIT_BRANCH_ALL = GIT_BRANCH_LOCAL|GIT_BRANCH_REMOTE,
|
||||
}
|
||||
|
||||
/** Valid modes for index and tree entries. */
|
||||
public enum git_filemode_t : int32
|
||||
{
|
||||
GIT_FILEMODE_UNREADABLE = 0000000,
|
||||
GIT_FILEMODE_TREE = 0040000,
|
||||
GIT_FILEMODE_BLOB = 0100644,
|
||||
GIT_FILEMODE_BLOB_EXECUTABLE = 0100755,
|
||||
GIT_FILEMODE_LINK = 0120000,
|
||||
GIT_FILEMODE_COMMIT = 0160000,
|
||||
}
|
||||
|
||||
/**
|
||||
* This is passed as the first argument to the callback to allow the
|
||||
* user to see the progress.
|
||||
*
|
||||
* - total_objects: number of objects in the packfile being downloaded
|
||||
* - indexed_objects: received objects that have been hashed
|
||||
* - received_objects: objects which have been downloaded
|
||||
* - local_objects: locally-available objects that have been injected
|
||||
* in order to fix a thin pack.
|
||||
* - received-bytes: size of the packfile received up to now
|
||||
*/
|
||||
[CRepr]
|
||||
public struct git_transfer_progress
|
||||
{
|
||||
public uint32 total_objects;
|
||||
public uint32 indexed_objects;
|
||||
public uint32 received_objects;
|
||||
public uint32 local_objects;
|
||||
public uint32 total_deltas;
|
||||
public uint32 indexed_deltas;
|
||||
public int received_bytes;
|
||||
}
|
||||
|
||||
public enum git_remote_completion_type : int32
|
||||
{
|
||||
GIT_REMOTE_COMPLETION_DOWNLOAD,
|
||||
GIT_REMOTE_COMPLETION_INDEXING,
|
||||
GIT_REMOTE_COMPLETION_ERROR,
|
||||
}
|
||||
|
||||
/**
|
||||
* Type for progress callbacks during indexing. Return a value less than zero
|
||||
* to cancel the transfer.
|
||||
*
|
||||
* @param stats Structure containing information about the state of the transfer
|
||||
* @param payload Payload provided by caller
|
||||
*/
|
||||
public function int32 git_transfer_progress_cb(git_transfer_progress *stats, void* payload);
|
||||
|
||||
/**
|
||||
* Type for messages delivered by the transport. Return a negative value
|
||||
* to cancel the network operation.
|
||||
*
|
||||
* @param str The message from the transport
|
||||
* @param len The length of the message
|
||||
* @param payload Payload provided by the caller
|
||||
*/
|
||||
public function int32 git_transport_message_cb(char8* str, int32 len, void *payload);
|
||||
|
||||
public function int git_cred_acquire_cb(
|
||||
git_cred **cred,
|
||||
char8 *url,
|
||||
char8 *username_from_url,
|
||||
uint32 allowed_types,
|
||||
void *payload);
|
||||
|
||||
public enum git_checkout_notify_t : int32
|
||||
{
|
||||
GIT_CHECKOUT_NOTIFY_NONE = 0,
|
||||
GIT_CHECKOUT_NOTIFY_CONFLICT = (1u << 0),
|
||||
GIT_CHECKOUT_NOTIFY_DIRTY = (1u << 1),
|
||||
GIT_CHECKOUT_NOTIFY_UPDATED = (1u << 2),
|
||||
GIT_CHECKOUT_NOTIFY_UNTRACKED = (1u << 3),
|
||||
GIT_CHECKOUT_NOTIFY_IGNORED = (1u << 4),
|
||||
|
||||
GIT_CHECKOUT_NOTIFY_ALL = 0x0FFFFu
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
public struct git_checkout_perfdata
|
||||
{
|
||||
public int mkdir_calls;
|
||||
public int stat_calls;
|
||||
public int chmod_calls;
|
||||
}
|
||||
|
||||
public struct git_diff_file
|
||||
{
|
||||
/*git_oid id;
|
||||
const char *path;
|
||||
git_off_t size;
|
||||
uint32_t flags;
|
||||
uint16_t mode;
|
||||
uint16_t id_abbrev;*/
|
||||
}
|
||||
|
||||
/** Checkout notification callback function */
|
||||
public function int32 git_checkout_notify_cb(
|
||||
git_checkout_notify_t why,
|
||||
char8* path,
|
||||
git_diff_file* baseline,
|
||||
git_diff_file* target,
|
||||
git_diff_file* workdir,
|
||||
void *payload);
|
||||
|
||||
/** Checkout progress notification function */
|
||||
public function void git_checkout_progress_cb(
|
||||
char8* path,
|
||||
int completed_steps,
|
||||
int total_steps,
|
||||
void *payload);
|
||||
|
||||
/** Checkout perfdata notification function */
|
||||
public function void git_checkout_perfdata_cb(
|
||||
git_checkout_perfdata *perfdata,
|
||||
void *payload);
|
||||
|
||||
[CRepr]
|
||||
public struct git_checkout_options
|
||||
{
|
||||
public uint32 version;
|
||||
|
||||
public uint32 checkout_strategy; /**< default will be a dry run */
|
||||
|
||||
public int32 disable_filters; /**< don't apply filters like CRLF conversion */
|
||||
public uint32 dir_mode; /**< default is 0755 */
|
||||
public uint32 file_mode; /**< default is 0644 or 0755 as dictated by blob */
|
||||
public int32 file_open_flags; /**< default is O_CREAT | O_TRUNC | O_WRONLY */
|
||||
|
||||
public uint32 notify_flags; /**< see `git_checkout_notify_t` above */
|
||||
public git_checkout_notify_cb notify_cb;
|
||||
public void *notify_payload;
|
||||
|
||||
/** Optional callback to notify the consumer of checkout progress. */
|
||||
public git_checkout_progress_cb progress_cb;
|
||||
public void *progress_payload;
|
||||
|
||||
/** When not zeroed out, array of fnmatch patterns specifying which
|
||||
* paths should be taken into account, otherwise all files. Use
|
||||
* GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH to treat as simple list.
|
||||
*/
|
||||
public git_strarray paths;
|
||||
|
||||
/** The expected content of the working directory; defaults to HEAD.
|
||||
* If the working directory does not match this baseline information,
|
||||
* that will produce a checkout conflict.
|
||||
*/
|
||||
public git_tree* baseline;
|
||||
|
||||
/** Like `baseline` above, though expressed as an index. This
|
||||
* option overrides `baseline`.
|
||||
*/
|
||||
public git_index* baseline_index; /**< expected content of workdir, expressed as an index. */
|
||||
|
||||
public char8* target_directory; /**< alternative checkout path to workdir */
|
||||
|
||||
public char8* ancestor_label; /**< the name of the common ancestor side of conflicts */
|
||||
public char8* our_label; /**< the name of the "our" side of conflicts */
|
||||
public char8* their_label; /**< the name of the "their" side of conflicts */
|
||||
|
||||
/** Optional callback to notify the consumer of performance data. */
|
||||
public git_checkout_perfdata_cb perfdata_cb;
|
||||
public void *perfdata_payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback settings structure
|
||||
*
|
||||
* Set the callbacks to be called by the remote when informing the user
|
||||
* about the progress of the network operations.
|
||||
*/
|
||||
[CRepr]
|
||||
public struct git_remote_callbacks
|
||||
{
|
||||
public uint32 version;
|
||||
/**
|
||||
* Textual progress from the remote. Text send over the
|
||||
* progress side-band will be passed to this function (this is
|
||||
* the 'counting objects' output).
|
||||
*/
|
||||
public git_transport_message_cb sideband_progress;
|
||||
|
||||
/**
|
||||
* Completion is called when different parts of the download
|
||||
* process are done (currently unused).
|
||||
*/
|
||||
public function int32(git_remote_completion_type type, void *data) completion;
|
||||
|
||||
/**
|
||||
* This will be called if the remote host requires
|
||||
* authentication in order to connect to it.
|
||||
*
|
||||
* Returning GIT_PASSTHROUGH will make libgit2 behave as
|
||||
* though this field isn't set.
|
||||
*/
|
||||
public git_cred_acquire_cb credentials;
|
||||
|
||||
/**
|
||||
* If cert verification fails, this will be called to let the
|
||||
* user make the final decision of whether to allow the
|
||||
* connection to proceed. Returns 1 to allow the connection, 0
|
||||
* to disallow it or a negative value to indicate an error.
|
||||
*/
|
||||
public git_transport_certificate_check_cb certificate_check;
|
||||
|
||||
/**
|
||||
* During the download of new data, this will be regularly
|
||||
* called with the current count of progress done by the
|
||||
* indexer.
|
||||
*/
|
||||
public git_transfer_progress_cb transfer_progress;
|
||||
|
||||
/**
|
||||
* Each time a reference is updated locally, this function
|
||||
* will be called with information about it.
|
||||
*/
|
||||
public function int32 (char8* refname, git_oid *a, git_oid *b, void *data) update_tips;
|
||||
|
||||
/**
|
||||
* Function to call with progress information during pack
|
||||
* building. Be aware that this is called inline with pack
|
||||
* building operations, so performance may be affected.
|
||||
*/
|
||||
public git_packbuilder_progress pack_progress;
|
||||
|
||||
/**
|
||||
* Function to call with progress information during the
|
||||
* upload portion of a push. Be aware that this is called
|
||||
* inline with pack building operations, so performance may be
|
||||
* affected.
|
||||
*/
|
||||
public git_push_transfer_progress push_transfer_progress;
|
||||
|
||||
/**
|
||||
* Called for each updated reference on push. If `status` is
|
||||
* not `NULL`, the update was rejected by the remote server
|
||||
* and `status` contains the reason given.
|
||||
*/
|
||||
public function int32 (char8* refname, char8* status, void *data) push_update_reference;
|
||||
|
||||
/**
|
||||
* Called once between the negotiation step and the upload. It
|
||||
* provides information about what updates will be performed.
|
||||
*/
|
||||
public git_push_negotiation push_negotiation;
|
||||
|
||||
/**
|
||||
* Create the transport to use for this operation. Leave NULL
|
||||
* to auto-detect.
|
||||
*/
|
||||
public git_transport_cb transport;
|
||||
|
||||
/**
|
||||
* This will be passed to each of the callbacks in this struct
|
||||
* as the last parameter.
|
||||
*/
|
||||
public void *payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch options structure.
|
||||
*
|
||||
* Zero out for defaults. Initialize with `GIT_FETCH_OPTIONS_INIT` macro to
|
||||
* correctly set the `version` field. E.g.
|
||||
*
|
||||
* git_fetch_options opts = GIT_FETCH_OPTIONS_INIT;
|
||||
*/
|
||||
[CRepr]
|
||||
public struct git_fetch_options
|
||||
{
|
||||
public int32 version;
|
||||
|
||||
/**
|
||||
* Callbacks to use for this fetch operation
|
||||
*/
|
||||
public git_remote_callbacks callbacks;
|
||||
|
||||
/**
|
||||
* Whether to perform a prune after the fetch
|
||||
*/
|
||||
public git_fetch_prune_t prune;
|
||||
|
||||
/**
|
||||
* Whether to write the results to FETCH_HEAD. Defaults to
|
||||
* on. Leave this default in order to behave like git.
|
||||
*/
|
||||
public int32 update_fetchhead;
|
||||
|
||||
/**
|
||||
* Determines how to behave regarding tags on the remote, such
|
||||
* as auto-downloading tags for objects we're downloading or
|
||||
* downloading all of them.
|
||||
*
|
||||
* The default is to auto-follow tags.
|
||||
*/
|
||||
public git_remote_autotag_option_t download_tags;
|
||||
|
||||
/**
|
||||
* Proxy options to use, by default no proxy is used.
|
||||
*/
|
||||
public git_proxy_options proxy_opts;
|
||||
|
||||
/**
|
||||
* Extra headers for this fetch operation
|
||||
*/
|
||||
public git_strarray custom_headers;
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
public struct git_clone_options
|
||||
{
|
||||
public uint32 version;
|
||||
|
||||
/**
|
||||
* These options are passed to the checkout step. To disable
|
||||
* checkout, set the `checkout_strategy` to
|
||||
* `GIT_CHECKOUT_NONE`.
|
||||
*/
|
||||
public git_checkout_options checkout_opts;
|
||||
|
||||
/**
|
||||
* Options which control the fetch, including callbacks.
|
||||
*
|
||||
* The callbacks are used for reporting fetch progress, and for acquiring
|
||||
* credentials in the event they are needed.
|
||||
*/
|
||||
public git_fetch_options fetch_opts;
|
||||
|
||||
/**
|
||||
* Set to zero (false) to create a standard repo, or non-zero
|
||||
* for a bare repo
|
||||
*/
|
||||
public int32 bare;
|
||||
|
||||
/**
|
||||
* Whether to use a fetch or copy the object database.
|
||||
*/
|
||||
public git_clone_local_t local;
|
||||
|
||||
/**
|
||||
* The name of the branch to checkout. NULL means use the
|
||||
* remote's default branch.
|
||||
*/
|
||||
public char8* checkout_branch;
|
||||
|
||||
/**
|
||||
* A callback used to create the new repository into which to
|
||||
* clone. If NULL, the 'bare' field will be used to determine
|
||||
* whether to create a bare repository.
|
||||
*/
|
||||
public git_repository_create_cb repository_cb;
|
||||
|
||||
/**
|
||||
* An opaque payload to pass to the git_repository creation callback.
|
||||
* This parameter is ignored unless repository_cb is non-NULL.
|
||||
*/
|
||||
public void* repository_cb_payload;
|
||||
|
||||
/**
|
||||
* A callback used to create the git_remote, prior to its being
|
||||
* used to perform the clone operation. See the documentation for
|
||||
* git_remote_create_cb for details. This parameter may be NULL,
|
||||
* indicating that git_clone should provide default behavior.
|
||||
*/
|
||||
public git_remote_create_cb remote_cb;
|
||||
|
||||
/**
|
||||
* An opaque payload to pass to the git_remote creation callback.
|
||||
* This parameter is ignored unless remote_cb is non-NULL.
|
||||
*/
|
||||
public void* remote_cb_payload;
|
||||
}
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
public static extern int32 git_libgit2_init();
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
public static extern int32 git_libgit2_shutdown();
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
public static extern int32 git_clone(git_repository** repoOut, char8* url, char8* local_path, git_clone_options* options);
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
public static extern void git_repository_free(git_repository *repo);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
35
IDE/src/util/PackMan.bf
Normal file
35
IDE/src/util/PackMan.bf
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using IDE.Util;
|
||||
|
||||
#if BF_PLATFORM_WINDOWS
|
||||
using static Git.GitApi;
|
||||
#define SUPPORT_GIT
|
||||
#endif
|
||||
|
||||
namespace IDE.util
|
||||
{
|
||||
class PackMan
|
||||
{
|
||||
class GitHelper
|
||||
{
|
||||
static bool sInitialized;
|
||||
|
||||
public this()
|
||||
{
|
||||
if (!sInitialized)
|
||||
{
|
||||
#if SUPPORT_GIT
|
||||
#unwarn
|
||||
var result = git_libgit2_init();
|
||||
sInitialized = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckLock(StringView projectName, String outPath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,22 @@ namespace IDE.Util
|
|||
{
|
||||
public String mVersion ~ delete _;
|
||||
|
||||
public this()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public this(SemVer semVer)
|
||||
{
|
||||
if (semVer.mVersion != null)
|
||||
mVersion = new String(semVer.mVersion);
|
||||
}
|
||||
|
||||
public this(StringView version)
|
||||
{
|
||||
mVersion = new String(version);
|
||||
}
|
||||
|
||||
public Result<void> Parse(StringView ver)
|
||||
{
|
||||
mVersion = new String(ver);
|
||||
|
|
|
@ -7,15 +7,131 @@ namespace IDE.Util
|
|||
{
|
||||
enum VerSpec
|
||||
{
|
||||
case None;
|
||||
case SemVer(SemVer ver);
|
||||
case Path(String path);
|
||||
case Git(String url);
|
||||
case Git(String url, SemVer ver);
|
||||
|
||||
public void Dispose() mut
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .None:
|
||||
case .SemVer(let ver):
|
||||
delete ver;
|
||||
case .Path(let path):
|
||||
delete path;
|
||||
case .Git(let url, let ver):
|
||||
delete url;
|
||||
delete ver;
|
||||
}
|
||||
this = .None;
|
||||
}
|
||||
|
||||
public VerSpec Duplicate()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .None:
|
||||
return .None;
|
||||
case .SemVer(let ver):
|
||||
return .SemVer(new SemVer(ver));
|
||||
case .Path(let path):
|
||||
return .Path(new String(path));
|
||||
case .Git(let url, let ver):
|
||||
return .Git(new String(url), new SemVer(ver));
|
||||
}
|
||||
}
|
||||
|
||||
public Result<void> Parse(StructuredData data) mut
|
||||
{
|
||||
Dispose();
|
||||
if (data.IsObject)
|
||||
{
|
||||
for (var valName in data.Enumerate())
|
||||
{
|
||||
if (valName == "Path")
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
this = .Path(pathStr);
|
||||
}
|
||||
else if (valName == "Git")
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
this = .Git(pathStr, null);
|
||||
}
|
||||
else if (valName == "Version")
|
||||
{
|
||||
if (this case .Git(var url, var prevVer))
|
||||
{
|
||||
if (prevVer == null)
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
SemVer semVer = new SemVer();
|
||||
semVer.mVersion = pathStr;
|
||||
this = .Git(url, semVer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
SemVer semVer = new SemVer();
|
||||
semVer.mVersion = pathStr;
|
||||
this = .SemVer(semVer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//gApp.Fail("Invalid ver path");
|
||||
return .Err;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
let verString = scope String();
|
||||
data.GetCurString(verString);
|
||||
let semVer = new SemVer();
|
||||
this = .SemVer(semVer);
|
||||
|
||||
Try!(semVer.Parse(verString));
|
||||
}
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
public void Serialize(String name, StructuredData data)
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .None:
|
||||
case .Git(var path, var ver):
|
||||
using (data.CreateObject(name))
|
||||
{
|
||||
data.Add("Git", path);
|
||||
if (ver != null)
|
||||
data.Add("Version", ver.mVersion);
|
||||
}
|
||||
case .SemVer(var ver):
|
||||
data.Add(name, ver.mVersion);
|
||||
case .Path(var path):
|
||||
using (data.CreateObject(name))
|
||||
{
|
||||
data.Add("Path", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VerSpecRecord
|
||||
{
|
||||
public VerSpec mVerSpec;
|
||||
public Object mVerObject;
|
||||
public Object mVerObject2;
|
||||
|
||||
public ~this()
|
||||
{
|
||||
|
@ -26,6 +142,7 @@ namespace IDE.Util
|
|||
case .Git(let url): delete url;
|
||||
}*/
|
||||
delete mVerObject;
|
||||
delete mVerObject2;
|
||||
}
|
||||
|
||||
public void SetPath(StringView path)
|
||||
|
@ -67,18 +184,31 @@ namespace IDE.Util
|
|||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
mVerObject = pathStr;
|
||||
mVerSpec = .Git(pathStr);
|
||||
mVerSpec = .Git(pathStr, null);
|
||||
}
|
||||
else if (valName == "Ver")
|
||||
else if (valName == "Version")
|
||||
{
|
||||
if (mVerSpec case .Git(var url, var prevVer))
|
||||
{
|
||||
if (prevVer == null)
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
SemVer semVer = new SemVer();
|
||||
semVer.mVersion = pathStr;
|
||||
mVerSpec = .Git(url, semVer);
|
||||
mVerObject2 = semVer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var pathStr = new String();
|
||||
data.GetCurString(pathStr);
|
||||
|
||||
SemVer semVer = new SemVer();
|
||||
mVerObject = semVer;
|
||||
|
||||
semVer.mVersion = pathStr;
|
||||
mVerSpec = .SemVer(semVer);
|
||||
mVerObject = semVer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -106,10 +236,13 @@ namespace IDE.Util
|
|||
{
|
||||
switch (mVerSpec)
|
||||
{
|
||||
case .Git(var path):
|
||||
case .None:
|
||||
case .Git(var path, var ver):
|
||||
using (data.CreateObject(name))
|
||||
{
|
||||
data.Add("Git", path);
|
||||
if (ver != null)
|
||||
data.Add("Version", ver.mVersion);
|
||||
}
|
||||
case .SemVer(var ver):
|
||||
data.Add(name, ver.mVersion);
|
||||
|
|
|
@ -47,11 +47,11 @@ CALL bin/msbuild.bat BeefBoot\BeefBoot.vcxproj /p:Configuration=Release /p:Platf
|
|||
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||
|
||||
@ECHO Building BeefBuild_bootd
|
||||
IDE\dist\BeefBoot_d.exe --out="IDE\dist\BeefBuild_bootd.exe" --src=IDE\src --src=BeefBuild\src --src=BeefLibs\corlib\src --src=BeefLibs\Beefy2D\src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDE\dist\Beef042RT64_d.lib IDE\dist\IDEHelper64_d.lib IDE\dist\BeefySysLib64_d.lib"
|
||||
IDE\dist\BeefBoot_d.exe --out="IDE\dist\BeefBuild_bootd.exe" --src=IDE\src --src=BeefBuild\src --src=BeefLibs\corlib\src --src=BeefLibs\Beefy2D\src --src=BeefLibs\libgit2\src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDE\dist\Beef042RT64_d.lib IDE\dist\IDEHelper64_d.lib IDE\dist\BeefySysLib64_d.lib"
|
||||
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||
|
||||
@ECHO Building BeefBuild_boot
|
||||
IDE\dist\BeefBoot.exe --out="IDE\dist\BeefBuild_boot.exe" --src=IDE\src --src=BeefBuild\src --src=BeefLibs\corlib\src --src=BeefLibs\Beefy2D\src --define=CLI --define=RELEASE --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDE\dist\Beef042RT64.lib IDE\dist\IDEHelper64.lib IDE\dist\BeefySysLib64.lib"
|
||||
IDE\dist\BeefBoot.exe --out="IDE\dist\BeefBuild_boot.exe" --src=IDE\src --src=BeefBuild\src --src=BeefLibs\corlib\src --src=BeefLibs\Beefy2D\src --src=BeefLibs\libgit2\src --define=CLI --define=RELEASE --startup=BeefBuild.Program --linkparams="Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDE\dist\Beef042RT64.lib IDE\dist\IDEHelper64.lib IDE\dist\BeefySysLib64.lib"
|
||||
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||
|
||||
@ECHO Building BeefBuild_d
|
||||
|
|
|
@ -12,11 +12,11 @@ SETLOCAL EnableDelayedExpansion
|
|||
PUSHD %~dp0..\
|
||||
|
||||
@ECHO Testing IDEHelper\Tests\PlatformChange.txt in BeefIDE_d
|
||||
%~dp0\RunAndWait %~dp0..\IDE\dist\BeefIDE_d.exe -platform=Win32 -proddir=%~dp0..\IDEHelper\Tests%TESTPATH% -test=scripts\PlatformChange.txt
|
||||
%~dp0\RunAndWait %~dp0..\IDE\dist\BeefIDE_d.exe -platform=Win32 -proddir=%~dp0..\IDEHelper\Tests -test=scripts\PlatformChange.txt
|
||||
@IF !ERRORLEVEL! NEQ 0 GOTO:EOF
|
||||
|
||||
@ECHO Testing IDEHelper\Tests\Reify.txt in BeefIDE_d
|
||||
%~dp0\RunAndWait %~dp0..\IDE\dist\BeefIDE_d.exe -proddir=%~dp0..\IDEHelper\Tests%TESTPATH% -test=scripts\Reify.txt
|
||||
%~dp0\RunAndWait %~dp0..\IDE\dist\BeefIDE_d.exe -proddir=%~dp0..\IDEHelper\Tests -test=scripts\Reify.txt
|
||||
@IF !ERRORLEVEL! NEQ 0 GOTO:EOF
|
||||
|
||||
@SET TESTPATH=IDE\Tests\CompileFail001
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue