{"action":"created","comment":{"url":"https://api.github.com/repos/project-generator/project_generator/pulls/comments/34759197","id":34759197,"diff_hunk":"@@ -124,139 +125,191 @@ def _process_source_files(self, files, group_name):\n             if os.path.dirname(source_file) not in self.source_paths:\n                 self.source_paths.append(os.path.dirname(source_file))\n \n+    # TODO 0xc0170: remove this and process source files - duplicate. Probably we should reconsider\n+    # this class\n+    def _process_include_files(self, files):\n+        # If it's dic add it , if file, add it to files\n+        for include_file in files:\n+            if os.path.isfile(include_file):\n+                if not include_file in self.include_files:\n+                    self.include_files.append(os.path.normpath(include_file))\n+            if not os.path.dirname(include_file) in self.includes:\n+                self.includes.append(os.path.normpath(include_file))\n+\n+class ProjectWorkspace:\n+    \"\"\"represents a workspace (multiple projects) \"\"\"\n+\n+    def __init__(self, name, projects, pgen_workspace):\n+        self.name = name\n+        self.projects = projects\n+        self.pgen_workspace = pgen_workspace # TODO: FIX me please\n+        self.generated_files = {}\n \n-class Project:\n+    def export(self, tool, copy):\n+        \"\"\" Exports workspace \"\"\"\n \n-    \"\"\"represents a project, which can be formed of many yaml files\"\"\"\n+        tools = []\n+        if not tool:\n+            tools = self.project['tools_supported']\n+        else:\n+            tools = [tool]\n \n-    def __init__(self, name, project_files, workspace):\n-        \"\"\"initialise a project with a yaml file\"\"\"\n+        for export_tool in tools:\n+            exporter = ToolsSupported().get_value(export_tool, 'exporter')\n+            workspace_dic = {\n+                'projects': [],\n+                'settings': {\n+                    'name': self.name,\n+                    'path': os.path.join(self.pgen_workspace.settings.generated_projects_dir_default, export_tool + '_' + self.name),\n+                },\n+            }\n \n-        self.workspace = workspace\n+            for project in self.projects:\n+                generated_files = {\n+                    'projects' : [],\n+                    'workspaces': [],\n+                }\n+                # projects are part of a workspace, by default fix output dir path to\n+                # workspace_output_dir/project_1, workspace_output_dir/project_2, ..\n+                workspace_path = export_tool + '_' + self.name\n \n-        #logging.debug(\"Initialising project %s\" % name)\n+                # Merge all dics, copy sources if required, correct output dir. This happens here\n+                # because we need tool to set proper path (tool might be used as string template)\n+                project.customize_project_for_tool(export_tool)\n+                project._set_output_dir_path(export_tool, workspace_path)\n \n-        self.name = name\n+                project._set_output_dir()\n+                if copy:\n+                    project.copy_sources_to_generated_destination\n+                project.project['singular'] = False\n+                files = exporter(project.project, self.pgen_workspace.settings).export_project()\n+                # we gather all generated files, needed for workspace files\n+                workspace_dic['projects'].append(files)\n+                generated_files['projects'].append(files)\n \n-        self.include_paths = []\n-        self.source_paths = []\n-        self.source_groups = {}\n-        self.macros = []\n-        self.project_dir = {\n-            'name': '',\n-            'path': '',\n-        }\n-        self.build_dir = 'build'\n-        self.output_dir = {\n-            'path': '',\n-            'rel_path': '',\n-            'rel_count': '',\n-        }\n-        self.mcu = ''\n-        self.core = ''\n-        self.target = ''\n-        self.tools_supported = []\n+            # all projects are genereated, now generate workspace files\n+            generated_files['workspaces'] = exporter(workspace_dic, self.pgen_workspace.settings).export_workspace()\n+\n+            self.generated_files[export_tool] = generated_files\n+\n+class Project:\n+\n+    \"\"\"represents a project, which can be formed of many yaml files\"\"\"\n \n+    def __init__(self, name, project_dicts, pgen_workspace):\n+        \"\"\"initialise a project with a yaml file\"\"\"\n+        self.pgen_workspace = pgen_workspace\n+        self.tool_specific = defaultdict(ToolSpecificSettings)\n+        self.name = name\n         self.output_types = {\n             'executable': 'exe',\n             'exe': 'exe',\n             'library': 'lib',\n             'lib': 'lib',\n         }\n-        self.output_type = self.output_types['executable']\n-\n-        self.debugger = 'cmsis-dap'\n+        self.tools = ToolsSupported()\n+        self.source_groups = {}\n+        self.project = {}\n+        self._fill_project_defaults()\n+        # process all projects dictionaries\n+        for project in project_dicts:\n+            self._set_project_attributes(project)\n+        self.generated_files = {}\n+\n+    def _fill_project_defaults(self):\n+\n+        self.project = {\n+            'name': self.name,          # project name\n+            'core': '',                 # core\n+            'linker_file': None,        # linker command file\n+            'build_dir' : 'build',      # Build output path\n+            'debugger' : 'cmsis-dap',   # Debugger\n+            'includes': [],             # include paths\n+            'copy_sources': False,      # [internal] Copy sources to destination flag\n+            'include_files': [],        # [internal] files to be included\n+            'source_paths': [],         # [internal] source paths\n+            'source_files_c': [],       # [internal] c source files","path":"project_generator/project.py","position":183,"original_position":183,"commit_id":"4d2c5eb32c95981249be7efc8524cb3101f58dc9","original_commit_id":"4d2c5eb32c95981249be7efc8524cb3101f58dc9","user":{"login":"0xc0170","id":2963726,"avatar_url":"https://avatars.githubusercontent.com/u/2963726?v=3","gravatar_id":"","url":"https://api.github.com/users/0xc0170","html_url":"https://github.com/0xc0170","followers_url":"https://api.github.com/users/0xc0170/followers","following_url":"https://api.github.com/users/0xc0170/following{/other_user}","gists_url":"https://api.github.com/users/0xc0170/gists{/gist_id}","starred_url":"https://api.github.com/users/0xc0170/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xc0170/subscriptions","organizations_url":"https://api.github.com/users/0xc0170/orgs","repos_url":"https://api.github.com/users/0xc0170/repos","events_url":"https://api.github.com/users/0xc0170/events{/privacy}","received_events_url":"https://api.github.com/users/0xc0170/received_events","type":"User","site_admin":false},"body":"Because you can't set them in the yaml file. We should distinguish between what can be imported from a user and what pgen generates as internal data.","created_at":"2015-07-16T06:33:41Z","updated_at":"2015-07-16T06:33:41Z","html_url":"https://github.com/project-generator/project_generator/pull/214#discussion_r34759197","pull_request_url":"https://api.github.com/repos/project-generator/project_generator/pulls/214","_links":{"self":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/comments/34759197"},"html":{"href":"https://github.com/project-generator/project_generator/pull/214#discussion_r34759197"},"pull_request":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/214"}}},"pull_request":{"url":"https://api.github.com/repos/project-generator/project_generator/pulls/214","id":40051435,"html_url":"https://github.com/project-generator/project_generator/pull/214","diff_url":"https://github.com/project-generator/project_generator/pull/214.diff","patch_url":"https://github.com/project-generator/project_generator/pull/214.patch","issue_url":"https://api.github.com/repos/project-generator/project_generator/issues/214","number":214,"state":"open","locked":false,"title":"Ready for v0.7?","user":{"login":"0xc0170","id":2963726,"avatar_url":"https://avatars.githubusercontent.com/u/2963726?v=3","gravatar_id":"","url":"https://api.github.com/users/0xc0170","html_url":"https://github.com/0xc0170","followers_url":"https://api.github.com/users/0xc0170/followers","following_url":"https://api.github.com/users/0xc0170/following{/other_user}","gists_url":"https://api.github.com/users/0xc0170/gists{/gist_id}","starred_url":"https://api.github.com/users/0xc0170/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xc0170/subscriptions","organizations_url":"https://api.github.com/users/0xc0170/orgs","repos_url":"https://api.github.com/users/0xc0170/repos","events_url":"https://api.github.com/users/0xc0170/events{/privacy}","received_events_url":"https://api.github.com/users/0xc0170/received_events","type":"User","site_admin":false},"body":"Time to review all the code here - 155 commits ! 1/4 of what pgen currently contains :-) The last days were crazy :-) Tests got improved finally, therefore I have more confidence in this release than any before :smile: \r\n\r\nAlmost no breaking changes, one is that string template are now used for export_dir if it's defined in settings.\r\n\r\nI'll update the wiki before the real release.\r\n\r\nThanks guys!","created_at":"2015-07-15T18:04:55Z","updated_at":"2015-07-16T06:33:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d99d35a8d8e1f2efcca79cb87585f542101b42ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/project-generator/project_generator/pulls/214/commits","review_comments_url":"https://api.github.com/repos/project-generator/project_generator/pulls/214/comments","review_comment_url":"https://api.github.com/repos/project-generator/project_generator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/project-generator/project_generator/issues/214/comments","statuses_url":"https://api.github.com/repos/project-generator/project_generator/statuses/4d2c5eb32c95981249be7efc8524cb3101f58dc9","head":{"label":"project-generator:dev_v0.7","ref":"dev_v0.7","sha":"4d2c5eb32c95981249be7efc8524cb3101f58dc9","user":{"login":"project-generator","id":11992191,"avatar_url":"https://avatars.githubusercontent.com/u/11992191?v=3","gravatar_id":"","url":"https://api.github.com/users/project-generator","html_url":"https://github.com/project-generator","followers_url":"https://api.github.com/users/project-generator/followers","following_url":"https://api.github.com/users/project-generator/following{/other_user}","gists_url":"https://api.github.com/users/project-generator/gists{/gist_id}","starred_url":"https://api.github.com/users/project-generator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-generator/subscriptions","organizations_url":"https://api.github.com/users/project-generator/orgs","repos_url":"https://api.github.com/users/project-generator/repos","events_url":"https://api.github.com/users/project-generator/events{/privacy}","received_events_url":"https://api.github.com/users/project-generator/received_events","type":"Organization","site_admin":false},"repo":{"id":22783065,"name":"project_generator","full_name":"project-generator/project_generator","owner":{"login":"project-generator","id":11992191,"avatar_url":"https://avatars.githubusercontent.com/u/11992191?v=3","gravatar_id":"","url":"https://api.github.com/users/project-generator","html_url":"https://github.com/project-generator","followers_url":"https://api.github.com/users/project-generator/followers","following_url":"https://api.github.com/users/project-generator/following{/other_user}","gists_url":"https://api.github.com/users/project-generator/gists{/gist_id}","starred_url":"https://api.github.com/users/project-generator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-generator/subscriptions","organizations_url":"https://api.github.com/users/project-generator/orgs","repos_url":"https://api.github.com/users/project-generator/repos","events_url":"https://api.github.com/users/project-generator/events{/privacy}","received_events_url":"https://api.github.com/users/project-generator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-generator/project_generator","description":"Project generators for various embedded tools (IDE). IAR, uVision, Makefile, CoIDE, Eclipse and many more in the roadmap!","fork":false,"url":"https://api.github.com/repos/project-generator/project_generator","forks_url":"https://api.github.com/repos/project-generator/project_generator/forks","keys_url":"https://api.github.com/repos/project-generator/project_generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-generator/project_generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-generator/project_generator/teams","hooks_url":"https://api.github.com/repos/project-generator/project_generator/hooks","issue_events_url":"https://api.github.com/repos/project-generator/project_generator/issues/events{/number}","events_url":"https://api.github.com/repos/project-generator/project_generator/events","assignees_url":"https://api.github.com/repos/project-generator/project_generator/assignees{/user}","branches_url":"https://api.github.com/repos/project-generator/project_generator/branches{/branch}","tags_url":"https://api.github.com/repos/project-generator/project_generator/tags","blobs_url":"https://api.github.com/repos/project-generator/project_generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-generator/project_generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-generator/project_generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-generator/project_generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-generator/project_generator/statuses/{sha}","languages_url":"https://api.github.com/repos/project-generator/project_generator/languages","stargazers_url":"https://api.github.com/repos/project-generator/project_generator/stargazers","contributors_url":"https://api.github.com/repos/project-generator/project_generator/contributors","subscribers_url":"https://api.github.com/repos/project-generator/project_generator/subscribers","subscription_url":"https://api.github.com/repos/project-generator/project_generator/subscription","commits_url":"https://api.github.com/repos/project-generator/project_generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-generator/project_generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-generator/project_generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-generator/project_generator/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-generator/project_generator/contents/{+path}","compare_url":"https://api.github.com/repos/project-generator/project_generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-generator/project_generator/merges","archive_url":"https://api.github.com/repos/project-generator/project_generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-generator/project_generator/downloads","issues_url":"https://api.github.com/repos/project-generator/project_generator/issues{/number}","pulls_url":"https://api.github.com/repos/project-generator/project_generator/pulls{/number}","milestones_url":"https://api.github.com/repos/project-generator/project_generator/milestones{/number}","notifications_url":"https://api.github.com/repos/project-generator/project_generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-generator/project_generator/labels{/name}","releases_url":"https://api.github.com/repos/project-generator/project_generator/releases{/id}","created_at":"2014-08-09T09:22:51Z","updated_at":"2015-07-08T20:09:56Z","pushed_at":"2015-07-15T20:10:03Z","git_url":"git://github.com/project-generator/project_generator.git","ssh_url":"git@github.com:project-generator/project_generator.git","clone_url":"https://github.com/project-generator/project_generator.git","svn_url":"https://github.com/project-generator/project_generator","homepage":"","size":2723,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":21,"forks":13,"open_issues":21,"watchers":15,"default_branch":"master"}},"base":{"label":"project-generator:master","ref":"master","sha":"c2d55776eeda86172700234fe1a9aaba31c625b9","user":{"login":"project-generator","id":11992191,"avatar_url":"https://avatars.githubusercontent.com/u/11992191?v=3","gravatar_id":"","url":"https://api.github.com/users/project-generator","html_url":"https://github.com/project-generator","followers_url":"https://api.github.com/users/project-generator/followers","following_url":"https://api.github.com/users/project-generator/following{/other_user}","gists_url":"https://api.github.com/users/project-generator/gists{/gist_id}","starred_url":"https://api.github.com/users/project-generator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-generator/subscriptions","organizations_url":"https://api.github.com/users/project-generator/orgs","repos_url":"https://api.github.com/users/project-generator/repos","events_url":"https://api.github.com/users/project-generator/events{/privacy}","received_events_url":"https://api.github.com/users/project-generator/received_events","type":"Organization","site_admin":false},"repo":{"id":22783065,"name":"project_generator","full_name":"project-generator/project_generator","owner":{"login":"project-generator","id":11992191,"avatar_url":"https://avatars.githubusercontent.com/u/11992191?v=3","gravatar_id":"","url":"https://api.github.com/users/project-generator","html_url":"https://github.com/project-generator","followers_url":"https://api.github.com/users/project-generator/followers","following_url":"https://api.github.com/users/project-generator/following{/other_user}","gists_url":"https://api.github.com/users/project-generator/gists{/gist_id}","starred_url":"https://api.github.com/users/project-generator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-generator/subscriptions","organizations_url":"https://api.github.com/users/project-generator/orgs","repos_url":"https://api.github.com/users/project-generator/repos","events_url":"https://api.github.com/users/project-generator/events{/privacy}","received_events_url":"https://api.github.com/users/project-generator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-generator/project_generator","description":"Project generators for various embedded tools (IDE). IAR, uVision, Makefile, CoIDE, Eclipse and many more in the roadmap!","fork":false,"url":"https://api.github.com/repos/project-generator/project_generator","forks_url":"https://api.github.com/repos/project-generator/project_generator/forks","keys_url":"https://api.github.com/repos/project-generator/project_generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-generator/project_generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-generator/project_generator/teams","hooks_url":"https://api.github.com/repos/project-generator/project_generator/hooks","issue_events_url":"https://api.github.com/repos/project-generator/project_generator/issues/events{/number}","events_url":"https://api.github.com/repos/project-generator/project_generator/events","assignees_url":"https://api.github.com/repos/project-generator/project_generator/assignees{/user}","branches_url":"https://api.github.com/repos/project-generator/project_generator/branches{/branch}","tags_url":"https://api.github.com/repos/project-generator/project_generator/tags","blobs_url":"https://api.github.com/repos/project-generator/project_generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-generator/project_generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-generator/project_generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-generator/project_generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-generator/project_generator/statuses/{sha}","languages_url":"https://api.github.com/repos/project-generator/project_generator/languages","stargazers_url":"https://api.github.com/repos/project-generator/project_generator/stargazers","contributors_url":"https://api.github.com/repos/project-generator/project_generator/contributors","subscribers_url":"https://api.github.com/repos/project-generator/project_generator/subscribers","subscription_url":"https://api.github.com/repos/project-generator/project_generator/subscription","commits_url":"https://api.github.com/repos/project-generator/project_generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-generator/project_generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-generator/project_generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-generator/project_generator/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-generator/project_generator/contents/{+path}","compare_url":"https://api.github.com/repos/project-generator/project_generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-generator/project_generator/merges","archive_url":"https://api.github.com/repos/project-generator/project_generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-generator/project_generator/downloads","issues_url":"https://api.github.com/repos/project-generator/project_generator/issues{/number}","pulls_url":"https://api.github.com/repos/project-generator/project_generator/pulls{/number}","milestones_url":"https://api.github.com/repos/project-generator/project_generator/milestones{/number}","notifications_url":"https://api.github.com/repos/project-generator/project_generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-generator/project_generator/labels{/name}","releases_url":"https://api.github.com/repos/project-generator/project_generator/releases{/id}","created_at":"2014-08-09T09:22:51Z","updated_at":"2015-07-08T20:09:56Z","pushed_at":"2015-07-15T20:10:03Z","git_url":"git://github.com/project-generator/project_generator.git","ssh_url":"git@github.com:project-generator/project_generator.git","clone_url":"https://github.com/project-generator/project_generator.git","svn_url":"https://github.com/project-generator/project_generator","homepage":"","size":2723,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":21,"forks":13,"open_issues":21,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/214"},"html":{"href":"https://github.com/project-generator/project_generator/pull/214"},"issue":{"href":"https://api.github.com/repos/project-generator/project_generator/issues/214"},"comments":{"href":"https://api.github.com/repos/project-generator/project_generator/issues/214/comments"},"review_comments":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/214/comments"},"review_comment":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/project-generator/project_generator/pulls/214/commits"},"statuses":{"href":"https://api.github.com/repos/project-generator/project_generator/statuses/4d2c5eb32c95981249be7efc8524cb3101f58dc9"}}}}