mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
UserKit Build support
This commit is contained in:
parent
456e8cdbdb
commit
e2b2bf641a
4 changed files with 110 additions and 32 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#define ChangeSetVersion "92560"
|
; Do NOT change this next line in Dev Kit
|
||||||
|
#define ChangeSetVersion "7"
|
||||||
|
|
||||||
#ifndef BuildConfiguration
|
#ifndef BuildConfiguration
|
||||||
#error "No Build configuration defined!"
|
#error "No Build configuration defined!"
|
||||||
|
|
@ -31,7 +32,7 @@ AppVersion={#ChangeSetVersion}
|
||||||
DefaultDirName={userappdata}\Cosmos User Kit
|
DefaultDirName={userappdata}\Cosmos User Kit
|
||||||
DefaultGroupName=Cosmos User Kit
|
DefaultGroupName=Cosmos User Kit
|
||||||
OutputDir=.\Setup2\Output
|
OutputDir=.\Setup2\Output
|
||||||
OutputBaseFilename=CosmosUserKit
|
OutputBaseFilename=CosmosUserKit-{#ChangeSetVersion}
|
||||||
#ifdef Compress
|
#ifdef Compress
|
||||||
Compression=lzma2/ultra64
|
Compression=lzma2/ultra64
|
||||||
InternalCompressLevel=ultra64
|
InternalCompressLevel=ultra64
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@
|
||||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualBasic" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,14 @@ namespace Cosmos.Build.Builder {
|
||||||
protected string mCosmosPath;
|
protected string mCosmosPath;
|
||||||
public bool ResetHive { get; set; }
|
public bool ResetHive { get; set; }
|
||||||
protected string mOutputPath;
|
protected string mOutputPath;
|
||||||
protected bool mUserKit;
|
public bool IsUserKit { get; set; }
|
||||||
|
protected int mReleaseNo;
|
||||||
|
protected string mInnoFile;
|
||||||
|
|
||||||
public CosmosTask(string aCosmosPath, bool aUserKit) {
|
public CosmosTask(string aCosmosPath, int aReleaseNo) {
|
||||||
mCosmosPath = aCosmosPath;
|
mCosmosPath = aCosmosPath;
|
||||||
mUserKit = aUserKit;
|
mReleaseNo = aReleaseNo;
|
||||||
|
mInnoFile = mCosmosPath + @"\Setup2\Cosmos.iss";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void MsBuild(string aSlnFile, string aBuildCfg) {
|
protected void MsBuild(string aSlnFile, string aBuildCfg) {
|
||||||
|
|
@ -27,10 +30,51 @@ namespace Cosmos.Build.Builder {
|
||||||
Directory.CreateDirectory(mOutputPath);
|
Directory.CreateDirectory(mOutputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Section("Compiling X# Compiler");
|
CompileXSharpCompiler();
|
||||||
MsBuild(mCosmosPath + @"\source2\XSharp.sln", "Debug");
|
CompileXSharpSource();
|
||||||
|
CompileCosmos();
|
||||||
|
CopyTemplates();
|
||||||
|
if (IsUserKit) {
|
||||||
|
CreateUserKitScript();
|
||||||
|
}
|
||||||
|
CreateSetup();
|
||||||
|
if (!IsUserKit) {
|
||||||
|
RunSetup();
|
||||||
|
LaunchVS();
|
||||||
|
}
|
||||||
|
|
||||||
|
Done();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateUserKitScript() {
|
||||||
|
Section("Creating User Kit Script");
|
||||||
|
|
||||||
|
// Read in Cosmos.iss
|
||||||
|
using (var xSrc = new StreamReader(mInnoFile)) {
|
||||||
|
mInnoFile = Path.Combine(Path.GetDirectoryName(mInnoFile), "UserKit.iss");
|
||||||
|
// Write out UserKit.iss
|
||||||
|
using (var xDest = new StreamWriter(mInnoFile)) {
|
||||||
|
string xLine;
|
||||||
|
while ((xLine = xSrc.ReadLine()) != null) {
|
||||||
|
if (xLine.StartsWith("#define ChangeSetVersion ", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
|
xDest.WriteLine("#define ChangeSetVersion " + Quoted(mReleaseNo.ToString()));
|
||||||
|
} else {
|
||||||
|
xDest.WriteLine(xLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompileXSharpCompiler() {
|
||||||
|
Section("Compiling X# Compiler");
|
||||||
|
|
||||||
|
MsBuild(mCosmosPath + @"\source2\XSharp.sln", "Debug");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompileXSharpSource() {
|
||||||
Section("Compiling X# Sources");
|
Section("Compiling X# Sources");
|
||||||
|
|
||||||
var xFiles = Directory.GetFiles(mCosmosPath + @"\source2\Compiler\Cosmos.Compiler.DebugStub\", "*.xs");
|
var xFiles = Directory.GetFiles(mCosmosPath + @"\source2\Compiler\Cosmos.Compiler.DebugStub\", "*.xs");
|
||||||
foreach (var xFile in xFiles) {
|
foreach (var xFile in xFiles) {
|
||||||
Echo("Compiling " + Path.GetFileName(xFile));
|
Echo("Compiling " + Path.GetFileName(xFile));
|
||||||
|
|
@ -42,15 +86,18 @@ namespace Cosmos.Build.Builder {
|
||||||
// This way we can build it and call it directly.
|
// This way we can build it and call it directly.
|
||||||
StartConsole(mOutputPath + @"\xsc.exe", Quoted(xFile) + @" Cosmos.Debug.DebugStub");
|
StartConsole(mOutputPath + @"\xsc.exe", Quoted(xFile) + @" Cosmos.Debug.DebugStub");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompileCosmos() {
|
||||||
Section("Compiling Cosmos");
|
Section("Compiling Cosmos");
|
||||||
|
|
||||||
MsBuild(mCosmosPath + @"\source\Cosmos.sln", "Builder");
|
MsBuild(mCosmosPath + @"\source\Cosmos.sln", "Builder");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CopyTemplates() {
|
||||||
|
Section("Copying Templates");
|
||||||
|
|
||||||
CD(mOutputPath);
|
CD(mOutputPath);
|
||||||
|
|
||||||
Section("Copying Templates");
|
|
||||||
// Copy templates
|
|
||||||
// .iss does some of this as well.. why some here? And why is VB disabled in .iss?
|
|
||||||
SrcPath = mCosmosPath + @"\source2\VSIP\Cosmos.VS.Package\obj\x86\Debug";
|
SrcPath = mCosmosPath + @"\source2\VSIP\Cosmos.VS.Package\obj\x86\Debug";
|
||||||
Copy("CosmosProject (C#).zip");
|
Copy("CosmosProject (C#).zip");
|
||||||
Copy("CosmosKernel (C#).zip");
|
Copy("CosmosKernel (C#).zip");
|
||||||
|
|
@ -59,19 +106,25 @@ namespace Cosmos.Build.Builder {
|
||||||
Copy("CosmosProject (VB).zip");
|
Copy("CosmosProject (VB).zip");
|
||||||
Copy("CosmosKernel (VB).zip");
|
Copy("CosmosKernel (VB).zip");
|
||||||
Copy(mCosmosPath + @"\source2\VSIP\Cosmos.VS.XSharp\Template\XSharpFileItem.zip");
|
Copy(mCosmosPath + @"\source2\VSIP\Cosmos.VS.XSharp\Template\XSharpFileItem.zip");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateSetup() {
|
||||||
Section("Creating Setup");
|
Section("Creating Setup");
|
||||||
|
|
||||||
if (!File.Exists(Paths.ProgFiles32 + @"\Inno Setup 5\ISCC.exe")) {
|
if (!File.Exists(Paths.ProgFiles32 + @"\Inno Setup 5\ISCC.exe")) {
|
||||||
throw new Exception("Cannot find Inno setup.");
|
throw new Exception("Cannot find Inno setup.");
|
||||||
}
|
}
|
||||||
string xCfg = mUserKit ? "UserKit" : "DevKit";
|
string xCfg = IsUserKit ? "UserKit" : "DevKit";
|
||||||
StartConsole(Paths.ProgFiles32 + @"\Inno Setup 5\ISCC.exe", @"/Q " + Quoted(mCosmosPath + @"\Setup2\Cosmos.iss") + " /dBuildConfiguration=" + xCfg);
|
StartConsole(Paths.ProgFiles32 + @"\Inno Setup 5\ISCC.exe", @"/Q " + Quoted(mInnoFile) + " /dBuildConfiguration=" + xCfg);
|
||||||
|
|
||||||
if (!mUserKit) {
|
if (IsUserKit) {
|
||||||
Section("Running Setup");
|
File.Delete(mInnoFile);
|
||||||
Start(mCosmosPath + @"\Setup2\Output\CosmosUserKit.exe", @"/SILENT");
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LaunchVS() {
|
||||||
Section("Launching Visual Studio");
|
Section("Launching Visual Studio");
|
||||||
|
|
||||||
string xVisualStudio = Paths.ProgFiles32 + @"\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe";
|
string xVisualStudio = Paths.ProgFiles32 + @"\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe";
|
||||||
if (!File.Exists(xVisualStudio)) {
|
if (!File.Exists(xVisualStudio)) {
|
||||||
throw new Exception("Cannot find Visual Studio.");
|
throw new Exception("Cannot find Visual Studio.");
|
||||||
|
|
@ -86,6 +139,13 @@ namespace Cosmos.Build.Builder {
|
||||||
Start(xVisualStudio, mCosmosPath + @"\source\Cosmos.sln", false);
|
Start(xVisualStudio, mCosmosPath + @"\source\Cosmos.sln", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunSetup() {
|
||||||
|
Section("Running Setup");
|
||||||
|
|
||||||
|
Start(mCosmosPath + @"\Setup2\Output\CosmosUserKit-" + mReleaseNo + ".exe", @"/SILENT");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Done() {
|
||||||
Section("Build Complete!");
|
Section("Build Complete!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ using System.Windows.Navigation;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
|
||||||
namespace Cosmos.Build.Builder {
|
namespace Cosmos.Build.Builder {
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window {
|
||||||
|
|
@ -39,23 +40,36 @@ namespace Cosmos.Build.Builder {
|
||||||
StringBuilder mClipboard = new StringBuilder();
|
StringBuilder mClipboard = new StringBuilder();
|
||||||
DispatcherTimer mCloseTimer;
|
DispatcherTimer mCloseTimer;
|
||||||
|
|
||||||
public void Build() {
|
public bool Build() {
|
||||||
// TODO: Check for Inno, VS SDK SP1, other prereqs
|
// TODO: Check for Inno, VS SDK SP1, other prereqs
|
||||||
|
|
||||||
string xAppPath = System.AppDomain.CurrentDomain.BaseDirectory;
|
string xAppPath = System.AppDomain.CurrentDomain.BaseDirectory;
|
||||||
string xCosmosPath = Path.GetFullPath(xAppPath + @"..\..\..\..\..\");
|
string xCosmosPath = Path.GetFullPath(xAppPath + @"..\..\..\..\..\");
|
||||||
|
bool xIsUserKit = mApp.Args.Contains("-USERKIT");
|
||||||
|
int xReleaseNo = 7;
|
||||||
|
|
||||||
var xTask = new CosmosTask(xCosmosPath, mApp.Args.Contains("-USERKIT"));
|
if (xIsUserKit) {
|
||||||
|
string x = Interaction.InputBox("Enter Release Number", "Cosmos Builder");
|
||||||
|
if (string.IsNullOrEmpty(x)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
xReleaseNo = int.Parse(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
var xTask = new CosmosTask(xCosmosPath, xReleaseNo);
|
||||||
xTask.Log.LogLine += new Installer.Log.LogLineHandler(Log_LogLine);
|
xTask.Log.LogLine += new Installer.Log.LogLineHandler(Log_LogLine);
|
||||||
xTask.Log.LogSection += new Installer.Log.LogSectionHandler(Log_LogSection);
|
xTask.Log.LogSection += new Installer.Log.LogSectionHandler(Log_LogSection);
|
||||||
xTask.Log.LogError += new Installer.Log.LogErrorHandler(Log_LogError);
|
xTask.Log.LogError += new Installer.Log.LogErrorHandler(Log_LogError);
|
||||||
xTask.ResetHive = mApp.Args.Contains("-RESETHIVE");
|
xTask.ResetHive = mApp.Args.Contains("-RESETHIVE");
|
||||||
|
xTask.IsUserKit = xIsUserKit;
|
||||||
|
|
||||||
var xThread = new System.Threading.Thread(delegate() {
|
var xThread = new System.Threading.Thread(delegate() {
|
||||||
xTask.Run();
|
xTask.Run();
|
||||||
ThreadDone();
|
ThreadDone();
|
||||||
});
|
});
|
||||||
xThread.Start();
|
xThread.Start();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadDone() {
|
void ThreadDone() {
|
||||||
|
|
@ -152,7 +166,9 @@ namespace Cosmos.Build.Builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_Loaded(object sender, RoutedEventArgs e) {
|
void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||||
Build();
|
if (!Build()) {
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void butnCopy_Click(object sender, RoutedEventArgs e) {
|
void butnCopy_Click(object sender, RoutedEventArgs e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue