Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Limit on failures due to configure issues on mismatched cabal

(#91)
  • Loading branch information...
commit 81a2cc6edb7e7f55b164ca2171e856ebaad85ae7 1 parent 87ac7a4
@JPMoresmau authored
View
2  docs/releasenotes/net.sf.eclipsefp.haskell_2.5.2.txt
@@ -16,7 +16,7 @@ Fixes:
Features:
- Rebuild executables if workspace is autobuilding when dependent project is rebuilt (https://github.com/JPMoresmau/eclipsefp/issues/94)
-
+ - Limit on failures due to configure issues on mismatched cabal (https://github.com/JPMoresmau/eclipsefp/issues/91)
Internal:
View
14 ...sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BWFacade.java
@@ -68,6 +68,7 @@
private static boolean showedNoExeError=false;
+ private int configureFailures=0;
private String bwPath;
//private String tempFolder=".dist-buildwrapper";
@@ -208,7 +209,7 @@ public JSONArray build(BuildOptions buildOptions){
command.add("--cabaltarget="+buildOptions.getTarget().toString());
JSONArray arr=run(command,ARRAY,false);
refreshDist();
- if (arrC!=null){
+ if (arr!=null && arrC!=null){
for (int a=0;a<arrC.length();a++){
try {
arr.put(a, arrC.get(a));
@@ -1173,7 +1174,7 @@ private synchronized void addBuildWrapperPath(ProcessBuilder pb){
return null;
}
showedNoExeError=false;
-
+ boolean isConfigureAction=args.size()>0 && ("synchronize".equals(args.get(0)) || "configure".equals(args.get(0)) || "build".equals(args.get(0)));
args.addFirst(bwPath);
args.add("--tempfolder="+DIST_FOLDER);
if (cabalImplDetails!=null){
@@ -1254,6 +1255,15 @@ private synchronized void addBuildWrapperPath(ProcessBuilder pb){
}
configure(new BuildOptions());
return run(new LinkedList<String>(args.subList(1, args.size()-4)),f,false);
+ } else if (needDelete){
+ configureFailures++;
+ if (BuildWrapperPlugin.getMaxConfigureFailures()>=0 && configureFailures>=BuildWrapperPlugin.getMaxConfigureFailures()){
+ BuildWrapperPlugin.logError(BWText.error_toomanyfailures, null);
+ showedNoExeError=true;
+ bwPath=null;
+ }
+ } else if (isConfigureAction){
+ configureFailures=0;
}
// maybe now the folder exists...
if (needSetDerivedOnDistDir){
View
10 ...fp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BuildWrapperPlugin.java
@@ -3,7 +3,6 @@
import java.io.File;
import java.io.Writer;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import net.sf.eclipsefp.haskell.buildwrapper.types.CabalImplDetails;
@@ -51,6 +50,7 @@
private static Map<IProject, BWFacade> facades=new HashMap<IProject, BWFacade>();
private static String bwPath;
+ private static int maxConfigureFailures=10;
public static boolean logAnswers=false;
@@ -291,6 +291,14 @@ public static void setBwPath(String bwPath) {
}
}
}
+
+ public static int getMaxConfigureFailures() {
+ return maxConfigureFailures;
+ }
+
+ public static void setMaxConfigureFailures(int maxConfigureFailures) {
+ BuildWrapperPlugin.maxConfigureFailures = maxConfigureFailures;
+ }
View
1  ...eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/util/BWText.java
@@ -35,6 +35,7 @@
public static String error_deleteMarkers;
public static String error_gettingFlags;
public static String error_noexe;
+ public static String error_toomanyfailures;
public static String error_derived;
public static String error_refreshLocal;
public static String error_clean;
View
1  ...efp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/util/bwtext.properties
@@ -15,6 +15,7 @@ project_cabal_duplicate=More than one cabal file under project {0}
error_deleteMarkers = Error deleting problem markers
error_gettingFlags = Error getting saved flags from project
error_noexe = No buildwrapper executable defined
+error_toomanyfailures = Too many configure failures. Disabling buildwrapper.
error_derived = Cannot set derived status on build-wrapper folder
error_refreshLocal = Error refreshing resource
error_clean = Error cleaning project
View
1  ...haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/IPreferenceConstants.java
@@ -31,6 +31,7 @@
public final static String IGNORE_MISSING_EXECUTABLE = "IGNORE_MISSING_EXECUTABLE";
public final static String IGNORE_TOOOLD_EXECUTABLE = "IGNORE_TOOOLD_EXECUTABLE";
public final static String VERBOSE_INTERACTION = "VERBOSE_INTERACTION"; //$NON-NLS-1$
+ public final static String MAX_CONFIGURE_FAILURES = "MAX_CONFIGURE_FAILURES"; //$NON-NLS-1$
public final static String BROWSER_VERBOSE_INTERACTION = "BROWSER_VERBOSE_INTERACTION"; //$NON-NLS-1$
//public final static String RUN_CABAL_UPDATE = "RUN_CABAL_UPDATE" ; //$NON-NLS-1$
View
21 ...ipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/scion/ScionPP.java
@@ -7,6 +7,7 @@
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -47,10 +48,14 @@
private BooleanFieldEditor verboseInteractionField;
private Composite verboseInteractionFieldC;
+ private IntegerFieldEditor maxConfigureFailuresField;
+ private Composite maxConfigureFailuresFieldC;
+
private BooleanFieldEditor verboseBrowserInteractionField;
private Composite verboseBrowserInteractionFieldC;
- private CabalImplsBlock cabalBlock;
+
+ private CabalImplsBlock cabalBlock;
private BooleanFieldEditor ignoreMissing;
private BooleanFieldEditor ignoreTooOld;
@@ -130,6 +135,18 @@ public void selectionChanged( final SelectionChangedEvent event ) {
verboseInteractionField.setPreferenceStore( prefStore );
verboseInteractionField.load();
+ maxConfigureFailuresFieldC = new Composite(bwComposite, SWT.NONE);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
+ gd.horizontalSpan=2;
+ maxConfigureFailuresFieldC.setLayoutData( gd);
+ maxConfigureFailuresField = new IntegerFieldEditor( IPreferenceConstants.MAX_CONFIGURE_FAILURES,
+ UITexts.maxConfigureFailures_title,
+ maxConfigureFailuresFieldC );
+ maxConfigureFailuresField.setValidRange( -1, Integer.MAX_VALUE );
+ maxConfigureFailuresField.setPage(this);
+ maxConfigureFailuresField.setPreferenceStore( prefStore );
+ maxConfigureFailuresField.load();
+
// scion-browser
Group sbComposite = new Group(parentComposite, SWT.NONE);
@@ -204,6 +221,7 @@ public static void initializeDefaults(final IPreferenceStore store) {
store.setDefault( VERBOSE_INTERACTION, false );
store.setDefault( BROWSER_VERBOSE_INTERACTION, false );
store.setDefault( SCION_BROWSER_EXTRA_HOOGLE_PATH, "" );
+ store.setDefault( MAX_CONFIGURE_FAILURES, 10 );
}
@Override
@@ -216,6 +234,7 @@ public boolean performOk() {
ignoreMissing.store();
ignoreTooOld.store();
verboseInteractionField.store();
+ maxConfigureFailuresField.store();
verboseBrowserInteractionField.store();
// hlintExecutableField.store();
View
5 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/scion/ScionManager.java
@@ -315,6 +315,8 @@ private synchronized void buildWrapperFactorySetup(){
boolean verbose = preferenceStore.getBoolean( IPreferenceConstants.VERBOSE_INTERACTION );
BuildWrapperPlugin.logAnswers=verbose;
+ int maxConfigureFailures=preferenceStore.getInt( IPreferenceConstants.MAX_CONFIGURE_FAILURES );
+ BuildWrapperPlugin.setMaxConfigureFailures( maxConfigureFailures );
if ( buildWrapperExecutablePath != null && buildWrapperExecutablePath.toFile().exists() ) {
try {
@@ -645,6 +647,9 @@ public void propertyChange( final PropertyChangeEvent event ) {
} else if (event.getProperty().equals(IPreferenceConstants.VERBOSE_INTERACTION)){
boolean verbose = ((Boolean)event.getNewValue()).booleanValue();
BuildWrapperPlugin.logAnswers=verbose;
+ } else if (event.getProperty().equals(IPreferenceConstants.MAX_CONFIGURE_FAILURES)){
+ int max = ((Integer)event.getNewValue()).intValue();
+ BuildWrapperPlugin.setMaxConfigureFailures( max );
}
}
View
2  net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/UITexts.java
@@ -815,6 +815,8 @@
public static String option_overwrite;
+ public static String maxConfigureFailures_title;
+
private static final String BUNDLE_NAME = UITexts.class.getPackage()
.getName() + ".uitexts"; //$NON-NLS-1$
View
4 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/uitexts.properties
@@ -818,4 +818,6 @@ folder_add_title=Add new folder
folder_add_duplicate=Folder already exists
folder_add_empty=Folder name cannot be empty
-option_overwrite=Overwrite existing files
+option_overwrite=Overwrite existing files
+
+maxConfigureFailures_title=Maximum number of 'configure' failures (-1: no limit)
Please sign in to comment.
Something went wrong with that request. Please try again.