Skip to content

Commit

Permalink
Submodule rename to Odin repo (#6)
Browse files Browse the repository at this point in the history
* Rename deskflow to odin

* Update subproject commit reference

* Update all odin paths

* Consolidate odin dir const

* Introduce config file

* Fixed Odin dir in setup

* Update paths for Odin in CI workflow
  • Loading branch information
nbolton authored Oct 23, 2024
1 parent 9b1faed commit 38e54ae
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 39 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
uses: actions/cache@v4
with:
path: |
deskflow/vcpkg
deskflow/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('deskflow/vcpkg.json', 'deskflow/vcpkg-configuration.json') }}
odin/vcpkg
odin/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('odin/vcpkg.json', 'odin/vcpkg-configuration.json') }}

- name: Cache deps dir
uses: actions/cache@v4
with:
path: deskflow/deps
path: odin/deps
key: ${{ runner.os }}-deps-${{ hashFiles('config.yaml') }}

# This effectively runs `vcvarsall.bat`, etc. It's not actually installing
Expand All @@ -90,7 +90,7 @@ jobs:
run: python ./scripts/setup.py

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=windows-release
Expand All @@ -99,11 +99,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: ${{ matrix.target.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down Expand Up @@ -161,14 +161,14 @@ jobs:
- name: Cache deps dir
uses: actions/cache@v4
with:
path: deskflow/deps
path: odin/deps
key: ${{ runner.os }}-deps-${{ hashFiles('config.yaml') }}

- name: Install dependencies
run: ./scripts/setup.py

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=macos-release
Expand All @@ -177,11 +177,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: ${{ matrix.target.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
- name: Get JSON file
id: get
run: |
json_file="./deskflow/.github/workflows/ci-linux.json"
json_file="./odin/.github/workflows/ci-linux.json"
json=$(cat $json_file)
echo "json=$(echo $json)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
DEBIAN_FRONTEND: noninteractive

- name: Get version
uses: ./deskflow/.github/actions/get-version
uses: ./odin/.github/actions/get-version

- name: Configure
run: cmake -B build --preset=linux-release ${{ matrix.distro.extra-cmake-args }}
Expand All @@ -263,11 +263,11 @@ jobs:
run: cmake --build build -j8

- name: Tests
uses: ./deskflow/.github/actions/run-tests
uses: ./odin/.github/actions/run-tests
timeout-minutes: 2
with:
job: linux-${{ matrix.distro.name }}
bin-dir: build/deskflow/bin
bin-dir: build/odin/bin

- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "synergy-deskflow"]
path = deskflow
url = [email protected]:symless/synergy-deskflow.git
[submodule "synergy-odin"]
path = odin
url = [email protected]:symless/synergy-odin.git
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ cmake_minimum_required(VERSION 3.8)

project(synergy C CXX)

include(cmake/Deskflow.cmake)
include(cmake/Odin.cmake)
include(cmake/Licensing.cmake)
include(cmake/Build.cmake)
include(cmake/Libraries.cmake)

configure_deskflow()
configure_odin()
configure_licensing()
configure_build()
configure_libs()

add_subdirectory(deskflow)
add_subdirectory(odin)
add_subdirectory(src)
5 changes: 3 additions & 2 deletions cmake/Deskflow.cmake → cmake/Odin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

macro(configure_deskflow)
# Synergy Odin is our fork of Deskflow.
macro(configure_odin)

set(DESKFLOW_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deskflow)
set(DESKFLOW_SOURCE_DIR ${CMAKE_SOURCE_DIR}/odin)

configure_meta()
configure_dist()
Expand Down
Submodule odin updated from 000000 to ebb92c
9 changes: 7 additions & 2 deletions scripts/lib/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys, os, subprocess, venv
import lib.config as config

VENV_DIR = ".venv"


def add_deskflow_path(script):
def add_odin_path(script):
path = os.path.abspath(os.path.join(os.path.dirname(script), f"../{config.ODIN_DIR}/scripts"))
if not os.path.exists(path):
raise RuntimeError(f"Path does not exist: {path}")

sys.path.insert(
0,
os.path.abspath(os.path.join(os.path.dirname(script), "../deskflow/scripts")),
os.path.abspath(path),
)


Expand Down
19 changes: 19 additions & 0 deletions scripts/lib/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

# Synergy -- mouse and keyboard sharing utility
# Copyright (C) 2024 Symless Ltd.
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file LICENSE that should have accompanied this file.
#
# This package 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 this program. If not, see <http://www.gnu.org/licenses/>.

ODIN_DIR = "odin"

12 changes: 6 additions & 6 deletions scripts/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import os, argparse
import lib.bootstrap as bootstrap
import lib.config as config

APP_NAME = "Synergy"
DESKFLOW_SOURCE_DIR = "deskflow"
DESKFLOW_BUILD_DIR = "build/deskflow"
ODIN_BUILD_DIR = f"build/{config.ODIN_DIR}"
VERSION_FILENAME = f"{config.ODIN_DIR}/VERSION"
DEFAULT_PREFIX = "synergy"
DIST_DIR = "dist"
VERSION_FILENAME = "deskflow/VERSION"
TEST_CMD = "synergy-server --version"
PACKAGE_NAME = "synergy"

Expand All @@ -38,7 +38,7 @@ def main():
args = parser.parse_args()

bootstrap.ensure_in_venv(__file__)
bootstrap.add_deskflow_path(__file__)
bootstrap.add_odin_path(__file__)

import package

Expand All @@ -51,12 +51,12 @@ def main():
package.package(
filename_base,
version,
DESKFLOW_BUILD_DIR,
ODIN_BUILD_DIR,
DIST_DIR,
TEST_CMD,
APP_NAME,
PACKAGE_NAME,
source_dir=DESKFLOW_SOURCE_DIR,
source_dir=config.ODIN_DIR,
leave_test_installed=args.leave_test_installed,
)

Expand Down
12 changes: 4 additions & 8 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import sys
import os
import lib.bootstrap as bootstrap

DESKFLOW_DIR = "deskflow"

import lib.config as config

def main():
bootstrap.ensure_in_venv(__file__)
Expand All @@ -41,20 +39,18 @@ def setup_deskflow():
"submodule",
"update",
"--init",
"--recursive",
"--remote",
"--merge",
"--recursive"
]
)

# HACK: This proves why we should not be using Meson, and should only use CMake.
args = sys.argv[1:]
if "--build-dir" not in args:
args += ["--build-dir", "../build/deskflow"]
args += ["--build-dir", f"../build/{config.ODIN_DIR}"]

current_dir = os.getcwd()
try:
os.chdir(DESKFLOW_DIR)
os.chdir(config.ODIN_DIR)
subprocess.run([sys.executable, "scripts/install_deps.py"] + sys.argv[1:])
finally:
os.chdir(current_dir)
Expand Down

0 comments on commit 38e54ae

Please sign in to comment.