浏览代码

Bring the Rakefile up to date, and remove uninstall survey

Antony Male 4 年之前
父节点
当前提交
bcb9a737ee
共有 4 个文件被更改,包括 22 次插入200 次删除
  1. 1 1
      LICENSE.txt
  2. 13 20
      Rakefile
  3. 二进制
      build/7za.exe
  4. 8 179
      installer/common.iss

+ 1 - 1
LICENSE.txt

@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2015-2017 Antony Male
+Copyright (c) 2015-2021 Antony Male
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 13 - 20
Rakefile

@@ -4,13 +4,12 @@ require 'open-uri'
 require_relative 'build/TxClient'
 require_relative 'build/CsprojResxWriter'
 
-ISCC = ENV['ISCC'] || 'C:\Program Files (x86)\Inno Setup 5\ISCC.exe'
-SZIP = ENV['SZIP'] || 'C:\Program Files\7-Zip\7z.exe'
+ISCC = ENV['ISCC'] || 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
+SZIP = ENV['SZIP'] || File.join(__dir__, 'build', '7za.exe')
 SIGNTOOL = ENV['SIGNTOOL'] || 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe'
 VSWHERE = 'build/vswhere.exe'
 
 CONFIG = ENV['CONFIG'] || 'Release'
-MSBUILD_VERSION = '15.0'
 MSBUILD_LOGGER = ENV['MSBUILD_LOGGER']
 
 SRC_DIR = 'src/SyncTrayzor'
@@ -67,30 +66,24 @@ SYNCTHING_VERSIONS_TO_UPDATE = ['latest']
 ARCH_CONFIG = [ArchDirConfig.new('x64', 'amd64'), ArchDirConfig.new('x86', '386')]
 ASSEMBLY_INFOS = FileList['**/AssemblyInfo.cs']
 
-def ensure_7zip
-  unless File.exist?(SIGNTOOL)
-    warn "You must install the Windows SDK"
-    exit 1
-  end
-end
-
 def build(sln, platform, rebuild = true)
   if ENV['MSBUILD']
     msbuild = ENV['MSBUILD']
   else
-    path = `#{VSWHERE} -version #{MSBUILD_VERSION} -requires Microsoft.Component.MSBuild -format value -property installationPath`.chomp
-    msbuild = File.join(path, 'MSBuild', MSBUILD_VERSION, 'Bin', 'MSBuild.exe')
+    path = `#{VSWHERE} -requires Microsoft.Component.MSBuild -format value -property installationPath`.chomp
+    msbuild = File.join(path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
   end
 
   puts "MSBuild is at #{msbuild}"
   tasks = rebuild ? 'Clean;Rebuild' : 'Build'
-  cmd = "\"#{msbuild}\" \"#{sln}\" /t:#{tasks} /p:Configuration=#{CONFIG};Platform=#{platform}"
+  cmd = "\"#{msbuild}\" \"#{sln}\" -t:#{tasks} -p:Configuration=#{CONFIG};Platform=#{platform}"
   if MSBUILD_LOGGER
-    cmd << " /logger:\"#{MSBUILD_LOGGER}\" /verbosity:minimal"
+    cmd << " -logger:\"#{MSBUILD_LOGGER}\" /verbosity:minimal"
   else
-    cmd << " /verbosity:quiet"
+    cmd << " -verbosity:quiet"
   end
   
+  puts cmd
   sh cmd
 end
 
@@ -135,7 +128,11 @@ namespace :"sign-installer" do
   ARCH_CONFIG.each do |arch_config|
     desc "Sign the installer (#{arch_config.arch}). Specify PASSWORD if required"
     task arch_config.arch do
-      ensure_7zip
+
+      unless File.exist?(SIGNTOOL)
+        warn "You must install the Windows SDK"
+        exit 1
+      end
 
       unless File.exist?(PFX)
         warn "#{PFX} must exist"
@@ -171,8 +168,6 @@ namespace :portable do
   ARCH_CONFIG.each do |arch_config|
     desc "Create the portable package (#{arch_config.arch})"
     task arch_config.arch do
-      ensure_7zip
-
       mkdir_p File.dirname(arch_config.portable_output_file)
       rm arch_config.portable_output_file if File.exist?(arch_config.portable_output_file)
 
@@ -290,8 +285,6 @@ namespace :syncthing do
     ARCH_CONFIG.each do |arch_config|
       desc "Download syncthing (#{arch_config.arch})"
       task arch_config.arch, [:version] => [:"build-checksum-util"] do |t, args|
-        ensure_7zip
-
         Dir.mktmpdir do |tmp|
           download_file = File.join(tmp, File.basename(arch_config.download_uri(args[:version])))
           File.open(download_file, 'wb') do |outfile|

二进制
build/7za.exe


+ 8 - 179
installer/common.iss

@@ -1,17 +1,17 @@
+
 #define AppExeName "SyncTrayzor.exe"
 #define AppRoot "..\.."
 #define AppSrc AppRoot + "\src\SyncTrayzor"
 #define AppBin AppRoot +"\bin\" + Arch + "\Release"
 #define AppExe AppBin + "\SyncTrayzor.exe"
 #define AppName GetStringFileInfo(AppExe, "ProductName")
-#define AppVersion GetFileVersion(AppExe)
+#define AppVersion GetVersionNumbersString(AppExe)
 #define AppPublisher "SyncTrayzor"
 #define AppURL "https://github.com/canton7/SyncTrayzor"
 #define AppDataFolder "SyncTrayzor"
 #define RunRegKey "Software\Microsoft\Windows\CurrentVersion\Run"
 #define DotNetInstallerExe "dotNet472Setup.exe"
 #define DonateUrl "https://synctrayzor.antonymale.co.uk/donate"
-#define SurveyUrl "https://synctrayzor.antonymale.co.uk/survey.php"
 
 [Setup]
 AppId={{#AppId}
@@ -23,7 +23,7 @@ AppPublisher={#AppPublisher}
 AppPublisherURL={#AppURL}
 AppSupportURL={#AppURL}
 AppUpdatesURL={#AppURL}
-DefaultDirName={pf}\{#AppName}
+DefaultDirName={commonpf}\{#AppName}
 DefaultGroupName={#AppName}
 AllowNoIcons=yes
 LicenseFile={#AppRoot}\LICENSE.txt
@@ -86,8 +86,6 @@ Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(
 [Code]
 var
   GlobalRestartRequired: boolean;
-  UninstallPollPage: TNewNotebookPage;
-  UninstallNextButton: TNewButton;
 
 function DotNetIsMissing(): Boolean;
 var 
@@ -167,9 +165,9 @@ end;
 
 procedure URLLabelOnClick(Sender: TObject);
 var
-	ErrorCode: Integer;
+  ErrorCode: Integer;
 begin
-	ShellExec('open', '{#DonateUrl}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
+  ShellExec('open', '{#DonateUrl}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
 end;
 
 procedure InitializeWizard;
@@ -181,8 +179,8 @@ begin
   URLLabel.Cursor := crHand;
   URLLabel.Parent := WizardForm;
   URLLabel.Font.Style := URLLabel.Font.Style + [fsUnderline];
-	URLLabel.Font.Color := clBlue;
-	URLLabel.Top := WizardForm.ClientHeight - URLLabel.Height - 15;
+  URLLabel.Font.Color := clBlue;
+  URLLabel.Top := WizardForm.ClientHeight - URLLabel.Height - 15;
   URLLabel.Left := ScaleX(10)
   URLLabel.OnClick := @URLLabelOnClick;
 end;
@@ -242,11 +240,6 @@ begin
   end
 end;
 
-procedure CurPageChanged(CurPageID: Integer);
-begin
-
-end;
-
 function PrepareToInstall(var NeedsRestart: Boolean): String;
 begin
   // 'NeedsRestart' only has an effect if we return a non-empty string, thus aborting the installation.
@@ -289,172 +282,8 @@ begin
    end;
 end;
 
-function SerializeBool(value: Boolean): String;
-begin
-  if value then begin
-    Result := 'true';
-  end else begin
-    Result := 'false';
-  end
-end;
-
-function EscapeJsonString(value: String): String;
-var
-  c: Char;
-  i: Integer;
-begin
-  // http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_charlength
-  i := 1;
-  while i <= Length(value) do
-  begin
-    c := value[i];
-    if c = #10 then begin
-      Result := Result + '\n';
-    end else if c = #13 then begin
-      Result := Result + '\r';
-    end else if c = #9 then begin
-      Result := Result + '\t';
-    end else if Ord(c) < 32 then begin
-      Result := Result + Format('\x%.4x', [Ord(c)]);
-    end else if c = '"' then begin
-      Result := Result + '\"';
-    end else if c = '\' then begin
-      Result := Result + '\\'
-    end else begin
-      Result := Result + c;
-    end;
-    i := i + CharLength(value, i);
-  end;
-end;
-
-// See https://stackoverflow.com/a/42550055/1086121
-
-procedure UpdateUninstallWizard;
-begin
-  if UninstallProgressForm.InnerNotebook.ActivePage = UninstallPollPage then
-  begin
-    UninstallProgressForm.PageNameLabel.Caption := 'Please Tell Us Why You''re Leaving';
-    UninstallProgressForm.PageDescriptionLabel.Caption := '';
-  end;
-
-  UninstallNextButton.Caption := 'Uninstall';
-  // Make the "Uninstall" button break the ShowModal loop
-  UninstallNextButton.ModalResult := mrOK;
-end;
-
-procedure InitializeUninstallProgressForm();
-var
-  PageText: TNewStaticText;
-  PageNameLabel: string;
-  PageDescriptionLabel: string;
-  CancelButtonEnabled: Boolean;
-  CancelButtonModalResult: Integer;
-  Checklist: TNewCheckListBox;
-  CommentsText: TNewStaticText;
-  CommentsBox: TNewMemo;
-  WinHttpReq: Variant;
-begin
-  if not UninstallSilent then
-  begin
-    // Create the poll page and make it active
-    UninstallPollPage := TNewNotebookPage.Create(UninstallProgressForm);
-    UninstallPollPage.Notebook := UninstallProgressForm.InnerNotebook;
-    UninstallPollPage.Parent := UninstallProgressForm.InnerNotebook;
-    UninstallPollPage.Align := alClient;
-
-    PageText := TNewStaticText.Create(UninstallProgressForm);
-    PageText.Parent := UninstallPollPage;
-    PageText.AutoSize := True;
-    PageText.WordWrap := True;
-    PageText.SetBounds(UninstallProgressForm.StatusLabel.Left, UninstallProgressForm.StatusLabel.Top, UninstallProgressForm.StatusLabel.Width, UninstallProgressForm.StatusLabel.Height);
-    PageText.ShowAccelChar := False;
-    PageText.Caption := 'Sorry you''re leaving! Please tell us what you didn''t like so we can improve it.' + #13#10 +
-    'No personal data will be sent. You can skip this step if you want.';
-
-    Checklist := TNewCheckListBox.Create(UninstallProgressForm);
-    Checklist.Parent := UninstallPollPage;
-    Checklist.SetBounds(PageText.Left, PageText.Top + PageText.Height + ScaleY(10), PageText.Width, ScaleY(20) * 5);
-    Checklist.BorderStyle := bsNone;
-    Checklist.Color := clBtnFace;
-    Checklist.WantTabs := True;
-    Checklist.MinItemHeight := ScaleY(20);
-
-    Checklist.AddCheckBox('I couldn''t get Syncthing to work', '', 0, False, True, False, False, nil);
-    Checklist.AddCheckBox('Syncthing doesn''t do what I need', '', 0, False, True, False, False, nil);
-    Checklist.AddCheckBox('I prefer another sync tool (please say which below)', '', 0, False, True, False, False, nil);
-    Checklist.AddCheckBox('I don''t like SyncTrayzor - I''m going to use another wrapper', '', 0, False, True, False, False, nil);
-    Checklist.AddCheckBox('Other (please expand below)', '', 0, False, True, False, False, nil);
-
-    CommentsText := TNewStaticText.Create(UninstallProgressForm);
-    CommentsText.Parent := UninstallPollPage;
-    CommentsText.AutoSize := True;
-    CommentsText.WordWrap := True;
-    CommentsText.SetBounds(PageText.Left, Checklist.Top + Checklist.Height + ScaleY(10), PageText.Width, ScaleY(15));
-    CommentsText.AutoSize := False;
-    CommentsText.ShowAccelChar := False;
-    CommentsText.Caption := 'More Details / Complaints:';
-
-    CommentsBox := TNewMemo.Create(UninstallProgressForm);
-    CommentsBox.Parent := UninstallPollPage;
-    CommentsBox.SetBounds(PageText.Left, CommentsText.Top + CommentsText.Height + ScaleY(5), PageText.Width, ScaleY(60));
-    CommentsBox.ScrollBars := ssVertical;
-
-    UninstallProgressForm.InnerNotebook.ActivePage := UninstallPollPage;
-
-    PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
-    PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;
-
-    UninstallNextButton := TNewButton.Create(UninstallProgressForm);
-    UninstallNextButton.Parent := UninstallProgressForm;
-    UninstallNextButton.Left := UninstallProgressForm.CancelButton.Left - UninstallProgressForm.CancelButton.Width - ScaleX(10);
-    UninstallNextButton.Top := UninstallProgressForm.CancelButton.Top;
-    UninstallNextButton.Width := UninstallProgressForm.CancelButton.Width;
-    UninstallNextButton.Height := UninstallProgressForm.CancelButton.Height;
-
-    UninstallProgressForm.CancelButton.TabOrder := UninstallNextButton.TabOrder + 1;
-
-    // Run our wizard pages
-    UpdateUninstallWizard;
-    CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
-    UninstallProgressForm.CancelButton.Enabled := True;
-    CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
-    UninstallProgressForm.CancelButton.ModalResult := mrCancel;
-
-    if UninstallProgressForm.ShowModal = mrCancel then Abort;
-
-    if Checklist.Checked[0] or Checklist.Checked[1] or Checklist.Checked[2] or Checklist.Checked[3] or Checklist.Checked[4] or (CommentsBox.Text <> '') then begin
-      try
-      begin
-        WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
-        WinHttpReq.Open('POST', '{#SurveyUrl}', false);
-        WinHttpReq.Send('{' +
-          ' "version": "{#AppVersion}"' +
-          ', "comment": "' + EscapeJsonString(CommentsBox.Text) + '"' +
-          ', "checklist": {' +
-            ' "wontWork": '+ SerializeBool(Checklist.Checked[0]) + 
-            ', "notWhatINeed": '+ SerializeBool(Checklist.Checked[1]) +
-            ', "preferAnotherSyncTool": '+ SerializeBool(Checklist.Checked[2]) +
-            ', "dontLikeSyncTrayzor": '+ SerializeBool(Checklist.Checked[3]) +
-            ', "other": '+ SerializeBool(Checklist.Checked[4]) +
-          ' }' +
-          ' }');
-      end except
-      end;
-    end;
-
-    // Restore the standard page payout
-    UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
-    UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;
-
-    UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
-    UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;
-
-    UninstallProgressForm.InnerNotebook.ActivePage := UninstallProgressForm.InstallingPage;
-  end;
-end;
-
 [UninstallDelete]
 Type: files; Name: "{app}\ProcessRunner.exe.old"
 Type: files; Name: "{app}\InstallCount.txt"
 Type: filesandordirs; Name: "{userappdata}\{#AppDataFolder}"
-Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"
+Type: filesandordirs; Name: "{localappdata}\{#AppDataFolder}"