-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3639 from Autodesk/donnels/EMSUSD-1024/new_comman…
…d_to_report_build_info EMSUSD-1024 - Provide a mechanism to retrieve an unambigous version f…
- Loading branch information
Showing
11 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright 2024 Autodesk, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#include <mayaUsd/buildInfo.h> | ||
|
||
namespace MAYAUSD_NS_DEF { | ||
|
||
int MayaUsdBuildInfo::buildNumber() { return MAYAUSD_BUILD_NUMBER; } | ||
const char* MayaUsdBuildInfo::gitCommit() { return MAYAUSD_GIT_COMMIT; } | ||
const char* MayaUsdBuildInfo::gitBranch() { return MAYAUSD_GIT_BRANCH; } | ||
const char* MayaUsdBuildInfo::cutId() { return MAYAUSD_CUT_ID; } | ||
const char* MayaUsdBuildInfo::buildDate() { return MAYAUSD_BUILD_DATE; } | ||
|
||
} // namespace MAYAUSD_NS_DEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Copyright 2024 Autodesk, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#ifndef MAYAUSD_BUILDINFO_H | ||
#define MAYAUSD_BUILDINFO_H | ||
|
||
#include <mayaUsd/base/api.h> | ||
|
||
#define MAYAUSD_BUILD_NUMBER ${MAYAUSD_BUILD_NUMBER} | ||
#define MAYAUSD_GIT_COMMIT "${MAYAUSD_GIT_COMMIT}" | ||
#define MAYAUSD_GIT_BRANCH "${MAYAUSD_GIT_BRANCH}" | ||
#define MAYAUSD_CUT_ID "${MAYAUSD_CUT_ID}" | ||
#define MAYAUSD_BUILD_DATE ${MAYAUSD_BUILD_DATE} | ||
|
||
namespace MAYAUSD_NS_DEF { | ||
|
||
class MAYAUSD_CORE_PUBLIC MayaUsdBuildInfo | ||
{ | ||
public: | ||
static int buildNumber(); | ||
static const char* gitCommit(); | ||
static const char* gitBranch(); | ||
static const char* cutId(); | ||
static const char* buildDate(); | ||
}; | ||
|
||
} // namespace MAYAUSD_NS_DEF | ||
|
||
#endif // MAYAUSD_BUILDINFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// | ||
// Copyright 2024 Autodesk | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#include "mayaUsdInfoCommand.h" | ||
|
||
#include <mayaUsd/buildInfo.h> | ||
|
||
#include <maya/MArgParser.h> | ||
#include <maya/MSyntax.h> | ||
|
||
#define XSTR(x) STR(x) | ||
#define STR(x) #x | ||
|
||
namespace MAYAUSD_NS_DEF { | ||
|
||
const MString MayaUsdInfoCommand::commandName("mayaUsd"); | ||
|
||
namespace { | ||
|
||
// Versioning and build information. | ||
constexpr auto kMajorVersion = "-mjv"; | ||
constexpr auto kMajorVersionLong = "-majorVersion"; | ||
|
||
constexpr auto kMinorVersion = "-mnv"; | ||
constexpr auto kMinorVersionLong = "-minorVersion"; | ||
|
||
constexpr auto kPatchVersion = "-pv"; | ||
constexpr auto kPatchVersionLong = "-patchVersion"; | ||
|
||
constexpr auto kVersion = "-v"; | ||
constexpr auto kVersionLong = "-version"; | ||
|
||
constexpr auto kCutId = "-c"; | ||
constexpr auto kCutIdLong = "-cutIdentifier"; | ||
|
||
constexpr auto kBuildNumber = "-bn"; | ||
constexpr auto kBuildNumberLong = "-buildNumber"; | ||
|
||
constexpr auto kGitCommit = "-gc"; | ||
constexpr auto kGitCommitLong = "-gitCommit"; | ||
|
||
constexpr auto kGitBranch = "-gb"; | ||
constexpr auto kGitBranchLong = "-gitBranch"; | ||
|
||
constexpr auto kBuildDate = "-bd"; | ||
constexpr auto kBuildDateLong = "-buildDate"; | ||
|
||
} // namespace | ||
|
||
MSyntax MayaUsdInfoCommand::createSyntax() | ||
{ | ||
MSyntax syntax; | ||
syntax.enableQuery(false); | ||
syntax.enableEdit(false); | ||
|
||
// Versioning and build information flags. | ||
syntax.addFlag(kMajorVersion, kMajorVersionLong); | ||
syntax.addFlag(kMinorVersion, kMinorVersionLong); | ||
syntax.addFlag(kPatchVersion, kPatchVersionLong); | ||
syntax.addFlag(kVersion, kVersionLong); | ||
syntax.addFlag(kCutId, kCutIdLong); | ||
syntax.addFlag(kBuildNumber, kBuildNumberLong); | ||
syntax.addFlag(kGitCommit, kGitCommitLong); | ||
syntax.addFlag(kGitBranch, kGitBranchLong); | ||
syntax.addFlag(kBuildDate, kBuildDateLong); | ||
|
||
return syntax; | ||
} | ||
|
||
MStatus MayaUsdInfoCommand::doIt(const MArgList& args) | ||
{ | ||
MStatus st; | ||
MArgParser argData(syntax(), args, &st); | ||
if (!st) | ||
return st; | ||
|
||
if (argData.isFlagSet(kMajorVersion)) { | ||
setResult(MAYAUSD_MAJOR_VERSION); // int | ||
} else if (argData.isFlagSet(kMinorVersion)) { | ||
setResult(MAYAUSD_MINOR_VERSION); // int | ||
} else if (argData.isFlagSet(kPatchVersion)) { | ||
setResult(MAYAUSD_PATCH_LEVEL); // int | ||
} else if (argData.isFlagSet(kVersion)) { | ||
setResult(XSTR(MAYAUSD_VERSION)); // convert to string | ||
} else if (argData.isFlagSet(kCutId)) { | ||
setResult(MayaUsdBuildInfo::cutId()); | ||
} else if (argData.isFlagSet(kBuildNumber)) { | ||
setResult(MayaUsdBuildInfo::buildNumber()); | ||
} else if (argData.isFlagSet(kGitCommit)) { | ||
setResult(MayaUsdBuildInfo::gitCommit()); | ||
} else if (argData.isFlagSet(kGitBranch)) { | ||
setResult(MayaUsdBuildInfo::gitBranch()); | ||
} else if (argData.isFlagSet(kBuildDate)) { | ||
setResult(MayaUsdBuildInfo::buildDate()); | ||
} | ||
|
||
return MS::kSuccess; | ||
} | ||
|
||
} // namespace MAYAUSD_NS_DEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// Copyright 2024 Autodesk | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#ifndef MAYAUSD_MAYAUSD_CMD_H | ||
#define MAYAUSD_MAYAUSD_CMD_H | ||
|
||
#include <mayaUsd/mayaUsd.h> | ||
|
||
#include <maya/MPxCommand.h> | ||
|
||
namespace MAYAUSD_NS_DEF { | ||
|
||
class MayaUsdInfoCommand : public MPxCommand | ||
{ | ||
public: | ||
static void* creator() { return new MayaUsdInfoCommand(); } | ||
static MSyntax createSyntax(); | ||
|
||
static const MString commandName; | ||
|
||
MStatus doIt(const MArgList& args) override; | ||
}; | ||
|
||
} // namespace MAYAUSD_NS_DEF | ||
#endif // MAYAUSD_MAYAUSD_CMD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.