Skip to content

Commit 41e3f9f

Browse files
committed
Ware signature cleaning
* adjusted wareshub.json references to openfluid-ware.json * set previous signature macros as deprecated (closes #1038)
1 parent 7ee8f01 commit 41e3f9f

11 files changed

Lines changed: 30 additions & 27 deletions

share/openfluid/waresdev/cpp.syntaxhl.ofdev.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@
194194
<pattern value="\bOPENFLUID_\w+\b" />
195195
<pattern value="\bOpenFLUID_\w+\b" />
196196
<pattern value="\bopenfluid::[\w::]+\b" />
197-
<pattern value="\bDECLARE_\w+\b" />
198-
<pattern value="\bBEGIN_SIMULATOR_SIGNATURE\b" />
199-
<pattern value="\bEND_SIMULATOR_SIGNATURE\b" />
200-
<pattern value="\bBEGIN_OBSERVER_SIGNATURE\b" />
201-
<pattern value="\bEND_OBSERVER_SIGNATURE\b" />
202-
<pattern value="\bBEGIN_BUILDEREXT_SIGNATURE\b" />
203-
<pattern value="\bEND_BUILDEREXT_SIGNATURE\b" />
204197
</rule>
205198

206199
<rule name="openfluid-deprecated-keywords" style="openfluid-deprecated">
@@ -221,6 +214,13 @@
221214
<pattern value="DECLARE_USED_VAR(?!\w)" />
222215
<pattern value="DECLARE_PRODUCED_VAR(?!\w)" />
223216
<pattern value="DECLARE_UPDATED_VAR(?!\w)" />
217+
<pattern value="\bBEGIN_SIMULATOR_SIGNATURE\b" />
218+
<pattern value="\bEND_SIMULATOR_SIGNATURE\b" />
219+
<pattern value="\bBEGIN_OBSERVER_SIGNATURE\b" />
220+
<pattern value="\bEND_OBSERVER_SIGNATURE\b" />
221+
<pattern value="\bBEGIN_BUILDEREXT_SIGNATURE\b" />
222+
<pattern value="\bEND_BUILDEREXT_SIGNATURE\b" />
223+
<pattern value="\bDECLARE_\w+\b" />
224224
</rule>
225225

226226
<rule name="string" style="quoted">

src/openfluid/config.hpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const std::string WARESDEV_BUILD_PARAMSUISIGN = "@OPENFLUID_WARESDEV_BUILD_PARAM
174174
const std::string WARESDEV_BUILD_PARAMSUIINFO = "@OPENFLUID_WARESDEV_BUILD_PARAMSUIINFO@";
175175
const std::string WARESDEV_PARAMSUI_IDSUFFIX = "@OPENFLUID_WARESDEV_PARAMSUI_IDSUFFIX@";
176176
const std::string WARESDEV_PACKAGE_CONFFILE = "ofwdp.conf";
177-
const std::string WARESDEV_WARESHUB_FILE = "wareshub.json";
177+
const std::string WARESDEV_WARESHUB_FILE = "wareshub.json"; // deprecated
178178
const std::string WARESDEV_MIGRATION_WORK_DIR = "_migration";
179179
const std::string WARESDEV_MIGRATION_ORIGINAL_DIR = "_original";
180180
const std::string WARESDEV_DOCALYZER_WORK_DIRROOT = "_docalyzer";

src/openfluid/tools/IDHelpers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ bool isValidVariableName(const openfluid::core::VariableName_t& Name)
106106
{
107107
// authorized chars: a to z, A to Z, 0 to 9, -, ., _
108108
// must start by an alphanumeric char
109-
std::regex Exp("[A-Za-z0-9]+([A-Za-z0-9_\\.\\-]*)");
109+
std::regex Exp("[A-Za-z0-9@]+([A-Za-z0-9_\\.\\-@]*)");
110110

111111
return std::regex_match(Name,Exp);
112112
}
@@ -122,7 +122,7 @@ bool isValidTypedVariableName(const openfluid::core::VariableName_t& Name)
122122
// must start by an alphanumeric char
123123
// can have a type between square brackets at the end
124124
std::regex
125-
Exp("[A-Za-z0-9]+([A-Za-z0-9_\\.\\-]*)(\\[(|double|integer|boolean|string|vector|matrix|map|tree|null)\\])?");
125+
Exp("[A-Za-z0-9@]+([A-Za-z0-9_\\.\\-@]*)(\\[(|double|integer|boolean|string|vector|matrix|map|tree|null)\\])?");
126126

127127
return std::regex_match(Name,Exp);
128128
}
@@ -136,7 +136,7 @@ bool isValidAttributeName(const openfluid::core::AttributeName_t& Name)
136136
{
137137
// authorized chars: a to z, A to Z, 0 to 9, -, ., _
138138
// must start by an alphanumeric char
139-
std::regex Exp("[A-Za-z0-9]+([A-Za-z0-9_\\.\\-]*)");
139+
std::regex Exp("[A-Za-z0-9@]+([A-Za-z0-9_\\.\\-@]*)");
140140

141141
return std::regex_match(Name,Exp);
142142
}

src/openfluid/ui/waresdev/WareSrcFiletypeManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void WareSrcFiletypeManager::initializeFileTypes()
209209
m_WareSrcFiletypes["qt-ui"] = FileType;
210210

211211
FileType = WareSrcFiletype();
212-
FileType.m_Extensions = "wareshub.json";
212+
FileType.m_Extensions = "wareshub.json;openfluid-ware.json";
213213
FileType.m_LangCode = "json";
214214
FileType.m_IconPath = ":/ui/common/filetypes/wareshub.png";
215215
FileType.m_HlFilename = "";

src/openfluid/ui/waresdev/WorkspaceDevCheckWorker.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <QDir>
4141

4242
#include <openfluid/ui/waresdev/WorkspaceDevCheckWorker.hpp>
43+
#include <openfluid/config.hpp>
4344

4445

4546
namespace openfluid { namespace ui { namespace waresdev {
@@ -99,15 +100,15 @@ void WorkspaceDevCheckWorker::run()
99100

100101
if (m_CheckWareshub)
101102
{
102-
if (WareDir.exists("wareshub.json"))
103+
if (WareDir.exists(QString::fromStdString(openfluid::config::WARESDEV_WAREMETA_FILE)))
103104
{
104-
writeFileMessage("wareshub.json",true);
105-
emit processed(WType.first,WItem.ID,"wareshub", true);
105+
writeFileMessage(QString::fromStdString(openfluid::config::WARESDEV_WAREMETA_FILE),true);
106+
emit processed(WType.first,WItem.ID,"openfluid-ware", true);
106107
}
107108
else
108109
{
109-
writeFileMessage("wareshub.json",false);
110-
emit processed(WType.first,WItem.ID,"wareshub", false);
110+
writeFileMessage(QString::fromStdString(openfluid::config::WARESDEV_WAREMETA_FILE),false);
111+
emit processed(WType.first,WItem.ID,"openfluid-ware", false);
111112
}
112113
}
113114

src/openfluid/ui/waresdev/WorkspaceDevWaresWidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ namespace openfluid { namespace ui { namespace waresdev {
6363
const WorkspaceDevDashboardTypes::ActionsByRows WorkspaceDevWaresWidget::Actions =
6464
{
6565
{{"configure","Configure"},{"build","Build"},{"doc","Doc"}},
66-
{{"wareshub","wareshub.json"},{"readme","README"},{"license","LICENSE"}},
66+
{{"openfluid-ware",QString::fromStdString(openfluid::config::WARESDEV_WAREMETA_FILE)},{"readme","README"},
67+
{"license","LICENSE"}},
6768
{{"purge","Purge"}}
6869
};
6970

src/openfluid/waresdev/WareSrcContainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void WareSrcContainer::update()
104104
}
105105

106106
std::string JsonFilePath =
107-
openfluid::tools::Filesystem::joinPath({m_AbsolutePath,openfluid::config::WARESDEV_WARESHUB_FILE});
107+
openfluid::tools::Filesystem::joinPath({m_AbsolutePath,openfluid::config::WARESDEV_WAREMETA_FILE});
108108
if (openfluid::tools::Path(JsonFilePath).isFile())
109109
{
110110
m_AbsoluteJsonPath = JsonFilePath;

src/openfluid/waresdev/WareSrcContainer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class OPENFLUID_API WareSrcContainer
9999
std::string m_AbsoluteCMakeListsPath;
100100

101101
/**
102-
Absolute path of the wareshub.json file if it exists, otherwise an empty string
102+
Absolute path of the openfluid-ware.json file if it exists, otherwise an empty string
103103
*/
104104
std::string m_AbsoluteJsonPath;
105105

@@ -181,7 +181,7 @@ class OPENFLUID_API WareSrcContainer
181181
std::string getCMakeListsPath() const;
182182

183183
/**
184-
Returns the absolute path of the wareshub.json file, if this file exists,
184+
Returns the absolute path of the openfluid-ware.json file, if this file exists,
185185
otherwise an empty string
186186
*/
187187
std::string getJsonPath() const;

src/openfluid/waresdev/tests/BuilderextSignatureSerializer_TEST.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#include <openfluid/tools/FilesystemPath.hpp>
4747
#include <openfluid/waresdev/BuilderextSignatureSerializer.hpp>
48+
#include <openfluid/config.hpp>
4849

4950
#include "SignatureCommon.hpp"
5051

@@ -124,7 +125,7 @@ BOOST_AUTO_TEST_CASE(write_json)
124125
auto Sign = getBuilderextRefSignature();
125126

126127
openfluid::waresdev::BuilderextSignatureSerializer()
127-
.writeToJSONFile(Sign,WorkPath.fromThis("openfluid-ware.json").toGeneric());
128+
.writeToJSONFile(Sign,WorkPath.fromThis(openfluid::config::WARESDEV_WAREMETA_FILE).toGeneric());
128129
}
129130

130131

@@ -151,7 +152,7 @@ BOOST_AUTO_TEST_CASE(read_json)
151152
BOOST_REQUIRE_NO_THROW(SignRef.Issues.get(100));
152153
auto Sign =
153154
openfluid::waresdev::BuilderextSignatureSerializer()
154-
.readFromJSONFile(WorkPath.fromThis("openfluid-ware.json").toGeneric());
155+
.readFromJSONFile(WorkPath.fromThis(openfluid::config::WARESDEV_WAREMETA_FILE).toGeneric());
155156

156157
compareSignatures(Sign,SignRef,"read_json");
157158
}

src/openfluid/waresdev/tests/ObserverSignatureSerializer_TEST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(write_json)
111111
auto Sign = getObserverRefSignature();
112112

113113
openfluid::waresdev::ObserverSignatureSerializer()
114-
.writeToJSONFile(Sign,WorkPath.fromThis("openfluid-ware.json").toGeneric());
114+
.writeToJSONFile(Sign,WorkPath.fromThis(openfluid::config::WARESDEV_WAREMETA_FILE).toGeneric());
115115
}
116116

117117

@@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(read_json)
137137
auto SignRef = getObserverRefSignature();
138138
auto Sign =
139139
openfluid::waresdev::ObserverSignatureSerializer()
140-
.readFromJSONFile(WorkPath.fromThis("openfluid-ware.json").toGeneric());
140+
.readFromJSONFile(WorkPath.fromThis(openfluid::config::WARESDEV_WAREMETA_FILE).toGeneric());
141141

142142
compareSignatures(Sign,SignRef,"read_json");
143143
}

0 commit comments

Comments
 (0)