From: risd...@avalonconsult.com
Date: Wed, 24 Feb 2016 07:26:18 -0600
Subject: Re: ant idea and IntelliJ 15
To: dev@lucene.apache.org


On Wed, Feb 24, 2016 at 3:47 AM, Jan Høydahl <jan....@cominvent.com> wrote:
Not sure if the problem started after I upgraded to IntelliJ 15 or after we 
switched to git or what. Others having the same issues?
I haven't had any issues using IntellJ 14, 15 or 16 EAP with lucene-solr before 
or after switching to Git. I've cloned and cleaned out the IntelliJ settings 
multiple times and haven't had any issues opening the project in IntelliJ after 
doing "ant idea".
Kevin Risden
Hadoop Tech Lead | Avalon Consulting, LLCM: 732 213 8417LinkedIn | Google+ | 
Twitter

MG>Kevin..would you know of a GIT macrodef which can sub for build.xml 
svn-checker macrodef?
 <macrodef xmlns:ivy="antlib:org.apache.ivy.ant" name="svn-checker">    
<attribute name="failonmodifications" default="true"/> <!-- false if file 
modifications are allowed -->    <sequential>      <ivy:cachepath 
organisation="org.tmatesoft.svnkit" module="svnkit" 
revision="${svnkit.version}"        inline="true" conf="default" 
transitive="true" pathid="svnkit.classpath"/>      <local 
name="svn.checkprops.failed"/>      <local name="svn.unversioned.failed"/>      
<local name="svn.keywords.failed"/>      <local name="svn.changed.failed"/>     
 <groovy taskname="svn" classpathref="svnkit.classpath"><![CDATA[        import 
org.tmatesoft.svn.core.*;        import org.tmatesoft.svn.core.wc.*;        
import org.apache.tools.ant.Project;                SVNClientManager manager = 
SVNClientManager.newInstance();        SVNStatusClient statusClient = 
manager.getStatusClient();        SVNWCClient wcClient = manager.getWCClient(); 
               File basedir = new 
File(properties['basedir']).getAbsoluteFile();        int baseLen = 
basedir.toString().length();
        // do some fake check, to verify if this is valid SVN working copy. If 
this fails ignore checks but log some useful message.        
task.log('Initializing working copy...');        try {          
wcClient.doInfo(basedir, SVNRevision.WORKING);        } catch (SVNException ex) 
{          def ec = ex.getErrorMessage().getErrorCode();          int code = 
ec.getCode();          int category = ec.getCategory();          if (code == 
SVNErrorCode.WC_NOT_DIRECTORY.getCode() || code == 
SVNErrorCode.WC_NOT_FILE.getCode()) {            task.log('WARNING: Development 
directory is not an SVN checkout! Disabling checks...', Project.MSG_WARN);      
      return;          } else if (category == SVNErrorCode.WC_CATEGORY) {       
     task.log('WARNING: Development directory is not a valid SVN checkout (' + 
ex.getErrorMessage() + '). Disabling checks...', Project.MSG_WARN);            
return;          } else {            throw ex;          }        }              
  def convertRelative = {          file -> '.' + 
file.getAbsolutePath().substring(baseLen).replace(File.separatorChar, 
(char)'/');        }
        Set missingProps = new TreeSet(), withKeywords = new TreeSet(), 
unversioned = new TreeSet(), changed = new TreeSet();
        task.log('Getting all versioned and unversioned files...');        
statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), 
false, true, false, false, {          status ->          SVNStatusType 
nodeStatus = status.getNodeStatus();          if (nodeStatus == 
SVNStatusType.STATUS_UNVERSIONED || nodeStatus == SVNStatusType.STATUS_MISSING) 
{            unversioned.add(convertRelative(status.getFile()));          } 
else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != 
SVNStatusType.STATUS_DELETED) {            
missingProps.add(convertRelative(status.getFile()));          }          if 
(nodeStatus == SVNStatusType.STATUS_MODIFIED || nodeStatus == 
SVNStatusType.STATUS_REPLACED ||              nodeStatus == 
SVNStatusType.STATUS_DELETED  || nodeStatus == SVNStatusType.STATUS_ADDED) {    
        changed.add(convertRelative(status.getFile()));          }        } as 
ISVNStatusHandler, null);
        task.log('Filtering files with existing svn:eol-style...');        
wcClient.doGetProperty(basedir, 'svn:eol-style', SVNRevision.WORKING, 
SVNRevision.WORKING, true, {          file, prop -> 
missingProps.remove(convertRelative(file));        } as ISVNPropertyHandler);   
             task.log('Filtering files with binary svn:mime-type...');        
wcClient.doGetProperty(basedir, 'svn:mime-type', SVNRevision.WORKING, 
SVNRevision.WORKING, true, {          file, prop ->          prop = 
SVNPropertyValue.getPropertyAsString(prop.getValue());          if 
(prop.startsWith('application/') || prop.startsWith('image/')) {            
missingProps.remove(convertRelative(file));          }        } as 
ISVNPropertyHandler);                task.log('Scanning for files with 
svn:keywords property...');        wcClient.doGetProperty(basedir, 
'svn:keywords', SVNRevision.WORKING, SVNRevision.WORKING, true, {          
file, prop -> withKeywords.add(convertRelative(file));        } as 
ISVNPropertyHandler);                def setProjectPropertyFromSet(prop, set) { 
         if (set) {            properties[prop] = '* ' + 
set.join(properties['line.separator'] + '* ');          }        };        
setProjectPropertyFromSet('svn.checkprops.failed', missingProps);        
setProjectPropertyFromSet('svn.keywords.failed', withKeywords);        
setProjectPropertyFromSet('svn.unversioned.failed', unversioned);        
setProjectPropertyFromSet('svn.changed.failed', changed);      ]]></groovy>     
 <fail if="svn.checkprops.failed"        message="The following files are 
missing svn:eol-style (or binary 
svn:mime-type):${line.separator}${svn.checkprops.failed}"/>      <fail 
if="svn.keywords.failed"        message="The following files have the 
svn:keywords property set:${line.separator}${svn.keywords.failed}"/>      <fail 
if="svn.unversioned.failed"        message="Source checkout is dirty after 
running tests!!! Offending files:${line.separator}${svn.unversioned.failed}"/>  
    <fail message="Source checkout is modified !!! Offending 
files:${line.separator}${svn.changed.failed}">        <condition>          
<and>             <istrue value="@{failonmodifications}"/>             <isset 
property="svn.changed.failed"/>          </and>        </condition>      
</fail>    </sequential>  </macrodef>
MG>svn-checker invoked thru check-svn-working-copy target in build.xml
  <target name="check-svn-working-copy" 
depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">    
<svn-checker failonmodifications="false"/>  </target>
MG>Thanks Kevin!
-------------------------------------------------------------------------------------------------------------This
 message (including any attachments) contains confidential information intended 
for a specific individual and purpose, and is protected by law. If you are not 
the intended recipient, you should delete this message. Any disclosure, 
copying, or distribution of this message, or the taking of any action based on 
it, is strictly prohibited.
                                          

Reply via email to