From 4ce1f1ca16b0013298c51a5311528ae21cdfd645 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Wed, 8 Nov 2017 12:49:00 -0500 Subject: [PATCH] Add Makefile Projects to collection of core build project types. Reuses the old makeNature. Reuses the StandardBuildConfiguration. Generates a pretty simple project for now. Also handles the case where you don't want to generate anything, just create an empty or on an existing source tree. Change-Id: I2f3cddc85d55792a2c537e37d4bc236a3073d930 --- .../cdt/build/gcc/core/GCCToolChain.java | 38 +- .../cdt/cmake/core/CMakeProjectGenerator.java | 9 +- .../icons/cdt_logo_48.png | Bin 0 -> 3654 bytes .../plugin.xml | 1 + .../META-INF/MANIFEST.MF | 6 +- build/org.eclipse.cdt.make.core/plugin.xml | 8 + .../eclipse/cdt/make/core/MakeCorePlugin.java | 11 + .../make/core/MakefileProjectGenerator.java | 89 +++ .../MakefileBuildConfigurationProvider.java | 66 ++ .../templates/simple/Makefile | 12 + .../templates/simple/main.cpp | 4 + .../templates/simple/manifest.xml | 7 + .../META-INF/MANIFEST.MF | 4 +- .../icons/cdt_logo_48.png | Bin 0 -> 3654 bytes build/org.eclipse.cdt.make.ui/plugin.xml | 22 + .../ui/wizards/NewMakefileProjectWizard.java | 78 +++ .../cdt/core/build/CBuildConfiguration.java | 67 +- .../build/StandardBuildConfiguration.java | 8 +- .../cdt/internal/core/build/Messages.java | 1 + .../internal/core/build/ToolChainManager.java | 24 +- .../internal/core/build/messages.properties | 1 + .../debug.product | 576 +++++++++--------- 22 files changed, 675 insertions(+), 357 deletions(-) create mode 100644 build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakefileBuildConfigurationProvider.java create mode 100644 build/org.eclipse.cdt.make.core/templates/simple/Makefile create mode 100644 build/org.eclipse.cdt.make.core/templates/simple/main.cpp create mode 100644 build/org.eclipse.cdt.make.core/templates/simple/manifest.xml create mode 100644 build/org.eclipse.cdt.make.ui/icons/cdt_logo_48.png create mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java index 1b61d1a7b14..c922c4e32c2 100644 --- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java +++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java @@ -288,11 +288,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain { // Change source file to a tmp file (needs to be empty) Path tmpFile = null; for (int i = 1; i < commandLine.size(); ++i) { - if (!commandLine.get(i).startsWith("-")) { //$NON-NLS-1$ - // TODO optimize by dealing with multi arg options like -o + String arg = commandLine.get(i); + if (!arg.startsWith("-")) { //$NON-NLS-1$ Path filePath; try { - filePath = buildDirectory.resolve(commandLine.get(i)); + filePath = buildDirectory.resolve(commandLine.get(i)).normalize(); } catch (InvalidPathException e) { continue; } @@ -312,6 +312,10 @@ public class GCCToolChain extends PlatformObject implements IToolChain { tmpFile = Files.createTempFile(parentPath, ".sc", extension); //$NON-NLS-1$ commandLine.set(i, tmpFile.toString()); } + } else if (arg.equals("-o")) { //$NON-NLS-1$ + // skip over the next arg + // TODO handle other args like this + i++; } } if (tmpFile == null) { @@ -486,7 +490,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain { if (cCommand.contains("gcc")) { //$NON-NLS-1$ cppCommand = cCommand.replace("gcc", "g++"); //$NON-NLS-1$ //$NON-NLS-2$ // Also recognize c++ as an alias for g++ - commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++") }; //$NON-NLS-1$ //$NON-NLS-2$ + commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++"), "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } else if (cCommand.contains("clang")) { //$NON-NLS-1$ cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$ commands = new String[] { cCommand, cppCommand }; @@ -529,21 +533,21 @@ public class GCCToolChain extends PlatformObject implements IToolChain { // ran into an option, we're done. break; } - Path srcPath = Paths.get(arg); - URI uri; - if (srcPath.isAbsolute()) { - uri = srcPath.toUri(); - } else { - try { - uri = buildDirectoryURI.resolve(arg); - } catch (IllegalArgumentException e) { - // Bad URI - continue; + try { + Path srcPath = Paths.get(arg); + URI uri; + if (srcPath.isAbsolute()) { + uri = srcPath.toUri(); + } else { + uri = Paths.get(buildDirectoryURI).resolve(srcPath).toUri().normalize(); } - } - for (IFile resource : root.findFilesForLocationURI(uri)) { - resources.add(resource); + for (IFile resource : root.findFilesForLocationURI(uri)) { + resources.add(resource); + } + } catch (IllegalArgumentException e) { + // Bad URI + continue; } } diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java index de95869895d..45de6077e6a 100644 --- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java +++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java @@ -58,7 +58,9 @@ public class CMakeProjectGenerator extends FMProjectGenerator { List entries = new ArrayList<>(); IProject project = getProject(); - // Create the source folders + // Create the source and output folders + IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$ + TemplateManifest manifest = getManifest(); if (manifest != null) { List srcRoots = getManifest().getSrcRoots(); @@ -69,14 +71,15 @@ public class CMakeProjectGenerator extends FMProjectGenerator { sourceFolder.create(true, true, monitor); } - entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath())); + entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(), + new IPath[] { buildFolder.getFullPath() })); } } else { entries.add(CoreModel.newSourceEntry(getProject().getFullPath())); } } - entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath(), //$NON-NLS-1$ + entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath(), // $NON-NLS-1$ new IPath[] { new Path("**/CMakeFiles/**") })); //$NON-NLS-1$ CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor); diff --git a/build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png b/build/org.eclipse.cdt.core.autotools.ui/icons/cdt_logo_48.png new file mode 100644 index 0000000000000000000000000000000000000000..4f2aecee517a651167bf2876564ac0c53eae21b9 GIT binary patch literal 3654 zcmY*ccRU+v+m2cxRQ1?eBa~W+nUZ71iV-TcN$ssM602ybQK4py*C=X5OVy^W*xWM>s%1pol-Mo2yM$u55~#eqyG z>j(X3rvW+~+7JP#8@{l7a$yNX+Tj2I&>yFh4p30UcS5l9v9!h8qD>B zki$h_@h;(VSe)43BLAzS=Yewz_6fxM1Yku@bzNKoLhu@3@Tt+id;g3|Ch|)mHvgEl&Z<9 z4*j=nnyjWTCG7wJwnQU69ZOr5H+C$6R%84$@-u3e95nsC2vRR8MwCMz<;UCF|2fSe z2YIc{hp2RU6r5ak(U3^#RfV@el*2LYVT@T7fhB1AbvDqRoALT753WH<18 z{pS7=wG$L8ey-V!V zUm&H8f+JdWsl`E?S9dnj6DsOG(0=BCXK`wTl3*j&|F9s!W>2pf+=w^Hq z$k4UU%6|KKM^NiM;<61v+N{2k*2``S5RU3ES5~WD4)A@cSR*JQ3yJv7+~iZyd09cP z67seTdsnvfyb$7p0r#A31jMme9RQRvVyQ+*POB(YcSA94G=;>1()ir6SPNh6GrOee zl2V^Nm*_v$#)pYti@Sb~hlmNAzHX74t^d{zXOzAIB$&V5DUj{vC zUh@>nZB;Rs{w>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aLSw=bajDEWy@qRtk#-a?rhkqukUx-?qtMt zO7ai31&XOs*AgpzUdJ1C?r`j!2_PUNJk&#bybVKH$*PNrGQ-XGVkyarF7 zT)bM&#*cmuMT_m#Lf9?AE~->dV-cC4VXV@cEl4s2@#b~mcvO73BMOGo2H*N+@Jtrf zKYG0Hzga!?%6A2}J`ALKwT`r$?`c5X%-Fi+I9dC1@=EpdIQQY!)V)c1C<%B^J5+-$ zbd1r9rk;L{;8s9pX*yoI4kKO30R`^Yvo3F=3kphz-6=QR$5NkSZXWx+-^*D_Kx(;) zP0Z`D-y8I(_|uu|N(BcNLDIRUw7+s*TpJgE?hlYC$IKY2q=8edK^d|19z}@Y6NQ~1@ln5ry2Gq*PF+bx`-M3OiU6{x9%}gNKev2oh z=BI;J^FESZ#_S8D!dU$ZL0)N2nq!QJ&7jpHY{y zXMdUO+A+`tq-JiDil;}zw7jbG6OQk5Z!A(0R2#Fa4CD4;lN-ZCT7p}SoS1NtRT*l2 z^5b$AOL`AyAxKb7hM5_srbQ>UnZ69DFWz!~g8SI`DUto~K+U?B;reER_p|#FhAPoD zRSV9mt2o}A+PzN~DnDLVzVsN~mik2UJlwHEz;QP>`rW$HZUW;sc#I9c%9P^#wzqe@ zkG$jzx*zd|7mP_Of1~iwN>l}>MpEx|Ugc)CCMV^N0P|I^lz~(AqqOf0_^8Xo)DZs6c9v!M^l;IAE+vEk@o##_||M(!b6+xqy%ah0q6i#o=xaO zWw@CadW>!3n^=C`ZgLnHN&LO`r?yozEwrP7=&zv!VHZb?7 zNeeiVETH43hwX+$LTyY;?tY)S+M3vw_sH^0O6ImTd6z;wra006vA_OQ0m*Xuxiiu? K)2l-`-}xUPuCq7* literal 0 HcmV?d00001 diff --git a/build/org.eclipse.cdt.core.autotools.ui/plugin.xml b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml index e4abf4678a7..0437944c565 100644 --- a/build/org.eclipse.cdt.core.autotools.ui/plugin.xml +++ b/build/org.eclipse.cdt.core.autotools.ui/plugin.xml @@ -4,6 +4,7 @@