summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/AutoUpdater/DummyAutoUpdater.h10
-rw-r--r--SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp19
-rw-r--r--SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h9
-rw-r--r--SwifTools/SConscript3
4 files changed, 41 insertions, 0 deletions
diff --git a/SwifTools/AutoUpdater/DummyAutoUpdater.h b/SwifTools/AutoUpdater/DummyAutoUpdater.h
new file mode 100644
index 0000000..bdddb2a
--- /dev/null
+++ b/SwifTools/AutoUpdater/DummyAutoUpdater.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "SwifTools/AutoUpdater/AutoUpdater.h"
+
+namespace Swift {
+ class DummyAutoUpdater : public AutoUpdater {
+ public:
+ void checkForUpdates() {}
+ };
+}
diff --git a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp
new file mode 100644
index 0000000..2049a4e
--- /dev/null
+++ b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.cpp
@@ -0,0 +1,19 @@
+#include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h"
+
+#ifdef HAVE_SPARKLE
+#include "SwifTools/AutoUpdater/SparkleAutoUpdater.h"
+#else
+#include "SwifTools/AutoUpdater/DummyAutoUpdater.h"
+#endif
+
+namespace Swift {
+
+AutoUpdater* PlatformAutoUpdaterFactory::createAutoUpdater(const String& appcastURL) {
+#ifdef HAVE_SPARKLE
+ return new SparkleAutoUpdater(appcastURL);
+#else
+ return new DummyAutoUpdater();
+#endif
+}
+
+}
diff --git a/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h
new file mode 100644
index 0000000..4e3cef1
--- /dev/null
+++ b/SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h
@@ -0,0 +1,9 @@
+namespace Swift {
+ class AutoUpdater;
+ class String;
+
+ class PlatformAutoUpdaterFactory {
+ public:
+ AutoUpdater* createAutoUpdater(const String& appcastURL);
+ };
+}
diff --git a/SwifTools/SConscript b/SwifTools/SConscript
index 92e82be..a1b3d18 100644
--- a/SwifTools/SConscript
+++ b/SwifTools/SConscript
@@ -14,10 +14,13 @@ sources = [
"Idle/IdleQuerier.cpp",
"Idle/PlatformIdleQuerier.cpp",
"AutoUpdater/AutoUpdater.cpp",
+ "AutoUpdater/PlatformAutoUpdaterFactory.cpp",
"Linkify.cpp",
]
if myenv.get("HAVE_SPARKLE", 0) :
+ myenv.MergeFlags(myenv["SPARKLE_FLAGS"])
+ myenv.Append(CPPDEFINES = ["HAVE_SPARKLE"])
sources += ["AutoUpdater/SparkleAutoUpdater.mm"]
if myenv["PLATFORM"] == "win32" :