Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into choose
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Nov 3, 2023
2 parents 275b399 + e42851c commit 960dd0e
Show file tree
Hide file tree
Showing 29 changed files with 98 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Commit CI
on:
push:
branches:
- '*'
- '!master'
tags:
- '![0-9]+.*'
pull_request:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
submodules: recursive

- name: Install dependency
run: ./action-install-linux.sh
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: Release CI

on:
push:
branches:
- master
tags:
- '[0-9]+.*'
workflow_dispatch:

jobs:
linux:
Expand All @@ -13,12 +16,12 @@ jobs:
uses: ./.github/workflows/macos-build.yml
with:
build_variant: '-universal'
rime_plugins: hchunhui/librime-lua lotem/librime-octagram
rime_plugins: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict

windows:
uses: ./.github/workflows/windows-build.yml
with:
rime_plugins: hchunhui/librime-lua lotem/librime-octagram
rime_plugins: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict

release:
needs: [macos, windows]
Expand All @@ -27,7 +30,19 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v3

- name: Create GitHub release
- name: Create Nightly release
if: ${{ github.ref == 'refs/heads/master' }}
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: "Nightly Build"
files: |
artifact/*
- name: Create Stable release
if: ${{ github.ref != 'refs/heads/master' }}
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
plugins/*/
build/
build-static/
debug/
Expand All @@ -14,3 +15,4 @@ node_modules/
.*.swp
.cache/
*.7z
*.bz2
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ COPY / /librime
WORKDIR /librime/plugins
RUN git clone https://github.com/rime/librime-charcode charcode && \
git clone https://github.com/hchunhui/librime-lua lua && \
git clone https://github.com/rime/librime-predict predict && \
git clone https://github.com/lotem/librime-octagram octagram

WORKDIR /librime
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ Community:

Plugins
===
- [librime-charcode](https://github.com/rime/librime-charcode) Module that
- [librime-charcode](https://github.com/rime/librime-charcode) (Deprecated) Module that
deals with character encoding; depends on boost::locale and ICU libraries
- [librime-legacy](https://github.com/rime/librime-legacy) Legacy module with
- [librime-legacy](https://github.com/rime/librime-legacy) (Deprecated) Legacy module with
GPL-licensed code
- [librime-lua](https://github.com/hchunhui/librime-lua) Lua scripting
- [librime-octagram](https://github.com/lotem/librime-octagram) Language model
- [librime-predict](https://github.com/rime/librime-predict) Predict next word
- [librime-proto](https://github.com/lotem/librime-proto) IPC using CapnProto

Related works
Expand Down
9 changes: 3 additions & 6 deletions action-install-linux.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
#!/bin/bash

dep_packages=(
doxygen
libboost-locale-dev
libboost-regex-dev
libgoogle-glog-dev
libleveldb-dev
libmarisa-dev
libyaml-cpp-dev
libopencc-dev
libgtest-dev
)

sudo apt update -y
sudo apt update
# fix a package dependency bug in Ubuntu 22.04
# https://bugs.launchpad.net/ubuntu/+source/google-glog/+bug/1991919
# https://github.com/kadalu-tech/pkgs/pull/2/files#r1001042597
sudo apt install -y libunwind-dev ninja-build ${dep_packages[@]}

make deps/gtest
make -C deps/opencc build
sudo env "PATH=$PATH" make -C deps/opencc install
5 changes: 3 additions & 2 deletions data/minimal/default.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Rime default settings
# vim: set sw=2 sts=2 et:
# encoding: utf-8

config_version: "0.15.minimal"
config_version: "0.16.minimal"

schema_list:
- schema: luna_pinyin
Expand Down Expand Up @@ -118,6 +117,8 @@ key_binder:
- { when: has_menu, accept: equal, send: Page_Down }
- { when: paging, accept: comma, send: Page_Up }
- { when: has_menu, accept: period, send: Page_Down }
- { when: predicting, accept: comma, send: comma }
- { when: predicting, accept: period, send: period }
# hotkey switch
- { when: always, accept: Control+Shift+1, select: .next }
- { when: always, accept: Control+Shift+2, toggle: ascii_mode }
Expand Down
2 changes: 0 additions & 2 deletions src/rime/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include <boost/optional.hpp>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/signals2/connection.hpp>
#include <boost/signals2/signal.hpp>
Expand All @@ -39,7 +38,6 @@

namespace rime {

using boost::optional;
using std::function;
using std::list;
using std::make_pair;
Expand Down
9 changes: 4 additions & 5 deletions src/rime/config/config_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
#include <cstdlib>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <rime/config/config_data.h>
#include <rime/config/config_types.h>

Expand Down Expand Up @@ -61,7 +60,7 @@ bool ConfigValue::GetInt(int* value) const {
}
// decimal
try {
*value = boost::lexical_cast<int>(value_);
*value = std::stoi(value_);
} catch (...) {
return false;
}
Expand All @@ -72,7 +71,7 @@ bool ConfigValue::GetDouble(double* value) const {
if (!value || value_.empty())
return false;
try {
*value = boost::lexical_cast<double>(value_);
*value = std::stod(value_);
} catch (...) {
return false;
}
Expand All @@ -92,12 +91,12 @@ bool ConfigValue::SetBool(bool value) {
}

bool ConfigValue::SetInt(int value) {
value_ = boost::lexical_cast<string>(value);
value_ = std::to_string(value);
return true;
}

bool ConfigValue::SetDouble(double value) {
value_ = boost::lexical_cast<string>(value);
value_ = std::to_string(value);
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/rime/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace rime {
class Candidate;
class KeyEvent;

class Context {
class RIME_API Context {
public:
using Notifier = signal<void(Context* ctx)>;
using OptionUpdateNotifier = signal<void(Context* ctx, const string& option)>;
Expand All @@ -28,11 +28,11 @@ class Context {
Context() = default;
~Context() = default;

RIME_API bool Commit();
bool Commit();
string GetCommitText() const;
string GetScriptText() const;
Preedit GetPreedit() const;
RIME_API bool IsComposing() const;
bool IsComposing() const;
bool HasMenu() const;
an<Candidate> GetSelectedCandidate() const;

Expand Down
4 changes: 2 additions & 2 deletions src/rime/deployer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <future>
#include <mutex>
#include <queue>
#include <boost/any.hpp>
#include <any>
#include <rime/common.h>
#include <rime/component.h>
#include <rime/messenger.h>
Expand All @@ -19,7 +19,7 @@ namespace rime {

class Deployer;

using TaskInitializer = boost::any;
using TaskInitializer = std::any;

class DeploymentTask : public Class<DeploymentTask, TaskInitializer> {
public:
Expand Down
1 change: 0 additions & 1 deletion src/rime/dict/entry_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <fstream>
#include <utility>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <rime/algo/strings.h>
#include <rime/dict/dict_settings.h>
#include <rime/dict/entry_collector.h>
Expand Down
8 changes: 4 additions & 4 deletions src/rime/dict/mapped_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ struct List {

class MappedFileImpl;

class MappedFile : boost::noncopyable {
class RIME_API MappedFile : boost::noncopyable {
protected:
explicit MappedFile(const string& file_name);
RIME_API virtual ~MappedFile();
virtual ~MappedFile();

bool Create(size_t capacity);
bool OpenReadOnly();
Expand All @@ -108,8 +108,8 @@ class MappedFile : boost::noncopyable {
public:
bool Exists() const;
bool IsOpen() const;
RIME_API void Close();
RIME_API bool Remove();
void Close();
bool Remove();

template <class T>
T* Find(size_t offset);
Expand Down
5 changes: 2 additions & 3 deletions src/rime/dict/preset_vocabulary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// 2011-11-27 GONG Chen <[email protected]>
//
#include <filesystem>
#include <boost/lexical_cast.hpp>
#include <utf8.h>
#include <rime/resource.h>
#include <rime/service.h>
Expand Down Expand Up @@ -74,7 +73,7 @@ bool PresetVocabulary::GetWeightForEntry(const string& key, double* weight) {
if (!db_ || !db_->Fetch(key, &weight_str))
return false;
try {
*weight = boost::lexical_cast<double>(weight_str);
*weight = std::stod(weight_str);
} catch (...) {
return false;
}
Expand Down Expand Up @@ -105,7 +104,7 @@ bool PresetVocabulary::IsQualifiedPhrase(const string& phrase,
return false;
}
if (min_phrase_weight_ > 0.0) {
double weight = boost::lexical_cast<double>(weight_str);
double weight = std::stod(weight_str);
if (weight < min_phrase_weight_)
return false;
}
Expand Down
1 change: 0 additions & 1 deletion src/rime/dict/reverse_lookup_dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <sstream>
#include <boost/algorithm/string.hpp>
#include <filesystem>
#include <boost/lexical_cast.hpp>
#include <rime/resource.h>
#include <rime/schema.h>
#include <rime/service.h>
Expand Down
5 changes: 3 additions & 2 deletions src/rime/dict/string_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <utility>
#include <marisa.h>
#include <rime_api.h>
#include <rime/common.h>

namespace rime {
Expand All @@ -18,7 +19,7 @@ using StringId = marisa::UInt32;

const StringId kInvalidStringId = (StringId)(-1);

class StringTable {
class RIME_API StringTable {
public:
StringTable() = default;
virtual ~StringTable() = default;
Expand All @@ -37,7 +38,7 @@ class StringTable {
marisa::Trie trie_;
};

class StringTableBuilder : public StringTable {
class RIME_API StringTableBuilder : public StringTable {
public:
void Add(const string& key,
double weight = 1.0,
Expand Down
5 changes: 2 additions & 3 deletions src/rime/dict/table_db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// 2013-04-18 GONG Chen <[email protected]>
//
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <rime/dict/table_db.h>
#include <rime/dict/user_db.h>

Expand All @@ -28,7 +27,7 @@ static bool rime_table_entry_parser(const Tsv& row,
UserDbValue v;
if (row.size() >= 3 && !row[2].empty()) {
try {
v.commits = boost::lexical_cast<int>(row[2]);
v.commits = std::stoi(row[2]);
const double kS = 1e8;
v.dee = (v.commits + 1) / kS;
} catch (...) {
Expand All @@ -51,7 +50,7 @@ static bool rime_table_entry_formatter(const string& key,
return false;
boost::algorithm::trim(row[0]); // remove trailing space
row[0].swap(row[1]);
row.push_back(boost::lexical_cast<string>(v.commits));
row.push_back(std::to_string(v.commits));
return true;
}

Expand Down
Loading

0 comments on commit 960dd0e

Please sign in to comment.