You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2015/04/25 18:19:50 UTC

svn commit: r1676033 - in /uima/ruta/trunk: ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/ ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/

Author: pkluegl
Date: Sat Apr 25 16:19:50 2015
New Revision: 1676033

URL: http://svn.apache.org/r1676033
Log:
UIMA-4287
- fixed IDE descriptor building and error checking in mixin projects


Modified:
    uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java
    uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/RutaEngineAndCallChecker.java
    uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java

Modified: uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java?rev=1676033&r1=1676032&r2=1676033&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java (original)
+++ uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/LanguageCheckerVisitor.java Sat Apr 25 16:19:50 2015
@@ -983,13 +983,19 @@ public class LanguageCheckerVisitor exte
 
     try {
       typeSystemDescription = getTypeSystemOfScript();
-      IPath descriptorRootPath = RutaProjectUtils.getDescriptorRootPath(sourceModule
-              .getScriptProject().getProject());
-      IPath basicTSD = descriptorRootPath.append("BasicTypeSystem.xml");
-      boolean exists = basicTSD.toFile().exists();
-      if (exists) {
-        importCompleteTypeSystem(basicTSD, null);
-      } else {
+      IProject project = sourceModule
+              .getScriptProject().getProject();
+      List<IFolder> descriptorFolders = RutaProjectUtils.getDescriptorFolders(project);
+      boolean exists = false;
+      for (IFolder iFolder : descriptorFolders) {
+        IPath basicTSD = iFolder.getLocation().append("BasicTypeSystem.xml");
+        exists = basicTSD.toFile().exists();
+        if (exists) {
+          importCompleteTypeSystem(basicTSD, null);
+          break;
+        }
+      }
+      if(!exists) {
         // not in a common ruta project
         // try to find the file in the classpath
         URL resource = classLoader.getResource("org/apache/uima/ruta/engine/BasicTypeSystem.xml");

Modified: uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/RutaEngineAndCallChecker.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/RutaEngineAndCallChecker.java?rev=1676033&r1=1676032&r2=1676033&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/RutaEngineAndCallChecker.java (original)
+++ uima/ruta/trunk/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/validator/RutaEngineAndCallChecker.java Sat Apr 25 16:19:50 2015
@@ -93,9 +93,9 @@ public class RutaEngineAndCallChecker im
         } catch (CoreException e) {
         }
       }
-      IPreferenceStore preferenceStore = RutaIdeUIPlugin.getDefault().getPreferenceStore();
-      boolean noVM = preferenceStore.getBoolean(RutaCorePreferences.NO_VM_IN_DEV_MODE);
-      if (!(noVM && Platform.inDevelopmentMode())) {
+      // IPreferenceStore preferenceStore = RutaIdeUIPlugin.getDefault().getPreferenceStore();
+      // boolean noVM = preferenceStore.getBoolean(RutaCorePreferences.NO_VM_IN_DEV_MODE);
+      // if (!(noVM && Platform.inDevelopmentMode())) {
         try {
           Collection<String> dependencies = RutaLaunchConfigurationDelegate.getClassPath(project);
           URL[] urls = new URL[dependencies.size()];
@@ -110,7 +110,7 @@ public class RutaEngineAndCallChecker im
         } catch (MalformedURLException e) {
           RutaIdeUIPlugin.error(e);
         }
-      }
+//      }
 
     }
 

Modified: uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java?rev=1676033&r1=1676032&r2=1676033&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java Sat Apr 25 16:19:50 2015
@@ -137,48 +137,61 @@ public class RutaBuilder extends Abstrac
       IPath pathToModule = sourceModule.getResource().getLocation();
       String elementName = RutaProjectUtils.getModuleName(pathToModule);
 
-      IScriptProject proj = sourceModule.getScriptProject();
-      // TODO: dont use desc path!
-      IPath descPath = RutaProjectUtils.getDescriptorRootPath(proj.getProject());
-      IPath scriptPath = RutaProjectUtils.getScriptRootPath(proj.getProject());
-      IPath relativePackagePath = RutaProjectUtils.getPackagePath(sourceModule.getResource()
-              .getLocation(), proj.getProject());
-      IPath descPackagePath = descPath.append(relativePackagePath);
-      String typeSystem = descPackagePath.append(elementName + "TypeSystem.xml").toPortableString();
-      String engine = descPackagePath.append(elementName + "Engine.xml").toPortableString();
+      IScriptProject scriptProject = sourceModule.getScriptProject();
+      
+      IProject project = scriptProject.getProject();
+      
+      IPath descPath = RutaProjectUtils.getDescriptorRootPath(project);
       String basicTS = descPath.append("BasicTypeSystem.xml").toPortableString();
       String basicE = descPath.append("BasicEngine.xml").toPortableString();
+      
+      List<IFolder> descriptorFolders = RutaProjectUtils.getDescriptorFolders(project);
+      for (IFolder iFolder : descriptorFolders) {
+        File btsd = iFolder.getLocation().append("BasicTypeSystem.xml").toFile();
+        File baed = iFolder.getLocation().append("BasicEngine.xml").toFile();
+        if(btsd.exists() && baed.exists()) {
+          basicTS = btsd.getAbsolutePath();
+          basicE = baed.getAbsolutePath();
+          descPath = iFolder.getLocation();
+          break;
+        }
+      }
+      
+      IPath scriptPath = RutaProjectUtils.getScriptRootPath(project);
+      IPath relativePackagePath = RutaProjectUtils.getPackagePath(sourceModule.getResource()
+              .getLocation(), project);
+      IPath descPackagePath = descPath.append(relativePackagePath);
+      String typeSystem = descPackagePath.append(elementName + RutaProjectUtils.getTypeSystemSuffix(project) + ".xml").toPortableString();
+      String engine = descPackagePath.append(elementName + RutaProjectUtils.getAnalysisEngineSuffix(project) + ".xml").toPortableString();
 
-      // TODO: may not work with other script folders
-      IPath relativeTo = pathToModule.makeAbsolute().makeRelativeTo(scriptPath);
+      
+      String scriptWithPackagePath = RutaProjectUtils.getScriptWithPackage(pathToModule, project);
       List<String> scriptPathList = new ArrayList<String>();
       List<String> descriptorPathList = new ArrayList<String>();
 
       // add all folders
       try {
-        List<IFolder> scriptFolders = RutaProjectUtils.getAllScriptFolders(proj);
+        List<IFolder> scriptFolders = RutaProjectUtils.getAllScriptFolders(scriptProject);
         scriptPathList.addAll(RutaProjectUtils.getFolderLocations(scriptFolders));
       } catch (CoreException e) {
         RutaIdeCorePlugin.error(e);
       }
 
       try {
-        List<IFolder> descriptorFolders = RutaProjectUtils.getAllDescriptorFolders(proj
-                .getProject());
-        descriptorPathList.addAll(RutaProjectUtils.getFolderLocations(descriptorFolders));
+        List<IFolder> allDescriptorFolders = RutaProjectUtils.getAllDescriptorFolders(project);
+        descriptorPathList.addAll(RutaProjectUtils.getFolderLocations(allDescriptorFolders));
       } catch (Exception e) {
         RutaIdeCorePlugin.error(e);
       }
 
       String[] descriptorPaths = descriptorPathList.toArray(new String[0]);
       String[] scriptPaths = scriptPathList.toArray(new String[0]);
-      String mainScript = relativeTo.toPortableString();
+      String mainScript = scriptWithPackagePath;
       mainScript = mainScript.replaceAll("/", ".");
       if (mainScript.endsWith(RutaEngine.SCRIPT_FILE_EXTENSION)) {
         mainScript = mainScript.substring(0, mainScript.length() - 5);
       }
-      Collection<String> dependencies = RutaProjectUtils.getClassPath(proj
-              .getProject());
+      Collection<String> dependencies = RutaProjectUtils.getClassPath(project);
       URL[] urls = new URL[dependencies.size()];
       int counter = 0;
       for (String dep : dependencies) {