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

Find system ruby 3.2 #5158

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Apr 19, 2024

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec requested a review from kbenne April 19, 2024 07:57
@jmarrec jmarrec self-assigned this Apr 19, 2024
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is:

  1. Outdated
  2. Already preset in CMake itself
  3. Not going to be used, becasue conan2 places a FindRuby.cmake in our build dir

Comment on lines +6 to +29

# **NOTE**: we do not want to grab the conan one, which is statically built on all platforms, and is a msvc build on windows
# Instead, we want to grab the regularly installed one on your system

set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
ruby
ruby2.7
ruby2.7.2
ruby27
ruby272)
ruby3.2
ruby3.2.2
ruby32
ruby322
)

# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the one in build/Ruby-install/)
# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the conan one)
find_program(SYSTEM_RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}
HINTS
"/usr/local/rvm/rubies/ruby-2.7.2/bin/"
"/usr/local/rvm/rubies/ruby-2.7.2/bin/ruby"
"/usr/share/rvm/rubies/ruby-2.7.2/bin/"
"$ENV{HOME}/.rvm/rubies/ruby-2.7.2/bin/"
"/usr/local/rvm/rubies/ruby-3.2.2/bin/"
"/usr/local/rvm/rubies/ruby-3.2.2/bin/ruby"
"/usr/share/rvm/rubies/ruby-3.2.2/bin/"
"$ENV{HOME}/.rvm/rubies/ruby-3.2.2/bin/"

"C:/Ruby27-x64/bin/"
"C:/Ruby32-x64/bin/"

"/usr/local/ruby272/bin/"
"/usr/local/ruby27/bin/"
"/usr/local/ruby322/bin/"
"/usr/local/ruby32/bin/"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I realized CMake was happily picking my rvm ruby 2.7 because of this, so update the hints (and code comments)

Comment on lines +35 to +55
if(SYSTEM_RUBY_EXECUTABLE)
# Validate the version
execute_process (COMMAND "${SYSTEM_RUBY_EXECUTABLE}" -e "puts RUBY_VERSION"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _system_ruby_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_result OR (_system_ruby_version VERSION_LESS 3.2) OR (_system_ruby_version VERSION_GREATER_EQUAL 3.3))
if(_result)
message(WARNING "Cannot use the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\"")
else()
message(WARNING "Wrong version \"${_system_ruby_version}\" for the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\", not >= 3.2 < 3.3")
endif()
set_property (CACHE SYSTEM_RUBY_EXECUTABLE PROPERTY VALUE "SYSTEM_RUBY_EXECUTABLE-NOTFOUND")
else()
message(STATUS "Found SYSTEM_RUBY_EXECUTABLE=${SYSTEM_RUBY_EXECUTABLE} with version ${_system_ruby_version}")
endif()
endif()

if(NOT SYSTEM_RUBY_EXECUTABLE)
message(WARNING "Your system ruby wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.")
message(WARNING "A valid system ruby (3.2.2 or near) wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Validate the version of the ruby executable found.

If not the right version (I allow any 3.2.x), set not found and explain why.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Apr 19, 2024

@kbenne Just opening this PR with comment so you can follow, but I'm going to merge it back to my #5149 branch

@jmarrec jmarrec merged commit 0f4b9d6 into 5147_modernize_measure_templates Apr 19, 2024
@jmarrec jmarrec deleted the find_system_ruby branch April 19, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant