mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Update BeefBuild to use new custom build properties API.
This commit is contained in:
parent
275dbd14e8
commit
80a72f991d
5 changed files with 30 additions and 39 deletions
|
@ -110,7 +110,7 @@ namespace BeefBuild
|
||||||
{
|
{
|
||||||
mWorkspace.mName = new String();
|
mWorkspace.mName = new String();
|
||||||
Path.GetFileName(mWorkspace.mDir, mWorkspace.mName);
|
Path.GetFileName(mWorkspace.mDir, mWorkspace.mName);
|
||||||
LoadProperties();
|
CustomBuildProperties.Load(false);
|
||||||
LoadWorkspace(mVerb);
|
LoadWorkspace(mVerb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -308,15 +308,21 @@ namespace BeefBuild
|
||||||
int splitIdx = (int)value.IndexOf('=');
|
int splitIdx = (int)value.IndexOf('=');
|
||||||
if (splitIdx != -1)
|
if (splitIdx != -1)
|
||||||
{
|
{
|
||||||
String propertyKey = new String();
|
String propertyName = new String();
|
||||||
StringView propertyKeyView = value.Substring(0, splitIdx);
|
StringView propertyKeyView = value.Substring(0, splitIdx);
|
||||||
propertyKeyView.ToString(propertyKey);
|
propertyKeyView.ToString(propertyName);
|
||||||
|
|
||||||
String propertyValue = new String();
|
String propertyValue = new String();
|
||||||
StringView propertyValueView = value.Substring(splitIdx + 1, value.Length - splitIdx - 1);
|
StringView propertyValueView = value.Substring(splitIdx + 1, value.Length - splitIdx - 1);
|
||||||
propertyValueView.ToString(propertyValue);
|
propertyValueView.ToString(propertyValue);
|
||||||
|
|
||||||
mCustomProperties.Add(propertyKey, propertyValue);
|
if (!CustomBuildProperties.TryAddProperty(propertyName, propertyValue))
|
||||||
|
{
|
||||||
|
delete propertyName;
|
||||||
|
delete propertyValue;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,11 @@ namespace IDE
|
||||||
mProjects.Clear();
|
mProjects.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void Load()
|
static public void Load(bool clearExistingProperties = true)
|
||||||
{
|
{
|
||||||
const char8* PROPERTIES_STR = "Properties";
|
const char8* PROPERTIES_STR = "Properties";
|
||||||
|
|
||||||
|
if (clearExistingProperties)
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
String propertiesFileName = scope String();
|
String propertiesFileName = scope String();
|
||||||
|
@ -85,22 +86,31 @@ namespace IDE
|
||||||
|
|
||||||
for (var property in data.Enumerate(PROPERTIES_STR))
|
for (var property in data.Enumerate(PROPERTIES_STR))
|
||||||
{
|
{
|
||||||
String propertyStr = new String();
|
String propertyName = new String();
|
||||||
property.ToString(propertyStr);
|
property.ToString(propertyName);
|
||||||
|
|
||||||
if (Contains(propertyStr))
|
if (Contains(propertyName))
|
||||||
{
|
{
|
||||||
delete propertyStr;
|
delete propertyName;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String propertyValue = new String();
|
String propertyValue = new String();
|
||||||
data.GetCurString(propertyValue);
|
data.GetCurString(propertyValue);
|
||||||
|
|
||||||
mProperties.Add(propertyStr, propertyValue);
|
TryAddProperty(propertyName, propertyValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public bool TryAddProperty(String propertyName, String propertyValue)
|
||||||
|
{
|
||||||
|
if (Contains(propertyName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
mProperties.Add(propertyName, propertyValue);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static public bool Contains(String property)
|
static public bool Contains(String property)
|
||||||
{
|
{
|
||||||
return mProperties.ContainsKey(property);
|
return mProperties.ContainsKey(property);
|
||||||
|
|
|
@ -987,6 +987,7 @@ namespace IDE
|
||||||
mWorkspace.mName = new String();
|
mWorkspace.mName = new String();
|
||||||
Path.GetFileName(mWorkspace.mDir, mWorkspace.mName);
|
Path.GetFileName(mWorkspace.mDir, mWorkspace.mName);
|
||||||
|
|
||||||
|
CustomBuildProperties.Load();
|
||||||
LoadWorkspace(.OpenOrNew);
|
LoadWorkspace(.OpenOrNew);
|
||||||
FinishShowingNewWorkspace();
|
FinishShowingNewWorkspace();
|
||||||
}
|
}
|
||||||
|
@ -2258,18 +2259,6 @@ namespace IDE
|
||||||
outResult.Append(mInstallDir, "/DefaultLayout.toml");
|
outResult.Append(mInstallDir, "/DefaultLayout.toml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetPropertiesFileName(String outResult)
|
|
||||||
{
|
|
||||||
String workspaceDir = scope String();
|
|
||||||
|
|
||||||
if (mWorkspace.mDir == null)
|
|
||||||
Directory.GetCurrentDirectory(workspaceDir);
|
|
||||||
else
|
|
||||||
workspaceDir = mWorkspace.mDir;
|
|
||||||
|
|
||||||
outResult.Append(workspaceDir, "/BeefProperties.toml");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetWorkspaceFileName(String outResult)
|
bool GetWorkspaceFileName(String outResult)
|
||||||
{
|
{
|
||||||
if (mWorkspace.mDir == null)
|
if (mWorkspace.mDir == null)
|
||||||
|
@ -2973,8 +2962,6 @@ namespace IDE
|
||||||
{
|
{
|
||||||
scope AutoBeefPerf("IDEApp.LoadWorkspace");
|
scope AutoBeefPerf("IDEApp.LoadWorkspace");
|
||||||
|
|
||||||
CustomBuildProperties.Load();
|
|
||||||
|
|
||||||
AddRecentFile(.OpenedWorkspace, mWorkspace.mDir);
|
AddRecentFile(.OpenedWorkspace, mWorkspace.mDir);
|
||||||
|
|
||||||
StructuredData data = null;
|
StructuredData data = null;
|
||||||
|
@ -3149,15 +3136,6 @@ namespace IDE
|
||||||
LoadFailed();
|
LoadFailed();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (projSpec.mVerSpec case .Path(let projPath))
|
|
||||||
{
|
|
||||||
String resolvedProjPath = scope String();
|
|
||||||
if (gApp.ResolveConfigString(null, null, null, null, projPath, "custom properties", resolvedProjPath))
|
|
||||||
{
|
|
||||||
projPath.Clear();
|
|
||||||
projPath.Append(resolvedProjPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (AddProject(projectName, projSpec.mVerSpec))
|
switch (AddProject(projectName, projSpec.mVerSpec))
|
||||||
{
|
{
|
||||||
|
@ -3207,6 +3185,7 @@ namespace IDE
|
||||||
CloseWorkspace();
|
CloseWorkspace();
|
||||||
mWorkspace.mDir = new String(workspaceDir);
|
mWorkspace.mDir = new String(workspaceDir);
|
||||||
mWorkspace.mName = new String(workspaceName);
|
mWorkspace.mName = new String(workspaceName);
|
||||||
|
CustomBuildProperties.Load();
|
||||||
LoadWorkspace(.Open);
|
LoadWorkspace(.Open);
|
||||||
FinishShowingNewWorkspace();
|
FinishShowingNewWorkspace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1041,11 +1041,6 @@ namespace IDE
|
||||||
data.GetString("FileVersion", mFileVersion);
|
data.GetString("FileVersion", mFileVersion);
|
||||||
data.GetString("ProductVersion", mProductVersion);
|
data.GetString("ProductVersion", mProductVersion);
|
||||||
String resolvedProductVersion = scope String();
|
String resolvedProductVersion = scope String();
|
||||||
if (gApp.ResolveConfigString(null, null, null, null, mProductVersion, "custom properties", resolvedProductVersion))
|
|
||||||
{
|
|
||||||
mProductVersion.Clear();
|
|
||||||
mProductVersion.Append(resolvedProductVersion);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Serialize(StructuredData data)
|
public void Serialize(StructuredData data)
|
||||||
|
|
|
@ -143,6 +143,7 @@ namespace IDE.ui
|
||||||
app.mWorkspace.mDir = new String(projDirectory);
|
app.mWorkspace.mDir = new String(projDirectory);
|
||||||
app.mWorkspace.mName = new String(projName);
|
app.mWorkspace.mName = new String(projName);
|
||||||
|
|
||||||
|
CustomBuildProperties.Load();
|
||||||
app.[Friend]LoadWorkspace(.OpenOrNew);
|
app.[Friend]LoadWorkspace(.OpenOrNew);
|
||||||
app.[Friend]FinishShowingNewWorkspace(false);
|
app.[Friend]FinishShowingNewWorkspace(false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue