Skip to content

Support java executable in path #1215

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/release_notes/issue1214-improve-pre-commit-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Patch Updates

- Changes to the pre-commit hook. Issue [1214](https://github.com/semanticarts/gist/issues/1214).
- Prefer RDF_TOOLKIT_JAVA_HOME over JAVA_HOME, since it is the more specific name.
- If neither of those work, use a java executable if one is available in the PATH.
19 changes: 8 additions & 11 deletions tools/serializer/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,20 @@ function findJava() {

java_home=""

if [ "${RDF_TOOLKIT_JAVA_HOME}" != "" ] ; then
java_home="${RDF_TOOLKIT_JAVA_HOME}"
fi
if [ "${JAVA_HOME}" != "" ] ; then
java_home="${JAVA_HOME}"
fi
if [ "${java_home}" == "" ] ; then
log_error A-$JAVA_HOME
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java ${min_java} or later installation."
return 1
if [ "${RDF_TOOLKIT_JAVA_HOME}" != "" ] ; then
java_home="${RDF_TOOLKIT_JAVA_HOME}"
fi
java_home=${java_home/C:\\/\/c\/}
java_home=${java_home//\\/\/}
log "java_home =" ${java_home}

if [ -x "${java_home}/bin/java" ] ; then
whichJava="${java_home}/bin/java"
elif [ -x `which java` ] ; then
whichJava=`which java`
else
log_error "Could not find java in your RDF_TOOLKIT_JAVA_HOME or JAVA_HOME: ${java_home}."
log_error "Please set RDF_TOOLKIT_JAVA_HOME or JAVA_HOME to point to a Java ${min_java} or later installation."
Expand Down Expand Up @@ -146,13 +143,13 @@ function serialize() {
esac

log "Target format is $tfmt"
if [[ $file =~ .*About.* ]] ; then

if [[ $file =~ .*About.* ]] ; then
log "Skipping unsupported file $file"
return 0
fi

if [[ $file =~ .*OWL.* ]] ; then
if [[ $file =~ .*OWL.* ]] ; then
log "Skipping unsupported file $file"
return 0
fi
Expand Down Expand Up @@ -185,7 +182,7 @@ __log_config__
--use-dtd-subset \
--string-data-typing explicit \
--suppress-named-individuals \
--inline-blank-nodes
--inline-blank-nodes
rc=$?
set +x

Expand Down