Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-4343: Add auto-serialization example for .net #227

Merged
merged 3 commits into from
Mar 5, 2018

Conversation

pdxcodemonkey
Copy link
Contributor

Signed-off-by: Ivan Godwin igodwin@pivotal.io
Signed-off-by: Ryan McMahon rmcmahon@pivotal.io

# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.8.2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.10 is required to do CSharp.


project(AuthInitialize CSharp)

message(STATUS "Assembly is ${GEODE_ASSEMBLY}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug messages?


add_executable(${PROJECT_NAME}
Program.cs
ExampleAuthInitialize.cs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting

message(STATUS "project binary dir: ${PROJECT_BINARY_DIR}")

message(STATUS "current source dir is ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "Attempting to link to ${CMAKE_CURRENT_SOURCE_DIR}/../../../build/clicache/src/Debug/Apache.Geode.dll")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded build directory!

Program.cs
ExampleAuthInitialize.cs)

message(STATUS "output dir is ${RUNTIME_OUTPUT_DIRECTORY}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug output?

Copy link
Contributor

@jake-at-work jake-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checked in .csproj files should be deleted now that a CMake file has been added.

{
if (-not (Test-Path env:GEODE_HOME))
{
echo "Could not find gfsh. Please set the GEODE_HOME path. e.g. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why write powershell script and use cmd echo?

@@ -16,4 +16,6 @@ cmake_minimum_required(VERSION 3.4)

project(Apache.Geode.Examples)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs language NONE

# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.8.2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSharp requires 3.10.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, below all the same comments that the other CMake file has.

return "Order: [" + OrderId + ", " + Name + ", " + Quantity + "]";
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should end with a blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the heck??? I definitely added these, looks like VS or maybe Git "helped" me by taking the newline back out. Will try again.

cache.Close();
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should end with a blank line.

{
if (-not (Test-Path env:GEODE_HOME))
{
echo "Could not find gfsh. Please set the GEODE_HOME path. e.g. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issues as with the other powershell script.


Console.WriteLine("Storing id and username in the region");

const string rtimmonsKey = "rtimmons";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, why not using var since the type is deduced by the rhs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using const string prevents the variable from being modified once initialized.

So this won't compile:

const string foo = "foo"
foo = "bar"

but this will:

var foo = "foo"
foo = "bar"

Using 'const string' is mostly an indication of intent (rtimmonsKey should not be modified after initialization), but also protects against accidentally reassigning it at some point (unlikely).


message(STATUS "Assembly is ${GEODE_ASSEMBLY}")

if ("${GEODE_ASSEMBLY}" STREQUAL "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be using the find_package to find this and not force the user to specify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find_package call in Findgeode-native.cmake is broken and we made the decision to just require the location explicitly rather than rathole on fixing the script for this story.

@pdxcodemonkey pdxcodemonkey changed the title GEODE-4341: Add auto-serialization example for .net GEODE-4343: Add auto-serialization example for .net Feb 23, 2018

project(AuthInitialize CSharp)

if ("${GEODE_ASSEMBLY}" STREQUAL "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use find_package.

{
if (-not (Test-Path env:GEODE_HOME))
{
write-output "Could not find gfsh. Please set the GEODE_HOME path. e.g. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write-Output to be consistent with PS formatting. May want to consider Write-Host.


Console.WriteLine("Storing id and username in the region");

const string rtimmonsKey = "rtimmons";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, why not using var since the type is deduced by the rhs?

@jake-at-work
Copy link
Contributor

@austxcodemonkey Please rebase and force push.

Signed-off-by: Ivan Godwin <igodwin@pivotal.io>
Signed-off-by: Ryan McMahon <rmcmahon@pivotal.io>
if(NOT TARGET ${GEODE_NATIVE_CPP_TARGET})
set(GEODE_NATIVE_CPP_TARGET "apache.geode::cpp")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep consistent naming. Maybe we should change this from apache.geode::cpp to ApacheGeode::cpp to match find_package(ApacheGeode COMPONENT cpp).

INTERFACE_INCLUDE_DIRECTORIES "${GEODE_NATIVE_CPP_INCLUDE_DIR}")
endif()
if(NOT TARGET ${GEODE_NATIVE_DOTNET_TARGET})
set(GEODE_NATIVE_DOTNET_TARGET "apache.geode::dotnet")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for naming.

@@ -31,15 +31,14 @@
#
# This module will set the following variables in your project:
#
# ``GEODE_NATIVE_INCLUDE_DIRS``
# ``GEODE_NATIVE_CPP_INCLUDE_DIRS``
# where to find CacheFactory.hpp, etc.
# ``GEODE_NATIVE_LIBRARIES``
# the libraries to link against to use Geode Native.
# ``GEODE_NATIVE_FOUND``
# true if the Geode Native headers and libraries were found.
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to verify there names are still valid and update the docs to include the dotnet component.

@jake-at-work jake-at-work merged commit 8eb5c67 into apache:develop Mar 5, 2018
mmartell pushed a commit to mmartell/geode-native that referenced this pull request Mar 6, 2018
* Normalize naming convention in find module.
mmartell pushed a commit to mmartell/geode-native that referenced this pull request Mar 6, 2018
* Normalize naming convention in find module.
jake-at-work pushed a commit to jake-at-work/geode-native that referenced this pull request Oct 6, 2018
* Normalize naming convention in find module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants