map, String macroName, String filename) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(map.get(macroName));
+ String escapedFilename = escapeWhitespaces(filename);
+ buffer.append(escapedFilename).append(WHITESPACE).append(LINEBREAK);
+ map.put(macroName, buffer.toString());
+ }
+
+ /**
+ * Process a String denoting a filepath in a way compatible for GNU Make rules,
+ * handling windows drive letters and whitespace appropriately.
+ *
+ *
+ * The context these paths appear in is on the right hand side of a rule header.
+ * i.e.
+ *
+ *
+ * target : dep1 dep2 dep3
+ *
+ *
+ * @param path
+ * the String denoting the path to process
+ * @throws NullPointerException
+ * is path is null
+ * @return a suitable Make rule compatible path
+ */
+ /* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=129782 */
+ static public String ensurePathIsGNUMakeTargetRuleCompatibleSyntax(String path) {
+ return escapeWhitespaces(ensureUnquoted(path));
+ }
+
+ static public String getToolCommandLinePattern(IAutoBuildConfigurationDescription autoBuildConfData, ITool tool) {
+ String orgPattern = tool.getDefaultCommandLinePattern();
+ if (orgPattern.contains("$")) { //$NON-NLS-1$
+ //if the pattern contains a space no use to try to expand it
+ return orgPattern;
+ }
+ return getVariableValue(orgPattern, orgPattern, false, autoBuildConfData);
+
+ }
+
+ static public String GetNiceFileName(IFolder buildPath, IFile path) {
+ return GetNiceFileName(buildPath.getLocation(), path.getLocation());
+ }
+
+ static public String GetNiceFileName(IPath buildPath, IPath filePath) {
+ String ret;
+ if (buildPath.isPrefixOf(filePath) || buildPath.removeLastSegments(3).isPrefixOf(filePath)) {
+ ret = filePath.makeRelativeTo(buildPath).toString();
+ } else {
+ ret = filePath.toString();
+ }
+
+ return ret;
+ }
+
+ static public String makeVariable(String variableName) {
+ return VARIABLE_PREFIX + variableName + VARIABLE_SUFFIX;
+ }
+
+ public static String[] resolveStringListValues(String[] basicStringListValue,
+ IAutoBuildConfigurationDescription autoConfData, boolean ignoreErrors) {
+ ICConfigurationDescription confDesc = autoConfData.getCdtConfigurationDescription();
+ DefaultVariableContextInfo contextInfo = new DefaultVariableContextInfo(
+ ICoreVariableContextInfo.CONTEXT_CONFIGURATION, confDesc);
+ IVariableSubstitutor varSubs = new SupplierBasedCdtVariableSubstitutor(contextInfo, EMPTY_STRING, EMPTY_STRING);
+ try {
+ return CdtVariableResolver.resolveStringListValues(basicStringListValue, varSubs, ignoreErrors);
+ } catch (CdtVariableException e) {
+ Activator.log(e);
+ }
+ return new String[0];
+ }
+
+ /**
+ * Mapper function for CdtVariableResolver.resolveToString
+ * Non existing environment variables are removed
+ * List type environment variables are seperated by an empty string
+ * The context for resolution is the configuration provided
+ *
+ * @param unresolved
+ * @param icConfigurationDescription
+ * @return a string that holds the resolved unresolved input. Never returns null
+ */
+ static public String resolve(String unresolved, IAutoBuildConfigurationDescription autoData) {
+ return resolve(unresolved, EMPTY_STRING, EMPTY_STRING, autoData);
+ }
+
+ static public String resolve(String unresolved, String nonexistentMacrosValue, String listDelimiter,
+ IAutoBuildConfigurationDescription autoData) {
+ DefaultVariableContextInfo contextInfo = new DefaultVariableContextInfo(
+ ICoreVariableContextInfo.CONTEXT_CONFIGURATION, autoData.getCdtConfigurationDescription());
+ IVariableSubstitutor varSubs = new SupplierBasedCdtVariableSubstitutor(contextInfo, nonexistentMacrosValue,
+ listDelimiter);
+ try {
+ return resolveToString(unresolved, varSubs);
+ } catch (CdtVariableException e) {
+ Activator.log(e);
+ }
+ return EMPTY_STRING;
+ }
+
+ /**
+ * resolves a string untill it contains no more environment variable references
+ * (read ${xx})
+ * That is: it will try maximum 20 times and then stop
+ *
+ * @param unresolved
+ * @param nonexistentMacrosValue
+ * @param listDelimiter
+ * @param autoData
+ * @return
+ */
+ static public String resolveRecursive(String unresolved, String nonexistentMacrosValue, String listDelimiter,
+ IAutoBuildConfigurationDescription autoData) {
+ int count = 0;
+ String inString = unresolved;
+ do {
+
+ String resolved = resolve(inString, nonexistentMacrosValue, listDelimiter, autoData);
+ if (resolved.equals(inString)) {
+ return resolved;
+ }
+ inString = resolved;
+ } while (++count < 20);
+ System.err.println("String relovement of string failed " + unresolved + " final value" + inString); //$NON-NLS-1$ //$NON-NLS-2$
+ return inString;
+ }
+
+ static public String getVariableValue(String varName, String defaultvalue, boolean resolve,
+ IAutoBuildConfigurationDescription autoBuildConfData) {
+ ICConfigurationDescription confDesc = autoBuildConfData.getCdtConfigurationDescription();
+ IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
+ try {
+ IEnvironmentVariable envVar=envManager.getVariable(varName, confDesc, resolve);
+ if(envVar!=null) {
+ return envVar.getValue();
+ }
+ } catch ( Exception e) {
+ // ignore all errors and return the default value
+ e.printStackTrace();
+ }
+ return defaultvalue;
+ }
+
+ /**
+ * This method makes sure that a string can be used as a file or folder name
+ *
+ * To do this it replaces all unacceptable characters with underscores.
+ * Currently it replaces (based on http://en.wikipedia.org/wiki/Filename ) /
+ * slash used as a path name component separator in Unix-like, Windows, and
+ * Amiga systems. (The MS-DOS command.com shell would consume it as a switch
+ * character, but Windows itself always accepts it as a
+ * separator.[6][vague]) \ backslash Also used as a path name component
+ * separator in MS-DOS, OS/2 and Windows (where there are few differences
+ * between slash and backslash); allowed in Unix filenames, see Note 1 ?
+ * question mark used as a wildcard in Unix, Windows and AmigaOS; marks a
+ * single character. Allowed in Unix filenames, see Note 1 % percent used as
+ * a wildcard in RT-11; marks a single character. asterisk or star used as a
+ * wildcard in Unix, MS-DOS, RT-11, VMS and Windows. Marks any sequence of
+ * characters (Unix, Windows, later versions of MS-DOS) or any sequence of
+ * characters in either the basename or extension (thus "*.*" in early
+ * versions of MS-DOS means "all files". Allowed in Unix filenames, see note
+ * 1 : colon used to determine the mount point / drive on Windows; used to
+ * determine the virtual device or physical device such as a drive on
+ * AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac OS.
+ * Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
+ * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar
+ * or pipe designates software pipelining in Unix and Windows; allowed in
+ * Unix filenames, see Note 1 " quote used to mark beginning and end of
+ * filenames containing spaces in Windows, see Note 1 < less than used to
+ * redirect input, allowed in Unix filenames, see Note 1 > greater than used
+ * to redirect output, allowed in Unix filenames, see Note 1 . period or dot
+ *
+ * # is excluded as it is seen as a special character by make
+ * =======
+ * character, but Windows itself always accepts it as a separator.[6][vague]) \
+ * backslash Also used as a path name component separator in MS-DOS, OS/2 and
+ * Windows (where there are few differences between slash and backslash);
+ * allowed in Unix filenames, see Note 1 ? question mark used as a wildcard in
+ * Unix, Windows and AmigaOS; marks a single character. Allowed in Unix
+ * filenames, see Note 1 % percent used as a wildcard in RT-11; marks a single
+ * character. asterisk or star used as a wildcard in Unix, MS-DOS, RT-11, VMS
+ * and Windows. Marks any sequence of characters (Unix, Windows, later versions
+ * of MS-DOS) or any sequence of characters in either the basename or extension
+ * (thus "*.*" in early versions of MS-DOS means "all files". Allowed in Unix
+ * filenames, see note 1 : colon used to determine the mount point / drive on
+ * Windows; used to determine the virtual device or physical device such as a
+ * drive on AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac
+ * OS. Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
+ * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar or
+ * pipe designates software pipelining in Unix and Windows; allowed in Unix
+ * filenames, see Note 1 " quote used to mark beginning and end of filenames
+ * containing spaces in Windows, see Note 1 < less than used to redirect input,
+ * allowed in Unix filenames, see Note 1 > greater than used to redirect output,
+ * allowed in Unix filenames, see Note 1 . period or dot
+ *
+ * @param name
+ * the string that needs to be checked
+ * @return a name safe to create files or folders
+ */
+ public static String MakeNameCompileSafe(String name) {
+ char[] badChars = { ' ', '/', '.', ':', '\\', '(', ')', '*', '?', '%', '|', '<', '>', ',', '-', '#' };
+ String ret = name.trim();
+ for (char curchar : badChars) {
+ ret = ret.replace(curchar, '_');
+ }
+ if(ret.length()>60) {
+ ret.substring(0, 60);
+ }
+ return ret;
+ }
+
+ /**
+ * given a pattern provide the name
+ *
+ * @param myNamePattern
+ * the pattern used to get the filename
+ * @param inputFile
+ * the file that is the input to the pattern
+ * @return the filename as to the pattern using inputFile as data
+ */
+ public static String applyPattern(String myNamePattern, IFile inputFile) {
+ String fileNameWithoutExtension = inputFile.getFullPath().removeFileExtension().lastSegment();
+ String fileNameWithExtension = inputFile.getName();
+ // Replace the % with the file name without extension
+ String outName = myNamePattern.replace(PROCENT, fileNameWithoutExtension);
+ //Replace the @ with the file name with extension
+ outName = outName.replace(AT_SYMBOL, fileNameWithExtension);
+ //Replace the * with the file name with extension
+ outName = outName.replace(ASTERISK, fileNameWithExtension);
+ return outName;
+ }
+
+ /**
+ * Returns the optimal number of parallel jobs.
+ * The number is the number of available processors on the machine.
+ *
+ * The function never returns number smaller than 1.
+ */
+ public static int getOptimalParallelJobNum() {
+ // Bug 398426: On my Mac running parallel builds at full tilt hangs the desktop.
+ // Need to pull it back one.
+ int j = Runtime.getRuntime().availableProcessors();
+ if (j > 1 && isMac)
+ return j - 1;
+ return j;
+ }
+
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //I copied the code below from the CDT code base because the CDT code contain historical
+ // backwards limitation (not expanding when there is a newline)
+ //I opted to just copy the code
+ //I didn't feel like asking if it was an option to remove the limitation because "to much time/frustration to little result"
+ //Anyway this code comes from CdtVariableResolver.resolveToString
+
+ /**
+ * Resolves macros of kind ${Macro} in the given string by calling the macro
+ * substitutor
+ * for each macro reference found. Macros can be inside one another like
+ * ${workspace_loc:/${ProjName}/} but resolved just once. No recursive
+ * macro names are allowed.
+ * It is not possible to prevent macros from expanding.
+ *
+ * @param string
+ * - macro expression.
+ * @param substitutor
+ * - macro resolution provider to retrieve macro values.
+ * @return resolved string
+ *
+ * @throws CdtVariableException
+ * if substitutor can't handle the macro and returns null or throws.
+ */
+ static private String resolveToString(String string, IVariableSubstitutor substitutor) throws CdtVariableException {
+ if (string == null) {
+ return EMPTY_STRING;
+ }
+
+ final Pattern pattern = Pattern.compile("(\\$\\{([^${}]*)\\})"); //$NON-NLS-1$
+ final String VARIABLE_PREFIX_MASKED = "$\1"; //$NON-NLS-1$
+ final String VARIABLE_SUFFIX_MASKED = "\2"; //$NON-NLS-1$
+
+ StringBuilder buffer = new StringBuilder(string);
+ int limit = string.length();
+ Matcher matcher = pattern.matcher(buffer);
+ while (matcher.find()) {
+ String name = matcher.group(2);
+ String resolved = name.length() > 0 ? substitutor.resolveToString(name) : EMPTY_STRING;
+ if (resolved == null) {
+ throw new CdtVariableException(ICdtVariableStatus.TYPE_MACRO_UNDEFINED, null, string, name);
+ }
+
+ if (limit-- < 0) {
+ // to prevent incidental endless looping
+ throw new CdtVariableException(ICdtVariableStatus.TYPE_ERROR, name, string, resolved);
+ }
+ // Only one expansion is allowed, so hide any text interfering with macro syntax
+ resolved = resolved.replace(VARIABLE_PREFIX, VARIABLE_PREFIX_MASKED);
+ resolved = resolved.replace(VARIABLE_SUFFIX, VARIABLE_SUFFIX_MASKED);
+
+ buffer.replace(matcher.start(1), matcher.end(1), resolved);
+ matcher = pattern.matcher(buffer);
+ }
+ String result = buffer.toString();
+ // take hidden data back
+ result = result.replace(VARIABLE_PREFIX_MASKED, VARIABLE_PREFIX);
+ result = result.replace(VARIABLE_SUFFIX_MASKED, VARIABLE_SUFFIX);
+
+ return result;
+ }
+
+ public static String makeNameMakeSafe( String fileName) {
+ // if(myReplceSpaceWith_) {
+ return fileName.replace(BLANK, UNDER_SCORE);
+ //}
+ }
+
+
+ /**
+ * copied from
+ * https://stackoverflow.com/questions/934191/how-to-check-existence-of-a-program-in-the-path#23539220
+ * and added EXTENSIONS
+ *
+ * @param exe
+ * @return
+ */
+ @SuppressWarnings("nls")
+ public static boolean canExecute(final String exe) {
+ if (exe == null || exe.isBlank()) {
+ new Throwable().printStackTrace();
+ return false;
+ }
+ String knownExtensions[] = { "", ".exe", ".bat", ".com", ".cmd" };
+ final var paths = getenv(ENV_VAR_PATH).split(quote(pathSeparator));
+ return Stream.of(paths).map(Paths::get).anyMatch(path -> {
+ final var p = path.resolve(exe);
+ var found = false;
+
+ for (final var extension : knownExtensions) {
+ if (isExecutable(java.nio.file.Path.of(p.toString() + extension))) {
+ found = true;
+ break;
+ }
+ }
+
+ return found;
+ });
+ }
+
+
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/Messages.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/Messages.java
new file mode 100644
index 000000000..cc60d342f
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/Messages.java
@@ -0,0 +1,160 @@
+package io.sloeber.autoBuild.core;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "io.sloeber.autoBuild.core.messages"; //$NON-NLS-1$
+
+ public static String ManagedMakeBuilder_message_starting;
+ public static String ManagedMakeBuilder_message_rebuild_makefiles;
+ public static String ManagedMakeBuilder_message_update_makefiles;
+ public static String ManagedMakeBuilder_message_incremental;
+ public static String ManagedMakeBuilder_message_updating;
+ public static String ManagedMakeBuilder_message_make;
+ public static String ManagedMakeBuilder_message_internal_builder;
+ public static String ManagedMakeBuilder_message_regen_deps;
+ public static String ManagedMakeBuilder_message_updating_deps;
+ public static String ManagedMakeBuilder_message_creating_markers;
+ public static String ManagedMakeBuilder_message_console_header;
+ public static String ManagedMakeBuilder_message_internal_builder_header_note;
+ public static String ManagedMakeBuilder_message_no_build;
+ public static String ManagedMakeBuilder_message_error;
+ public static String ManagedMakeBuilder_message_error_build;
+ // public static String ManagedMakeBuilder_message_error_refresh;
+ public static String ManagedMakeBuilder_message_undefined_build_command;
+ public static String ManagedMakeBuilder_message_finished;
+ public static String ManagedMakeBuilder_message_cancelled;
+ public static String ManagedMakeBuilder_message_finished_with_errs;
+ public static String ManagedMakeBuilder_message_internal_builder_error;
+ public static String ManagedMakeBuilder_message_stopped_error;
+ public static String ManagedMakeBuilder_message_clean_deleting_output;
+ public static String ManagedMakeBuilder_message_clean_build_clean;
+ public static String ManagedMakeBuilder_message_program_not_in_path;
+ public static String ManagedMakeBuilder_message_build_finished;
+ public static String ManagedMakeBuilder_type_clean;
+ public static String ManagedMakeBuider_type_incremental;
+ public static String ManagedMakeBuider_type_rebuild;
+ public static String ManagedMakeBuilder_warning_unsupported_configuration;
+ public static String ManagedMakeBuilder_error_prefix;
+
+ public static String Option_error_bad_value_type;
+ public static String ManagedBuildManager_error_owner_not_null;
+ public static String ManagedBuildManager_error_null_owner;
+ public static String ManagedBuildManager_error_owner_not_project;
+ public static String ManagedBuildManager_error_manifest_load_failed_title;
+ public static String ManagedBuildManager_error_manifest_version_error;
+ public static String ManagedBuildManager_error_manifest_header;
+ public static String ManagedBuildManager_error_manifest_resolving;
+ public static String ManagedBuildManager_error_manifest_duplicate;
+ public static String ManagedBuildManager_error_manifest_icon;
+ public static String ManagedBuildManager_error_manifest_option_category;
+ public static String ManagedBuildManager_error_manifest_option_filter;
+ public static String ManagedBuildManager_error_manifest_option_valuehandler;
+ public static String ManagedBuildManager_error_open_failed_title;
+ public static String ManagedBuildManager_error_open_failed;
+ public static String ManagedBuildManager_error_write_failed_title;
+ public static String ManagedBuildManager_error_write_failed;
+ public static String ManagedBuildManager_error_read_only;
+ public static String ManagedBuildManager_error_project_version_error;
+ public static String ManagedBuildManager_error_id_nomatch;
+ public static String ManagedBuildManager_error_project_file_missing;
+ public static String MakefileGenerator_message_start_file;
+ public static String MakefileGenerator_message_finish_file;
+ public static String MakefileGenerator_message_start_build;
+ public static String MakefileGenerator_message_finish_build;
+ public static String MakefileGenerator_message_start_dependency;
+ public static String MakefileGenerator_message_no_target;
+ public static String MakefileGenerator_message_adding_source_folder;
+ public static String MakefileGenerator_message_gen_source_makefile;
+ public static String MakefileGenerator_message_calc_delta;
+ public static String MakefileGenerator_message_finding_sources;
+ public static String MakefileGenerator_comment_module_list;
+ public static String MakefileGenerator_comment_module_variables;
+ public static String MakefileGenerator_comment_source_list;
+ public static String MakefileGenerator_comment_build_rule;
+ public static String MakefileGenerator_comment_build_toprules;
+ public static String MakefileGenerator_comment_build_alltarget;
+ public static String MakefileGenerator_comment_build_mainbuildtarget;
+ public static String MakefileGenerator_comment_build_toptargets;
+ public static String MakefileGenerator_comment_module_make_includes;
+ public static String MakefileGenerator_comment_module_dep_includes;
+ public static String MakefileGenerator_comment_autodeps;
+ public static String MakefileGenerator_comment_header;
+ public static String MakefileGenerator_error_spaces;
+ public static String MakeBuilder_Invoking_Make_Builder;
+ public static String MakeBuilder_Invoking_Command;
+ public static String MakeBuilder_Updating_project;
+ public static String MakeBuilder_Creating_Markers;
+ public static String MakefileGenerator_warning_no_source;
+ public static String MakefileGenerator_error_no_nameprovider;
+ public static String ManagedBuildInfo_message_job_init;
+ public static String ManagedBuildInfo_message_init_ok;
+ public static String GnuMakefileGenerator_message_postproc_dep_file;
+ public static String Configuration_orphaned;
+ public static String Tool_default_announcement;
+ public static String Tool_Problem_Discovering_Args_For_Option;
+ public static String StorableEnvironmentLoader_storeOutputStream_wrong_arguments;
+ public static String UserDefinedMacroSupplier_storeOutputStream_wrong_arguments;
+ public static String BuildMacroStatus_status_macro_undefined;
+ public static String GeneratedMakefileBuilder_buildingSelectedFiles;
+ public static String BuildDescriptionGnuMakefileGenerator_0;
+ public static String BuildDescriptionGnuMakefileGenerator_1;
+ public static String BuildMacroStatus_status_reference_eachother;
+ public static String BuildMacroStatus_status_reference_incorrect;
+ public static String BuildMacroStatus_status_macro_not_string;
+ public static String BuildMacroStatus_status_macro_not_stringlist;
+ public static String BuildMacroStatus_status_error;
+ public static String BuildMacroStatus_value_undefined;
+ public static String BuildInfoFactory_Missing_Builder;
+ public static String ResourceChangeHandler_buildInfoSerializationJob;
+ public static String GeneratedMakefileBuilder_buildingProject;
+ public static String GeneratedMakefileBuilder_cleaningProject;
+ public static String GeneratedMakefileBuilder_removingResourceMarkers;
+ public static String GeneratedMakefileBuilder_refreshingArtifacts;
+ public static String GeneratedMakefileBuilder_fileDeleted;
+ public static String GeneratedMakefileBuilder_nothingToClean;
+ public static String GenerateMakefileWithBuildDescription_0;
+ public static String GenerateMakefileWithBuildDescription_1;
+ public static String ManagedBuilderCorePlugin_resourceChangeHandlingInitializationJob;
+ public static String InternalBuilder_msg_header;
+ public static String InternalBuilder_nothing_todo;
+ public static String CfgScannerConfigUtil_ErrorNotSupported;
+ public static String GeneratedMakefileBuilder_cleanSelectedFiles;
+ public static String FolderInfo_4;
+ public static String GnuLinkOutputNameProvider_0;
+ public static String CommonBuilder_1;
+ public static String CommonBuilder_2;
+ public static String CommonBuilder_6;
+ public static String CommonBuilder_7;
+ public static String CommonBuilder_0;
+ public static String CommonBuilder_16;
+ public static String CommonBuilder_12;
+ public static String CommonBuilder_13;
+ public static String CommonBuilder_22;
+ public static String CommonBuilder_23;
+ public static String CommonBuilder_24;
+ public static String CommonBuilder_circular_dependency;
+ public static String ParallelBuilder_missingOutDir;
+ public static String MakeBuilder_buildError;
+ public static String MultiResourceInfo_MultiResourceInfo_UnhandledIHoldsOptionsType;
+ public static String ResourceChangeHandler2_0;
+ public static String ToolInfo_0;
+ public static String ToolInfo_1;
+ public static String AbstractBuiltinSpecsDetector_AddScannerDiscoveryMarkers;
+ public static String AbstractBuiltinSpecsDetector_ClearingMarkers;
+ public static String AbstractBuiltinSpecsDetector_DiscoverBuiltInSettingsJobName;
+ public static String AbstractBuiltinSpecsDetector_RunningScannerDiscovery;
+ public static String AbstractBuiltinSpecsDetector_ScannerDiscoveryMarkerLocationPreferences;
+ public static String AbstractBuiltinSpecsDetector_ScannerDiscoveryMarkerLocationProperties;
+ public static String AbstractBuiltinSpecsDetector_ScannerDiscoveryTaskTitle;
+ public static String AbstractBuiltinSpecsDetector_SerializingResults;
+ public static String ExternalBuilderName;
+ public static String InternalBuilderName;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/messages.properties b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/messages.properties
new file mode 100644
index 000000000..b8c0b8e6b
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/core/messages.properties
@@ -0,0 +1,186 @@
+###############################################################################
+# Copyright (c) 2002, 2010 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
+###############################################################################
+
+# Generated makefile builder messages
+ManagedMakeBuilder_message_starting = Starting the build for project {0}
+ManagedMakeBuilder_message_rebuild_makefiles = Regenerating makefiles for project {0}
+ManagedMakeBuilder_message_update_makefiles = Updating makefiles for project {0}
+ManagedMakeBuilder_message_incremental = Updating makefiles for project {0}
+ManagedMakeBuilder_message_updating = Updating project files...
+ManagedMakeBuilder_message_make = Calling {0} for project {1}
+ManagedMakeBuilder_message_internal_builder = Internal Builder
+ManagedMakeBuilder_message_regen_deps = Regenerating dependency files for {0}
+ManagedMakeBuilder_message_updating_deps = Updating dependency files for {0}
+ManagedMakeBuilder_message_creating_markers = Generating markers...
+ManagedMakeBuilder_message_console_header = **** {0} of configuration {1} for project {2} ****
+ManagedMakeBuilder_message_internal_builder_header_note = Info: Internal Builder is used for build
+ManagedMakeBuilder_message_no_build = Info: Nothing to build for {0}
+ManagedMakeBuilder_message_error = Internal error during build, see eclipse error log.
+ManagedMakeBuilder_message_error_build = Internal error building project {0} configuration {1}
+ManagedMakeBuilder_message_undefined_build_command = Build command is null for builder {0}
+ManagedMakeBuilder_message_finished = Build complete for project {0}
+ManagedMakeBuilder_message_cancelled = Build cancelled
+ManagedMakeBuilder_message_finished_with_errs = Build completed with errors
+ManagedMakeBuilder_message_internal_builder_error = Build failed: Internal builder error occurred
+ManagedMakeBuilder_message_stopped_error=Build error occurred, build is stopped
+ManagedMakeBuilder_message_clean_deleting_output=Removing build artifacts from {0}
+ManagedMakeBuilder_message_clean_build_clean=Trying a make clean in {0}
+ManagedMakeBuilder_message_program_not_in_path=Program "{0}" is not found in PATH
+ManagedMakeBuilder_message_build_finished=**** Build Finished ****
+ManagedMakeBuilder_type_clean = Clean-only build
+ManagedMakeBuider_type_incremental = Build
+ManagedMakeBuider_type_rebuild = Rebuild
+ManagedMakeBuilder_warning_unsupported_configuration=**** WARNING: The "{0}" Configuration may not build ****\n**** because it uses the "{1}" ****\n**** tool-chain that is unsupported on this system. ****\n\n**** Attempting to build... ****\u0020
+ManagedMakeBuilder_error_prefix=Error:\u0020
+
+# Option exception messages
+Option_error_bad_value_type=Type of option value is inconsistent with option type
+
+# Managed build manager exception messages
+ManagedBuildManager_error_owner_not_null=addTarget: owner not null
+ManagedBuildManager_error_null_owner=addTarget: null owner
+ManagedBuildManager_error_owner_not_project=addTarget: owner not project
+ManagedBuildManager_error_manifest_load_failed_title=Managed Build System Version Error
+ManagedBuildManager_error_manifest_version_error=The version number defined in the plug-in manifest file\n{0}\nis greater than the version of the Managed Build System.\nThe definitions in the manifest file will not be loaded.
+ManagedBuildManager_error_manifest_header=Managed Build system manifest file error:\u0020
+ManagedBuildManager_error_manifest_resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
+ManagedBuildManager_error_manifest_duplicate=Duplicate identifier {1} for element type {0}.
+ManagedBuildManager_error_manifest_icon=Could not load icon "{0}".
+ManagedBuildManager_error_manifest_option_category=Option {0} uses a null category that is invalid in its context. The option was ignored.
+ManagedBuildManager_error_manifest_option_filter=Option {0} uses an unsupported resourceFilter attribute value. The option was ignored.
+ManagedBuildManager_error_manifest_option_valuehandler=Could not load value handler {0} in option {1}.
+ManagedBuildManager_error_open_failed_title=Managed Make Project File Error
+ManagedBuildManager_error_open_failed=The Managed Make project file could not be read because of the following error:\n\n{0}\n\nManaged Make functionality will not be available for this project.
+ManagedBuildManager_error_write_failed_title=Managed Make Project File Write Error
+ManagedBuildManager_error_write_failed=The Managed Make project file could not be written because of the following error:\n\n{0}\n
+ManagedBuildManager_error_read_only=File {0} is read-only.
+ManagedBuildManager_error_project_version_error=The version number of the project {0} is greater than the Managed Build System version number.
+ManagedBuildManager_error_id_nomatch=Error loading Managed Make project information for project {0}. The tool definitions used to create the project are not available.
+ManagedBuildManager_error_project_file_missing=The Managed Make project file for project {0} is missing.
+# Makefile Generator Messages
+MakefileGenerator_message_start_file=Building file:
+MakefileGenerator_message_finish_file=Finished building:
+MakefileGenerator_message_start_build=Building target:
+MakefileGenerator_message_finish_build=Finished building target:
+MakefileGenerator_message_start_dependency=Regenerating dependency file:
+MakefileGenerator_message_no_target=No tool found that can build the extension specified with the build artifact name
+MakefileGenerator_message_adding_source_folder=Adding folder {0} to sources
+MakefileGenerator_message_gen_source_makefile=Generating makefile for source folder {0}
+MakefileGenerator_message_calc_delta=Calculating the delta for project {0}
+MakefileGenerator_message_finding_sources=Finding source files in project {0}
+MakefileGenerator_comment_module_list = Every subdirectory with source files must be described here
+MakefileGenerator_comment_module_variables = Add inputs and outputs from these tool invocations to the build variables\u0020
+MakefileGenerator_comment_source_list = All of the sources participating in the build are defined here
+MakefileGenerator_comment_build_rule = Each subdirectory must supply rules for building sources it contributes
+MakefileGenerator_comment_build_toprules = Tool invocations
+MakefileGenerator_comment_build_alltarget = All Target
+MakefileGenerator_comment_build_mainbuildtarget = Main-build Target
+MakefileGenerator_comment_build_toptargets = Other Targets
+MakefileGenerator_comment_module_make_includes = Include the makefiles for each source subdirectory
+MakefileGenerator_comment_module_dep_includes = Include automatically-generated dependency list:
+MakefileGenerator_comment_autodeps=Automatically-generated dependency list:
+MakefileGenerator_comment_header=Automatically-generated file. Do not edit!
+MakefileGenerator_error_spaces=Cannot generate makefile for folder with spaces in name
+MakeBuilder_Invoking_Make_Builder=Invoking Make Builder...
+MakeBuilder_Invoking_Command=Invoking Command:\u0020
+MakeBuilder_Updating_project=Updating project...
+MakeBuilder_Creating_Markers=Generating markers...
+MakefileGenerator_warning_no_source=Nothing to build for project {0}
+MakefileGenerator_error_no_nameprovider=A nameProvider or outputNames must be specified with multipleType == true
+
+ManagedBuildInfo_message_job_init = Initializing path container for {0}
+ManagedBuildInfo_message_init_ok = Initializing path container succeeded for {0}
+
+# Default GNU Makefile Generator messages
+GnuMakefileGenerator_message_postproc_dep_file=Verifying contents of dependency file {0}
+
+# Configuration strings
+Configuration_orphaned=Orphaned CDT build configuration [{0}]: parent extension cfg [{1}] not found
+# Tool strings
+Tool_default_announcement=Invoking:
+Tool_Problem_Discovering_Args_For_Option=Problem discovering arguments for Tool option: {0} ({1})
+#Environment loader messages
+StorableEnvironmentLoader_storeOutputStream_wrong_arguments=Wrong arguments
+
+#User Defined Macro Supplier
+UserDefinedMacroSupplier_storeOutputStream_wrong_arguments=Failed to persist macros: Wrong arguments
+
+# BuildMacroStatus messages
+BuildMacroStatus_status_macro_undefined=Macro {0} is undefined
+GeneratedMakefileBuilder_buildingSelectedFiles=Building Selected Files
+BuildDescriptionGnuMakefileGenerator_0=IO exception occurred:\u0020
+BuildDescriptionGnuMakefileGenerator_1=IO exception occurred:\u0020
+BuildMacroStatus_status_reference_eachother=Macros {0} and {1} reference each other
+BuildMacroStatus_status_reference_incorrect=Macro {0} reference is incorrect
+BuildMacroStatus_status_macro_not_string=Macro {0} is not of String type
+BuildMacroStatus_status_macro_not_stringlist=Macro {0} is not of String-list type
+BuildMacroStatus_status_error=Error occurred
+BuildMacroStatus_value_undefined=\u0020
+BuildInfoFactory_Missing_Builder=Missing Builder:\u0020
+
+#ResourceChangeHandler messages
+ResourceChangeHandler_buildInfoSerializationJob=Build Info Serialization
+
+#ManagedBuilderCorePlugin messages
+GeneratedMakefileBuilder_buildingProject=Building project {0}
+GeneratedMakefileBuilder_cleaningProject=Cleaning project {0}
+GeneratedMakefileBuilder_removingResourceMarkers=Removing problem markers for {0}
+GeneratedMakefileBuilder_refreshingArtifacts=Refreshing build artifacts for {0}
+GeneratedMakefileBuilder_fileDeleted={0} deleted.
+GeneratedMakefileBuilder_nothingToClean=Nothing to clean.
+GenerateMakefileWithBuildDescription_0=info is null
+GenerateMakefileWithBuildDescription_1=cfg is null
+ManagedBuilderCorePlugin_resourceChangeHandlingInitializationJob=Initializing Resource Change Handling
+
+#Internal Builder messages
+InternalBuilder_msg_header=Internal Builder: {0}
+InternalBuilder_nothing_todo=Nothing to be done for project {0}
+CfgScannerConfigUtil_ErrorNotSupported=Only type {0} is supported in this method.
+GeneratedMakefileBuilder_cleanSelectedFiles=Cleaning Selected Files
+FolderInfo_4=converter invocation failed
+GnuLinkOutputNameProvider_0=tool parent must be one of configuration, toolchain, or resource configuration
+CommonBuilder_1=customized builder created for builder that does not support customization
+CommonBuilder_2=request for building non active configuration for the builder that does not support this
+CommonBuilder_6=Time consumed: {0} ms. \u0020
+CommonBuilder_7=Info: Parallel threads used: {0}
+CommonBuilder_0=can not clean programmatically: build workspace path is not specified
+CommonBuilder_16=can not clean programmatically: build workspace path is not the project path
+CommonBuilder_12=can not clean programmatically: build workspace path is not folder
+CommonBuilder_13=can not clean programmatically: build folder is not accessible
+CommonBuilder_22=Building referenced configurations.
+CommonBuilder_23=Buildfile generation error occurred.
+CommonBuilder_24=Build stopped.
+CommonBuilder_circular_dependency=Circular dependency detected in "Project Properties -> C/C++ General -> Path and Symbols -> References tab" for project {0} <{1}>. Build of dependency aborted to prevent infinite cyclic build.
+ParallelBuilder_missingOutDir=Failed to create output directory {0}
+
+MakeBuilder_buildError=
+MultiResourceInfo_MultiResourceInfo_UnhandledIHoldsOptionsType=Unhandled parent type: not ITool nor IToolChain
+ResourceChangeHandler2_0=project build settings update job
+ToolInfo_0=conversion failure
+ToolInfo_1=the tool is removed
+
+#Language settings providers messages
+AbstractBuiltinSpecsDetector_AddScannerDiscoveryMarkers=Adding Scanner Discovery markers
+AbstractBuiltinSpecsDetector_ClearingMarkers=Clearing markers for {0}
+AbstractBuiltinSpecsDetector_DiscoverBuiltInSettingsJobName=Discover compiler built-in language settings
+AbstractBuiltinSpecsDetector_RunningScannerDiscovery=Running scanner discovery: {0}
+AbstractBuiltinSpecsDetector_ScannerDiscoveryMarkerLocationPreferences=Preferences, C++/Build/Settings/Discovery, [{0}] options
+AbstractBuiltinSpecsDetector_ScannerDiscoveryMarkerLocationProperties=Project Properties, C++ Preprocessor Include.../Providers, [{0}] options
+AbstractBuiltinSpecsDetector_ScannerDiscoveryTaskTitle=CDT Scanner Discovery
+AbstractBuiltinSpecsDetector_SerializingResults=Serializing results
+
+
+
+ExternalBuilderName=Make builder
+InternalBuilderName=Internal builder
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IBuildPathResolver.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IBuildPathResolver.java
new file mode 100644
index 000000000..064c703bd
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IBuildPathResolver.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2012 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package io.sloeber.autoBuild.extensionPoint;
+
+import io.sloeber.autoBuild.schema.api.IConfiguration;
+
+/**
+ * This interface is to be implemented by the tool-integrator to provide some specific
+ * logic for resolving the build path variable values to the build paths.
+ *
+ * See extension point {@code org.eclipse.cdt.managedbuilder.core.buildDefinitions},
+ * element {@code envVarBuildPath} attribute {@code buildPathResolver}.
+ *
+ * @since 3.0
+ */
+public interface IBuildPathResolver {
+ /**
+ * @param pathType one of the IEnvVarBuildPath.BUILDPATH _xxx
+ * @param variableName represents the name of the variable that holds the build paths
+ * @param variableValue represents the value of the value specified with the
+ * variableName argument
+ * @param configuration represents configuration for which the build paths are requested
+ */
+ String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration);
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationBuildMacroSupplier.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationBuildMacroSupplier.java
new file mode 100644
index 000000000..20451b035
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationBuildMacroSupplier.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2012 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package io.sloeber.autoBuild.extensionPoint;
+
+import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
+
+import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription;
+
+/**
+ *
+ * this interface is to be implemented by the tool-integrator
+ * for supplying the configuration-specific macros
+ *
+ * @since 3.0
+ */
+public interface IConfigurationBuildMacroSupplier {
+ /**
+ *
+ * @param macroName
+ * the macro name
+ * @param configuration
+ * configuration
+ * @param provider
+ * the instance of the build macro provider to be used for querying
+ * the
+ * build macros from within the supplier. The supplier should use
+ * this provider to obtain
+ * the already defined build macros instead of using the "default"
+ * provider returned by the
+ * ManagedBuildManager.getBuildMacroProvider().
+ * The provider passed to a supplier will ignore searching macros for
+ * the levels
+ * higher than the current supplier level, will query only the
+ * lower-precedence suppliers
+ * for the current level and will query all suppliers for the lower
+ * levels.
+ * This is done to avoid infinite loops that could be caused if the
+ * supplier calls the provider
+ * and the provider in turn calls that supplier again. Also the
+ * supplier should not know anything
+ * about the build macros defined for the higher levels.
+ * @return the reference to the ICdtVariable interface representing
+ * the build macro of a given name or null if the macro of that name is
+ * not defined
+ */
+ public ICdtVariable getMacro(String macroName, IAutoBuildConfigurationDescription configuration);
+
+ /**
+ *
+ * @param configuration
+ * configuration
+ * @param provider
+ * the instance of the build macro provider to be used for querying
+ * the
+ * build macros from within the supplier. The supplier should use
+ * this provider to obtain
+ * the already defined build macros instead of using the "default"
+ * provider returned by the
+ * ManagedBuildManager.getBuildMacroProvider().
+ * The provider passed to a supplier will ignore searching macros for
+ * the levels
+ * higher than the current supplier level, will query only the
+ * lower-precedence suppliers
+ * for the current level and will query all suppliers for the lower
+ * levels.
+ * This is done to avoid infinite loops that could be caused if the
+ * supplier calls the provider
+ * and the provider in turn calls that supplier again. Also the
+ * supplier should not know anything
+ * about the build macros defined for the higher levels.
+ * @return the ICdtVariable[] array representing defined macros
+ */
+ public ICdtVariable[] getMacros(IAutoBuildConfigurationDescription configuration);
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationNameProvider.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationNameProvider.java
new file mode 100644
index 000000000..5c8fd8f49
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IConfigurationNameProvider.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+
+package io.sloeber.autoBuild.extensionPoint;
+
+import io.sloeber.autoBuild.schema.api.IConfiguration;
+
+public interface IConfigurationNameProvider {
+
+ /*
+ * Returns the new unique configuration name based on the 'configuration'
+ * object and the list of configuration names already in use in the project.
+ *
+ */
+
+ String getNewConfigurationName(IConfiguration configuration, String[] usedConfigurationNames);
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/ILanguageInfoCalculator.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/ILanguageInfoCalculator.java
new file mode 100644
index 000000000..f8cf4f600
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/ILanguageInfoCalculator.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package io.sloeber.autoBuild.extensionPoint;
+
+import org.eclipse.core.resources.IResource;
+
+import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription;
+import io.sloeber.autoBuild.schema.api.IInputType;
+import io.sloeber.autoBuild.schema.api.ITool;
+
+public interface ILanguageInfoCalculator {
+ String getLanguageName(IResource rcInfo, IAutoBuildConfigurationDescription confDesc, ITool tool, IInputType type);
+
+ String getLanguageId(IResource rcInfo, IAutoBuildConfigurationDescription confDesc, ITool tool, IInputType type);
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IManagedCommandLineGenerator.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IManagedCommandLineGenerator.java
new file mode 100644
index 000000000..809157496
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IManagedCommandLineGenerator.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package io.sloeber.autoBuild.extensionPoint;
+
+import io.sloeber.autoBuild.api.IManagedCommandLineInfo;
+import io.sloeber.autoBuild.schema.api.ITool;
+
+public interface IManagedCommandLineGenerator {
+ public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
+ String outputFlag, String outputPrefix, String outputName, String[] inputResources,
+ String commandLinePattern);
+}
diff --git a/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IOptionCommandGenerator.java b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IOptionCommandGenerator.java
new file mode 100644
index 000000000..b802886ce
--- /dev/null
+++ b/io.sloeber.autoBuild/src/io/sloeber/autoBuild/extensionPoint/IOptionCommandGenerator.java
@@ -0,0 +1,49 @@
+/*****************************************************************
+ * Copyright (c) 2010, 2011 Texas Instruments 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:
+ * Texas Instruments - Initial API and implementation
+ *****************************************************************/
+
+package io.sloeber.autoBuild.extensionPoint;
+
+import java.util.Map;
+
+import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription;
+import io.sloeber.autoBuild.schema.api.IOption;
+
+/**
+ * This interface can be implemented by clients to contribute custom
+ * command-generator
+ * for a build-option.
+ *
+ * The custom command-generator class should be referenced in the
+ *