HBASE-24449: Generate version.h include file during compilation. (#1794)

This is needed for the hbase-native-client to compile. Also ships
the includes in the assembly tar.

Signed-off-by: Marc <phrocker@apache.org>
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Bharath Vissapragada 2020-05-28 15:26:53 -07:00 committed by GitHub
parent f06248ef84
commit fe1fc25fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 4 deletions

View File

@ -106,6 +106,16 @@
<include>*.dylib</include>
</includes>
</fileSet>
<!-- includes for native client -->
<fileSet>
<directory>${project.basedir}/../hbase-common/target/generated-sources/native</directory>
<outputDirectory>include</outputDirectory>
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
<includes>
<include>**/*.h</include>
</includes>
</fileSet>
<!-- This is only necessary until maven fixes the intra-project dependency bug
in maven 3.0. Until then, we have to include the test jars for sub-projects. When
fixed, the below dependencySet stuff is sufficient for pulling in the test jars as

View File

@ -92,7 +92,7 @@
<property name="generated.sources" location="${project.build.directory}/generated-sources"/>
<exec executable="bash" failonerror="true">
<arg line="${basedir}/src/saveVersion.sh ${project.version} ${generated.sources}/java"/>
<arg line="${basedir}/src/saveVersion.sh ${project.version} ${generated.sources}"/>
</exec>
</target>
</configuration>

View File

@ -24,7 +24,8 @@ unset LANG
unset LC_CTYPE
version=$1
outputDirectory=$2
javaOutputDirectory="$2/java/"
nativeOutputDirectory="$2/native/utils/"
pushd .
cd ..
@ -60,8 +61,26 @@ else
fi
popd
mkdir -p "$outputDirectory/org/apache/hadoop/hbase"
cat >"$outputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF
mkdir -p "$javaOutputDirectory/org/apache/hadoop/hbase"
cat >"$javaOutputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Generated by src/saveVersion.sh
*/
@ -82,3 +101,42 @@ public class Version {
}
EOF
mkdir -p "$nativeOutputDirectory"
cat > "$nativeOutputDirectory/version.h" <<EOF
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Generated by src/saveVersion.sh from hbase-common.
*/
#pragma once
namespace hbase {
class Version {
public:
static constexpr const char* version = "$version";
static constexpr const char* revision = "$revision";
static constexpr const char* user = "$user";
static constexpr const char* date = "$date";
static constexpr const char* url = "$url";
static constexpr const char* src_checksum = "$srcChecksum";
};
} /* namespace hbase */
EOF