mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
GODT-1675: Pass app name and vendor from topmost Makefile.
This commit is contained in:
9
Makefile
9
Makefile
@ -13,6 +13,8 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
# Keep version hardcoded so app build works also without Git repository.
|
||||
BRIDGE_APP_VERSION?=2.3.0+git
|
||||
APP_VERSION:=${BRIDGE_APP_VERSION}
|
||||
APP_FULL_NAME:=Proton Bridge
|
||||
APP_VENDOR:=Proton AG
|
||||
SRC_ICO:=bridge.ico
|
||||
SRC_ICNS:=Bridge.icns
|
||||
SRC_SVG:=bridge.svg
|
||||
@ -23,7 +25,8 @@ BUILD_TIME:=$(shell date +%FT%T%z)
|
||||
BUILD_FLAGS:=-tags='${BUILD_TAGS}'
|
||||
BUILD_FLAGS_LAUNCHER:=${BUILD_FLAGS}
|
||||
BUILD_FLAGS_GUI:=-tags='${BUILD_TAGS} build_qt'
|
||||
GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/v2/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME})
|
||||
GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/v2/internal/constants., Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME})
|
||||
GO_LDFLAGS+=-X "github.com/ProtonMail/proton-bridge/v2/internal/constants.FullAppName=${APP_FULL_NAME}"
|
||||
ifneq "${BUILD_LDFLAGS}" ""
|
||||
GO_LDFLAGS+=${BUILD_LDFLAGS}
|
||||
endif
|
||||
@ -33,7 +36,7 @@ ifeq "${TARGET_OS}" "windows"
|
||||
endif
|
||||
|
||||
BUILD_FLAGS+=-ldflags '${GO_LDFLAGS}'
|
||||
BUILD_FLAGS_GUI+=-ldflags '${GO_LDFLAGS}'
|
||||
BUILD_FLAGS_GUI+=-ldflags "${GO_LDFLAGS}"
|
||||
BUILD_FLAGS_LAUNCHER+=-ldflags '${GO_LDFLAGS_LAUNCHER}'
|
||||
|
||||
DEPLOY_DIR:=cmd/${TARGET_CMD}/deploy
|
||||
@ -128,6 +131,8 @@ ${DEPLOY_DIR}/windows: ${EXE_TARGET} build-launcher
|
||||
${EXE_TARGET}: check-build-essentials ${EXE_NAME}
|
||||
# TODO: resource.syso for windows
|
||||
cd internal/frontend/bridge-gui/bridge-gui && \
|
||||
BRIDGE_APP_FULL_NAME="${APP_FULL_NAME}" \
|
||||
BRIDGE_VENDOR="${APP_VENDOR}" \
|
||||
BRIDGE_APP_VERSION=${APP_VERSION} \
|
||||
BRIDGE_REVISION=${REVISION} \
|
||||
BRIDGE_BUILD_TIME=${BUILD_TIME} \
|
||||
|
||||
@ -39,11 +39,11 @@ import (
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/app/base"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/app/bridge"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
appName = "Proton Mail Bridge"
|
||||
appUsage = "Proton Mail IMAP and SMTP Bridge"
|
||||
configName = "bridge"
|
||||
updateURLName = "bridge"
|
||||
@ -53,7 +53,7 @@ const (
|
||||
|
||||
func main() {
|
||||
base, err := base.New(
|
||||
appName,
|
||||
constants.FullAppName,
|
||||
appUsage,
|
||||
configName,
|
||||
updateURLName,
|
||||
|
||||
@ -24,6 +24,9 @@ const VendorName = "protonmail"
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
// Version of the build.
|
||||
FullAppName = ""
|
||||
|
||||
// Version of the build.
|
||||
Version = ""
|
||||
|
||||
|
||||
@ -28,6 +28,20 @@ include(../BridgeSetup.cmake)
|
||||
|
||||
project(bridge-gui LANGUAGES CXX)
|
||||
|
||||
if (NOT DEFINED BRIDGE_APP_FULL_NAME)
|
||||
message(FATAL_ERROR "BRIDGE_APP_FULL_NAME is not defined.")
|
||||
else()
|
||||
message(STATUS "App name is ${BRIDGE_APP_FULL_NAME}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED BRIDGE_VENDOR)
|
||||
message(FATAL_ERROR "BRIDGE_VENDOR is not defined.")
|
||||
else()
|
||||
message(STATUS "App vendor is ${BRIDGE_VENDOR}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if (NOT DEFINED BRIDGE_APP_VERSION)
|
||||
message(FATAL_ERROR "BRIDGE_APP_VERSION is not defined.")
|
||||
else()
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
|
||||
#include "DockIcon/DockIcon.h"
|
||||
#include "Version.h"
|
||||
#include "UserList.h"
|
||||
#include <bridgepp/GRPC/GRPCClient.h>
|
||||
#include <bridgepp/GRPC/GRPCUtils.h>
|
||||
@ -57,6 +58,8 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
Q_PROPERTY(QUrl releaseNotesLink READ releaseNotesLink NOTIFY releaseNotesLinkChanged) // _ core.QUrl `property:"releaseNotesLink"`
|
||||
Q_PROPERTY(QUrl dependencyLicensesLink READ dependencyLicensesLink NOTIFY dependencyLicensesLinkChanged) // _ core.QUrl `property:"dependencyLicensesLink"`
|
||||
Q_PROPERTY(QUrl landingPageLink READ landingPageLink NOTIFY landingPageLinkChanged) // _ core.QUrl `property:"landingPageLink"`
|
||||
Q_PROPERTY(QString appname READ appname NOTIFY appnameChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString vendor READ vendor NOTIFY vendorChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString version READ version NOTIFY versionChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString hostname READ hostname NOTIFY hostnameChanged) // _ string `property:"hostname"`
|
||||
Q_PROPERTY(bool isAutostartOn READ isAutostartOn NOTIFY isAutostartOnChanged) // _ bool `property:"isAutostartOn"`
|
||||
@ -86,6 +89,8 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
QUrl releaseNotesLink() const { QUrl link; app().grpc().releaseNotesPageLink(link); return link; }
|
||||
QUrl dependencyLicensesLink() const { QUrl link; app().grpc().dependencyLicensesLink(link); return link; }
|
||||
QUrl landingPageLink() const { QUrl link; app().grpc().landingPageLink(link); return link; }
|
||||
QString appname() const { return QString(PROJECT_FULL_NAME); }
|
||||
QString vendor() const { return QString(PROJECT_VENDOR); }
|
||||
QString version() const { QString version; app().grpc().version(version); return version; }
|
||||
QString hostname() const { QString hostname; app().grpc().hostname(hostname); return hostname; }
|
||||
bool isAutostartOn() const { bool v; app().grpc().isAutostartOn(v); return v; };
|
||||
@ -121,6 +126,8 @@ signals: // Signal used by the Qt property system. Many of them are unused but r
|
||||
void releaseNotesLinkChanged(QUrl const &link);
|
||||
void dependencyLicensesLinkChanged(QUrl const &link);
|
||||
void landingPageLinkChanged(QUrl const &link);
|
||||
void appnameChanged(QString const &appname);
|
||||
void vendorChanged(QString const &vendor);
|
||||
void versionChanged(QString const &version);
|
||||
void currentEmailClientChanged(QString const &email);
|
||||
void currentKeychainChanged(QString const &keychain);
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#ifndef BRIDGE_GUI_VERSION_H
|
||||
#define BRIDGE_GUI_VERSION_H
|
||||
|
||||
#define PROJECT_FULL_NAME "@BRIDGE_APP_FULL_NAME@"
|
||||
#define PROJECT_VENDOR "@BRIDGE_VENDOR@"
|
||||
#define PROJECT_VER "@BRIDGE_APP_VERSION@"
|
||||
#define PROJECT_REVISION "@BRIDGE_REVISION@"
|
||||
#define PROJECT_BUILD_TIME "@BRIDGE_BUILD_TIME@"
|
||||
|
||||
@ -25,22 +25,23 @@ fi
|
||||
BRIDGE_REPO_ROOT="../../../.."
|
||||
BRIDGE_INSTALL_PATH=${BRIDGE_INSTALL_PATH:-deploy}
|
||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-$("${BRIDGE_REPO_ROOT}/utils/bridge_app_version.sh")}
|
||||
BRIDGE_VENDOR=${BRIDGE_VENDOR:-"Proton AG"}
|
||||
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
realpath() {
|
||||
START_DIR=$PWD
|
||||
BASENAME="$(basename "$1")"
|
||||
cd "$(dirname "$1")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
while [ "$LNK" ]; do
|
||||
BASENAME="$(basename "$LNK")"
|
||||
cd "$(dirname "$LNK")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
done
|
||||
REALPATH="$PWD/$BASENAME"
|
||||
cd "$START_DIR" || exit
|
||||
echo "$REALPATH"
|
||||
START_DIR=$PWD
|
||||
BASENAME="$(basename "$1")"
|
||||
cd "$(dirname "$1")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
while [ "$LNK" ]; do
|
||||
BASENAME="$(basename "$LNK")"
|
||||
cd "$(dirname "$LNK")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
done
|
||||
REALPATH="$PWD/$BASENAME"
|
||||
cd "$START_DIR" || exit
|
||||
echo "$REALPATH"
|
||||
}
|
||||
|
||||
check_exit() {
|
||||
@ -86,6 +87,8 @@ ${VCPKG_EXE} upgrade --no-dry-run
|
||||
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
|
||||
-DBRIDGE_APP_FULL_NAME="${BRIDGE_APP_FULL_NAME}" \
|
||||
-DBRIDGE_VENDOR="${BRIDGE_VENDOR}" \
|
||||
-DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" \
|
||||
-G Ninja \
|
||||
-S . \
|
||||
|
||||
@ -30,7 +30,7 @@ using namespace bridgepp;
|
||||
namespace
|
||||
{
|
||||
|
||||
/// \brief The file extension for the bridge executable file.
|
||||
/// \brief The file extension for the bridge executable file.
|
||||
#ifdef Q_OS_WIN32
|
||||
QString const exeSuffix = ".exe";
|
||||
#else
|
||||
@ -62,12 +62,12 @@ void initQtApplication()
|
||||
if ((!qsgInfo.isEmpty()) && (qsgInfo != "0"))
|
||||
QLoggingCategory::setFilterRules("qt.scenegraph.general=true");
|
||||
|
||||
QGuiApplication::setApplicationName("Proton Mail Bridge");
|
||||
QGuiApplication::setApplicationName(PROJECT_FULL_NAME);
|
||||
QGuiApplication::setApplicationVersion(PROJECT_VER);
|
||||
QGuiApplication::setOrganizationName("Proton AG");
|
||||
QGuiApplication::setOrganizationName(PROJECT_VENDOR);
|
||||
QGuiApplication::setOrganizationDomain("proton.ch");
|
||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
@ -147,7 +147,7 @@ void parseArguments(int argc, char *argv[], QStringList& args, QString& launcher
|
||||
launcher = QString::fromLocal8Bit(argv[0]);
|
||||
// for unknown reasons, on Windows QCoreApplication::arguments() frequently returns an empty list, which is incorrect, so we rebuild the argument
|
||||
// list from the original argc and argv values.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
QString const &arg = QString::fromLocal8Bit(argv[i]);
|
||||
// we can't use QCommandLineParser here since it will fail on unknown options.
|
||||
// Arguments may contain some bridge flags.
|
||||
@ -274,9 +274,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
app().log().debug(QString("Monitoring Bridge PID : %1").arg(status.pid));
|
||||
connection = QObject::connect(bridgeMonitor, &ProcessMonitor::processExited, [&](int returnCode) {
|
||||
bridgeExited = true;// clazy:exclude=lambda-in-connect
|
||||
qGuiApp->exit(returnCode);
|
||||
});
|
||||
bridgeExited = true;// clazy:exclude=lambda-in-connect
|
||||
qGuiApp->exit(returnCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ QtObject {
|
||||
return Math.max(lower_limit, Math.min(upper_limit, num))
|
||||
}
|
||||
|
||||
property var title: "Proton Mail Bridge"
|
||||
property var title: Backend.appname
|
||||
|
||||
property Notifications _notifications: Notifications {
|
||||
id: notifications
|
||||
|
||||
@ -108,8 +108,10 @@ SettingsView {
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
text: qsTr("Proton Mail Bridge v%1<br>© 2021 Proton AG<br>%2 %3<br>%4").
|
||||
text: qsTr("%1 v%2<br>© 2021 %3<br>%4 %5<br>%6").
|
||||
arg(Backend.appname).
|
||||
arg(Backend.version).
|
||||
arg(Backend.vendor).
|
||||
arg(link(Backend.licensePath, qsTr("License"))).
|
||||
arg(link(Backend.dependencyLicensesLink, qsTr("Dependencies"))).
|
||||
arg(link(Backend.releaseNotesLink, qsTr("Release notes")))
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||
@ -319,8 +320,8 @@ func (f *frontendCLI) watchEvents() {
|
||||
|
||||
// Loop starts the frontend loop with an interactive shell.
|
||||
func (f *frontendCLI) Loop() error {
|
||||
f.Print(`
|
||||
Welcome to Proton Mail Bridge interactive shell
|
||||
f.Printf(`
|
||||
Welcome to %s interactive shell
|
||||
___....___
|
||||
^^ __..-:'':__:..:__:'':-..__
|
||||
_.-:__:.-:'': : : :'':-.:__:-._
|
||||
@ -335,7 +336,7 @@ func (f *frontendCLI) Loop() error {
|
||||
[ ] [ ]
|
||||
jgs [ ] [ ]
|
||||
~~^_~^~/ \~^-~^~ _~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/ \~^ ~~_ ^
|
||||
`)
|
||||
`, constants.FullAppName)
|
||||
f.Run()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1,2 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2022 Proton AG
|
||||
#
|
||||
# This file is part of Proton Mail Bridge.
|
||||
#
|
||||
# Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
sed -n "s/BRIDGE_APP_VERSION?=\(\S*\)/\1/p" "$(dirname $0)/../Makefile"
|
||||
|
||||
Reference in New Issue
Block a user