Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
More icons, build script, updater
Browse files Browse the repository at this point in the history
  • Loading branch information
LogicAndTrick committed Jul 20, 2013
1 parent 65f8dd6 commit 1e629f2
Show file tree
Hide file tree
Showing 33 changed files with 1,008 additions and 5 deletions.
1 change: 1 addition & 0 deletions Build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Out
46 changes: 46 additions & 0 deletions Build/GenerateInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
$msbuild = Join-Path (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0').MSBuildToolsPath "MSBuild.exe"
if (Test-Path 'HKLM:\SOFTWARE\7-Zip') {
$7zip = Join-Path (Get-ItemProperty 'HKLM:\SOFTWARE\7-Zip').Path "7z.exe"
} else {
$7zip = Join-Path (Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\7-Zip').Path "7z.exe"
}
if (Test-Path 'HKLM:\SOFTWARE\NSIS') {
$nsis = Join-Path (Get-ItemProperty 'HKLM:\SOFTWARE\NSIS').'(default)' "makensis.exe"
} else {
$nsis = Join-Path (Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\NSIS').'(default)' "makensis.exe"
}

If (Test-Path './Out') { Remove-Item './Out' -recurse }

(New-Item './Out' -ItemType directory) | Out-Null
$log = './Out/Build.log'
(Set-Content $log '')

echo 'Building Solution...'
(& $msbuild '../Sledge.sln' '/p:Configuration=Release') | Add-Content $log

echo 'Copying Files...'
(& 'robocopy.exe' '../Sledge.Editor/bin/Release/' 'Out/Build' '/S' '/XF' '*.pdb' '*.xml' '*.vshost.*') | Add-Content $log

$version = (Get-Command './Out/Build/Sledge.Editor.exe').FileVersionInfo.ProductVersion
$zipfile = './Out/Sledge.Editor.' + $version + '.zip'
$exefile = './Out/Sledge.Editor.' + $version + '.zip'
$nsifile = './Out/Sledge.Editor.Installer.' + $version + '.nsi'
$verfile = './Out/version.txt'

echo ('Version is ' + $version + '.')
echo 'Creating Archive...'
(& $7zip 'a' '-tzip' '-r' $zipfile './Out/Build/*.*') | Add-Content $log

echo 'Creating Installer...'
Set-Content $nsifile ((Get-Content '.\Sledge.Editor.Installer.nsi') -replace "\{version\}", $version)

(& $nsis $nsifile) | Add-Content $log

echo 'Creating Version File...'
$date = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
#/~https://github.com/LogicAndTrick/sledge/releases/download/pre-alpha/Sledge.Editor.0.1.0.0.zip
$url ='/~https://github.com/LogicAndTrick/sledge/releases/download/' + $version + '/Sledge.Editor.' + $version + '.zip'
Set-Content $verfile $version, $date, $url

echo 'Done.'
20 changes: 20 additions & 0 deletions Build/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Sledge Build Script
-------------------

This script will build Sledge and package it up in a nice way.

To use:

* Install [7-Zip](http://www.7-zip.org/)
* Install [NSIS](http://nsis.sourceforge.net/)
* You also need Powershell, MSBuild 4.0, and Robocopy available.
* In Powershell, run: Set-ExecutionPolicy unrestricted (required to run Powershell scripts)
* Run GenerateInstall.ps1 as an administrator
* The build artifacts are in /Out
* The results from MSBuild are in /Out/Build
* The ZIP archive is at /Out/Sledge.Editor.{version}.zip
* The installer is at /Out/Sledge.Editor.{version}.exe
* The NSIS script is at /Out/Sledge.Editor.Installer.{version}.nsi
* The version text file is at /Out/version.txt
* The complete build log is at /Out/Build.log
* If you wish to disable Powershell scripts again, run: Set-ExecutionPolicy restricted
86 changes: 86 additions & 0 deletions Build/Sledge.Editor.Installer.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
; Sledge NSIS Installer
; ---------------------

; Installer Info
Name "Sledge"
OutFile "Sledge.Editor.{version}.exe"
InstallDir "$PROGRAMFILES\Sledge Editor"
InstallDirRegKey HKLM "Software\Sledge\Editor" "InstallDir"
RequestExecutionLevel admin

; Version Info
VIProductVersion "{version}"
VIAddVersionKey "FileVersion" "{version}"
VIAddVersionKey "ProductName" "Sledge Editor"
VIAddVersionKey "FileDescription" "Installer for Sledge Editor"
VIAddVersionKey "LegalCopyright" "http://logic-and-trick.com 2013"

; Ensure Admin Rights
!include LogicLib.nsh

Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd

; Installer Pages

Page components
Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles

; Installer Sections

Section "Sledge Editor"
SectionIn RO
SetOutPath $INSTDIR
File /r "Build\*"

WriteRegStr HKLM "Software\Sledge\Editor" "InstallDir" "$INSTDIR"
WriteRegStr HKLM "Software\Sledge\Editor" "Version" "{version}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SledgeEditor" "DisplayName" "Sledge Editor"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SledgeEditor" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SledgeEditor" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SledgeEditor" "NoRepair" 1
WriteUninstaller "Uninstall.exe"
SectionEnd

Section "Start Menu Shortcuts"

SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Sledge Editor"
CreateShortCut "$SMPROGRAMS\Sledge Editor\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\Sledge Editor\Sledge Editor.lnk" "$INSTDIR\Sledge.Editor.exe" "" "$INSTDIR\Sledge.Editor.exe" 0

SectionEnd

Section "Desktop Shortcut"

SetShellVarContext all
CreateShortCut "$DESKTOP\Sledge Editor.lnk" "$INSTDIR\Sledge.Editor.exe" "" "$INSTDIR\Sledge.Editor.exe" 0

SectionEnd

; Uninstall

Section "Uninstall"

DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SledgeEditor"
DeleteRegKey HKLM "Software\Sledge\Editor"

SetShellVarContext all
Delete "$SMPROGRAMS\Sledge Editor\*.*"
Delete "$DESKTOP\Sledge Editor.lnk"

RMDir /r "$SMPROGRAMS\Sledge Editor"
RMDir /r "$INSTDIR"

SectionEnd
21 changes: 21 additions & 0 deletions Sledge.Editor.Updater/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace Sledge.Editor.Updater
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new UpdaterForm());
}
}
}
36 changes: 36 additions & 0 deletions Sledge.Editor.Updater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sledge.Editor.Updater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sledge.Editor.Updater")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("07c55370-d004-4738-a158-8e85c77ede82")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
71 changes: 71 additions & 0 deletions Sledge.Editor.Updater/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e629f2

Please sign in to comment.