mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe710715aa | ||
|
|
d7061cc18c | ||
|
|
e935d9adde | ||
|
|
d0913d07d3 | ||
|
|
6b51c170c1 | ||
|
|
a4213dd4c6 | ||
|
|
9ebabacc32 | ||
|
|
70983cb2e7 | ||
|
|
d61079e1f6 | ||
|
|
76e8c56235 | ||
|
|
10db7fe1a5 | ||
|
|
8afb96c229 | ||
|
|
66539d7f1f | ||
|
|
5f7c5eb1a2 | ||
|
|
886dadfedb | ||
|
|
66daf5054b | ||
|
|
9aec5a70a8 | ||
|
|
42aef59f9e | ||
|
|
7d1fdce8b5 | ||
|
|
45508c3d99 | ||
|
|
5cb43da0e5 | ||
|
|
858662e225 | ||
|
|
a30dd8399b | ||
|
|
3e4b31aebb | ||
|
|
e3401732c1 | ||
|
|
6284f7869f | ||
|
|
95fa410e45 |
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# We'll use defaults from the LLVM style, but with 4 columns indentation.
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
# Force pointers to the type for C++.
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
AlignConsecutiveAssignments: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AccessModifierOffset: -4
|
||||
AlignTrailingComments: true
|
||||
SpacesBeforeTrailingComments: 2
|
||||
NamespaceIndentation: All
|
||||
MaxEmptyLinesToKeep: 1
|
||||
BreakBeforeBraces: Stroustrup
|
||||
ColumnLimit: 88
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"pch.h"$'
|
||||
Priority: -1
|
||||
SortPriority: -1
|
||||
@@ -0,0 +1 @@
|
||||
d0913d07d33929d7b753a3a09a0dac70e5befbc1
|
||||
@@ -0,0 +1,7 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.cpp text eol=crlf
|
||||
*.h text eol=crlf
|
||||
@@ -0,0 +1,16 @@
|
||||
name: Build Mob
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build Mob
|
||||
shell: pwsh
|
||||
run: ./bootstrap.ps1 -Verbose
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Lint Mob
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run clang-format
|
||||
uses: jidicula/clang-format-action@v4.11.0
|
||||
with:
|
||||
clang-format-version: "16"
|
||||
check-path: "."
|
||||
exclude-regex: "third-party"
|
||||
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(mob)
|
||||
add_subdirectory(src)
|
||||
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mob)
|
||||
+14
-5
@@ -1,8 +1,14 @@
|
||||
param([switch]$Verbose)
|
||||
|
||||
$root = $PSScriptRoot
|
||||
if (!$root) {
|
||||
$root = "."
|
||||
$root = "."
|
||||
}
|
||||
|
||||
$output = if ($Verbose) { "Out-Default" } else { "Out-Null" }
|
||||
|
||||
cmake -B $root/build $root | & $output
|
||||
|
||||
$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath
|
||||
if (! $?) {
|
||||
Write-Error "vswhere returned $LastExitCode"
|
||||
@@ -15,13 +21,16 @@ if (! $installationPath) {
|
||||
}
|
||||
|
||||
$opts = ""
|
||||
$opts += " $root\vs\mob.sln"
|
||||
$opts += " $root\build\mob.sln"
|
||||
$opts += " -m"
|
||||
$opts += " -p:Configuration=Release"
|
||||
$opts += " -noLogo"
|
||||
$opts += " -p:UseMultiToolTask=true"
|
||||
$opts += " -p:EnforceProcessCountAcrossBuilds=true"
|
||||
$opts += " -clp:ErrorsOnly;Verbosity=minimal"
|
||||
|
||||
if (!$Verbose) {
|
||||
$opts += " -clp:ErrorsOnly;Verbosity=minimal"
|
||||
}
|
||||
|
||||
$vsDevCmd = "$installationPath\Common7\Tools\VsDevCmd.bat"
|
||||
if (!(Test-Path "$vsDevCmd")) {
|
||||
@@ -36,5 +45,5 @@ if (! $?) {
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
Copy-Item "$root\build\Release\x64\mob.exe" "$root\mob.exe"
|
||||
echo "run ``.\mob -d prefix/path build`` to start building"
|
||||
Copy-Item "$root\build\src\Release\mob.exe" "$root\mob.exe"
|
||||
Write-Output "run ``.\mob -d prefix/path build`` to start building"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Matthias Moeller 2016 m_moeller@live.de
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+170
-118
@@ -1,125 +1,177 @@
|
||||
|
||||
LICENSE ISSUES
|
||||
==============
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
https://www.apache.org/licenses/
|
||||
|
||||
The OpenSSL toolkit stays under a double license, i.e. both the conditions of
|
||||
the OpenSSL License and the original SSLeay license apply to the toolkit.
|
||||
See below for the actual license texts.
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
OpenSSL License
|
||||
---------------
|
||||
1. Definitions.
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
Original SSLeay License
|
||||
-----------------------
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
@@ -97,25 +97,25 @@ vs_year = 2022
|
||||
vs_toolset = 14.3
|
||||
sdk = 10.0.22621.0
|
||||
sevenz = 23.01
|
||||
boost = 1.82.0
|
||||
boost = 1.83.0
|
||||
boost_vs = 14.3
|
||||
fmt = 8.1.1
|
||||
gtest = main
|
||||
libloot = 0.19.4
|
||||
libloot = 0.21.0
|
||||
lz4 = v1.9.4
|
||||
nmm = 0.71.2
|
||||
openssl = 1.1.1u
|
||||
pyqt = 6.5.1
|
||||
pyqt_builder = 1.15.1
|
||||
pyqt_sip = 13.5.1
|
||||
python = v3.10.12
|
||||
openssl = 3.1.2
|
||||
pyqt = 6.5.3.dev2309101249
|
||||
pyqt_builder = 1.15.2
|
||||
pyqt_sip = 13.5.2
|
||||
python = v3.11.5
|
||||
pybind11 = v2.10.4
|
||||
bzip2 = 1.0.8
|
||||
sip = 6.7.1
|
||||
sip = 6.7.11
|
||||
spdlog = v1.10.0
|
||||
qt = 6.5.1
|
||||
qt = 6.5.0
|
||||
qt_vs = 2019
|
||||
zlib = v1.2.13
|
||||
zlib = v1.3
|
||||
libbsarch = 0.0.9
|
||||
usvfs = qt6
|
||||
explorerpp = 1.3.5
|
||||
@@ -126,8 +126,8 @@ ss_paper_mono_6788 = 2.2
|
||||
ss_dark_mode_1809_6788 = 3.0
|
||||
ss_morrowind_trosski = 1.1
|
||||
ss_skyrim_trosski = v1.1
|
||||
ss_fallout3_trosski = v1.1
|
||||
ss_fallout4_trosski = v1.1
|
||||
ss_fallout3_trosski = v1.11
|
||||
ss_fallout4_trosski = v1.11
|
||||
|
||||
[paths]
|
||||
third_party =
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
file(GLOB_RECURSE source_files *.cpp)
|
||||
file(GLOB_RECURSE header_files *.h)
|
||||
|
||||
add_executable(mob ${source_files} ${header_files})
|
||||
set_target_properties(mob PROPERTIES CXX_STANDARD 20)
|
||||
|
||||
target_compile_definitions(mob PUBLIC NOMINMAX)
|
||||
target_compile_options(mob PUBLIC "/MT")
|
||||
target_include_directories(mob PUBLIC ${CMAKE_SOURCE_DIR}/third-party/include)
|
||||
target_link_libraries(mob PUBLIC
|
||||
wsock32 ws2_32 crypt32 wldap32 dbghelp shlwapi version
|
||||
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl.lib
|
||||
debug ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl-d.lib
|
||||
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/zlib.lib
|
||||
debug ${CMAKE_SOURCE_DIR}/third-party/lib/zlibd.lib)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PREFIX src
|
||||
FILES ${source_files} ${header_files})
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mob)
|
||||
+150
-155
@@ -1,200 +1,195 @@
|
||||
#include "pch.h"
|
||||
#include "commands.h"
|
||||
#include "../core/ini.h"
|
||||
#include "../core/conf.h"
|
||||
#include "../core/context.h"
|
||||
#include "../core/ini.h"
|
||||
#include "../core/op.h"
|
||||
#include "../tasks/task_manager.h"
|
||||
#include "commands.h"
|
||||
|
||||
namespace mob
|
||||
{
|
||||
namespace mob {
|
||||
|
||||
build_command::build_command()
|
||||
: command(requires_options | handle_sigint)
|
||||
{
|
||||
}
|
||||
build_command::build_command() : command(requires_options | handle_sigint) {}
|
||||
|
||||
command::meta_t build_command::meta() const
|
||||
{
|
||||
return
|
||||
{
|
||||
"build",
|
||||
"builds tasks"
|
||||
};
|
||||
}
|
||||
command::meta_t build_command::meta() const
|
||||
{
|
||||
return {"build", "builds tasks"};
|
||||
}
|
||||
|
||||
clipp::group build_command::do_group()
|
||||
{
|
||||
return
|
||||
(clipp::command("build")).set(picked_),
|
||||
clipp::group build_command::do_group()
|
||||
{
|
||||
return (clipp::command("build")).set(picked_),
|
||||
|
||||
(clipp::option("-h", "--help") >> help_)
|
||||
% ("shows this message"),
|
||||
(clipp::option("-h", "--help") >> help_) % ("shows this message"),
|
||||
|
||||
(clipp::option("-g", "--redownload") >> redownload_)
|
||||
% "redownloads archives, see --reextract",
|
||||
(clipp::option("-g", "--redownload") >> redownload_) %
|
||||
"redownloads archives, see --reextract",
|
||||
|
||||
(clipp::option("-e", "--reextract") >> reextract_)
|
||||
% "deletes source directories and re-extracts archives",
|
||||
(clipp::option("-e", "--reextract") >> reextract_) %
|
||||
"deletes source directories and re-extracts archives",
|
||||
|
||||
(clipp::option("-c", "--reconfigure") >> reconfigure_)
|
||||
% "reconfigures the task by running cmake, configure scripts, "
|
||||
"etc.; some tasks might have to delete the whole source "
|
||||
"directory",
|
||||
(clipp::option("-c", "--reconfigure") >> reconfigure_) %
|
||||
"reconfigures the task by running cmake, configure scripts, "
|
||||
"etc.; some tasks might have to delete the whole source "
|
||||
"directory",
|
||||
|
||||
(clipp::option("-b", "--rebuild") >> rebuild_)
|
||||
% "cleans and rebuilds projects; some tasks might have to "
|
||||
"delete the whole source directory",
|
||||
(clipp::option("-b", "--rebuild") >> rebuild_) %
|
||||
"cleans and rebuilds projects; some tasks might have to "
|
||||
"delete the whole source directory",
|
||||
|
||||
(clipp::option("-n", "--new") >> new_)
|
||||
% "deletes everything and starts from scratch",
|
||||
(clipp::option("-n", "--new") >> new_) %
|
||||
"deletes everything and starts from scratch",
|
||||
|
||||
(
|
||||
clipp::option("--clean-task").call([&]{ clean_ = true; }) |
|
||||
clipp::option("--no-clean-task").call([&]{ clean_ = false; })
|
||||
) % "sets whether tasks are cleaned",
|
||||
(clipp::option("--clean-task").call([&] {
|
||||
clean_ = true;
|
||||
}) |
|
||||
clipp::option("--no-clean-task").call([&] {
|
||||
clean_ = false;
|
||||
})) %
|
||||
"sets whether tasks are cleaned",
|
||||
|
||||
(
|
||||
clipp::option("--fetch-task").call([&]{ fetch_ = true; }) |
|
||||
clipp::option("--no-fetch-task").call([&]{ fetch_ = false; })
|
||||
) % "sets whether tasks are fetched",
|
||||
(clipp::option("--fetch-task").call([&] {
|
||||
fetch_ = true;
|
||||
}) |
|
||||
clipp::option("--no-fetch-task").call([&] {
|
||||
fetch_ = false;
|
||||
})) %
|
||||
"sets whether tasks are fetched",
|
||||
|
||||
(
|
||||
clipp::option("--build-task").call([&]{ build_ = true; }) |
|
||||
clipp::option("--no-build-task").call([&]{ build_ = false; })
|
||||
) % "sets whether tasks are built",
|
||||
(clipp::option("--build-task").call([&] {
|
||||
build_ = true;
|
||||
}) |
|
||||
clipp::option("--no-build-task").call([&] {
|
||||
build_ = false;
|
||||
})) %
|
||||
"sets whether tasks are built",
|
||||
|
||||
(
|
||||
clipp::option("--pull").call([&]{ nopull_ = false; }) |
|
||||
clipp::option("--no-pull").call([&]{ nopull_ = true; })
|
||||
) % "whether to pull repos that are already cloned; global override",
|
||||
(clipp::option("--pull").call([&] {
|
||||
nopull_ = false;
|
||||
}) |
|
||||
clipp::option("--no-pull").call([&] {
|
||||
nopull_ = true;
|
||||
})) %
|
||||
"whether to pull repos that are already cloned; global override",
|
||||
|
||||
(
|
||||
clipp::option("--revert-ts").call([&]{ revert_ts_ = true; }) |
|
||||
clipp::option("--no-revert-ts").call([&]{ revert_ts_ = false; })
|
||||
) % "whether to revert all the .ts files in a repo before pulling to "
|
||||
"avoid merge errors; global override",
|
||||
(clipp::option("--revert-ts").call([&] {
|
||||
revert_ts_ = true;
|
||||
}) |
|
||||
clipp::option("--no-revert-ts").call([&] {
|
||||
revert_ts_ = false;
|
||||
})) %
|
||||
"whether to revert all the .ts files in a repo before pulling to "
|
||||
"avoid merge errors; global override",
|
||||
|
||||
(clipp::option("--ignore-uncommitted-changes") >> ignore_uncommitted_)
|
||||
% "when --reextract is given, directories controlled by git will "
|
||||
"be deleted even if they contain uncommitted changes",
|
||||
(clipp::option("--ignore-uncommitted-changes") >> ignore_uncommitted_) %
|
||||
"when --reextract is given, directories controlled by git will "
|
||||
"be deleted even if they contain uncommitted changes",
|
||||
|
||||
(clipp::option("--keep-msbuild") >> keep_msbuild_)
|
||||
% "don't terminate msbuild.exe instances after building",
|
||||
(clipp::option("--keep-msbuild") >> keep_msbuild_) %
|
||||
"don't terminate msbuild.exe instances after building",
|
||||
|
||||
(clipp::opt_values(
|
||||
clipp::match::prefix_not("-"), "task", tasks_))
|
||||
% "tasks to run; specify 'super' to only build modorganizer "
|
||||
"projects";
|
||||
}
|
||||
(clipp::opt_values(clipp::match::prefix_not("-"), "task", tasks_)) %
|
||||
"tasks to run; specify 'super' to only build modorganizer "
|
||||
"projects";
|
||||
}
|
||||
|
||||
void build_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
void build_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
|
||||
if (redownload_ || new_)
|
||||
common.options.push_back("global/redownload=true");
|
||||
if (redownload_ || new_)
|
||||
common.options.push_back("global/redownload=true");
|
||||
|
||||
if (reextract_ || new_)
|
||||
common.options.push_back("global/reextract=true");
|
||||
if (reextract_ || new_)
|
||||
common.options.push_back("global/reextract=true");
|
||||
|
||||
if (reconfigure_ || new_)
|
||||
common.options.push_back("global/reconfigure=true");
|
||||
if (reconfigure_ || new_)
|
||||
common.options.push_back("global/reconfigure=true");
|
||||
|
||||
if (rebuild_ || new_)
|
||||
common.options.push_back("global/rebuild=true");
|
||||
if (rebuild_ || new_)
|
||||
common.options.push_back("global/rebuild=true");
|
||||
|
||||
if (ignore_uncommitted_)
|
||||
common.options.push_back("global/ignore_uncommitted=true");
|
||||
if (ignore_uncommitted_)
|
||||
common.options.push_back("global/ignore_uncommitted=true");
|
||||
|
||||
if (clean_)
|
||||
{
|
||||
if (*clean_)
|
||||
common.options.push_back("global/clean_task=true");
|
||||
else
|
||||
common.options.push_back("global/clean_task=false");
|
||||
}
|
||||
if (clean_) {
|
||||
if (*clean_)
|
||||
common.options.push_back("global/clean_task=true");
|
||||
else
|
||||
common.options.push_back("global/clean_task=false");
|
||||
}
|
||||
|
||||
if (fetch_)
|
||||
{
|
||||
if (*fetch_)
|
||||
common.options.push_back("global/fetch_task=true");
|
||||
else
|
||||
common.options.push_back("global/fetch_task=false");
|
||||
}
|
||||
if (fetch_) {
|
||||
if (*fetch_)
|
||||
common.options.push_back("global/fetch_task=true");
|
||||
else
|
||||
common.options.push_back("global/fetch_task=false");
|
||||
}
|
||||
|
||||
if (build_)
|
||||
{
|
||||
if (*build_)
|
||||
common.options.push_back("global/build_task=true");
|
||||
else
|
||||
common.options.push_back("global/build_task=false");
|
||||
}
|
||||
if (build_) {
|
||||
if (*build_)
|
||||
common.options.push_back("global/build_task=true");
|
||||
else
|
||||
common.options.push_back("global/build_task=false");
|
||||
}
|
||||
|
||||
if (nopull_)
|
||||
{
|
||||
if (*nopull_)
|
||||
common.options.push_back("_override:task/no_pull=true");
|
||||
else
|
||||
common.options.push_back("_override:task/no_pull=false");
|
||||
}
|
||||
if (nopull_) {
|
||||
if (*nopull_)
|
||||
common.options.push_back("_override:task/no_pull=true");
|
||||
else
|
||||
common.options.push_back("_override:task/no_pull=false");
|
||||
}
|
||||
|
||||
if (revert_ts_)
|
||||
{
|
||||
if (*revert_ts_)
|
||||
common.options.push_back("_override:task/revert_ts=true");
|
||||
else
|
||||
common.options.push_back("_override:task/revert_ts=false");
|
||||
}
|
||||
if (revert_ts_) {
|
||||
if (*revert_ts_)
|
||||
common.options.push_back("_override:task/revert_ts=true");
|
||||
else
|
||||
common.options.push_back("_override:task/revert_ts=false");
|
||||
}
|
||||
|
||||
if (!tasks_.empty())
|
||||
set_task_enabled_flags(tasks_);
|
||||
}
|
||||
if (!tasks_.empty())
|
||||
set_task_enabled_flags(tasks_);
|
||||
}
|
||||
|
||||
int build_command::do_run()
|
||||
{
|
||||
try
|
||||
{
|
||||
create_prefix_ini();
|
||||
int build_command::do_run()
|
||||
{
|
||||
try {
|
||||
create_prefix_ini();
|
||||
|
||||
task_manager::instance().run_all();
|
||||
task_manager::instance().run_all();
|
||||
|
||||
if (!keep_msbuild_)
|
||||
terminate_msbuild();
|
||||
if (!keep_msbuild_)
|
||||
terminate_msbuild();
|
||||
|
||||
mob::gcx().info(mob::context::generic, "mob done");
|
||||
return 0;
|
||||
}
|
||||
catch(bailed&)
|
||||
{
|
||||
gcx().error(context::generic, "bailing out");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
mob::gcx().info(mob::context::generic, "mob done");
|
||||
return 0;
|
||||
}
|
||||
catch (bailed&) {
|
||||
gcx().error(context::generic, "bailing out");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void build_command::create_prefix_ini()
|
||||
{
|
||||
const auto prefix = conf().path().prefix();
|
||||
void build_command::create_prefix_ini()
|
||||
{
|
||||
const auto prefix = conf().path().prefix();
|
||||
|
||||
// creating prefix
|
||||
if (!exists(prefix))
|
||||
op::create_directories(gcx(), prefix);
|
||||
// creating prefix
|
||||
if (!exists(prefix))
|
||||
op::create_directories(gcx(), prefix);
|
||||
|
||||
const auto ini = prefix / default_ini_filename();
|
||||
if (!exists(ini))
|
||||
{
|
||||
std::ofstream(ini)
|
||||
<< "[paths]\n"
|
||||
<< "prefix = .\n";
|
||||
}
|
||||
}
|
||||
const auto ini = prefix / default_ini_filename();
|
||||
if (!exists(ini)) {
|
||||
std::ofstream(ini) << "[paths]\n"
|
||||
<< "prefix = .\n";
|
||||
}
|
||||
}
|
||||
|
||||
void build_command::terminate_msbuild()
|
||||
{
|
||||
if (conf().global().dry())
|
||||
return;
|
||||
void build_command::terminate_msbuild()
|
||||
{
|
||||
if (conf().global().dry())
|
||||
return;
|
||||
|
||||
system("taskkill /im msbuild.exe /f > NUL 2>&1");
|
||||
}
|
||||
system("taskkill /im msbuild.exe /f > NUL 2>&1");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mob
|
||||
|
||||
+45
-63
@@ -1,83 +1,65 @@
|
||||
#include "pch.h"
|
||||
#include "commands.h"
|
||||
#include "../tasks/tasks.h"
|
||||
#include "commands.h"
|
||||
|
||||
namespace mob
|
||||
{
|
||||
namespace mob {
|
||||
|
||||
cmake_command::cmake_command()
|
||||
: command(requires_options)
|
||||
{
|
||||
}
|
||||
cmake_command::cmake_command() : command(requires_options) {}
|
||||
|
||||
command::meta_t cmake_command::meta() const
|
||||
{
|
||||
return
|
||||
{
|
||||
"cmake",
|
||||
"runs cmake in a directory"
|
||||
};
|
||||
}
|
||||
command::meta_t cmake_command::meta() const
|
||||
{
|
||||
return {"cmake", "runs cmake in a directory"};
|
||||
}
|
||||
|
||||
clipp::group cmake_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("cmake").set(picked_),
|
||||
clipp::group cmake_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("cmake").set(picked_),
|
||||
|
||||
(clipp::option("-h", "--help") >> help_)
|
||||
% "shows this message",
|
||||
(clipp::option("-h", "--help") >> help_) % "shows this message",
|
||||
|
||||
(clipp::option("-G", "--generator")
|
||||
& clipp::value("GEN") >> gen_)
|
||||
% ("sets the -G option for cmake [default: VS]"),
|
||||
(clipp::option("-G", "--generator") & clipp::value("GEN") >> gen_) %
|
||||
("sets the -G option for cmake [default: VS]"),
|
||||
|
||||
(clipp::option("-c", "--cmd")
|
||||
& clipp::value("CMD") >> cmd_)
|
||||
% "overrides the cmake command line [default: \"..\"]",
|
||||
(clipp::option("-c", "--cmd") & clipp::value("CMD") >> cmd_) %
|
||||
"overrides the cmake command line [default: \"..\"]",
|
||||
|
||||
(
|
||||
clipp::option("--x64").set(x64_, true) |
|
||||
clipp::option("--x86").set(x64_, false)
|
||||
)
|
||||
% "whether to use the x64 or x86 vcvars; if -G is not set, "
|
||||
"whether to pass \"-A Win32\" or \"-A x64\" for the default "
|
||||
"VS generator [default: x64]",
|
||||
(clipp::option("--x64").set(x64_, true) |
|
||||
clipp::option("--x86").set(x64_, false)) %
|
||||
"whether to use the x64 or x86 vcvars; if -G is not set, "
|
||||
"whether to pass \"-A Win32\" or \"-A x64\" for the default "
|
||||
"VS generator [default: x64]",
|
||||
|
||||
(clipp::option("--install-prefix")
|
||||
& clipp::value("PATH") >> prefix_)
|
||||
% "sets CMAKE_INSTALL_PREFIX [default: empty]",
|
||||
(clipp::option("--install-prefix") & clipp::value("PATH") >> prefix_) %
|
||||
"sets CMAKE_INSTALL_PREFIX [default: empty]",
|
||||
|
||||
(clipp::value("PATH") >> path_)
|
||||
% "path from which to run `cmake`"
|
||||
);
|
||||
}
|
||||
(clipp::value("PATH") >> path_) % "path from which to run `cmake`");
|
||||
}
|
||||
|
||||
int cmake_command::do_run()
|
||||
{
|
||||
auto t = tasks::modorganizer::create_cmake_tool(
|
||||
fs::path(utf8_to_utf16(path_)));
|
||||
int cmake_command::do_run()
|
||||
{
|
||||
auto t = tasks::modorganizer::create_cmake_tool(fs::path(utf8_to_utf16(path_)));
|
||||
|
||||
t.generator(gen_);
|
||||
t.cmd(cmd_);
|
||||
t.prefix(prefix_);
|
||||
t.output(path_);
|
||||
t.generator(gen_);
|
||||
t.cmd(cmd_);
|
||||
t.prefix(prefix_);
|
||||
t.output(path_);
|
||||
|
||||
if (!x64_)
|
||||
t.architecture(arch::x86);
|
||||
if (!x64_)
|
||||
t.architecture(arch::x86);
|
||||
|
||||
// copy the global context, the tool will modify it
|
||||
context cxcopy(gcx());
|
||||
// copy the global context, the tool will modify it
|
||||
context cxcopy(gcx());
|
||||
|
||||
t.run(cxcopy);
|
||||
t.run(cxcopy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string cmake_command::do_doc()
|
||||
{
|
||||
return
|
||||
"Runs `cmake ..` in the given directory with the same command line\n"
|
||||
"as the one used for modorganizer projects.";
|
||||
}
|
||||
std::string cmake_command::do_doc()
|
||||
{
|
||||
return "Runs `cmake ..` in the given directory with the same command line\n"
|
||||
"as the one used for modorganizer projects.";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mob
|
||||
|
||||
+319
-372
File diff suppressed because it is too large
Load Diff
+423
-479
File diff suppressed because it is too large
Load Diff
+191
-229
@@ -1,285 +1,247 @@
|
||||
#include "pch.h"
|
||||
#include "commands.h"
|
||||
#include "../tasks/tasks.h"
|
||||
#include "../tools/tools.h"
|
||||
#include "commands.h"
|
||||
|
||||
namespace mob
|
||||
{
|
||||
namespace mob {
|
||||
|
||||
git_command::git_command()
|
||||
: command(requires_options)
|
||||
{
|
||||
}
|
||||
git_command::git_command() : command(requires_options) {}
|
||||
|
||||
command::meta_t git_command::meta() const
|
||||
{
|
||||
return
|
||||
{
|
||||
"git",
|
||||
"manages the git repos"
|
||||
};
|
||||
}
|
||||
command::meta_t git_command::meta() const
|
||||
{
|
||||
return {"git", "manages the git repos"};
|
||||
}
|
||||
|
||||
clipp::group git_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("git").set(picked_),
|
||||
clipp::group git_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("git").set(picked_),
|
||||
|
||||
(clipp::option("-h", "--help") >> help_)
|
||||
% ("shows this message"),
|
||||
(clipp::option("-h", "--help") >> help_) % ("shows this message"),
|
||||
|
||||
"set-remotes" %
|
||||
(clipp::command("set-remotes").set(mode_, modes::set_remotes),
|
||||
(clipp::required("-u", "--username")
|
||||
& clipp::value("USERNAME") >> username_)
|
||||
% "git username",
|
||||
"set-remotes" %
|
||||
(clipp::command("set-remotes").set(mode_, modes::set_remotes),
|
||||
(clipp::required("-u", "--username") &
|
||||
clipp::value("USERNAME") >> username_) %
|
||||
"git username",
|
||||
|
||||
(clipp::required("-e", "--email")
|
||||
& clipp::value("EMAIL") >> email_)
|
||||
% "git email",
|
||||
(clipp::required("-e", "--email") &
|
||||
clipp::value("EMAIL") >> email_) %
|
||||
"git email",
|
||||
|
||||
(clipp::option("-k", "--key")
|
||||
& clipp::value("PATH") >> key_)
|
||||
% "path to putty key",
|
||||
(clipp::option("-k", "--key") & clipp::value("PATH") >> key_) %
|
||||
"path to putty key",
|
||||
|
||||
(clipp::option("-s", "--no-push").set(nopush_)
|
||||
% "disables pushing to 'upstream' by changing the push url "
|
||||
"to 'nopushurl' to avoid accidental pushes"),
|
||||
(clipp::option("-s", "--no-push").set(nopush_) %
|
||||
"disables pushing to 'upstream' by changing the push url "
|
||||
"to 'nopushurl' to avoid accidental pushes"),
|
||||
|
||||
(clipp::option("-p", "--push-origin").set(push_default_)
|
||||
% "sets the new 'origin' remote as the default push target"),
|
||||
(clipp::option("-p", "--push-origin").set(push_default_) %
|
||||
"sets the new 'origin' remote as the default push target"),
|
||||
|
||||
(clipp::opt_value("path") >> path_)
|
||||
% "only use this repo"
|
||||
)
|
||||
(clipp::opt_value("path") >> path_) % "only use this repo")
|
||||
|
||||
|
|
||||
|
|
||||
|
||||
"add-remote" %
|
||||
(clipp::command("add-remote").set(mode_, modes::add_remote),
|
||||
(clipp::required("-n", "--name")
|
||||
& clipp::value("NAME") >> remote_)
|
||||
% "name of new remote",
|
||||
"add-remote" %
|
||||
(clipp::command("add-remote").set(mode_, modes::add_remote),
|
||||
(clipp::required("-n", "--name") &
|
||||
clipp::value("NAME") >> remote_) %
|
||||
"name of new remote",
|
||||
|
||||
(clipp::required("-u", "--username")
|
||||
& clipp::value("USERNAME") >> username_)
|
||||
% "git username",
|
||||
(clipp::required("-u", "--username") &
|
||||
clipp::value("USERNAME") >> username_) %
|
||||
"git username",
|
||||
|
||||
(clipp::option("-k", "--key")
|
||||
& clipp::value("PATH") >> key_)
|
||||
% "path to putty key",
|
||||
(clipp::option("-k", "--key") & clipp::value("PATH") >> key_) %
|
||||
"path to putty key",
|
||||
|
||||
(clipp::option("-p", "--push-origin").set(push_default_)
|
||||
% "sets this new remote as the default push target"),
|
||||
(clipp::option("-p", "--push-origin").set(push_default_) %
|
||||
"sets this new remote as the default push target"),
|
||||
|
||||
(clipp::opt_value("path") >> path_)
|
||||
% "only use this repo"
|
||||
)
|
||||
(clipp::opt_value("path") >> path_) % "only use this repo")
|
||||
|
||||
|
|
||||
|
|
||||
|
||||
"ignore-ts" %
|
||||
(clipp::command("ignore-ts").set(mode_, modes::ignore_ts),
|
||||
(
|
||||
clipp::command("on").set(tson_, true) |
|
||||
clipp::command("off").set(tson_, false)
|
||||
)
|
||||
)
|
||||
"ignore-ts" % (clipp::command("ignore-ts").set(mode_, modes::ignore_ts),
|
||||
(clipp::command("on").set(tson_, true) |
|
||||
clipp::command("off").set(tson_, false)))
|
||||
|
||||
|
|
||||
|
|
||||
|
||||
"branches" %
|
||||
(clipp::command("branches").set(mode_, modes::branches),
|
||||
clipp::option("-a", "--all").set(all_branches_)
|
||||
% "shows all branches, including those on master"
|
||||
)
|
||||
);
|
||||
}
|
||||
"branches" % (clipp::command("branches").set(mode_, modes::branches),
|
||||
clipp::option("-a", "--all").set(all_branches_) %
|
||||
"shows all branches, including those on master"));
|
||||
}
|
||||
|
||||
int git_command::do_run()
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case modes::set_remotes:
|
||||
{
|
||||
do_set_remotes();
|
||||
break;
|
||||
}
|
||||
int git_command::do_run()
|
||||
{
|
||||
switch (mode_) {
|
||||
case modes::set_remotes: {
|
||||
do_set_remotes();
|
||||
break;
|
||||
}
|
||||
|
||||
case modes::add_remote:
|
||||
{
|
||||
do_add_remote();
|
||||
break;
|
||||
}
|
||||
case modes::add_remote: {
|
||||
do_add_remote();
|
||||
break;
|
||||
}
|
||||
|
||||
case modes::ignore_ts:
|
||||
{
|
||||
do_ignore_ts();
|
||||
break;
|
||||
}
|
||||
case modes::ignore_ts: {
|
||||
do_ignore_ts();
|
||||
break;
|
||||
}
|
||||
|
||||
case modes::branches:
|
||||
{
|
||||
do_branches();
|
||||
break;
|
||||
}
|
||||
case modes::branches: {
|
||||
do_branches();
|
||||
break;
|
||||
}
|
||||
|
||||
case modes::none:
|
||||
default:
|
||||
u8cerr << "bad git mode " << static_cast<int>(mode_) << "\n";
|
||||
throw bailed();
|
||||
}
|
||||
case modes::none:
|
||||
default:
|
||||
u8cerr << "bad git mode " << static_cast<int>(mode_) << "\n";
|
||||
throw bailed();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string git_command::do_doc()
|
||||
{
|
||||
return
|
||||
"All the commands will go through all modorganizer repos, plus usvfs\n"
|
||||
"and NCC.\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
"set-remotes\n"
|
||||
" For each repo, this first sets the username and email. Then, it\n"
|
||||
" will rename the remote 'origin' to 'upstream' and create a new\n"
|
||||
" remote 'origin' with the given information. If the remote\n"
|
||||
" 'upstream' already exists in a repo, nothing happens.\n"
|
||||
"\n"
|
||||
"add-remote\n"
|
||||
" For each repo, adds a new remote with the given information. If a\n"
|
||||
" remote with the same name already exists, nothing happens.\n"
|
||||
"\n"
|
||||
"ignore-ts\n"
|
||||
" Toggles the --assume-changed status of all .ts files in all repos.\n"
|
||||
"\n"
|
||||
"branches\n"
|
||||
" Lists all git repos that are not on master. With -a, show all \n"
|
||||
" repos and their current branch.";
|
||||
}
|
||||
std::string git_command::do_doc()
|
||||
{
|
||||
return "All the commands will go through all modorganizer repos, plus usvfs\n"
|
||||
"and NCC.\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
"set-remotes\n"
|
||||
" For each repo, this first sets the username and email. Then, it\n"
|
||||
" will rename the remote 'origin' to 'upstream' and create a new\n"
|
||||
" remote 'origin' with the given information. If the remote\n"
|
||||
" 'upstream' already exists in a repo, nothing happens.\n"
|
||||
"\n"
|
||||
"add-remote\n"
|
||||
" For each repo, adds a new remote with the given information. If a\n"
|
||||
" remote with the same name already exists, nothing happens.\n"
|
||||
"\n"
|
||||
"ignore-ts\n"
|
||||
" Toggles the --assume-changed status of all .ts files in all repos.\n"
|
||||
"\n"
|
||||
"branches\n"
|
||||
" Lists all git repos that are not on master. With -a, show all \n"
|
||||
" repos and their current branch.";
|
||||
}
|
||||
|
||||
void git_command::do_set_remotes()
|
||||
{
|
||||
if (path_.empty())
|
||||
{
|
||||
const auto repos = get_repos();
|
||||
void git_command::do_set_remotes()
|
||||
{
|
||||
if (path_.empty()) {
|
||||
const auto repos = get_repos();
|
||||
|
||||
for (auto&& r : repos)
|
||||
do_set_remotes(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
do_set_remotes(path_);
|
||||
}
|
||||
}
|
||||
for (auto&& r : repos)
|
||||
do_set_remotes(r);
|
||||
}
|
||||
else {
|
||||
do_set_remotes(path_);
|
||||
}
|
||||
}
|
||||
|
||||
void git_command::do_set_remotes(const fs::path& r)
|
||||
{
|
||||
u8cout << "setting up " << path_to_utf8(r.filename()) << "\n";
|
||||
void git_command::do_set_remotes(const fs::path& r)
|
||||
{
|
||||
u8cout << "setting up " << path_to_utf8(r.filename()) << "\n";
|
||||
|
||||
git_wrap(r).set_credentials(username_, email_);
|
||||
git_wrap(r).set_credentials(username_, email_);
|
||||
|
||||
git_wrap(r).set_origin_and_upstream_remotes(
|
||||
username_, key_, nopush_, push_default_);
|
||||
}
|
||||
git_wrap(r).set_origin_and_upstream_remotes(username_, key_, nopush_,
|
||||
push_default_);
|
||||
}
|
||||
|
||||
void git_command::do_add_remote()
|
||||
{
|
||||
u8cout
|
||||
<< "adding remote '" << remote_ << "' "
|
||||
<< "from '" << username_ << "' to repos\n";
|
||||
void git_command::do_add_remote()
|
||||
{
|
||||
u8cout << "adding remote '" << remote_ << "' "
|
||||
<< "from '" << username_ << "' to repos\n";
|
||||
|
||||
if (path_.empty())
|
||||
{
|
||||
const auto repos = get_repos();
|
||||
if (path_.empty()) {
|
||||
const auto repos = get_repos();
|
||||
|
||||
for (auto&& r : repos)
|
||||
do_add_remote(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
do_add_remote(path_);
|
||||
}
|
||||
}
|
||||
for (auto&& r : repos)
|
||||
do_add_remote(r);
|
||||
}
|
||||
else {
|
||||
do_add_remote(path_);
|
||||
}
|
||||
}
|
||||
|
||||
void git_command::do_add_remote(const fs::path& r)
|
||||
{
|
||||
u8cout << path_to_utf8(r.filename()) << "\n";
|
||||
git_wrap(r).add_remote(remote_, username_, key_, push_default_);
|
||||
}
|
||||
void git_command::do_add_remote(const fs::path& r)
|
||||
{
|
||||
u8cout << path_to_utf8(r.filename()) << "\n";
|
||||
git_wrap(r).add_remote(remote_, username_, key_, push_default_);
|
||||
}
|
||||
|
||||
void git_command::do_ignore_ts()
|
||||
{
|
||||
if (tson_)
|
||||
u8cout << "ignoring .ts files\n";
|
||||
else
|
||||
u8cout << "un-ignoring .ts files\n";
|
||||
void git_command::do_ignore_ts()
|
||||
{
|
||||
if (tson_)
|
||||
u8cout << "ignoring .ts files\n";
|
||||
else
|
||||
u8cout << "un-ignoring .ts files\n";
|
||||
|
||||
if (path_.empty())
|
||||
{
|
||||
const auto repos = get_repos();
|
||||
if (path_.empty()) {
|
||||
const auto repos = get_repos();
|
||||
|
||||
for (auto&& r : repos)
|
||||
do_ignore_ts(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
do_ignore_ts(path_);
|
||||
}
|
||||
}
|
||||
for (auto&& r : repos)
|
||||
do_ignore_ts(r);
|
||||
}
|
||||
else {
|
||||
do_ignore_ts(path_);
|
||||
}
|
||||
}
|
||||
|
||||
void git_command::do_ignore_ts(const fs::path& r)
|
||||
{
|
||||
u8cout << path_to_utf8(r.filename()) << "\n";
|
||||
git_wrap(r).ignore_ts(tson_);
|
||||
}
|
||||
void git_command::do_ignore_ts(const fs::path& r)
|
||||
{
|
||||
u8cout << path_to_utf8(r.filename()) << "\n";
|
||||
git_wrap(r).ignore_ts(tson_);
|
||||
}
|
||||
|
||||
void git_command::do_branches()
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> v;
|
||||
void git_command::do_branches()
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> v;
|
||||
|
||||
for (auto&& r : get_repos())
|
||||
{
|
||||
const auto b = git_wrap(r).current_branch();
|
||||
if (b == "master" && !all_branches_)
|
||||
continue;
|
||||
for (auto&& r : get_repos()) {
|
||||
const auto b = git_wrap(r).current_branch();
|
||||
if (b == "master" && !all_branches_)
|
||||
continue;
|
||||
|
||||
if (b.empty())
|
||||
v.push_back({r.filename().string(), "detached head"});
|
||||
else
|
||||
v.push_back({r.filename().string(), b});
|
||||
}
|
||||
if (b.empty())
|
||||
v.push_back({r.filename().string(), "detached head"});
|
||||
else
|
||||
v.push_back({r.filename().string(), b});
|
||||
}
|
||||
|
||||
u8cout << table(v, 0, 3) << "\n";
|
||||
}
|
||||
u8cout << table(v, 0, 3) << "\n";
|
||||
}
|
||||
|
||||
std::vector<fs::path> git_command::get_repos() const
|
||||
{
|
||||
std::vector<fs::path> v;
|
||||
std::vector<fs::path> git_command::get_repos() const
|
||||
{
|
||||
std::vector<fs::path> v;
|
||||
|
||||
// usvfs
|
||||
if (fs::exists(tasks::usvfs::source_path()))
|
||||
v.push_back(tasks::usvfs::source_path());
|
||||
// usvfs
|
||||
if (fs::exists(tasks::usvfs::source_path()))
|
||||
v.push_back(tasks::usvfs::source_path());
|
||||
|
||||
const auto super = tasks::modorganizer::super_path();
|
||||
const auto super = tasks::modorganizer::super_path();
|
||||
|
||||
// all directories in super except for those starting with a dot
|
||||
if (fs::exists(super))
|
||||
{
|
||||
for (auto e : fs::directory_iterator(super))
|
||||
{
|
||||
if (!e.is_directory())
|
||||
continue;
|
||||
// all directories in super except for those starting with a dot
|
||||
if (fs::exists(super)) {
|
||||
for (auto e : fs::directory_iterator(super)) {
|
||||
if (!e.is_directory())
|
||||
continue;
|
||||
|
||||
const auto p = e.path();
|
||||
if (path_to_utf8(p.filename()).starts_with("."))
|
||||
continue;
|
||||
const auto p = e.path();
|
||||
if (path_to_utf8(p.filename()).starts_with("."))
|
||||
continue;
|
||||
|
||||
v.push_back(p);
|
||||
}
|
||||
}
|
||||
v.push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mob
|
||||
|
||||
+62
-79
@@ -1,100 +1,83 @@
|
||||
#include "pch.h"
|
||||
#include "commands.h"
|
||||
#include "../tasks/task_manager.h"
|
||||
#include "../tasks/task.h"
|
||||
#include "../tasks/task_manager.h"
|
||||
#include "../utility/io.h"
|
||||
#include "commands.h"
|
||||
|
||||
namespace mob
|
||||
{
|
||||
namespace mob {
|
||||
|
||||
command::meta_t list_command::meta() const
|
||||
{
|
||||
return
|
||||
{
|
||||
"list",
|
||||
"lists available tasks"
|
||||
};
|
||||
}
|
||||
command::meta_t list_command::meta() const
|
||||
{
|
||||
return {"list", "lists available tasks"};
|
||||
}
|
||||
|
||||
clipp::group list_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("list").set(picked_),
|
||||
clipp::group list_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("list").set(picked_),
|
||||
|
||||
(clipp::option("-h", "--help") >> help_)
|
||||
% "shows this message",
|
||||
(clipp::option("-h", "--help") >> help_) % "shows this message",
|
||||
|
||||
(clipp::option("-a", "--all") >> all_)
|
||||
% "shows all the tasks, including pseudo parallel tasks",
|
||||
(clipp::option("-a", "--all") >> all_) %
|
||||
"shows all the tasks, including pseudo parallel tasks",
|
||||
|
||||
(clipp::option("-i", "--aliases") >> aliases_)
|
||||
% "shows only aliases",
|
||||
(clipp::option("-i", "--aliases") >> aliases_) % "shows only aliases",
|
||||
|
||||
(clipp::opt_values(
|
||||
clipp::match::prefix_not("-"), "task", tasks_))
|
||||
% "with -a; when given, acts like the tasks given to `build` and "
|
||||
"shows only the tasks that would run"
|
||||
);
|
||||
}
|
||||
(clipp::opt_values(clipp::match::prefix_not("-"), "task", tasks_)) %
|
||||
"with -a; when given, acts like the tasks given to `build` and "
|
||||
"shows only the tasks that would run");
|
||||
}
|
||||
|
||||
int list_command::do_run()
|
||||
{
|
||||
auto& tm = task_manager::instance();
|
||||
int list_command::do_run()
|
||||
{
|
||||
auto& tm = task_manager::instance();
|
||||
|
||||
if (aliases_)
|
||||
{
|
||||
load_options();
|
||||
dump_aliases();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (all_)
|
||||
{
|
||||
if (!tasks_.empty())
|
||||
set_task_enabled_flags(tasks_);
|
||||
if (aliases_) {
|
||||
load_options();
|
||||
dump_aliases();
|
||||
}
|
||||
else {
|
||||
if (all_) {
|
||||
if (!tasks_.empty())
|
||||
set_task_enabled_flags(tasks_);
|
||||
|
||||
load_options();
|
||||
dump(tm.top_level(), 0);
|
||||
load_options();
|
||||
dump(tm.top_level(), 0);
|
||||
|
||||
u8cout << "\n\naliases:\n";
|
||||
dump_aliases();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto&& t : tm.all())
|
||||
u8cout << " - " << join(t->names(), ", ") << "\n";
|
||||
}
|
||||
}
|
||||
u8cout << "\n\naliases:\n";
|
||||
dump_aliases();
|
||||
}
|
||||
else {
|
||||
for (auto&& t : tm.all())
|
||||
u8cout << " - " << join(t->names(), ", ") << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
void list_command::dump(const std::vector<task*>& v, std::size_t indent) const
|
||||
{
|
||||
for (auto&& t : v) {
|
||||
if (!t->enabled())
|
||||
continue;
|
||||
|
||||
void list_command::dump(const std::vector<task*>& v, std::size_t indent) const
|
||||
{
|
||||
for (auto&& t : v)
|
||||
{
|
||||
if (!t->enabled())
|
||||
continue;
|
||||
u8cout << std::string(indent * 4, ' ') << " - " << join(t->names(), ",")
|
||||
<< "\n";
|
||||
|
||||
u8cout
|
||||
<< std::string(indent*4, ' ')
|
||||
<< " - " << join(t->names(), ",")
|
||||
<< "\n";
|
||||
if (auto* pt = dynamic_cast<parallel_tasks*>(t))
|
||||
dump(pt->children(), indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto* pt=dynamic_cast<parallel_tasks*>(t))
|
||||
dump(pt->children(), indent + 1);
|
||||
}
|
||||
}
|
||||
void list_command::dump_aliases() const
|
||||
{
|
||||
const auto v = task_manager::instance().aliases();
|
||||
if (v.empty())
|
||||
return;
|
||||
|
||||
void list_command::dump_aliases() const
|
||||
{
|
||||
const auto v = task_manager::instance().aliases();
|
||||
if (v.empty())
|
||||
return;
|
||||
for (auto&& [k, patterns] : v)
|
||||
u8cout << " - " << k << ": " << join(patterns, ", ") << "\n";
|
||||
}
|
||||
|
||||
for (auto&& [k, patterns] : v)
|
||||
u8cout << " - " << k << ": " << join(patterns, ", ") << "\n";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mob
|
||||
|
||||
+358
-403
File diff suppressed because it is too large
Load Diff
+525
-587
File diff suppressed because it is too large
Load Diff
+141
-166
@@ -1,213 +1,188 @@
|
||||
#include "pch.h"
|
||||
#include "commands.h"
|
||||
#include "../net.h"
|
||||
#include "../utility.h"
|
||||
#include "../core/conf.h"
|
||||
#include "../core/context.h"
|
||||
#include "../core/env.h"
|
||||
#include "../net.h"
|
||||
#include "../tasks/tasks.h"
|
||||
#include "../utility.h"
|
||||
#include "commands.h"
|
||||
|
||||
namespace mob
|
||||
{
|
||||
namespace mob {
|
||||
|
||||
tx_command::tx_command()
|
||||
: command(requires_options)
|
||||
{
|
||||
}
|
||||
tx_command::tx_command() : command(requires_options) {}
|
||||
|
||||
command::meta_t tx_command::meta() const
|
||||
{
|
||||
return
|
||||
{
|
||||
"tx",
|
||||
"manages transifex translations"
|
||||
};
|
||||
}
|
||||
command::meta_t tx_command::meta() const
|
||||
{
|
||||
return {"tx", "manages transifex translations"};
|
||||
}
|
||||
|
||||
clipp::group tx_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("tx").set(picked_),
|
||||
clipp::group tx_command::do_group()
|
||||
{
|
||||
return clipp::group(
|
||||
clipp::command("tx").set(picked_),
|
||||
|
||||
(clipp::option("-h", "--help") >> help_)
|
||||
% ("shows this message"),
|
||||
(clipp::option("-h", "--help") >> help_) % ("shows this message"),
|
||||
|
||||
"get" %
|
||||
(clipp::command("get").set(mode_, modes::get),
|
||||
(clipp::option("-k", "--key")
|
||||
& clipp::value("APIKEY") >> key_)
|
||||
% "API key",
|
||||
"get" % (clipp::command("get").set(mode_, modes::get),
|
||||
(clipp::option("-k", "--key") & clipp::value("APIKEY") >> key_) %
|
||||
"API key",
|
||||
|
||||
(clipp::option("-t", "--team")
|
||||
& clipp::value("TEAM") >> team_)
|
||||
% "team name",
|
||||
(clipp::option("-t", "--team") & clipp::value("TEAM") >> team_) %
|
||||
"team name",
|
||||
|
||||
(clipp::option("-p", "--project")
|
||||
& clipp::value("PROJECT") >> project_)
|
||||
% "project name",
|
||||
(clipp::option("-p", "--project") &
|
||||
clipp::value("PROJECT") >> project_) %
|
||||
"project name",
|
||||
|
||||
(clipp::option("-u", "--url")
|
||||
& clipp::value("URL") >> url_)
|
||||
% "project URL",
|
||||
(clipp::option("-u", "--url") & clipp::value("URL") >> url_) %
|
||||
"project URL",
|
||||
|
||||
(clipp::option("-m", "--minimum")
|
||||
& clipp::value("PERCENT").set(min_))
|
||||
% "minimum translation threshold to download [0-100]",
|
||||
(clipp::option("-m", "--minimum") &
|
||||
clipp::value("PERCENT").set(min_)) %
|
||||
"minimum translation threshold to download [0-100]",
|
||||
|
||||
(clipp::option("-f", "--force").call([&]{ force_ = true; }))
|
||||
% "don't check timestamps, re-download all translation files",
|
||||
(clipp::option("-f", "--force").call([&] {
|
||||
force_ = true;
|
||||
})) %
|
||||
"don't check timestamps, re-download all translation files",
|
||||
|
||||
(clipp::value("path") >> path_)
|
||||
% "path that will contain the .tx directory"
|
||||
)
|
||||
(clipp::value("path") >> path_) %
|
||||
"path that will contain the .tx directory")
|
||||
|
||||
|
|
||||
|
|
||||
|
||||
"build" %
|
||||
(clipp::command("build").set(mode_, modes::build),
|
||||
"build" % (clipp::command("build").set(mode_, modes::build),
|
||||
|
||||
(clipp::value("source") >> path_)
|
||||
% "path that contains the translation directories",
|
||||
(clipp::value("source") >> path_) %
|
||||
"path that contains the translation directories",
|
||||
|
||||
(clipp::value("destination") >> dest_)
|
||||
% "path that will contain the .qm files"
|
||||
)
|
||||
);
|
||||
}
|
||||
(clipp::value("destination") >> dest_) %
|
||||
"path that will contain the .qm files"));
|
||||
}
|
||||
|
||||
void tx_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
void tx_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
|
||||
if (!key_.empty())
|
||||
common.options.push_back("transifex/key=" + key_);
|
||||
if (!key_.empty())
|
||||
common.options.push_back("transifex/key=" + key_);
|
||||
|
||||
if (!team_.empty())
|
||||
common.options.push_back("transifex/team=" + team_);
|
||||
if (!team_.empty())
|
||||
common.options.push_back("transifex/team=" + team_);
|
||||
|
||||
if (!project_.empty())
|
||||
common.options.push_back("transifex/project=" + project_);
|
||||
if (!project_.empty())
|
||||
common.options.push_back("transifex/project=" + project_);
|
||||
|
||||
if (!url_.empty())
|
||||
common.options.push_back("transifex/url=" + url_);
|
||||
if (!url_.empty())
|
||||
common.options.push_back("transifex/url=" + url_);
|
||||
|
||||
if (min_ >= 0)
|
||||
common.options.push_back("transifex/minimum=" + std::to_string(min_));
|
||||
if (min_ >= 0)
|
||||
common.options.push_back("transifex/minimum=" + std::to_string(min_));
|
||||
|
||||
if (force_)
|
||||
common.options.push_back("transifex/force=" + std::to_string(*force_));
|
||||
}
|
||||
if (force_)
|
||||
common.options.push_back("transifex/force=" + std::to_string(*force_));
|
||||
}
|
||||
|
||||
int tx_command::do_run()
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case modes::get:
|
||||
do_get();
|
||||
break;
|
||||
int tx_command::do_run()
|
||||
{
|
||||
switch (mode_) {
|
||||
case modes::get:
|
||||
do_get();
|
||||
break;
|
||||
|
||||
case modes::build:
|
||||
do_build();
|
||||
break;
|
||||
case modes::build:
|
||||
do_build();
|
||||
break;
|
||||
|
||||
case modes::none:
|
||||
default:
|
||||
u8cerr << "bad tx mode " << static_cast<int>(mode_) << "\n";
|
||||
throw bailed();
|
||||
}
|
||||
case modes::none:
|
||||
default:
|
||||
u8cerr << "bad tx mode " << static_cast<int>(mode_) << "\n";
|
||||
throw bailed();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string tx_command::do_doc()
|
||||
{
|
||||
return
|
||||
"Some values will be taken from the INI file if not specified.\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
"get\n"
|
||||
" Initializes a Transifex project in the given directory if\n"
|
||||
" necessary and pulls all the translation files.\n"
|
||||
"\n"
|
||||
"build\n"
|
||||
" Builds all .qm files. The path can either be the transifex\n"
|
||||
" project (where .tx is) or the `translations` directory (where the\n"
|
||||
" individual translation directories are).";
|
||||
}
|
||||
std::string tx_command::do_doc()
|
||||
{
|
||||
return "Some values will be taken from the INI file if not specified.\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
"get\n"
|
||||
" Initializes a Transifex project in the given directory if\n"
|
||||
" necessary and pulls all the translation files.\n"
|
||||
"\n"
|
||||
"build\n"
|
||||
" Builds all .qm files. The path can either be the transifex\n"
|
||||
" project (where .tx is) or the `translations` directory (where the\n"
|
||||
" individual translation directories are).";
|
||||
}
|
||||
|
||||
void tx_command::do_get()
|
||||
{
|
||||
const url u =
|
||||
conf().transifex().get("url") + "/" +
|
||||
conf().transifex().get("team") + "/" +
|
||||
conf().transifex().get("project");
|
||||
void tx_command::do_get()
|
||||
{
|
||||
const url u = conf().transifex().get("url") + "/" +
|
||||
conf().transifex().get("team") + "/" +
|
||||
conf().transifex().get("project");
|
||||
|
||||
const std::string key = conf().transifex().get("key");
|
||||
const std::string key = conf().transifex().get("key");
|
||||
|
||||
if (key.empty() && !this_env::get_opt("TX_TOKEN"))
|
||||
{
|
||||
u8cout <<
|
||||
"(no key was in the INI, --key wasn't given and TX_TOKEN env\n"
|
||||
"variable doesn't exist, this will probably fail)\n\n";
|
||||
}
|
||||
if (key.empty() && !this_env::get_opt("TX_TOKEN")) {
|
||||
u8cout << "(no key was in the INI, --key wasn't given and TX_TOKEN env\n"
|
||||
"variable doesn't exist, this will probably fail)\n\n";
|
||||
}
|
||||
|
||||
// copy the global context, the tools will modify it
|
||||
context cxcopy = gcx();
|
||||
// copy the global context, the tools will modify it
|
||||
context cxcopy = gcx();
|
||||
|
||||
u8cout << "initializing\n";
|
||||
transifex(transifex::init)
|
||||
.root(path_)
|
||||
.run(cxcopy);
|
||||
u8cout << "initializing\n";
|
||||
transifex(transifex::init).root(path_).run(cxcopy);
|
||||
|
||||
u8cout << "configuring\n";
|
||||
transifex(transifex::config)
|
||||
.stdout_level(context::level::info)
|
||||
.root(path_)
|
||||
.api_key(key)
|
||||
.url(u)
|
||||
.run(cxcopy);
|
||||
u8cout << "configuring\n";
|
||||
transifex(transifex::config)
|
||||
.stdout_level(context::level::info)
|
||||
.root(path_)
|
||||
.api_key(key)
|
||||
.url(u)
|
||||
.run(cxcopy);
|
||||
|
||||
u8cout << "pulling\n";
|
||||
transifex(transifex::pull)
|
||||
.stdout_level(context::level::info)
|
||||
.root(path_)
|
||||
.api_key(key)
|
||||
.minimum(conf().transifex().get<int>("minimum"))
|
||||
.force(conf().transifex().get<bool>("force"))
|
||||
.run(cxcopy);
|
||||
}
|
||||
u8cout << "pulling\n";
|
||||
transifex(transifex::pull)
|
||||
.stdout_level(context::level::info)
|
||||
.root(path_)
|
||||
.api_key(key)
|
||||
.minimum(conf().transifex().get<int>("minimum"))
|
||||
.force(conf().transifex().get<bool>("force"))
|
||||
.run(cxcopy);
|
||||
}
|
||||
|
||||
void tx_command::do_build()
|
||||
{
|
||||
fs::path root = path_;
|
||||
if (fs::exists(root / ".tx") && fs::exists(root / "translations"))
|
||||
root = root / "translations";
|
||||
void tx_command::do_build()
|
||||
{
|
||||
fs::path root = path_;
|
||||
if (fs::exists(root / ".tx") && fs::exists(root / "translations"))
|
||||
root = root / "translations";
|
||||
|
||||
tasks::translations::projects ps(root);
|
||||
tasks::translations::projects ps(root);
|
||||
|
||||
fs::path dest = dest_;
|
||||
op::create_directories(gcx(), dest, op::unsafe);
|
||||
fs::path dest = dest_;
|
||||
op::create_directories(gcx(), dest, op::unsafe);
|
||||
|
||||
for (auto&& w : ps.warnings())
|
||||
u8cerr << w << "\n";
|
||||
for (auto&& w : ps.warnings())
|
||||
u8cerr << w << "\n";
|
||||
|
||||
thread_pool tp;
|
||||
thread_pool tp;
|
||||
|
||||
for (auto& p : ps.get())
|
||||
{
|
||||
for (auto& lg : p.langs)
|
||||
{
|
||||
// copy the global context, each thread must have its own
|
||||
tp.add([&, cxcopy=gcx()]() mutable
|
||||
{
|
||||
lrelease()
|
||||
.project(p.name)
|
||||
.sources(lg.ts_files)
|
||||
.out(dest)
|
||||
.run(cxcopy);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto& p : ps.get()) {
|
||||
for (auto& lg : p.langs) {
|
||||
// copy the global context, each thread must have its own
|
||||
tp.add([&, cxcopy = gcx()]() mutable {
|
||||
lrelease()
|
||||
.project(p.name)
|
||||
.sources(lg.ts_files)
|
||||
.out(dest)
|
||||
.run(cxcopy);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mob
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user