buildsystem,epj2make,ide: add the optional use of resources.ear before target linking...
authorRejean Loyer <redj@ecere.com>
Mon, 14 Mar 2016 14:53:22 +0000 (10:53 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:24 +0000 (18:23 -0400)
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/project/Project.ec
ide/src/project/ProjectNode.ec

index bf7f56b..1476d6b 100644 (file)
@@ -1096,6 +1096,7 @@ public:
       get { return executableLauncher; }
       isset { return false; }
    }
+   bool resourcesDotEar;
 private:
    Array<String> includeDirs { };
    Array<String> libraryDirs { };
index 620bb2c..01782aa 100644 (file)
@@ -1154,6 +1154,24 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
+   Button resourcesDotEar
+   {
+      this, text = $"Use resources.ear", position = { 300, 308 };
+      isCheckbox = true;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         CompilerConfig compiler = loadedCompiler;
+         if(compiler)
+         {
+            compiler.resourcesDotEar = button.checked;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   };
+
    CompilerOptionsTab()
    {
       Platform p;
@@ -1186,6 +1204,7 @@ class CompilerOptionsTab : CompilersSubTab
          linkerFlags.strings = compiler.linkerFlags;
          objectFileExt.contents = compiler.objectFileExt;
          outputFileExt.contents = compiler.outputFileExt;
+         resourcesDotEar.checked = compiler.resourcesDotEar;
 
          labelTargetPlatform.disabled = disabled;
          targetPlatform.disabled = disabled;
index 5f14944..8934619 100644 (file)
@@ -2531,6 +2531,11 @@ private:
             f.Puts("# TOOLCHAIN\n");
             f.Puts("\n");
 
+            f.Puts("# OPTIONS\n");
+            if(compiler.resourcesDotEar)
+               f.Puts("USE_RESOURCES_EAR := defined\n");
+            f.Puts("\n");
+
             f.Puts("# EXTENSIONS\n");
             if(compiler.outputFileExt)
                f.Printf("OUT := %s\n", compiler.outputFileExt);
@@ -3022,6 +3027,13 @@ private:
             resNode.GenMakefilePrintNode(f, this, resources, null, listItems, config, null);
          OutputFileList(f, "RESOURCES", listItems, varStringLenDiffs, null);
 
+         f.Puts("ifdef USE_RESOURCES_EAR\n");
+         f.Puts("RESOURCES_EAR = $(OBJ)resources.ear\n");
+         f.Puts("else\n");
+         f.Puts("RESOURCES_EAR = $(RESOURCES)\n");
+         f.Puts("endif\n");
+         f.Puts("\n");
+
          f.Puts("LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)\n");
          f.Puts("\n");
          if((config && config.options && config.options.libraries) ||
@@ -3357,6 +3369,15 @@ private:
             f.Puts("\n");
          }
 
+         if(resNode.files && resNode.files.count && !noResources)
+         {
+            f.Puts("ifdef USE_RESOURCES_EAR\n");
+            f.Puts("$(RESOURCES_EAR): $(RESOURCES) | objdir\n");
+               resNode.GenMakefileAddResources(f, resNode.path, config, "RESOURCES_EAR");
+            f.Puts("endif\n");
+            f.Puts("\n");
+         }
+
          // *** Target ***
 
          // This would not rebuild the target on updated objects
@@ -3367,7 +3388,7 @@ private:
          f.Puts("$(OBJECTS): | objdir\n");
 
          // This alone was breaking the tarball, object directory does not get created first (order-only rules happen last it seems!)
-         f.Printf("$(TARGET): $(SOURCES)%s $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir%s\n",
+         f.Printf("$(TARGET): $(SOURCES)%s $(RESOURCES_EAR) $(SYMBOLS) $(OBJECTS) | objdir%s\n",
                rcSourcesParts ? " $(RCSOURCES)" : "", sameOrRelObjTargetDirs ? "" : " targetdir");
 
          f.Printf("\t@$(call rm,$(OBJ)objects.lst)\n");
@@ -3408,7 +3429,11 @@ private:
             }
          }
          if(resNode.files && resNode.files.count && !noResources)
-            resNode.GenMakefileAddResources(f, resNode.path, config);
+         {
+            f.Puts("ifndef USE_RESOURCES_EAR\n");
+            resNode.GenMakefileAddResources(f, resNode.path, config, "TARGET");
+            f.Puts("endif\n");
+         }
          f.Puts("else\n");
          f.Puts("ifdef WINDOWS_HOST\n");
          f.Puts("\t$(AR) rcs $(TARGET) @$(OBJ)objects.lst $(LIBS)\n");
@@ -3597,6 +3622,12 @@ private:
             OutputCleanActions(f, "IMPORTS", eCsourcesParts);
             OutputCleanActions(f, "SYMBOLS", eCsourcesParts);
          }
+         if(resNode.files && resNode.files.count && !noResources)
+         {
+            f.Puts("ifdef USE_RESOURCES_EAR\n");
+            f.Printf("\t$(call rm,$(RESOURCES_EAR))\n");
+            f.Puts("endif\n");
+         }
          f.Puts("\n");
 
          f.Puts("realclean: cleantarget\n");
index 5af5371..ad9702e 100644 (file)
@@ -2136,7 +2136,7 @@ private:
       delete platforms;
    }
 
-   void GenMakefileAddResources(File f, String resourcesPath, ProjectConfig prjConfig)
+   void GenMakefileAddResources(File f, String resourcesPath, ProjectConfig prjConfig, const char * resourcesTarget)
    {
       int count = 0;
       if(files)
@@ -2161,7 +2161,7 @@ private:
 
                // $(EAR) aw%s --- /*quiet ? "q" : */""
                if(count == 0)
-                  f.Printf("\t%s$(EAR) aw$(EARFLAGS) $(TARGET)", ts.a);
+                  f.Printf("\t%s$(EAR) aw$(EARFLAGS) $(%s)", ts.a, resourcesTarget);
 
                tempPath[0] = '\0';
                if(eString_PathInsideOfMore(child.path, resourcesPath, tempPath))
@@ -2207,7 +2207,7 @@ private:
          for(child : files)
          {
             if(child.type == folder)
-               child.GenMakefileAddResources(f, resourcesPath, prjConfig);
+               child.GenMakefileAddResources(f, resourcesPath, prjConfig, resourcesTarget);
          }
       }
    }