Fixing #270763 - Move clang-tidy integration to nb contrib release82
authorIlia Gromov <ilia@netbeans.org>
Wed, 07 Jun 2017 18:50:35 +0300
branchrelease82
changeset 184220bdf8b66a76b
parent 18421 99d684ee4e50
child 18423 b9d9af239a0c
Fixing #270763 - Move clang-tidy integration to nb contrib
(transplanted from a225e57384a7fe82b6fb8ae18f5aa52e2350ce5a)
clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/build-impl.xml
clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/genfiles.properties
clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/release/clang-tidy/README.txt
clang-tidy.wrappers/post-build.sh
clang-tidy.wrappers/pre-build.sh
ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/ClangAnalyzerOptions.java
     1.1 --- a/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/build-impl.xml	Wed Jun 07 17:36:09 2017 +0300
     1.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/build-impl.xml	Wed Jun 07 18:50:35 2017 +0300
     1.3 @@ -1,9 +1,16 @@
     1.4 -<?xml version="1.0" encoding="UTF-8"?>
     1.5 -<!--
     1.6 +<?xml version="1.0" encoding="UTF-8"?>                                                                                                                                                                                                                                          
     1.7 +<!--                                                                                                                                                                                                                                                                            
     1.8  *** GENERATED FROM project.xml - DO NOT EDIT  ***
     1.9  ***         EDIT ../build.xml INSTEAD         ***
    1.10  -->
    1.11  <project name="org.netbeans.modules.analysis.clangtidy.Linux_x86_64-impl" basedir="..">
    1.12 +    <fail message="Please build using Ant 1.7.1 or higher.">
    1.13 +        <condition>
    1.14 +            <not>
    1.15 +                <antversion atleast="1.7.1"/>
    1.16 +            </not>
    1.17 +        </condition>
    1.18 +    </fail>
    1.19      <property file="nbproject/private/platform-private.properties"/>
    1.20      <property file="nbproject/platform.properties"/>
    1.21      <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
    1.22 @@ -13,13 +20,21 @@
    1.23              <property name="@{name}" value="${@{value}}"/>
    1.24          </sequential>
    1.25      </macrodef>
    1.26 +    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
    1.27 +        <attribute name="property"/>
    1.28 +        <attribute name="value"/>
    1.29 +        <sequential>
    1.30 +            <property name="@{property}" value="@{value}"/>
    1.31 +        </sequential>
    1.32 +    </macrodef>
    1.33      <property file="${user.properties.file}"/>
    1.34      <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    1.35 -    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    1.36 -    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
    1.37 +    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    1.38 +    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    1.39 +    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
    1.40          <condition>
    1.41              <not>
    1.42 -                <available file="${harness.dir}" type="dir"/>
    1.43 +                <contains string="${cluster.path.evaluated}" substring="platform"/>
    1.44              </not>
    1.45          </condition>
    1.46      </fail>
     2.1 --- a/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/nbproject/genfiles.properties	Wed Jun 07 17:36:09 2017 +0300
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,5 +0,0 @@
     2.4 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     2.5 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     2.6 -nbproject/build-impl.xml.data.CRC32=d77a417d
     2.7 -nbproject/build-impl.xml.script.CRC32=395569c1
     2.8 -nbproject/build-impl.xml.stylesheet.CRC32=68e521fc@2.72.1
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/clang-tidy.wrappers/analysis.clangtidy.Linux_x86_64/release/clang-tidy/README.txt	Wed Jun 07 18:50:35 2017 +0300
     3.3 @@ -0,0 +1,1 @@
     3.4 +Place clang-tidy binary near this file
     4.1 --- a/clang-tidy.wrappers/post-build.sh	Wed Jun 07 17:36:09 2017 +0300
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,49 +0,0 @@
     4.4 -#!/bin/bash -x
     4.5 -
     4.6 -#
     4.7 -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     4.8 -#
     4.9 -function add_module() {
    4.10 -    platform=$1
    4.11 -    unzip -q com-oracle-tools-analysis-clangtidy-${platform}.nbm Info/info.xml
    4.12 -#    cat Info/info.xml | egrep -e "<.?module|<.?manifest|<.?license" >> catalog.xml
    4.13 -    cat Info/info.xml | egrep -e "<.?module|<.?manifest" >> catalog.xml
    4.14 -    downlod_size=`ls -l com-oracle-tools-analysis-clangtidy-${platform}.nbm | awk '{print $5}'`
    4.15 -    sed -e "s|downloadsize=\"0\"|downloadsize=\"${downlod_size}\"|" catalog.xml > tmp
    4.16 -    sed -e "s|distribution=\"\"|distribution=\"com-oracle-tools-analysis-clangtidy-${platform}\.nbm\"|" tmp > catalog.xml
    4.17 -    rm -rf tmp
    4.18 -    rm -rf Info
    4.19 -}
    4.20 -
    4.21 -function add_modules_licence() {
    4.22 -    platform=$1
    4.23 -    unzip -q com-oracle-tools-analysis-clangtidy-${platform}.nbm Info/info.xml
    4.24 -    sed -e '/<license name/,/license>/!d' Info/info.xml >> catalog.xml
    4.25 -    rm -rf Info
    4.26 -}
    4.27 -
    4.28 -#upload="/net/everest/export1/sside/parfait/upload/"
    4.29 -export projects=$1
    4.30 -
    4.31 -#cp ${projects}/Linux_x86/build/com-oracle-tools-analysis-parfait-Linux_x86.nbm out/
    4.32 -cp ${projects}/Linux_x86_64/build/com-oracle-tools-analysis-clangtidy-Linux_x86_64.nbm out/
    4.33 -
    4.34 -cd out
    4.35 -timestamp=`date +%H/%M/%S/%m/%d/%Y`
    4.36 -
    4.37 -echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" > catalog.xml
    4.38 -echo "" >> catalog.xml
    4.39 -echo "<!DOCTYPE module_updates PUBLIC \"-//NetBeans//DTD Autoupdate Catalog 2.6//EN\" \"http://www.netbeans.org/dtds/autoupdate-catalog-2_6.dtd\">" >> catalog.xml
    4.40 -echo "<module_updates timestamp=\"${timestamp}\">" >> catalog.xml
    4.41 -echo '<module_group name="Oracle Developer Studio">' >> catalog.xml
    4.42 -
    4.43 -#add_module Linux_x86
    4.44 -add_module Linux_x86_64
    4.45 -
    4.46 -echo '</module_group>' >> catalog.xml
    4.47 -add_modules_licence Linux_x86_64
    4.48 -echo '</module_updates>' >> catalog.xml
    4.49 -cp catalog.xml catalog.xml.1
    4.50 -rm -f catalog.xml.gz
    4.51 -gzip catalog.xml
    4.52 -mv catalog.xml.1 catalog.xml
     5.1 --- a/clang-tidy.wrappers/pre-build.sh	Wed Jun 07 17:36:09 2017 +0300
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,22 +0,0 @@
     5.4 -#!/bin/bash -x
     5.5 -
     5.6 -export download_dir="$1"
     5.7 -export projects_dir="$2"
     5.8 -export netbeans="${projects_dir}/../../../netbeans"
     5.9 -export harness="${projects_dir}/../../../netbeans/harness"
    5.10 -
    5.11 -assemble() {
    5.12 -  local platform=$1
    5.13 -
    5.14 -  # erase contents of project's binary dir
    5.15 -  local project_bin="${projects_dir}/${platform}/release/clang-tidy"
    5.16 -  rm -rf   "$project_bin"
    5.17 -  mkdir -p "$project_bin"
    5.18 -
    5.19 -  cp "${download_dir}/clang-tidy-${platform}" "$project_bin"
    5.20 -
    5.21 -  ant -f ${projects_dir}/${platform} -Ddo.not.clean.module.config.xml=true -Dcontinue.after.failing.tests=true -Dnbplatform.NetBeans_IDE_CND_Dev.netbeans.dest.dir="$netbeans" -Dnbplatform.NetBeans_IDE_CND_Release.netbeans.dest.dir="$netbeans" -Dnbplatform.NetBeans_IDE_CND_Dev.harness.dir="$harness" -Dnbplatform.NetBeans_IDE_CND_Release.harness.dir="$harness" clean netbeans
    5.22 -  ant -f ${projects_dir}/${platform} -Dcontinue.after.failing.tests=true -Dnbplatform.NetBeans_IDE_CND_Dev.netbeans.dest.dir="$netbeans" -Dnbplatform.NetBeans_IDE_CND_Release.netbeans.dest.dir="$netbeans" -Dnbplatform.NetBeans_IDE_CND_Dev.harness.dir="$harness" -Dnbplatform.NetBeans_IDE_CND_Release.harness.dir="$harness" -Dkeystore=${WORKSPACE}/keystore/key.priv -Dnbm_alias=nb_ide -Dstorepass=ch0b0t7 nbm
    5.23 -}
    5.24 -
    5.25 -assemble "Linux_x86_64"
     6.1 --- a/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/ClangAnalyzerOptions.java	Wed Jun 07 17:36:09 2017 +0300
     6.2 +++ b/ide.analysis.modernize/src/org/netbeans/modules/ide/analysis/modernize/options/ClangAnalyzerOptions.java	Wed Jun 07 18:50:35 2017 +0300
     6.3 @@ -78,6 +78,8 @@
     6.4              String relativePath = String.format("%s/%s-%s", CLANG_BINARY_NAME, CLANG_BINARY_NAME, codeBase); //NOI18N
     6.5              File toolFile = InstalledFileLocator.getDefault().locate(relativePath, codeBase, false);
     6.6              if (toolFile != null && toolFile.exists()) {
     6.7 +                toolFile.setExecutable(true);
     6.8 +                System.out.println(toolFile.canExecute());
     6.9                  result = toolFile.getAbsolutePath();
    6.10              }
    6.11          }
    6.12 @@ -98,7 +100,7 @@
    6.13      }
    6.14  
    6.15      public static String getMissingModuleName() {
    6.16 -        return "com.oracle.tools.analysis.clangtidy." + getCodeBase(); //NOI18N
    6.17 +        return "org.netbeans.modules.analysis.clangtidy." + getCodeBase(); //NOI18N
    6.18      }
    6.19  
    6.20      public static String getCodeBase() {