diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index bfb5529d2..9a5504162 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -17,16 +17,16 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 + uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.6 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'adopt' - name: Build Sloeber with Maven - run: mvn --no-transfer-progress verify -Pall,sloeber_release,NOSDK -Dtest=NightlyJenkins -DfailIfNoTests=false + run: mvn --no-transfer-progress verify -Pall,sloeber_release,NOSDK -Dtest=RegressionTest -DfailIfNoTests=false - name: Archive production artifacts uses: actions/upload-artifact@v4 diff --git a/.project b/.project new file mode 100644 index 000000000..d0ccde818 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + arduino-eclipse-plugin + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..4824b8026 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/io.sloeber.ManagedBuild/.settings/org.eclipse.core.resources.prefs b/io.sloeber.ManagedBuild/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 68a030452..000000000 --- a/io.sloeber.ManagedBuild/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=windows-1252 diff --git a/io.sloeber.autoBuild.test/.classpath b/io.sloeber.autoBuild.test/.classpath new file mode 100644 index 000000000..64ed6b379 --- /dev/null +++ b/io.sloeber.autoBuild.test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/io.sloeber.autoBuild.test/.gitignore b/io.sloeber.autoBuild.test/.gitignore index abf891104..b5d3d71c5 100644 --- a/io.sloeber.autoBuild.test/.gitignore +++ b/io.sloeber.autoBuild.test/.gitignore @@ -1,3 +1,4 @@ +/*.log +/bin/ /.classpath /.project -/hs_err_pid4576.log diff --git a/io.sloeber.autoBuild.test/.project b/io.sloeber.autoBuild.test/.project new file mode 100644 index 000000000..bd3a8f807 --- /dev/null +++ b/io.sloeber.autoBuild.test/.project @@ -0,0 +1,28 @@ + + + io.sloeber.autoBuild.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/io.sloeber.autoBuild.test/META-INF/MANIFEST.MF b/io.sloeber.autoBuild.test/META-INF/MANIFEST.MF new file mode 100644 index 000000000..969929334 --- /dev/null +++ b/io.sloeber.autoBuild.test/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Test +Bundle-SymbolicName: io.sloeber.autoBuild.test;singleton:=true +Bundle-Version: 4.4.3.qualifier +Require-Bundle: io.sloeber.autoBuild, + org.junit, + junit-jupiter-api;bundle-version="5.0.0", + junit-jupiter-params;bundle-version="5.0.0", + org.eclipse.core.resources, + org.apache.log4j;bundle-version="1.2.24", + org.eclipse.cdt.core;bundle-version="7.4.200", + org.eclipse.osgi, + org.eclipse.core.jobs, + org.eclipse.swt, + org.eclipse.core.runtime, + org.eclipse.cdt.core.native, + org.eclipse.equinox.registry, + org.eclipse.ui.workbench, + io.sloeber.autoBuild.ui;bundle-version="4.4.3" +Automatic-Module-Name: io.sloeber.autoBuild.test +Bundle-RequiredExecutionEnvironment: JavaSE-21 diff --git a/io.sloeber.autoBuild.test/build.properties b/io.sloeber.autoBuild.test/build.properties new file mode 100644 index 000000000..e9863e281 --- /dev/null +++ b/io.sloeber.autoBuild.test/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/io.sloeber.autoBuild.test/launch/AutoBuildIssues.launch b/io.sloeber.autoBuild.test/launch/AutoBuildIssues.launch new file mode 100644 index 000000000..070d03d80 --- /dev/null +++ b/io.sloeber.autoBuild.test/launch/AutoBuildIssues.launch @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.test/launch/AutoBuildRegression.launch b/io.sloeber.autoBuild.test/launch/AutoBuildRegression.launch new file mode 100644 index 000000000..3f821327a --- /dev/null +++ b/io.sloeber.autoBuild.test/launch/AutoBuildRegression.launch @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.test/launch/Autobuild AutoBuildCreateBasicProjects.launch b/io.sloeber.autoBuild.test/launch/Autobuild AutoBuildCreateBasicProjects.launch new file mode 100644 index 000000000..a520a8a56 --- /dev/null +++ b/io.sloeber.autoBuild.test/launch/Autobuild AutoBuildCreateBasicProjects.launch @@ -0,0 +1,484 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.test/launch/AutobuildAutoBuildCreateProject.launch b/io.sloeber.autoBuild.test/launch/AutobuildAutoBuildCreateProject.launch new file mode 100644 index 000000000..004552770 --- /dev/null +++ b/io.sloeber.autoBuild.test/launch/AutobuildAutoBuildCreateProject.launch @@ -0,0 +1,437 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.test/plugin.xml b/io.sloeber.autoBuild.test/plugin.xml new file mode 100644 index 000000000..0282d2eda --- /dev/null +++ b/io.sloeber.autoBuild.test/plugin.xml @@ -0,0 +1,600 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.test/pom.xml b/io.sloeber.autoBuild.test/pom.xml new file mode 100644 index 000000000..ed0883da2 --- /dev/null +++ b/io.sloeber.autoBuild.test/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + io.sloeber.arduino-eclipse-plugin + io.sloeber.parent + 4.4.3-SNAPSHOT + ../io.sloeber.parent + + + io.sloeber.autoBuild.test + eclipse-test-plugin + + + + + org.junit.jupiter + junit-jupiter-engine + 5.9.2 + test + + + + + + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho.version} + + + + org.eclipse.cdt.core.systemConsole + + + + + + diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Defaults.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Defaults.java new file mode 100644 index 000000000..f04d7da67 --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Defaults.java @@ -0,0 +1,28 @@ +package io.sloeber.autoBuild.helpers; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +import io.sloeber.autoBuild.api.AutoBuildNewProjectCodeManager; +import io.sloeber.autoBuild.api.ICodeProvider; +import io.sloeber.autoBuild.integration.AutoBuildManager; +import io.sloeber.autoBuild.schema.api.IProjectType; + +@SuppressWarnings("nls") +public class Defaults { + + static public final String defaultExtensionPointID = "io.sloeber.autoBuild.buildDefinitions"; + static public final String defaultExtensionID = "io.sloeber.autoBuild"; + static public final String defaultProjectTypeID = "io.sloeber.autoBuild.projectType.exe"; + static public final IProjectType defaultProjectType= AutoBuildManager.getProjectType(defaultExtensionPointID, defaultExtensionID, defaultProjectTypeID, true); + static public final String defaultNatureID = CCProjectNature.CC_NATURE_ID; + static public final Bundle thisBundle = Platform.getBundle("io.sloeber.autoBuild.test"); //$NON-NLS-1$ + public static final ICodeProvider c_exeCodeProvider = AutoBuildNewProjectCodeManager.getDefault().getCodeProvider("io.sloeber.autoBuild.templateCode.c.exe"); + public static final ICodeProvider c_LibProvider = AutoBuildNewProjectCodeManager.getDefault().getCodeProvider("io.sloeber.autoBuild.templateCode.c.lib"); + public static final ICodeProvider cpp_exeCodeProvider = AutoBuildNewProjectCodeManager.getDefault().getCodeProvider("io.sloeber.autoBuild.templateCode.cpp.exe"); + public static final ICodeProvider cpp_LibProvider = AutoBuildNewProjectCodeManager.getDefault().getCodeProvider("io.sloeber.autoBuild.templateCode.cpp.lib"); + public static final ICodeProvider compoundProvider = AutoBuildNewProjectCodeManager.getDefault().getCodeProvider("io.sloeber.autoBuild.templateCode.compound"); + + +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Shared.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Shared.java new file mode 100644 index 000000000..ca54cddc6 --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/helpers/Shared.java @@ -0,0 +1,244 @@ +package io.sloeber.autoBuild.helpers; + +import static org.junit.Assert.*; + +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.ICModelMarker; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; +import org.osgi.framework.Bundle; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription; + +@SuppressWarnings("nls") +public class Shared { + private static boolean deleteProjects = true; + private static boolean closeFailedProjects = false; + private static boolean closeProjects = true; + + public static void setDeleteProjects(boolean deleteProjects) { + Shared.deleteProjects = deleteProjects; + } + + public static void setCloseProjects(boolean close) { + Shared.closeProjects = close; + } + + public static void setCloseFailedProjects(boolean closeFailedProjects) { + Shared.closeFailedProjects = closeFailedProjects; + } + + public static boolean isCloseFailedProjects() { + return closeFailedProjects; + } + + private static void doFail(IProject project, String error) { + if (closeFailedProjects) { + try { + project.close(null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + fail(error); + } + + public static void hasProjectBuildErrors(IProject project) throws CoreException { + IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); + for (IMarker marker : markers) { + if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) { + doFail(project, "The project contains error"); + } + } + } + + public static void checkIfConfigurationBuildCorrectly(IProject project, + IAutoBuildConfigurationDescription autoBuild, Boolean shouldMakefileExists) { + IFolder buildRootFolder = autoBuild.getBuildFolder(); + String projName = project.getName(); + + // check to see if the makefile is present or not + if (shouldMakefileExists != null) { + if (shouldMakefileExists.booleanValue() && (!buildRootFolder.getFile("makefile").exists())) { + doFail(project, "makefile " + buildRootFolder.getFile("makefile") + " should exist but does not "); + } + if ((!shouldMakefileExists.booleanValue()) && buildRootFolder.getFile("makefile").exists()) { + doFail(project, "makefile " + buildRootFolder.getFile("makefile") + " should not exist but does"); + } + } + + // check to see if any of the expected outputfiles exists + String[] validOutputs = { projName + ".elf", projName + ".bin", projName + ".hex", projName + ".exe", + "lib_" + projName + ".so", projName + ".so", "lib_" + projName + ".a", projName + ".dll", + "application.axf",projName }; + for (String validOutput : validOutputs) { + if (buildRootFolder.getFile(validOutput).exists()) { + return; + } + } + + doFail(project, "The build did not produce a file that is considered a targetfile in build folder " + + buildRootFolder.toString()); + } + + public static void waitForAllJobsToFinish() throws InterruptedException { + Thread.sleep(1000); + IJobManager jobMan = Job.getJobManager(); + int counter = 0; + while ((!jobMan.isIdle()) && (counter++ < 120)) { + Thread.sleep(500); + // If you have to wait for counter it may mean you are + // runnning the test in the gui thread + } + // As nothing is running now we can start installing + } + + public static IPath getTemplateFolder(String templateName) throws Exception { + Bundle bundle = Platform.getBundle("io.sloeber.tests"); + Path path = new Path("src/templates/" + templateName); + URL fileURL = FileLocator.find(bundle, path, null); + URL resolvedFileURL = FileLocator.toFileURL(fileURL); + return new Path(resolvedFileURL.toURI().getPath()); + } + + public static IPath getprojectZip(String zipFileName) throws Exception { + Bundle bundle = Platform.getBundle("io.sloeber.tests"); + Path path = new Path("src/projects/" + zipFileName); + URL fileURL = FileLocator.find(bundle, path, null); + URL resolvedFileURL = FileLocator.toFileURL(fileURL); + return new Path(resolvedFileURL.toURI().getPath()); + } + + public static void buildProjectUsingActivConfig(IProject iProject, String builderName) throws Exception { + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(iProject, true); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + cProjectDesc.setActiveConfiguration(curConfig); + CCorePlugin.getDefault().setProjectDescription(iProject, cProjectDesc); + build(iProject, builderName, null); + } + } + + public static void buildAndVerifyProjectUsingActivConfig(IProject project, Boolean shouldMakefileExists) + throws Exception { + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(project, true); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + cProjectDesc.setActiveConfiguration(curConfig); + CCorePlugin.getDefault().setProjectDescription(project, cProjectDesc); + project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); + verifyConfig(project, IAutoBuildConfigurationDescription.getConfig(curConfig), shouldMakefileExists); + } + } + + /** + * clean all the configuration by looping over all the configurations and + * setting them active and then call a clean build + * + * @param iProject + * @throws CoreException + */ + public static void cleanProject(IProject iProject) throws CoreException { + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(iProject, true); + // clean all configurations and verify clean has been done properly + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { +// cProjectDesc.setActiveConfiguration(curConfig); +// CCorePlugin.getDefault().setProjectDescription(iProject, cProjectDesc); + + IAutoBuildConfigurationDescription autoConf = IAutoBuildConfigurationDescription.getConfig(curConfig); + cleanConfiguration(autoConf); + } + } + + /** + * clean all the configuration by looping over all the configurations and + * setting them active and then call a clean build + * + * @param iProject + * @throws CoreException + */ + public static void cleanConfiguration(IAutoBuildConfigurationDescription autoConf) throws CoreException { + IFolder buildRoot = autoConf.getBuildFolder(); + IProject iProject = buildRoot.getProject(); + int membersBeforeClean = buildRoot.members().length; + + iProject.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor()); + if (buildRoot.exists()) { + int membersAfterClean = buildRoot.members().length; + assertTrue("clean did not remove files", membersAfterClean <= membersBeforeClean); + } + } + + /** + * Convenience method to call BuildAndVerify for the active config of a project + * and a builder + * + * @param theTestProject The project to build + * @param builderName if null use the default builder else use the builder + * with the provided name + * @return true if build is successful otherwise false + * @throws Exception + */ + public static void BuildAndVerifyActiveConfig(IProject theTestProject) throws Exception { + BuildAndVerifyActiveConfig(theTestProject, null, null); + } + + public static void BuildAndVerifyActiveConfig(IProject theTestProject, String builderID, + Boolean shouldMakefileExists) throws Exception { + build(theTestProject, builderID, null); + + verifyConfig(theTestProject, IAutoBuildConfigurationDescription.getActiveConfig(theTestProject, false), + shouldMakefileExists); + + } + + public static void build(IProject theTestProject, String builderID, String configs) throws Exception { + NullProgressMonitor monitor = new NullProgressMonitor(); + + waitForAllJobsToFinish(); + if (builderID == null && configs == null) { + theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor); + } else { + Map args = new HashMap<>(); + if (builderID != null) { + args.put(AutoBuildProject.ARGS_BUILDER_KEY, builderID); + } + if (configs != null) { + args.put(AutoBuildProject.ARGS_CONFIGS_KEY, configs); + } + theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, AutoBuildProject.COMMON_BUILDER_ID, args, monitor); + } + waitForAllJobsToFinish(); + } + + public static void verifyConfig(IProject theTestProject, IAutoBuildConfigurationDescription autoBuild, + Boolean shouldMakefileExists) throws Exception { + + hasProjectBuildErrors(theTestProject); + checkIfConfigurationBuildCorrectly(theTestProject, autoBuild, shouldMakefileExists); + + if (deleteProjects) { + theTestProject.delete(true, true, null); + } else { + if (closeProjects) { + theTestProject.close(null); + } + } + } +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateBasicProjects.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateBasicProjects.java new file mode 100644 index 000000000..3ad643523 --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateBasicProjects.java @@ -0,0 +1,250 @@ +package io.sloeber.autoBuild.regression; + +import static io.sloeber.autoBuild.helpers.Defaults.*; +import static io.sloeber.autoBuild.helpers.api.AutoBuildConstants.*; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.stream.Stream; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription; +import io.sloeber.autoBuild.api.ICodeProvider; +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.buildTools.api.IBuildToolsManager; +import io.sloeber.autoBuild.core.AutoBuildCommon; +import io.sloeber.autoBuild.helpers.Shared; +import io.sloeber.autoBuild.integration.AutoBuildManager; +import io.sloeber.autoBuild.schema.api.IProjectType; + +@SuppressWarnings({ "nls" }) +public class AutoBuildCreateBasicProjects { + static int testCounter = 1; + // below are test limiting options buildTypeActiveBuild=null and + private boolean buildTypeActiveBuild = true; + private boolean doTestDefaultBuilder = true; + private boolean doTestInternalBuilder = true; + private boolean doTestMakeBuilder = true; + static Set myBuildTools = IBuildToolsManager.getDefault().getAllInstalledBuildTools(); + + @BeforeAll + public static void beforeAll() throws CoreException { + Shared.setDeleteProjects(false); + Shared.setCloseProjects(false); + // turn off auto building to make sure autobuild does not start a build behind + // our backs + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + workspaceDesc.setAutoBuilding(false); + workspace.setDescription(workspaceDesc); + } + + static void buildAllConfigsAsActive(String builderID, String projectName, String extensionPointID, + String extensionID, String projectTypeID, String natureID, ICodeProvider codeProvider, + IBuildTools buildTools, Boolean shouldMakefileExists) throws Exception { + + IProjectType projectType = AutoBuildManager.getProjectType(extensionPointID, extensionID, projectTypeID, true); + IProject testProject = AutoBuildProject.createProject( + String.format("%03d", Integer.valueOf(testCounter++)) + "_" + projectName, projectType, natureID, + codeProvider, buildTools, false, null); + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(testProject, true); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + IAutoBuildConfigurationDescription autConf=IAutoBuildConfigurationDescription.getConfig(curConfig); + autConf.setParallelizationNum(PARRALLEL_BUILD_OPTIMAL_JOBS); + autConf.setIsParallelBuild(true); + cProjectDesc.setActiveConfiguration(curConfig); + CCorePlugin.getDefault().setProjectDescription(testProject, cProjectDesc); + Shared.BuildAndVerifyActiveConfig(testProject, builderID, shouldMakefileExists); + } + endTest(testProject); + } + + static void endTest(IProject project) throws CoreException { + project.delete(true, true, null); + } + + static void buildAllConfigs(String builderName, String projectName, String extensionPointID, String extensionID, + String projectTypeID, String natureID, ICodeProvider codeProvider, IBuildTools buildTools, + Boolean shouldMakefileExists) throws Exception { + + IProjectType projectType = AutoBuildManager.getProjectType(extensionPointID, extensionID, projectTypeID, true); + IProject testProject = AutoBuildProject.createProject( + String.format("%03d", Integer.valueOf(testCounter++)) + "_" + projectName, projectType, natureID, + codeProvider, buildTools, false, null); + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(testProject, true); + Set configs = new HashSet<>(); + + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + configs.add(curConfig.getName()); + } + Shared.build(testProject, builderName, AutoBuildProject.encode(configs)); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + + Shared.verifyConfig(testProject, IAutoBuildConfigurationDescription.getConfig(curConfig), + shouldMakefileExists); + } + endTest(testProject); + } + + private void doBuilds(String builderID, String projectName, String extensionPointID, String extensionID, + String projectTypeID, String natureID, ICodeProvider codeProvider, IBuildTools buildTools, + Boolean shouldMakefileExists) throws Exception { + String shortProjectName = projectName; + if (projectName.length() > 41) { + shortProjectName = projectName.substring(0, 40); + } + if (buildTypeActiveBuild) { + buildAllConfigsAsActive(builderID, shortProjectName, extensionPointID, extensionID, projectTypeID, natureID, + codeProvider, buildTools, shouldMakefileExists); + } + if (!buildTypeActiveBuild) { + buildAllConfigs(builderID, "all_" + shortProjectName, extensionPointID, extensionID, projectTypeID, + natureID, codeProvider, buildTools, shouldMakefileExists); + } + //change the 2 ways of building all configs + buildTypeActiveBuild=!buildTypeActiveBuild; + + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testDefaultBuilderSrc(String projectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestDefaultBuilder) { + doBuilds(null, projectName, extensionPointID, extensionID, projectTypeID, natureID, codeProvider, + buildTools, null); + } + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testInternaltBuilderSrc(String inProjectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestInternalBuilder) { + String projectName = "Internal_" + inProjectName; + + doBuilds(AutoBuildProject.INTERNAL_BUILDER_ID, projectName, extensionPointID, extensionID, projectTypeID, + natureID, codeProvider, buildTools, Boolean.FALSE); + } + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testMakeBuilderSrc(String inProjectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestMakeBuilder) { + Assumptions.assumeFalse(buildTools.getProviderID().equals("io.sloeber.autoBuild.Path.BuildToolProvider"),"Ignoring as make is not assumed on the path") ; + String projectName = "make_" + inProjectName; + if (projectName.length() > 40) { + // somethimes the build fails due to to long filenames + // as the project name is part of the targetName + projectName = projectName.substring(0, 40); + } + doBuilds(AutoBuildProject.MAKE_BUILDER_ID, projectName, extensionPointID, extensionID, projectTypeID, + natureID, codeProvider, buildTools, Boolean.TRUE); + } + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testDefaultBuilderRoot(String projectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestDefaultBuilder) { + doBuilds(null, projectName, extensionPointID, extensionID, projectTypeID, natureID, codeProvider, + buildTools, null); + } + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testInternaltBuilderRoot(String inProjectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestInternalBuilder) { + String projectName = "Internal_" + inProjectName; + + doBuilds(AutoBuildProject.INTERNAL_BUILDER_ID, projectName, extensionPointID, extensionID, projectTypeID, + natureID, codeProvider, buildTools, Boolean.FALSE); + } + } + + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testMakeBuilderRoot(String inProjectName, String extensionPointID, String extensionID, String projectTypeID, + String natureID, ICodeProvider codeProvider, IBuildTools buildTools) throws Exception { + if (doTestMakeBuilder) { + Assumptions.assumeFalse(buildTools.getProviderID().equals("io.sloeber.autoBuild.Path.BuildToolProvider"),"Ignoring as make is not assumed on the path") ; + String projectName = "make_" + inProjectName; + if (projectName.length() > 40) { + // somethimes the build fails due to to long filenames + // as the project name is part of the targetName + projectName = projectName.substring(0, 40); + } + doBuilds(AutoBuildProject.MAKE_BUILDER_ID, projectName, extensionPointID, extensionID, projectTypeID, + natureID, codeProvider, buildTools, Boolean.TRUE); + } + } + + static Stream projectCreationInfoProvider() { + String extensionPointID = "io.sloeber.autoBuild.buildDefinitions"; + Map testProjectTypeIds = new HashMap<>(); + testProjectTypeIds.put(PROJECT_TYPE_ID_COMPOUND_EXE, "io.sloeber.autoBuild"); + testProjectTypeIds.put(PROJECT_TYPE_ID_EXE, "io.sloeber.autoBuild"); + testProjectTypeIds.put(PROJECT_TYPE_ID_STATIC_LIB, "io.sloeber.autoBuild"); + testProjectTypeIds.put(PROJECT_TYPE_ID_DYNAMIC_LIB, "io.sloeber.autoBuild"); + + List ret = new LinkedList<>(); + for (Entry testProjectEntry : testProjectTypeIds.entrySet()) { + String extensionID = testProjectEntry.getValue(); + String projectID = testProjectEntry.getKey(); + IProjectType projectType = AutoBuildManager.getProjectType(extensionPointID, extensionID, projectID, true); + if (projectType == null) { + System.err.println("Skipping " + extensionID + " " + projectID); + continue; + } + ICodeProvider codeProvider_cpp = null; + switch (projectID) { + case PROJECT_TYPE_ID_EXE: + codeProvider_cpp = cpp_exeCodeProvider; + break; + case PROJECT_TYPE_ID_STATIC_LIB: + case PROJECT_TYPE_ID_DYNAMIC_LIB: + codeProvider_cpp = cpp_LibProvider; + break; + case PROJECT_TYPE_ID_COMPOUND_EXE: + codeProvider_cpp = compoundProvider; + break; + default: + codeProvider_cpp = cpp_exeCodeProvider; + } + for (IBuildTools curBuildTools : myBuildTools) { + if (curBuildTools.isProjectTypeSupported(projectType)) { + String projectName = AutoBuildCommon.MakeNameCompileSafe(projectType.getName() + "_" + extensionID + + "_" + curBuildTools.getProviderID() + "_" + curBuildTools.getSelectionID()); + ret.add(Arguments.of(projectName, extensionPointID, extensionID, projectType.getId(), + CCProjectNature.CC_NATURE_ID, codeProvider_cpp, curBuildTools)); + } + } + } + return ret.stream(); + } +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateProject.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateProject.java new file mode 100644 index 000000000..1f03ed9c6 --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildCreateProject.java @@ -0,0 +1,107 @@ +package io.sloeber.autoBuild.regression; + +import static io.sloeber.autoBuild.helpers.Defaults.*; +import static io.sloeber.autoBuild.helpers.api.AutoBuildConstants.*; + +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Stream; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.api.ICodeProvider; +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.buildTools.api.IBuildToolsManager; +import io.sloeber.autoBuild.core.AutoBuildCommon; +import io.sloeber.autoBuild.helpers.Shared; +import io.sloeber.autoBuild.integration.AutoBuildManager; +import io.sloeber.autoBuild.schema.api.IProjectType; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CProjectNature; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.core.resources.IProject; + +@SuppressWarnings("nls") +class AutoBuildCreateProject { + + @BeforeAll + public static void beforeAll() { + Shared.setDeleteProjects(false); + Shared.setCloseProjects(false); + } + + @SuppressWarnings("static-method") + @ParameterizedTest + @MethodSource("projectCreationInfoProvider") + void testExample(String myProjectName, IProjectType projectType, IBuildTools buildTools, + String natureID, ICodeProvider codeProvider) throws Exception { + + IProject testProject = AutoBuildProject.createProject(myProjectName, projectType, natureID, codeProvider, buildTools, false, null); + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(testProject, true); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + cProjectDesc.setActiveConfiguration(curConfig); + CCorePlugin.getDefault().setProjectDescription(testProject, cProjectDesc); + Shared.BuildAndVerifyActiveConfig(testProject); + } + } + + static Stream projectCreationInfoProvider() { + int testCounter = 1; + List ret = new LinkedList<>(); + for (String extensionPointID : AutoBuildManager.supportedExtensionPointIDs()) { + for (String extensionID : AutoBuildManager.getSupportedExtensionIDs(extensionPointID)) { + for (IProjectType projectType : AutoBuildManager.getProjectTypes(extensionPointID, extensionID)) { + if (projectType.isTest()) { + continue; + } + String projectID = projectType.getId(); + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(projectType); + if(buildTools==null) { + continue; + } + + ICodeProvider codeProvider_cpp = null; + ICodeProvider codeProvider_c = null; + switch (projectID) { + case PROJECT_TYPE_ID_EXE: + codeProvider_cpp = cpp_exeCodeProvider; + codeProvider_c = c_exeCodeProvider; + break; + case "io.sloeber.autoBuild.projectType.static.lib": + case PROJECT_TYPE_ID_DYNAMIC_LIB: + codeProvider_cpp = cpp_LibProvider; + codeProvider_c = c_LibProvider; + break; + case PROJECT_TYPE_ID_COMPOUND_EXE: + codeProvider_cpp = compoundProvider; + break; + default: + codeProvider_cpp = cpp_exeCodeProvider; + } + String projectName = AutoBuildCommon + .MakeNameCompileSafe(String.format("%03d", Integer.valueOf(testCounter)) + "_CPP_" + + projectType.getName() + "_" + extensionID); + testCounter++; + ret.add(Arguments.of(projectName, projectType, buildTools, + CCProjectNature.CC_NATURE_ID, codeProvider_cpp)); + if (codeProvider_c != null) { + projectName = AutoBuildCommon + .MakeNameCompileSafe(String.format("%03d", Integer.valueOf(testCounter)) + "_C_" + + projectType.getName() + "_" + extensionID); + testCounter++; + ret.add(Arguments.of(projectName, projectType, buildTools, + CProjectNature.C_NATURE_ID, codeProvider_c)); + } + } + } + } + return ret.stream(); + } +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildIssues.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildIssues.java new file mode 100644 index 000000000..e816e2e4d --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildIssues.java @@ -0,0 +1,140 @@ +package io.sloeber.autoBuild.regression; + +import static io.sloeber.autoBuild.helpers.Defaults.*; +import static org.junit.Assert.*; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.content.IContentType; +import org.eclipse.core.runtime.content.IContentTypeManager; +import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.buildTools.api.IBuildToolsManager; +import io.sloeber.autoBuild.helpers.Shared; + +@SuppressWarnings({ "nls", "static-method" }) +public class AutoBuildIssues { + + @BeforeAll + public static void beforeAll() throws CoreException { + Shared.setDeleteProjects(false); + Shared.setCloseProjects(false); + // turn off auto building to make sure autobuild does not start a build behind our backs + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + workspaceDesc.setAutoBuilding(false); + workspace.setDescription(workspaceDesc); + } + + @Test + public void cxx_associates_with_c() { + IContentTypeManager manager = Platform.getContentTypeManager(); + IContentType contentType = manager.getContentType("org.eclipse.cdt.core.cxxSource"); + if (contentType.isAssociatedWith("test.c")) { + fail("org.eclipse.cdt.core.cxxSource should not associate with c files"); + + } + } + + @Test + public void cxx_associates_with_cpp() { + IContentTypeManager manager = Platform.getContentTypeManager(); + IContentType contentType = manager.getContentType("org.eclipse.cdt.core.cxxSource"); + if (!contentType.isAssociatedWith("test.cpp")) { + fail("org.eclipse.cdt.core.cxxSource should associate with cpp files"); + + } + } + + @Test + public void cxx_associates_with_C() { + IContentTypeManager manager = Platform.getContentTypeManager(); + IContentType contentType = manager.getContentType("org.eclipse.cdt.core.cxxSource"); + if (!contentType.isAssociatedWith("test.C")) { + fail("org.eclipse.cdt.core.cxxSource should associate with C files"); + + } + } + + @Test + public void cxx_associates_with_CPP() { + IContentTypeManager manager = Platform.getContentTypeManager(); + IContentType contentType = manager.getContentType("org.eclipse.cdt.core.cxxSource"); + if (contentType.isAssociatedWith("test.CPP")) { + fail("org.eclipse.cdt.core.cxxSource should not associate with CPP files"); + + } + } + + @Test + public void c_associates_with_C() { + IContentTypeManager manager = Platform.getContentTypeManager(); + IContentType contentType = manager.getContentType("org.eclipse.cdt.core.cSource"); + if (contentType.isAssociatedWith("test.C")) { + fail("org.eclipse.cdt.core.cxxSource should not associate with CPP files"); + + } + } + + @Test + public void setDescriptionDoesNotSetDescription() throws Exception { + beforeAll();// for one reason or another the beforeall is not called + String projectName = "setDescription"; + CoreModel coreModel = CoreModel.getDefault(); + + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(defaultProjectType); + IProject testProject = AutoBuildProject.createProject(projectName, defaultProjectType, defaultNatureID,cpp_exeCodeProvider, + buildTools, false, null); + + ICProjectDescription cProjectDesc = CCorePlugin.getDefault().getProjectDescription(testProject, true); + for (ICConfigurationDescription curConfig : cProjectDesc.getConfigurations()) { + //Set the active configuration + cProjectDesc.setActiveConfiguration(curConfig); + coreModel.setProjectDescription(testProject, cProjectDesc); + + //get the active configuration from the project + ICProjectDescription readProjectDescription = coreModel.getProjectDescription(testProject, false); + ICConfigurationDescription actualActiveConfig = readProjectDescription.getActiveConfiguration(); + //Make sure the active config has been set + assertEquals("After project create", curConfig.getName(), actualActiveConfig.getName()); + + } + + //open and close the project and try again + Thread.sleep(5000); + //close the project + testProject.close(new NullProgressMonitor()); + //wait a while + Thread.sleep(5000); + //open the project + testProject.open(new NullProgressMonitor()); + + ICProjectDescription cProjectDescOpen = CCorePlugin.getDefault().getProjectDescription(testProject, true); + for (ICConfigurationDescription curConfig : cProjectDescOpen.getConfigurations()) { + //Set the active configuration + cProjectDescOpen.setActiveConfiguration(curConfig); + coreModel.setProjectDescription(testProject, cProjectDescOpen); + + //get the active configuration from the project + ICProjectDescription readProjectDescription = coreModel.getProjectDescription(testProject, false); + ICConfigurationDescription actualActiveConfig = readProjectDescription.getActiveConfiguration(); + //Make sure the active config has been set + assertEquals("After close open", curConfig.getName(), actualActiveConfig.getName()); + + } + + } + +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildRegression.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildRegression.java new file mode 100644 index 000000000..767327a4b --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuild/regression/AutoBuildRegression.java @@ -0,0 +1,410 @@ +package io.sloeber.autoBuild.regression; + +import static org.junit.Assert.*; +import static io.sloeber.autoBuild.helpers.Defaults.*; + +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription; +import io.sloeber.autoBuild.api.IAutoBuildMakeRule; +import io.sloeber.autoBuild.api.IAutoBuildMakeRules; +import io.sloeber.autoBuild.api.ICodeProvider; +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.buildTools.api.IBuildToolsManager; +import io.sloeber.autoBuild.extensionPoint.providers.AutoBuildMakeRules; +import io.sloeber.autoBuild.helpers.Shared; +import io.sloeber.autoBuild.integration.AutoBuildConfigurationDescription; +import io.sloeber.autoBuild.integration.AutoBuildManager; +import io.sloeber.autoBuild.schema.api.IBuilder; +import io.sloeber.autoBuild.schema.api.IOption; +import io.sloeber.autoBuild.schema.api.IProjectType; +import io.sloeber.autoBuild.schema.api.ITool; + +@SuppressWarnings({ "static-method", "nls", "boxing" }) +public class AutoBuildRegression { + static private String extensionPointID = "io.sloeber.autoBuild.buildDefinitions"; + static int testCounter = 1; + + + @BeforeAll + public static void beforeAll() throws CoreException { + Shared.setDeleteProjects(false); + Shared.setCloseProjects(false); + // turn off auto building to make sure autobuild does not start a build behind our backs + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + workspaceDesc.setAutoBuilding(false); + workspace.setDescription(workspaceDesc); + } + + /* + * Create a project build it + * clean it + * close it + * open it + * check wether the configuration is equal + * build it + * + */ + @ParameterizedTest + @MethodSource("OpenCloseValueCmd") + public void createCloseOpenProject(String projectName,ICodeProvider codeProvider,String optionID,String optionValue) throws Exception { + + + IProjectType projectType= AutoBuildManager.getProjectType( extensionPointID, defaultExtensionID, defaultProjectTypeID, true); + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(projectType); + IProject testProject = AutoBuildProject.createProject(projectName, projectType, CCProjectNature.CC_NATURE_ID, + codeProvider, buildTools, false, null); + IAutoBuildConfigurationDescription beforeChange= IAutoBuildConfigurationDescription.getActiveConfig( testProject,false); + CoreModel coreModel = CoreModel.getDefault(); + ICProjectDescription projectDescription = coreModel.getProjectDescription(testProject, true); + ICConfigurationDescription cdtConfig =projectDescription.getActiveConfiguration(); + IAutoBuildConfigurationDescription origConfig= IAutoBuildConfigurationDescription.getConfig(cdtConfig); + + + ITool tool = origConfig.getProjectType().getToolChain().getToolFromOptionID(optionID); + IOption iOption = tool.getOption(optionID); + origConfig.setOptionValue(testProject, iOption, optionValue); + coreModel.setProjectDescription(testProject, projectDescription); + + + IAutoBuildConfigurationDescription beforeClose= IAutoBuildConfigurationDescription.getActiveConfig( testProject,false); + assertFalse("Changed configuration matches unchanged",beforeClose.equals(beforeChange)); + + //Build all the configurations and verify proper building + Shared.BuildAndVerifyActiveConfig(testProject); + //clean all configurations and verify clean has been done properly + Shared.cleanProject(testProject); + + + //close the project + testProject.close(new NullProgressMonitor()); + //wait a while + Thread.sleep(2000); + //open the project + testProject.open(new NullProgressMonitor()); + IAutoBuildConfigurationDescription afterClose= IAutoBuildConfigurationDescription.getActiveConfig( testProject,false); + assertTrue("loaded configuration does not match stored",beforeClose.equals(afterClose)); + //Build all the configurations and verify proper building + Shared.BuildAndVerifyActiveConfig(testProject); + } + + /* + * Create a project build it + * check whether there is a makefile + * if so set internal builder else set external builder + * clean it + * build + * check for makefile existence + * clean it + * close it + * open it + * build it + * check for makefile existence + * + */ + + @Test + public void setBuilder() throws Exception { + beforeAll();// for one reason or another the before all is not called + String projectName = "setBuilder"; + + IProjectType projectType= AutoBuildManager.getProjectType( extensionPointID, defaultExtensionID, defaultProjectTypeID, true); + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(projectType); + assertNotNull("no build tools found on the system", buildTools); + IProject testProject = AutoBuildProject.createProject(projectName, projectType, CCProjectNature.CC_NATURE_ID, + cpp_exeCodeProvider, buildTools, false, null); + + //Build the active configuration and verify proper building + Shared.BuildAndVerifyActiveConfig(testProject); + + ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); + ICProjectDescription projectDescription = mngr.getProjectDescription(testProject, true); + IAutoBuildConfigurationDescription activeConfig = IAutoBuildConfigurationDescription + .getActiveConfig(projectDescription); + + IFile makeFile = activeConfig.getBuildFolder().getFile("makefile"); + boolean hasMakefile = makeFile.exists(); + IBuilder builder=null; + if (hasMakefile) { + builder=activeConfig.getBuilder(AutoBuildProject.INTERNAL_BUILDER_ID); + } else { + builder=activeConfig.getBuilder(AutoBuildProject.MAKE_BUILDER_ID); + } + activeConfig.setBuilder(builder); + //clean all configurations and verify clean has been done properly + Shared.cleanConfiguration(activeConfig); + //do the clean before the builderswitch otherwise the makefile in the buildroot will make the test fail + mngr.setProjectDescription(testProject, projectDescription, true, new NullProgressMonitor()); + + //Build all the configurations and verify proper building + Shared.BuildAndVerifyActiveConfig(testProject); + + assertNotEquals("Builder changes have not been taken into account", makeFile.exists(), hasMakefile); + + //clean activeConfig and verify clean has been done properly + Shared.cleanConfiguration(activeConfig); + activeConfig.getBuildFolder().delete(true, new NullProgressMonitor()); + + assertFalse("Clean did not remove makefile", makeFile.exists()); + + //close the project + testProject.close(new NullProgressMonitor()); + //wait a while + Thread.sleep(5000); + //open the project + testProject.open(new NullProgressMonitor()); + //Build all the configurations and verify proper building + Shared.BuildAndVerifyActiveConfig(testProject); + + assertNotEquals("Builder changes have been lost in open close projects", makeFile.exists(), hasMakefile); + } + + static String savePreviousCommand = null; + static String savePreviousOptionCommand = null; + static String savepreviousOptionID = null; + + @ParameterizedTest + @MethodSource("OptionIDValueCmd") + void testOptions(String optionID, String optionValue, String commandContribution) throws CoreException { + //get the project; create it if nessesary + String projectName = "testOptionsProject"; + IProject testProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (testProject == null || !testProject.exists()) { + IProjectType projectType= AutoBuildManager.getProjectType( extensionPointID, "io.sloeber.autoBuild.test", "io.sloeber.autoBuild.projectType.test.options", true); + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(projectType); + testProject = AutoBuildProject.createProject(projectName, projectType, + CCProjectNature.CC_NATURE_ID, cpp_exeCodeProvider, buildTools, false, null); + } + + //get the project and autobuild configurations + CoreModel coreModel = CoreModel.getDefault(); + ICProjectDescription projectDescription = coreModel.getProjectDescription(testProject, true); + AutoBuildConfigurationDescription autoConf = (AutoBuildConfigurationDescription) IAutoBuildConfigurationDescription + .getActiveConfig(projectDescription); + + //get the tool and option + ITool tool = autoConf.getProjectType().getToolChain().getToolFromOptionID(optionID); + IOption iOption = tool.getOption(optionID); + + //If the statics are null initialize them + if (savePreviousCommand == null) { + savePreviousCommand = getTheCompileCommand(autoConf, tool).trim(); + savePreviousOptionCommand = savePreviousCommand; + savepreviousOptionID = optionID; + } + + if (!savepreviousOptionID.equals(optionID)) { + savePreviousOptionCommand = savePreviousCommand; + savepreviousOptionID = optionID; + } + + autoConf.setOptionValue(testProject, iOption, optionValue); + coreModel.setProjectDescription(testProject, projectDescription); + + String CurrentCommand = getTheCompileCommand(autoConf, tool).trim(); + String previousCommand = savePreviousOptionCommand; + savePreviousCommand = CurrentCommand; + if (commandContribution.isBlank()) { + if (previousCommand.equals(CurrentCommand) == false) { + getTheCompileCommand(autoConf, tool); + } + assertTrue("option is not consistent " + CurrentCommand + " " + previousCommand, + previousCommand.equals(CurrentCommand)); + } else { + String[] parts = CurrentCommand.split(Pattern.quote(" " + commandContribution + " ")); + if (parts.length != 2) { + getTheCompileCommand(autoConf, tool); + } + assertTrue("option contribution did not appear " + CurrentCommand, parts.length == 2); + assertTrue("option contribution appeard multiple times in command " + CurrentCommand, parts.length < 3); + String reGlued = parts[0] + " " + parts[1]; + if (!previousCommand.equals(reGlued)) { + fail("option is not consistent " + CurrentCommand + " " + previousCommand); + } + } + + } + + private String getTheCompileCommand(AutoBuildConfigurationDescription autoData, ITool iTool) throws CoreException { + IFolder buildRoot = autoData.getBuildFolder(); + + //Generate the make Rules + IAutoBuildMakeRules myMakeRules = new AutoBuildMakeRules(autoData); + for (IAutoBuildMakeRule curRule : myMakeRules) { + if (curRule.getTool().equals(iTool)) { + if (curRule.getTargetFiles().size() == 1) { + return curRule.getRecipes(buildRoot, autoData)[0]; + } + } + } + return null; + } + + static Stream OptionIDValueCmd() { + List ret = new LinkedList<>(); + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.std", "gnu.cpp.compiler.dialect.default", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.std", "gnu.cpp.compiler.dialect.c++98", "-std=c++98")); + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.std", "gnu.cpp.compiler.dialect.c++11", "-std=c++0x")); + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.std", "gnu.cpp.compiler.dialect.c++1y", "-std=c++1y")); + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.std", "gnu.cpp.compiler.dialect.c++17", "-std=c++17")); + + ret.add(Arguments.of("gnu.cpp.compiler.option.dialect.flags", "a flag", "a flag")); + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.nostdinc", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.nostdinc", "true", "-nostdinc")); + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.preprocess", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.preprocess", "true", "-E")); + + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.def", "Define1;Define2", "-DDefine1 -DDefine2")); + ret.add(Arguments.of("gnu.cpp.compiler.option.preprocessor.undef", "UnDefine1;UnDefine2", + "-UUnDefine1 -UUnDefine2")); + ret.add(Arguments.of("gnu.cpp.compiler.option.include.paths", "c:\\includePath1;/root/includePath2", + "-Ic:\\includePath1 -I/root/includePath2")); + ret.add(Arguments.of("gnu.cpp.compiler.option.include.files", "c:\\includeFile1;/root/includeFile2", + "-includec:\\includeFile1 -include/root/includeFile2")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.level", "gnu.cpp.compiler.optimization.level.none", + "-O0")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.level", + "gnu.cpp.compiler.optimization.level.optimize", "-O1")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.level", "gnu.cpp.compiler.optimization.level.more", + "-O2")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.level", "gnu.cpp.compiler.optimization.level.most", + "-O3")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.level", "gnu.cpp.compiler.optimization.level.size", + "-Os")); + ret.add(Arguments.of("gnu.cpp.compiler.option.optimization.flags", "optimize flags", "optimize flags")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.level", "gnu.cpp.compiler.debugging.level.none", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.level", "gnu.cpp.compiler.debugging.level.minimal", + "-g1")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.level", "gnu.cpp.compiler.debugging.level.default", + "-g")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.level", "gnu.cpp.compiler.debugging.level.max", "-g3")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.other", "debug other", "debug other")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.prof", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.prof", "true", "-p")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.gprof", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.gprof", "true", "-pg")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.codecov", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.codecov", "true", "-ftest-coverage -fprofile-arcs")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitaddress", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitaddress", "true", "-fsanitize=address")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitpointers", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitpointers", "true", + "-fsanitize=pointer-compare -fsanitize=pointer-subtract")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitthread", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitthread", "true", "-fsanitize=thread")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitleak", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitleak", "true", "-fsanitize=leak")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitundef", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.debugging.sanitundef", "true", "-fsanitize=undefined")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.syntax", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.syntax", "true", "-fsyntax-only")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.pedantic", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.pedantic", "true", "-pedantic")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.pedantic.error", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.pedantic.error", "true", "-pedantic-errors")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.nowarn", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.nowarn", "true", "-w")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.allwarn", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.allwarn", "true", "-Wall")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.extrawarn", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.extrawarn", "true", "-Wextra")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.toerrors", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.toerrors", "true", "-Werror")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wconversion", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wconversion", "true", "-Wconversion")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wcastalign", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wcastalign", "true", "-Wcast-align")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wcastqual", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wcastqual", "true", "-Wcast-qual")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wctordtorprivacy", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wctordtorprivacy", "true", "-Wctor-dtor-privacy")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wdisabledopt", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wdisabledopt", "true", "-Wdisabled-optimization")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wlogicalop", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wlogicalop", "true", "-Wlogical-op")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wmissingdecl", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wmissingdecl", "true", "-Wmissing-declarations")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wmissingincdir", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wmissingincdir", "true", "-Wmissing-include-dirs")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wnoexccept", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wnoexccept", "true", "-Wnoexcept")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.woldstylecast", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.woldstylecast", "true", "-Wold-style-cast")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.woverloadedvirtual", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.woverloadedvirtual", "true", "-Woverloaded-virtual")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wredundantdecl", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wredundantdecl", "true", "-Wredundant-decls")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wshadow", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wshadow", "true", "-Wshadow")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wsignconv", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wsignconv", "true", "-Wsign-conversion")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wsignpromo", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wsignpromo", "true", "-Wsign-promo")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wstrictnullsent", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wstrictnullsent", "true", "-Wstrict-null-sentinel")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wswitchdef", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wswitchdef", "true", "-Wswitch-default")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wundef", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wundef", "true", "-Wundef")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.weffcpp", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.weffcpp", "true", "-Weffc++")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wfloatequal", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.warnings.wfloatequal", "true", "-Wfloat-equal")); + ret.add(Arguments.of("gnu.cpp.compiler.option.other.verbose", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.other.verbose", "true", "-v")); + ret.add(Arguments.of("gnu.cpp.compiler.option.other.pic", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.other.pic", "true", "-fPIC")); + ret.add(Arguments.of("gnu.cpp.compiler.option.misc.hardening", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.misc.hardening", "true", + "-fstack-protector-all -Wformat=2 -Wformat-security -Wstrict-overflow")); + ret.add(Arguments.of("gnu.cpp.compiler.option.misc.randomization", "false", "")); + ret.add(Arguments.of("gnu.cpp.compiler.option.misc.randomization", "true", "-fPIE")); + // ret.add(Arguments.of("gddddddddddddddddnu", "true", "")); + // ret.add(Arguments.of("gddddddddddddddddnu", "false", "dddtddddddddddddd7")); + // ret.add(Arguments.of("gddddddddddddddddnu", "true", "")); + // ret.add(Arguments.of("gddddddddddddddddnu", "false", "dddtddddddddddddd7")); + + return ret.stream(); + } + + + static Stream OpenCloseValueCmd() { + ICodeProvider cpp_exeCodeProvider_inRoot=cpp_exeCodeProvider.createCopy(); + ICodeProvider cpp_exeCodeProvider_inxxFolder=cpp_exeCodeProvider.createCopy(); + ICodeProvider cpp_exeCodeProvider_srcFolder=cpp_exeCodeProvider.createCopy(); + cpp_exeCodeProvider_inRoot.setCodeFolder(null); + cpp_exeCodeProvider_inxxFolder.setCodeFolder("xx"); + cpp_exeCodeProvider_srcFolder.setCodeFolder("src"); + List ret = new LinkedList<>(); + ret.add(Arguments.of("createCloseOpenProjectRoot",cpp_exeCodeProvider_inRoot,"gnu.c.compiler.option.warnings.extrawarn", "true")); + ret.add(Arguments.of("createCloseOpenProjectXX",cpp_exeCodeProvider_inxxFolder,"gnu.cpp.compiler.option.other.pic", "true")); + ret.add(Arguments.of("createCloseOpenProjectSrc",cpp_exeCodeProvider_srcFolder,"gnu.cpp.compiler.option.other.verbose", "true")); + + return ret.stream(); + } + +} diff --git a/io.sloeber.autoBuild.test/src/io/sloeber/autoBuilld/investigate/CConfigurationDescriptionInvestigation.java b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuilld/investigate/CConfigurationDescriptionInvestigation.java new file mode 100644 index 000000000..e2a598bc8 --- /dev/null +++ b/io.sloeber.autoBuild.test/src/io/sloeber/autoBuilld/investigate/CConfigurationDescriptionInvestigation.java @@ -0,0 +1,54 @@ +package io.sloeber.autoBuilld.investigate; + +import static io.sloeber.autoBuild.helpers.Defaults.*; +import static org.junit.Assert.*; + +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICFolderDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription; +import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; + +import io.sloeber.autoBuild.api.AutoBuildProject; +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.buildTools.api.IBuildToolsManager; +import io.sloeber.autoBuild.helpers.Shared; + +@SuppressWarnings({ "restriction", "nls", "static-method" }) +public class CConfigurationDescriptionInvestigation { + static int testCounter = 1; + + @BeforeAll + static void beforeAll() { + Shared.setDeleteProjects(false); + Shared.setCloseProjects(false); + // turn off auto building to make sure autobuild does not start a build behind our backs + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + workspaceDesc.setAutoBuilding(false); + } + + @Test + public void testConfigDescription() { + beforeAll(); + String projectName = "testConfigDescription"; + IBuildTools buildTools = IBuildToolsManager.getDefault().getAnyInstalledBuildTools(defaultProjectType); + IProject testProject = AutoBuildProject.createProject(projectName, defaultProjectType, defaultNatureID, cpp_exeCodeProvider, buildTools, false, null); + ICProjectDescription projectDesc = CoreModel.getDefault().getProjectDescription(testProject, true); + for (ICConfigurationDescription curConf : projectDesc.getConfigurations()) { + assertFalse("conf is readOnly class instance", curConf instanceof CConfigurationDescriptionCache); + assertTrue("conf is of a unknown class instance", curConf instanceof CConfigurationDescription); + ICFolderDescription orgDescription = curConf.getRootFolderDescription(); + curConf.setDescription("A nice description"); + ICFolderDescription newDescription = curConf.getRootFolderDescription(); + } + } + +} diff --git a/io.sloeber.autoBuild.test/templates/c_exe/cExtra.c b/io.sloeber.autoBuild.test/templates/c_exe/cExtra.c new file mode 100644 index 000000000..75445d2fb --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/cExtra.c @@ -0,0 +1,3 @@ +#include "cExtra.h" +void cExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/c_exe/cExtra.h b/io.sloeber.autoBuild.test/templates/c_exe/cExtra.h new file mode 100644 index 000000000..f3b2654ca --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/cExtra.h @@ -0,0 +1,3 @@ +void cExtraMethod(); + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.c b/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.c new file mode 100644 index 000000000..a010cf81b --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.c @@ -0,0 +1,3 @@ +#include "cExtra2.h" +void cppExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.h b/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.h new file mode 100644 index 000000000..8b37bf826 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/cExtra2.h @@ -0,0 +1 @@ +void cppExtraMethod(); diff --git a/io.sloeber.autoBuild.test/templates/c_exe/main.c b/io.sloeber.autoBuild.test/templates/c_exe/main.c new file mode 100644 index 000000000..89f24c8a1 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/main.c @@ -0,0 +1,7 @@ +#include "main.h" + + +int main() { + cppExtraMethod(); + cExtraMethod(); +} diff --git a/io.sloeber.autoBuild.test/templates/c_exe/main.h b/io.sloeber.autoBuild.test/templates/c_exe/main.h new file mode 100644 index 000000000..d09a9a1bd --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_exe/main.h @@ -0,0 +1,2 @@ +#include "cExtra.h" +#include "cExtra2.h" diff --git a/io.sloeber.autoBuild.test/templates/c_lib/cExtra.c b/io.sloeber.autoBuild.test/templates/c_lib/cExtra.c new file mode 100644 index 000000000..75445d2fb --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_lib/cExtra.c @@ -0,0 +1,3 @@ +#include "cExtra.h" +void cExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/c_lib/cExtra.h b/io.sloeber.autoBuild.test/templates/c_lib/cExtra.h new file mode 100644 index 000000000..a598f9599 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_lib/cExtra.h @@ -0,0 +1,4 @@ + +void cExtraMethod(); + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/c_lib/cExtra2.h b/io.sloeber.autoBuild.test/templates/c_lib/cExtra2.h new file mode 100644 index 000000000..8b37bf826 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_lib/cExtra2.h @@ -0,0 +1 @@ +void cppExtraMethod(); diff --git a/io.sloeber.autoBuild.test/templates/c_lib/cppExtra2.c b/io.sloeber.autoBuild.test/templates/c_lib/cppExtra2.c new file mode 100644 index 000000000..a010cf81b --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/c_lib/cppExtra2.c @@ -0,0 +1,3 @@ +#include "cExtra2.h" +void cppExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.c b/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.c new file mode 100644 index 000000000..b754fd2d1 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.c @@ -0,0 +1,3 @@ +#include "cExtra Exe.h" +void cExtraExeMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.h b/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.h new file mode 100644 index 000000000..3e9dfe2a5 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/cExtra Exe.h @@ -0,0 +1,11 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void cExtraExeMethod(); +#ifdef __cplusplus +} +#endif + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.cpp b/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.cpp new file mode 100644 index 000000000..e5c3098f0 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.cpp @@ -0,0 +1,3 @@ +#include "cppExtraExe.h" +void cppExtraExeMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.h b/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.h new file mode 100644 index 000000000..0d616f434 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/cppExtraExe.h @@ -0,0 +1 @@ +void cppExtraExeMethod(); diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/c.h b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/c.h new file mode 100644 index 000000000..d09a9a1bd --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/c.h @@ -0,0 +1,2 @@ +#include "cExtra.h" +#include "cExtra2.h" diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.c b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.c new file mode 100644 index 000000000..75445d2fb --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.c @@ -0,0 +1,3 @@ +#include "cExtra.h" +void cExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.h b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.h new file mode 100644 index 000000000..a46c5dcdf --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra.h @@ -0,0 +1,11 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void cExtraMethod(); +#ifdef __cplusplus +} +#endif + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.c b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.c new file mode 100644 index 000000000..aefb18153 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.c @@ -0,0 +1,3 @@ +#include "cExtra2.h" +void cExtra2Method() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.h b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.h new file mode 100644 index 000000000..bf4b7d4da --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/c with space/cExtra2.h @@ -0,0 +1,11 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void cExtra2Method(); +#ifdef __cplusplus +} +#endif + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.cpp b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.cpp new file mode 100644 index 000000000..e1bf637d4 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.cpp @@ -0,0 +1,3 @@ +#include "cpp Extra.h" +void cppExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.h b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.h new file mode 100644 index 000000000..8b37bf826 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp Extra.h @@ -0,0 +1 @@ +void cppExtraMethod(); diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp.h b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp.h new file mode 100644 index 000000000..9f05c49de --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cpp.h @@ -0,0 +1,2 @@ +#include "cpp Extra.h" +#include "cppExtra2.h" diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.cpp b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.cpp new file mode 100644 index 000000000..c415b58cd --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.cpp @@ -0,0 +1,3 @@ +#include "cpp Extra.h" +void cppExtra2Method() { +} diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.h b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.h new file mode 100644 index 000000000..69f32f219 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/cppExtra2.h @@ -0,0 +1 @@ +void cppExtra2Method(); diff --git a/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/dynamic b/io.sloeber.autoBuild.test/templates/compound/libraries/cpp/dynamic new file mode 100644 index 000000000..e69de29bb diff --git a/io.sloeber.autoBuild.test/templates/compound/main.cpp b/io.sloeber.autoBuild.test/templates/compound/main.cpp new file mode 100644 index 000000000..72e655dfa --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/main.cpp @@ -0,0 +1,10 @@ +#include "main.h" + +int main() { + cppExtraMethod(); + cExtraMethod(); + cppExtra2Method(); + cExtra2Method(); + cppExtraExeMethod(); + cExtraExeMethod(); +} diff --git a/io.sloeber.autoBuild.test/templates/compound/main.h b/io.sloeber.autoBuild.test/templates/compound/main.h new file mode 100644 index 000000000..9c044bd4e --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/compound/main.h @@ -0,0 +1,4 @@ +#include "libraries/cpp/cpp.h" +#include "libraries/c with space/c.h" +#include "cppExtraExe.h" +#include "cExtra Exe.h" diff --git a/io.sloeber.autoBuild.test/templates/exe/cExtra.c b/io.sloeber.autoBuild.test/templates/exe/cExtra.c new file mode 100644 index 000000000..75445d2fb --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/exe/cExtra.c @@ -0,0 +1,3 @@ +#include "cExtra.h" +void cExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/exe/cExtra.h b/io.sloeber.autoBuild.test/templates/exe/cExtra.h new file mode 100644 index 000000000..a46c5dcdf --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/exe/cExtra.h @@ -0,0 +1,11 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void cExtraMethod(); +#ifdef __cplusplus +} +#endif + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/exe/cppExtra.cpp b/io.sloeber.autoBuild.test/templates/exe/cppExtra.cpp new file mode 100644 index 000000000..4943cc24a --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/exe/cppExtra.cpp @@ -0,0 +1,3 @@ +#include "cppExtra.h" +void cppExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/exe/cppExtra.h b/io.sloeber.autoBuild.test/templates/exe/cppExtra.h new file mode 100644 index 000000000..8b37bf826 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/exe/cppExtra.h @@ -0,0 +1 @@ +void cppExtraMethod(); diff --git a/io.sloeber.autoBuild.test/templates/exe/main.cpp b/io.sloeber.autoBuild.test/templates/exe/main.cpp new file mode 100644 index 000000000..c760e1bc1 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/exe/main.cpp @@ -0,0 +1,8 @@ +#include "main.h" +#include "cppExtra.h" +#include "cExtra.h" + +int main() { + cppExtraMethod(); + cExtraMethod(); +} diff --git a/io.sloeber.autoBuild.test/templates/exe/main.h b/io.sloeber.autoBuild.test/templates/exe/main.h new file mode 100644 index 000000000..e69de29bb diff --git a/io.sloeber.autoBuild.test/templates/lib/cExtra.c b/io.sloeber.autoBuild.test/templates/lib/cExtra.c new file mode 100644 index 000000000..75445d2fb --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/lib/cExtra.c @@ -0,0 +1,3 @@ +#include "cExtra.h" +void cExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/lib/cExtra.h b/io.sloeber.autoBuild.test/templates/lib/cExtra.h new file mode 100644 index 000000000..a46c5dcdf --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/lib/cExtra.h @@ -0,0 +1,11 @@ +#ifdef __cplusplus +extern "C" +{ +#endif + +void cExtraMethod(); +#ifdef __cplusplus +} +#endif + +#pragma once diff --git a/io.sloeber.autoBuild.test/templates/lib/cppExtra.cpp b/io.sloeber.autoBuild.test/templates/lib/cppExtra.cpp new file mode 100644 index 000000000..4943cc24a --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/lib/cppExtra.cpp @@ -0,0 +1,3 @@ +#include "cppExtra.h" +void cppExtraMethod() { +} diff --git a/io.sloeber.autoBuild.test/templates/lib/cppExtra.h b/io.sloeber.autoBuild.test/templates/lib/cppExtra.h new file mode 100644 index 000000000..8b37bf826 --- /dev/null +++ b/io.sloeber.autoBuild.test/templates/lib/cppExtra.h @@ -0,0 +1 @@ +void cppExtraMethod(); diff --git a/io.sloeber.autoBuild.ui/.classpath b/io.sloeber.autoBuild.ui/.classpath new file mode 100644 index 000000000..3628e3368 --- /dev/null +++ b/io.sloeber.autoBuild.ui/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.ui/.gitignore b/io.sloeber.autoBuild.ui/.gitignore new file mode 100644 index 000000000..93806e405 --- /dev/null +++ b/io.sloeber.autoBuild.ui/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/target/ diff --git a/io.sloeber.autoBuild.ui/.project b/io.sloeber.autoBuild.ui/.project new file mode 100644 index 000000000..d50410c1e --- /dev/null +++ b/io.sloeber.autoBuild.ui/.project @@ -0,0 +1,28 @@ + + + io.sloeber.autoBuild.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/io.sloeber.ManagedBuild.ui/.settings/org.eclipse.core.resources.prefs b/io.sloeber.autoBuild.ui/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from io.sloeber.ManagedBuild.ui/.settings/org.eclipse.core.resources.prefs rename to io.sloeber.autoBuild.ui/.settings/org.eclipse.core.resources.prefs diff --git a/io.sloeber.ManagedBuild.ui/.settings/org.eclipse.core.runtime.prefs b/io.sloeber.autoBuild.ui/.settings/org.eclipse.core.runtime.prefs similarity index 100% rename from io.sloeber.ManagedBuild.ui/.settings/org.eclipse.core.runtime.prefs rename to io.sloeber.autoBuild.ui/.settings/org.eclipse.core.runtime.prefs diff --git a/io.sloeber.autoBuild.ui/.settings/org.eclipse.jdt.core.prefs b/io.sloeber.autoBuild.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..62ef3488c --- /dev/null +++ b/io.sloeber.autoBuild.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/io.sloeber.autoBuild.ui/META-INF/MANIFEST.MF b/io.sloeber.autoBuild.ui/META-INF/MANIFEST.MF new file mode 100644 index 000000000..7ae8ccd07 --- /dev/null +++ b/io.sloeber.autoBuild.ui/META-INF/MANIFEST.MF @@ -0,0 +1,53 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Sloeber auto build user interface +Bundle-SymbolicName: io.sloeber.autoBuild.ui;singleton:=true +Bundle-Version: 4.4.3.qualifier +Require-Bundle: org.eclipse.tools.templates.ui, + org.eclipse.osgi, + org.eclipse.cdt.core;bundle-version="7.4.200", + org.eclipse.core.runtime;bundle-version="3.26.0", + org.eclipse.swt;bundle-version="3.121.0", + org.eclipse.jface;bundle-version="3.27.0", + org.eclipse.ui;bundle-version="3.201.100", + org.eclipse.ui.ide;bundle-version="3.19.100", + org.eclipse.tools.templates.freemarker;bundle-version="1.2.300", + org.eclipse.core.resources, + org.eclipse.cdt.ui, + org.eclipse.core.filesystem, + io.sloeber.autoBuild;bundle-version="4.4.1", + org.eclipse.tools.templates.core;bundle-version="2.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-21 +Bundle-Vendor: Sloeber.io +Bundle-ActivationPolicy: lazy +Bundle-Activator: io.sloeber.autoBuild.ui.internal.Activator +Automatic-Module-Name: io.sloeber.core +Export-Package: io.sloeber.autoBuild.integrations; + uses:="org.eclipse.swt.graphics, + org.eclipse.swt.widgets, + org.eclipse.ui.dialogs, + org.eclipse.cdt.internal.ui.wizards, + org.eclipse.jface.dialogs, + org.eclipse.jface.wizard, + org.eclipse.jface.viewers, + org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.cdt.core.cdtvariables, + org.eclipse.cdt.ui.wizards, + org.eclipse.jface.resource, + org.eclipse.tools.templates.core, + org.eclipse.cdt.core.settings.model, + org.eclipse.core.resources, + org.eclipse.tools.templates.ui, + org.eclipse.ui.wizards.newresource", + io.sloeber.autoBuild.ui.internal;x-internal:=true, + io.sloeber.autoBuild.ui.pages;uses:="org.eclipse.cdt.ui.newui", + io.sloeber.autoBuild.ui.tabs; + uses:="io.sloeber.schema.api, + org.eclipse.cdt.ui.newui, + org.eclipse.swt.widgets, + org.eclipse.jface.preference, + org.eclipse.cdt.core.settings.model, + org.eclipse.core.resources, + io.sloeber.autoBuild.api, + org.eclipse.jface.viewers" diff --git a/io.sloeber.autoBuild.ui/OSGI-INF/l10n/bundle.properties b/io.sloeber.autoBuild.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 000000000..2a30c41d0 --- /dev/null +++ b/io.sloeber.autoBuild.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,121 @@ +page.c.build=C/C++ Build +CDTVariablesProperty.name=Build Variables +Environment=Environment +Builder.settings=Builder Settings +WBB.settings=Behaviour +Refresh.policy=Refresh Policy +EnvironmentTab.name = (Single) Environment +CPropertyVarsTab.name = (Single) CDT Vars (macros) +toolchain.settings=Tool parameter Settings +ProjectSettingsTab.name=Project output Settings +CDTProjectProperty.name=Tool chain Settings +Tool.Manager.Tab=Build Tool Manager +Project.settings.tooltip=Use this tab to change the project type of this configuration +Tool.Manager.tooltip=Use this tab to change the tools used to build the project + +Tool.settings=Tool Settings +Build.steps=Build Steps +Binary.parsers=Binary Parsers +Error.parsers=Error Parsers + +Team.name=Team + + +category.build.name=C/C++ Build +category.build.description= C/C++ Build Actions + +# The property pages +MngBuildProp.name=C/C++ Build +MngOtherProp.name= Error/Binary Parsers + +# The preference pages +MakeBuildPref.name=Makefile Project +MngBuildPref.name=Managed Build +NewCDTWizardPref.name=New C/C++ Project Wizard +varsPrefName=Build Variables +envPrefName=Environment +propSettingsPrefName=Property Pages Settings + +# The Resource Property page +MngResourceProp.name=C/C++ Build + +# Build/clean commands and the corresponding menu items. +command.buildFiles.label=Build Selected &File(s) +command.buildFiles.name=Build Selected File(s) +command.buildFiles.description=Rebuilds the selected source files +command.cleanFiles.label=C&lean Selected File(s) +command.cleanFiles.name=Clean Selected File(s) +command.cleanFiles.description=Deletes build output files for the selected source files +command.buildAllConfigurations.label=Build All +command.buildAllConfigurations.name=Build All Configurations +command.cleanAllConfigurations.label=Clean All +command.cleanAllConfigurations.name=Clean All Configurations +command.rebuildConfigurations.label=Build Selected... +command.rebuildConfigurations.name=Build Selected Configurations + +# The Project Converter page +command.convertTarget.label=Convert To... +command.convertTarget.name=Convert To + +# New CDT project model - property pages names +page.c.build=C/C++ Build +PathSymbolsProperty.name=Paths and Symbols +CDTExpPathSymbolsProperty.name=Export Settings +CDTBuildProperty.name=Settings +CDTToolchainProperty.name=Tool Chain Editor +CDTToolchainProperty.keyword.toolchain1=toolchain +CDTToolchainProperty.keyword.toolchain2=tool chain +CDTVariablesProperty.name=Build Variables +Discovery.options=Discovery Options +Environment=Environment + +Build.System.Wizard=Build System Wizard +Make.Project.Wizard=Make Project Wizard + +MBS.create.configuration=Create New Configuration + +WizardConvertMakeProject.name=Convert to a C/C++ Project (Adds C/C++ Nature) +WizardConvertMakeProject.description=Convert to a C/C++ Project + +WizardMakeProjFromExisting.name=Existing Code as Makefile Project +WizardMakeProjFromExisting.description=Create a new Makefile project in a directory containing existing code + +NewMakeFromExisting.name=Makefile Project with Existing Code + +Tool.settings=Tool Settings +Build.steps=Build Steps +Build.artifact=Build Artifact +Builder.settings=Builder Settings +WBB.settings=Behavior +Refresh.policy=Refresh Policy +Includes=Includes +Includes.tooltip=Includes list +IncludeFiles=Include Files +IncludeFiles.tooltip=Include Files list +Symbols=Symbols +Symbols.tooltip=Macros list +Libraries=Libraries +Libraries.tooltip=Libraries list +Library.paths=Library Paths +References=References +Source.location=Source Location +Output.location=Output Location +Binary.parsers=Binary Parsers +Error.parsers=Error Parsers +Data.hierarchy=Data Hierarchy +Preferred.toolchains=Preferred Toolchains +Wizard.defaults=Wizard Defaults +PropertyPage.defaults=Property Page Settings +MBSPerProjectProfile.name=Managed Build System - per project scanner info profile +multicfg=Multiple Configurations Edit + +DiscoveryTab.name = (Single) Discovery Options +CPropertyVarsTab.name = (Single) CDT Vars (macros) +ToolChainEditTab.name = (Single) Tool chain edit +EnvironmentTab.name = (Single) Environment + +# menu labels +Configurations.menu=Build Configurations + +buildDefinitionsUI.ep.name = Build Definitions UI +extension-point.name = Custom MBS New Wizard Pages diff --git a/io.sloeber.autoBuild.ui/build.properties b/io.sloeber.autoBuild.ui/build.properties new file mode 100644 index 000000000..0f364769b --- /dev/null +++ b/io.sloeber.autoBuild.ui/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = .,\ + plugin.xml,\ + plugin.properties,\ + META-INF/,\ + OSGI-INF/,\ + OSGI-INF/l10n/bundle.properties +jars.compile.order = . diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/action-buildconfig.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/action-buildconfig.gif new file mode 100644 index 000000000..f0404659b Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/action-buildconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/action-deleteconfig.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/action-deleteconfig.gif new file mode 100644 index 000000000..0883ade29 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/action-deleteconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/action-editconfig.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/action-editconfig.gif new file mode 100644 index 000000000..179b657e2 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/action-editconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/action-newconfig.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/action-newconfig.gif new file mode 100644 index 000000000..ea3c1377e Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/action-newconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/build_configs.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/build_configs.gif new file mode 100644 index 000000000..4539ebd91 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/build_configs.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-category.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-category.gif new file mode 100644 index 000000000..cd837b147 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-category.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-compiler.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-compiler.gif new file mode 100644 index 000000000..906f442c4 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-compiler.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-debug.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-debug.gif new file mode 100644 index 000000000..788601256 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-debug.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-librarian.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-librarian.gif new file mode 100644 index 000000000..0e6ec9624 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-librarian.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-linker.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-linker.gif new file mode 100644 index 000000000..34b228e7b Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-linker.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-preprocessor.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-preprocessor.gif new file mode 100644 index 000000000..5bfadbc9c Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-preprocessor.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-profile.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-profile.gif new file mode 100644 index 000000000..4539ebd91 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-profile.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-release.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-release.gif new file mode 100644 index 000000000..439138bec Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-release.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/config-tool.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/config-tool.gif new file mode 100644 index 000000000..4539ebd91 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/config-tool.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/list-add.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/list-add.gif new file mode 100644 index 000000000..5ee82b45c Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/list-add.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/list-delete.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/list-delete.gif new file mode 100644 index 000000000..5fd7e2d44 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/list-delete.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/list-edit.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/list-edit.gif new file mode 100644 index 000000000..371897285 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/list-edit.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/list-movedown.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/list-movedown.gif new file mode 100644 index 000000000..d2866389e Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/list-movedown.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/list-moveup.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/list-moveup.gif new file mode 100644 index 000000000..f8440c816 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/list-moveup.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/newmngc_app.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/newmngc_app.gif new file mode 100644 index 000000000..a8353f637 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/newmngc_app.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/newmngcc_app.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/newmngcc_app.gif new file mode 100644 index 000000000..9ed7487c2 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/newmngcc_app.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/dlcl16/read_only.gif b/io.sloeber.autoBuild.ui/icons/dlcl16/read_only.gif new file mode 100644 index 000000000..dde3cbd61 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/dlcl16/read_only.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/action-buildconfig.gif b/io.sloeber.autoBuild.ui/icons/elcl16/action-buildconfig.gif new file mode 100644 index 000000000..c4c76d000 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/action-buildconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/action-deleteconfig.gif b/io.sloeber.autoBuild.ui/icons/elcl16/action-deleteconfig.gif new file mode 100644 index 000000000..3986a4bc4 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/action-deleteconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/action-editconfig.gif b/io.sloeber.autoBuild.ui/icons/elcl16/action-editconfig.gif new file mode 100644 index 000000000..cc28a3a42 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/action-editconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/action-newconfig.gif b/io.sloeber.autoBuild.ui/icons/elcl16/action-newconfig.gif new file mode 100644 index 000000000..0ebc0dfe3 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/action-newconfig.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/build_configs.gif b/io.sloeber.autoBuild.ui/icons/elcl16/build_configs.gif new file mode 100644 index 000000000..c984fba70 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/build_configs.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/built_in.gif b/io.sloeber.autoBuild.ui/icons/elcl16/built_in.gif new file mode 100644 index 000000000..b51281b2a Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/built_in.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-category.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-category.gif new file mode 100644 index 000000000..ee7c48524 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-category.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-compiler.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-compiler.gif new file mode 100644 index 000000000..39ee59207 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-compiler.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-debug.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-debug.gif new file mode 100644 index 000000000..aef2061e5 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-debug.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-librarian.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-librarian.gif new file mode 100644 index 000000000..cb55e33b5 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-librarian.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-linker.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-linker.gif new file mode 100644 index 000000000..fe5d5595c Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-linker.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-preprocessor.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-preprocessor.gif new file mode 100644 index 000000000..cf62b63ae Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-preprocessor.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-profile.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-profile.gif new file mode 100644 index 000000000..c984fba70 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-profile.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-release.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-release.gif new file mode 100644 index 000000000..fa1765ec5 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-release.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/config-tool.gif b/io.sloeber.autoBuild.ui/icons/elcl16/config-tool.gif new file mode 100644 index 000000000..c984fba70 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/config-tool.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/discovery.gif b/io.sloeber.autoBuild.ui/icons/elcl16/discovery.gif new file mode 100644 index 000000000..ec6cca452 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/discovery.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/editable.gif b/io.sloeber.autoBuild.ui/icons/elcl16/editable.gif new file mode 100644 index 000000000..c34076a12 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/editable.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/list-add.gif b/io.sloeber.autoBuild.ui/icons/elcl16/list-add.gif new file mode 100644 index 000000000..45c0e6077 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/list-add.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/list-delete.gif b/io.sloeber.autoBuild.ui/icons/elcl16/list-delete.gif new file mode 100644 index 000000000..af59a0b19 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/list-delete.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/list-edit.gif b/io.sloeber.autoBuild.ui/icons/elcl16/list-edit.gif new file mode 100644 index 000000000..d1aa86cdf Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/list-edit.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/list-movedown.gif b/io.sloeber.autoBuild.ui/icons/elcl16/list-movedown.gif new file mode 100644 index 000000000..572933eec Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/list-movedown.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/list-moveup.gif b/io.sloeber.autoBuild.ui/icons/elcl16/list-moveup.gif new file mode 100644 index 000000000..768c5c171 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/list-moveup.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/newmngc_app.gif b/io.sloeber.autoBuild.ui/icons/elcl16/newmngc_app.gif new file mode 100644 index 000000000..23b0284f8 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/newmngc_app.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/newmngcc_app.gif b/io.sloeber.autoBuild.ui/icons/elcl16/newmngcc_app.gif new file mode 100644 index 000000000..4b39411da Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/newmngcc_app.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/read_only.gif b/io.sloeber.autoBuild.ui/icons/elcl16/read_only.gif new file mode 100644 index 000000000..dde3cbd61 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/read_only.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/elcl16/refresh_nav.gif b/io.sloeber.autoBuild.ui/icons/elcl16/refresh_nav.gif new file mode 100644 index 000000000..3ca04d06f Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/elcl16/refresh_nav.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/artifact.gif b/io.sloeber.autoBuild.ui/icons/obj16/artifact.gif new file mode 100644 index 000000000..1273abb76 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/artifact.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/bin_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/bin_obj.gif new file mode 100644 index 000000000..66225ec45 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/bin_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/build_settings.gif b/io.sloeber.autoBuild.ui/icons/obj16/build_settings.gif new file mode 100644 index 000000000..8fddef69f Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/build_settings.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/convert-normal.gif b/io.sloeber.autoBuild.ui/icons/obj16/convert-normal.gif new file mode 100644 index 000000000..0b693cb5f Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/convert-normal.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/define_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/define_obj.gif new file mode 100644 index 000000000..87d583e1d Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/define_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/environment.gif b/io.sloeber.autoBuild.ui/icons/obj16/environment.gif new file mode 100644 index 000000000..716df436f Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/environment.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/error_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/error_obj.gif new file mode 100644 index 000000000..2cd37c254 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/error_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/fileFolder_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/fileFolder_obj.gif new file mode 100644 index 000000000..2a3eb9190 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/fileFolder_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/file_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/file_obj.gif new file mode 100644 index 000000000..9729c4273 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/file_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/filesystem.gif b/io.sloeber.autoBuild.ui/icons/obj16/filesystem.gif new file mode 100644 index 000000000..13ce11b14 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/filesystem.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/fldr_lib_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/fldr_lib_obj.gif new file mode 100644 index 000000000..db8e55b70 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/fldr_lib_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/fldr_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/fldr_obj.gif new file mode 100644 index 000000000..03ee1dcb8 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/fldr_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/h_file_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/h_file_obj.gif new file mode 100644 index 000000000..b902fca49 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/h_file_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/hfolder_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/hfolder_obj.gif new file mode 100644 index 000000000..b98b81727 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/hfolder_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/hierarchy.gif b/io.sloeber.autoBuild.ui/icons/obj16/hierarchy.gif new file mode 100644 index 000000000..17f927e9a Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/hierarchy.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/inspect_sys.gif b/io.sloeber.autoBuild.ui/icons/obj16/inspect_sys.gif new file mode 100644 index 000000000..d68100a74 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/inspect_sys.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/lib_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/lib_obj.gif new file mode 100644 index 000000000..cb55e33b5 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/lib_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/log_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/log_obj.gif new file mode 100644 index 000000000..aebeab820 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/log_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/mbs.gif b/io.sloeber.autoBuild.ui/icons/obj16/mbs.gif new file mode 100644 index 000000000..3406bb186 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/mbs.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/opentype.gif b/io.sloeber.autoBuild.ui/icons/obj16/opentype.gif new file mode 100644 index 000000000..e687f54e6 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/opentype.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/output_folder_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/output_folder_obj.gif new file mode 100644 index 000000000..07c410158 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/output_folder_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/search_ref_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/search_ref_obj.gif new file mode 100644 index 000000000..f8f0ce5aa Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/search_ref_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/sroot_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/sroot_obj.gif new file mode 100644 index 000000000..bacc22a65 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/sroot_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/steps.gif b/io.sloeber.autoBuild.ui/icons/obj16/steps.gif new file mode 100644 index 000000000..68b3e5d90 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/steps.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/target_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/target_obj.gif new file mode 100644 index 000000000..def312aa1 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/target_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/textfile_obj.gif b/io.sloeber.autoBuild.ui/icons/obj16/textfile_obj.gif new file mode 100644 index 000000000..b226e41c5 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/textfile_obj.gif differ diff --git a/io.sloeber.autoBuild.ui/icons/obj16/workspace.gif b/io.sloeber.autoBuild.ui/icons/obj16/workspace.gif new file mode 100644 index 000000000..eb7b90c76 Binary files /dev/null and b/io.sloeber.autoBuild.ui/icons/obj16/workspace.gif differ diff --git a/io.sloeber.autoBuild.ui/plugin.properties b/io.sloeber.autoBuild.ui/plugin.properties new file mode 100644 index 000000000..a66316c1e --- /dev/null +++ b/io.sloeber.autoBuild.ui/plugin.properties @@ -0,0 +1,2 @@ +pluginName=AutoBuild Plugin user interface +providerName=Jan Baeyens diff --git a/io.sloeber.autoBuild.ui/plugin.xml b/io.sloeber.autoBuild.ui/plugin.xml new file mode 100644 index 000000000..75a106c9b --- /dev/null +++ b/io.sloeber.autoBuild.ui/plugin.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.sloeber.autoBuild.ui/pom.xml b/io.sloeber.autoBuild.ui/pom.xml new file mode 100644 index 000000000..b566fb75a --- /dev/null +++ b/io.sloeber.autoBuild.ui/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + + io.sloeber.arduino-eclipse-plugin + io.sloeber.parent + 4.4.3-SNAPSHOT + ../io.sloeber.parent + + + io.sloeber.autoBuild.ui + eclipse-plugin + diff --git a/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/ManagedBuilderUIImages.java b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/ManagedBuilderUIImages.java new file mode 100644 index 000000000..0632e9fbd --- /dev/null +++ b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/ManagedBuilderUIImages.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2002, 2016 Rational Software Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package io.sloeber.autoBuild.integrations; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; + +/** + * Bundle of all images used by the C plugin. + * + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class ManagedBuilderUIImages { + + // The plugin registry + private static ImageRegistry imageRegistry = new ImageRegistry(); + + // Subdirectory (under the package containing this class) where 16 color images are + private static URL iconBaseURL = null; + static { + iconBaseURL = Platform.getBundle("io.sloeber.autoBuild.ui").getEntry("icons/"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private static final String NAME_PREFIX = "io.sloeber.autoBuild.ui."; //$NON-NLS-1$ + private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length(); + + public static final String T_BUILD = "elcl16/"; //$NON-NLS-1$ + // list icons dir + public static final String T_LIST = "elcl16/"; //$NON-NLS-1$ + public static final String T_OBJ = "obj16/"; //$NON-NLS-1$ + + // For the managed build images + public static final String IMG_BUILD_CONFIG = NAME_PREFIX + "build_configs.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_CONFIG = createManaged(T_BUILD, IMG_BUILD_CONFIG); + public static final String IMG_BUILD_COMPILER = NAME_PREFIX + "config-compiler.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_COMPILER = createManaged(T_BUILD, IMG_BUILD_COMPILER); + public static final String IMG_BUILD_LINKER = NAME_PREFIX + "config-linker.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_LINKER = createManaged(T_BUILD, IMG_BUILD_LINKER); + public static final String IMG_BUILD_LIBRARIAN = NAME_PREFIX + "config-librarian.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_LIBRARIAN = createManaged(T_BUILD, IMG_BUILD_LIBRARIAN); + public static final String IMG_BUILD_COMMAND = NAME_PREFIX + "config-command.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_COMMAND = createManaged(T_BUILD, IMG_BUILD_COMMAND); + public static final String IMG_BUILD_PREPROCESSOR = NAME_PREFIX + "config-preprocessor.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_PREPROCESSOR = createManaged(T_BUILD, IMG_BUILD_PREPROCESSOR); + public static final String IMG_BUILD_TOOL = NAME_PREFIX + "config-tool.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_TOOL = createManaged(T_BUILD, IMG_BUILD_TOOL); + public static final String IMG_BUILD_CAT = NAME_PREFIX + "config-category.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILD_CAT = createManaged(T_BUILD, IMG_BUILD_CAT); + + // new images + public static final String IMG_READ_ONLY = NAME_PREFIX + "read_only.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_READ_ONLY = createManaged(T_OBJ, IMG_READ_ONLY); + public static final String IMG_EDITABLE = NAME_PREFIX + "editable.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_EDITABLE = createManaged(T_OBJ, IMG_EDITABLE); + public static final String IMG_BUILT_IN = NAME_PREFIX + "built_in.gif"; //$NON-NLS-1$ + public static final ImageDescriptor DESC_BUILT_IN = createManaged(T_OBJ, IMG_BUILT_IN); + + // refresh policy tab + /** + * @since 8.0 + */ + public static final String IMG_FILE_OBJ = NAME_PREFIX + "file_obj.gif"; //$NON-NLS-1$ + /** + * @since 8.0 + */ + public static final ImageDescriptor DESC_FILE_OBJ = createManaged(T_OBJ, IMG_FILE_OBJ); + /** + * @since 8.0 + */ + public static final String IMG_TEXTFILE_OBJ = NAME_PREFIX + "textfile_obj.gif"; //$NON-NLS-1$ + /** + * @since 8.0 + */ + public static final ImageDescriptor DESC_TEXTFILE_OBJ = createManaged(T_OBJ, IMG_TEXTFILE_OBJ); + /** + * @since 8.0 + */ + public static final String IMG_FILE_FOLDER_OBJ = NAME_PREFIX + "fileFolder_obj.gif"; //$NON-NLS-1$ + /** + * @since 8.0 + */ + public static final ImageDescriptor DESC_FILE_FOLDER_OBJ = createManaged(T_OBJ, IMG_FILE_FOLDER_OBJ); + + private static ImageDescriptor createManaged(String prefix, String name) { + return createManaged(imageRegistry, prefix, name); + } + + private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) { + ImageDescriptor result = ImageDescriptor + .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH))); + registry.put(name, result); + return result; + } + + public static Image get(String key) { + return imageRegistry.get(key); + } + + private static URL makeIconFileURL(String prefix, String name) { + StringBuilder buffer = new StringBuilder(prefix); + buffer.append(name); + try { + return new URL(iconBaseURL, buffer.toString()); + } catch (MalformedURLException e) { + e.printStackTrace(); + // ManagedBuilderUIPlugin.log(e); + return null; + } + } + + /** + * Helper method to access the image registry from the JavaPlugin class. + */ + static ImageRegistry getImageRegistry() { + return imageRegistry; + } +} diff --git a/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectBuildToolsPage.java b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectBuildToolsPage.java new file mode 100644 index 000000000..3ee14ff1d --- /dev/null +++ b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectBuildToolsPage.java @@ -0,0 +1,45 @@ +package io.sloeber.autoBuild.integrations; + +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +import io.sloeber.autoBuild.buildTools.api.IBuildTools; +import io.sloeber.autoBuild.ui.internal.Messages; +import io.sloeber.autoBuild.ui.tabs.BuildToolManagerTab; +import io.sloeber.autoBuild.ui.tabs.DialogCompleteEvent; + +public class NewProjectBuildToolsPage extends WizardPage { + + + private BuildToolManagerTab myBuildToolsManagerTab; + + protected NewProjectBuildToolsPage(String pageName) { + super(pageName); + myBuildToolsManagerTab =new BuildToolManagerTab(); + setTitle(Messages.NewProjectBuildToolsPage_title); + setDescription(Messages.NewProjectBuildToolsPage_description); + setPageComplete(false); + } + + @Override + public void createControl(Composite parent) { + Composite usercomp = new Composite(parent, SWT.NONE); + usercomp.setLayout(new GridLayout()); + usercomp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + setControl(usercomp); + myBuildToolsManagerTab.internalCreateControls(usercomp, new DialogCompleteEvent(){ + @Override + public void completeEvent(boolean isComplete) { + setPageComplete(isComplete); + } + }); + } + + public IBuildTools getBuildTools() { + return myBuildToolsManagerTab.getSelecteddBuildTool(); + } + +} diff --git a/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectCodeProviderPage.java b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectCodeProviderPage.java new file mode 100644 index 000000000..d023478fd --- /dev/null +++ b/io.sloeber.autoBuild.ui/src/io/sloeber/autoBuild/integrations/NewProjectCodeProviderPage.java @@ -0,0 +1,154 @@ +package io.sloeber.autoBuild.integrations; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import io.sloeber.autoBuild.api.AutoBuildNewProjectCodeManager; +import io.sloeber.autoBuild.api.ICodeProvider; +import io.sloeber.autoBuild.ui.internal.Messages; + +public class NewProjectCodeProviderPage extends WizardPage { + private static final String EMPTY=""; //$NON-NLS-1$ + private Group myButtonComp; + private Button myNoCodeButton; + private List