Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
libretro-chailove
Commits
ff6bd43a
Verified
Commit
ff6bd43a
authored
Apr 02, 2018
by
RobLoach
Browse files
Add Semantic Versioining checks
parent
68f033e3
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
ff6bd43a
...
...
@@ -4,10 +4,15 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/en/1.0.0/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/spec/v2.0.0.html
)
.
## 0.17.1 - Unreleased
## 0.18.0 - Unreleased
### Added
-
[
Semantic Versioning
](
https://semver.org/
)
checks
-
Use
`t.version = 0.18.0`
in
`def load(t) {}`
to specify which ChaiLove version you're targeting
### Fixed
-
Documentation
## 0.17.0 - 2018-03-18
### Added
-
`love.system.getOS()`
now returns actual operating system name
...
...
Makefile.common
View file @
ff6bd43a
...
...
@@ -9,6 +9,10 @@ SOURCES_CXX += $(wildcard \
test
/native/
*
.cpp
\
)
# semver
FLAGS
+=
-Ivendor
/semver
SOURCES_C
+=
vendor/semver/semver.c
# random
FLAGS
+=
-Ivendor
/random/include
...
...
docs/Doxyfile
View file @
ff6bd43a
...
...
@@ -23,7 +23,7 @@ PROJECT_NAME = "ChaiLove API"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = "0.1
7
.0"
PROJECT_NUMBER = "0.1
8
.0"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
...
...
src/ChaiLove.cpp
View file @
ff6bd43a
...
...
@@ -45,6 +45,7 @@ bool ChaiLove::load(const std::string& file) {
// Initialize the scripting system.
script
=
new
love
::
script
(
file
);
script
->
conf
(
config
);
system
.
load
(
config
);
// Testing.
#ifdef __HAVE_TESTS__
...
...
src/ChaiLove.h
View file @
ff6bd43a
...
...
@@ -71,9 +71,9 @@
#define SRC_CHAILOVE_H_
#define CHAILOVE_VERSION_MAJOR 0
#define CHAILOVE_VERSION_MINOR 1
7
#define CHAILOVE_VERSION_MINOR 1
8
#define CHAILOVE_VERSION_PATCH 0
#define CHAILOVE_VERSION_STRING "0.1
7
.0"
#define CHAILOVE_VERSION_STRING "0.1
8
.0"
#include "SDL.h"
#include "libretro.h"
...
...
src/love/system.cpp
View file @
ff6bd43a
...
...
@@ -2,6 +2,8 @@
#include "../ChaiLove.h"
#include <string>
#include <iostream>
#include "semver.h"
namespace
love
{
...
...
@@ -52,4 +54,41 @@ std::string system::getVersionString() {
return
CHAILOVE_VERSION_STRING
;
}
bool
system
::
load
(
config
&
t
)
{
semver_t
current
=
{};
semver_t
compare
=
{};
if
(
semver_parse
(
getVersionString
().
c_str
(),
&
current
)
||
semver_parse
(
t
.
version
.
c_str
(),
&
compare
))
{
std
::
cout
<<
"[ChaiLove] [system] Error - Invalid version string: "
<<
t
.
version
<<
std
::
endl
;
return
false
;
}
std
::
cout
<<
"[ChaiLove] [system] Version desired: "
<<
t
.
version
<<
std
::
endl
;
int
resolution
=
semver_compare
(
compare
,
current
);
if
(
resolution
==
0
)
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" == "
<<
getVersionString
()
<<
std
::
endl
;
}
else
if
(
resolution
==
-
1
)
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" < "
<<
getVersionString
()
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" > "
<<
getVersionString
()
<<
std
::
endl
;
}
resolution
=
semver_satisfies
(
compare
,
current
,
"~"
);
if
(
resolution
==
1
)
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" ~= "
<<
getVersionString
()
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" !~= "
<<
getVersionString
()
<<
std
::
endl
;
}
resolution
=
semver_satisfies
(
compare
,
current
,
"^"
);
if
(
resolution
==
1
)
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" ^= "
<<
getVersionString
()
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"[ChaiLove] [system] Version "
<<
t
.
version
<<
" !^= "
<<
getVersionString
()
<<
std
::
endl
;
}
return
true
;
}
}
// namespace love
src/love/system.h
View file @
ff6bd43a
...
...
@@ -3,6 +3,7 @@
#include <vector>
#include <string>
#include "config.h"
namespace
love
{
/**
...
...
@@ -34,6 +35,8 @@ class system {
* @see love.system.getVersion
*/
std
::
string
getVersionString
();
bool
load
(
config
&
t
);
};
}
// namespace love
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment