[CARBONDATA-1981][Build] Fix compile error in windows env Fix compile error in windows env
This closes #1762 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/6123e7f3 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/6123e7f3 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/6123e7f3 Branch: refs/heads/fgdatamap Commit: 6123e7f383053d6222ea7870f3028709df4b8db6 Parents: f557545 Author: xuchuanyin <[email protected]> Authored: Fri Jan 5 15:22:01 2018 +0800 Committer: chenliang613 <[email protected]> Committed: Thu Jan 11 18:43:39 2018 +0800 ---------------------------------------------------------------------- build/README.md | 2 ++ build/carbondata-build-info | 36 ---------------------------------- build/carbondata-build-info.bat | 38 ++++++++++++++++++++++++++++++++++++ build/carbondata-build-info.sh | 36 ++++++++++++++++++++++++++++++++++ core/pom.xml | 22 ++++++++++----------- pom.xml | 7 +++++++ 6 files changed, 93 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/build/README.md ---------------------------------------------------------------------- diff --git a/build/README.md b/build/README.md index 65e58d8..028c03a 100644 --- a/build/README.md +++ b/build/README.md @@ -31,6 +31,8 @@ mvn -DskipTests -Pspark-2.1 -Dspark.version=2.1.0 clean package mvn -DskipTests -Pspark-2.2 -Dspark.version=2.2.1 clean package ``` +Note: If you are working in Windows environment, remember to add `-Pwindows` while building the project. + ## For contributors : To build the format code after any changes, please follow the below command. Note:Need install Apache Thrift 0.9.3 ``` http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/build/carbondata-build-info ---------------------------------------------------------------------- diff --git a/build/carbondata-build-info b/build/carbondata-build-info deleted file mode 100755 index 0d619fc..0000000 --- a/build/carbondata-build-info +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -# This script generates the build info for carbondata and places it into the carbondata-version-info.properties file. -# Arguments: -# build_tgt_directory - The target directory where properties file would be created. [./core/target/extra-resources] -# carbondata_version - The current version of carbondata - -RESOURCE_DIR="$1" -mkdir -p "$RESOURCE_DIR" -CARBONDATA_BUILD_INFO="${RESOURCE_DIR}"/carbondata-version-info.properties - -echo_build_properties() { - echo version=$1 - echo revision=$(git rev-parse HEAD) - echo branch=$(git rev-parse --abbrev-ref HEAD) - echo date=$(date -u +%Y-%m-%dT%H:%M:%SZ) -} - -echo_build_properties $2 > "$CARBONDATA_BUILD_INFO" http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/build/carbondata-build-info.bat ---------------------------------------------------------------------- diff --git a/build/carbondata-build-info.bat b/build/carbondata-build-info.bat new file mode 100644 index 0000000..c1b8b27 --- /dev/null +++ b/build/carbondata-build-info.bat @@ -0,0 +1,38 @@ +@echo off + +rem +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. +rem + +rem This script generates the build info for carbondata and places it into the carbondata-version-info.properties file. +rem Arguments: +rem build_tgt_directory - The target directory where properties file would be created. [./core/target/extra-resources] +rem carbondata_version - The current version of carbondata + +set RESOURCE_DIR=%1 +md "%RESOURCE_DIR%" +set CARBONDATA_BUILD_INFO=%RESOURCE_DIR%/carbondata-version-info.properties + +echo version=%2> %CARBONDATA_BUILD_INFO% + +for /f %%i in ('git rev-parse HEAD') do set revision=%%i +echo revision=%revision%>> %CARBONDATA_BUILD_INFO% + +for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set branch=%%i +echo branch=%branch%>> %CARBONDATA_BUILD_INFO% + +for /f "delims=," %%i in ('echo %date:/=-%T%time%Z') do set day=%%i +echo date=%day%>> %CARBONDATA_BUILD_INFO% \ No newline at end of file http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/build/carbondata-build-info.sh ---------------------------------------------------------------------- diff --git a/build/carbondata-build-info.sh b/build/carbondata-build-info.sh new file mode 100755 index 0000000..0d619fc --- /dev/null +++ b/build/carbondata-build-info.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# +# 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. +# + +# This script generates the build info for carbondata and places it into the carbondata-version-info.properties file. +# Arguments: +# build_tgt_directory - The target directory where properties file would be created. [./core/target/extra-resources] +# carbondata_version - The current version of carbondata + +RESOURCE_DIR="$1" +mkdir -p "$RESOURCE_DIR" +CARBONDATA_BUILD_INFO="${RESOURCE_DIR}"/carbondata-version-info.properties + +echo_build_properties() { + echo version=$1 + echo revision=$(git rev-parse HEAD) + echo branch=$(git rev-parse --abbrev-ref HEAD) + echo date=$(date -u +%Y-%m-%dT%H:%M:%SZ) +} + +echo_build_properties $2 > "$CARBONDATA_BUILD_INFO" http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index ebcf0ee..f874615 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -114,24 +114,22 @@ </resources> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.8</version> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> <executions> <execution> <phase>generate-resources</phase> + <!-- Execute the shell script to generate the CarbonData build information. --> <configuration> - <!-- Execute the shell script to generate the CarbonData build information. --> - <target> - <exec executable="bash"> - <arg value="${project.basedir}/../build/carbondata-build-info"/> - <arg value="${project.build.directory}/extra-resources"/> - <arg value="${project.version}"/> - </exec> - </target> + <executable>${project.basedir}/../build/carbondata-build-info${script.exetension}</executable> + <arguments> + <argument>${project.build.directory}/extra-resources</argument> + <argument>${project.version}</argument> + </arguments> </configuration> <goals> - <goal>run</goal> + <goal>exec</goal> </goals> </execution> </executions> http://git-wip-us.apache.org/repos/asf/carbondata/blob/6123e7f3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 0cbfc7b..07fd946 100644 --- a/pom.xml +++ b/pom.xml @@ -117,6 +117,7 @@ <spark.master.url>local[2]</spark.master.url> <hdfs.url>local</hdfs.url> <suite.name>org.apache.carbondata.cluster.sdv.suite.SDVSuites</suite.name> + <script.exetension>.sh</script.exetension> </properties> <repositories> @@ -603,6 +604,12 @@ </plugins> </build> </profile> + <profile> + <id>windows</id> + <properties> + <script.exetension>.bat</script.exetension> + </properties> + </profile> </profiles> </project>
