From 76a32914af4668ff56c085b07b1c4f01156b2c91 Mon Sep 17 00:00:00 2001 From: Karthik Purushothaman Date: Thu, 10 Dec 2015 15:53:31 +0530 Subject: [PATCH] Auto generate UUID in Atmel studio solution and project template file --- workspace_tools/export/atmelstudio.py | 8 +++++++- workspace_tools/export/atmelstudio6_2.atsln.tmpl | 10 +++++----- workspace_tools/export/atmelstudio6_2.cppproj.tmpl | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/workspace_tools/export/atmelstudio.py b/workspace_tools/export/atmelstudio.py index 0fa3710d81..548aa06465 100644 --- a/workspace_tools/export/atmelstudio.py +++ b/workspace_tools/export/atmelstudio.py @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ +import uuid from exporters import Exporter from os.path import splitext, basename, dirname @@ -51,6 +52,9 @@ class AtmelStudio(Exporter): for lib in self.resources.libraries: l, _ = splitext(basename(lib)) libraries.append(l[3:]) + + solution_uuid = '{' + str(uuid.uuid4()) + '}' + project_uuid = '{' + str(uuid.uuid4()) + '}' ctx = { 'target': self.target, @@ -62,7 +66,9 @@ class AtmelStudio(Exporter): 'library_paths': self.resources.lib_dirs, 'linker_script': self.resources.linker_script, 'libraries': libraries, - 'symbols': self.get_symbols() + 'symbols': self.get_symbols(), + 'solution_uuid': solution_uuid.upper(), + 'project_uuid': project_uuid.upper() } target = self.target.lower() self.gen_file('atmelstudio6_2.atsln.tmpl', ctx, '%s.atsln' % self.program_name) diff --git a/workspace_tools/export/atmelstudio6_2.atsln.tmpl b/workspace_tools/export/atmelstudio6_2.atsln.tmpl index f4a7d88dbd..3c8ea50f96 100644 --- a/workspace_tools/export/atmelstudio6_2.atsln.tmpl +++ b/workspace_tools/export/atmelstudio6_2.atsln.tmpl @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Atmel Studio Solution File, Format Version 11.00 -Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "{{name}}", "{{name}}.cppproj", "{5C0392AB-FF86-4EC0-9125-DC2B901B87CE}" +Project("{{solution_uuid}}") = "{{name}}", "{{name}}.cppproj", "{{project_uuid}}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -9,10 +9,10 @@ Global Release|ARM = Release|ARM EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5C0392AB-FF86-4EC0-9125-DC2B901B87CE}.Debug|ARM.ActiveCfg = Debug|ARM - {5C0392AB-FF86-4EC0-9125-DC2B901B87CE}.Debug|ARM.Build.0 = Debug|ARM - {5C0392AB-FF86-4EC0-9125-DC2B901B87CE}.Release|ARM.ActiveCfg = Release|ARM - {5C0392AB-FF86-4EC0-9125-DC2B901B87CE}.Release|ARM.Build.0 = Release|ARM + {{project_uuid}}.Debug|ARM.ActiveCfg = Debug|ARM + {{project_uuid}}.Debug|ARM.Build.0 = Debug|ARM + {{project_uuid}}.Release|ARM.ActiveCfg = Release|ARM + {{project_uuid}}.Release|ARM.Build.0 = Release|ARM EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/workspace_tools/export/atmelstudio6_2.cppproj.tmpl b/workspace_tools/export/atmelstudio6_2.cppproj.tmpl index d44170c8cb..8021a3d64d 100644 --- a/workspace_tools/export/atmelstudio6_2.cppproj.tmpl +++ b/workspace_tools/export/atmelstudio6_2.cppproj.tmpl @@ -4,7 +4,7 @@ 2.0 6.2 com.Atmel.ARMGCC.CPP - {5c0392ab-ff86-4ec0-9125-dc2b901b87ce} + {{project_uuid}} AT{{target}} none Executable