aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet/ede
diff options
context:
space:
mode:
authorJoakim Verona2013-03-26 16:20:17 +0100
committerJoakim Verona2013-03-26 16:20:17 +0100
commit6f6db22fc74ffb7fbdd4d805545b7e28cd59f0c8 (patch)
tree4a58903b4c3d010e90fc37fe10ea4d9895876d01 /lisp/cedet/ede
parent62dd123f7c11ddbe156bc0e84dcb7ca1da5368bb (diff)
parent48c226c2c2592e31a47559bd1689fcc4354d9479 (diff)
downloademacs-6f6db22fc74ffb7fbdd4d805545b7e28cd59f0c8.tar.gz
emacs-6f6db22fc74ffb7fbdd4d805545b7e28cd59f0c8.zip
conflict resolve
Diffstat (limited to 'lisp/cedet/ede')
-rw-r--r--lisp/cedet/ede/auto.el4
-rw-r--r--lisp/cedet/ede/base.el36
-rw-r--r--lisp/cedet/ede/cpp-root.el67
-rw-r--r--lisp/cedet/ede/emacs.el4
-rw-r--r--lisp/cedet/ede/files.el25
-rw-r--r--lisp/cedet/ede/locate.el2
-rw-r--r--lisp/cedet/ede/pconf.el2
-rw-r--r--lisp/cedet/ede/proj-elisp.el5
-rw-r--r--lisp/cedet/ede/proj.el4
-rw-r--r--lisp/cedet/ede/util.el2
10 files changed, 115 insertions, 36 deletions
diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el
index 22fce372e24..c0baf0fc8f8 100644
--- a/lisp/cedet/ede/auto.el
+++ b/lisp/cedet/ede/auto.el
@@ -199,8 +199,8 @@ added. Possible values are:
199 front of the list so more generic projects don't get priority." 199 front of the list so more generic projects don't get priority."
200 ;; First, can we identify PROJAUTO as already in the list? If so, replace. 200 ;; First, can we identify PROJAUTO as already in the list? If so, replace.
201 (let ((projlist ede-project-class-files) 201 (let ((projlist ede-project-class-files)
202 (projname (object-name-string projauto))) 202 (projname (eieio-object-name-string projauto)))
203 (while (and projlist (not (string= (object-name-string (car projlist)) projname))) 203 (while (and projlist (not (string= (eieio-object-name-string (car projlist)) projname)))
204 (setq projlist (cdr projlist))) 204 (setq projlist (cdr projlist)))
205 205
206 (if projlist 206 (if projlist
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 1368ea348a0..5302ac3207a 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -135,7 +135,9 @@ other desired outcome.")
135 (dirinode :documentation "The inode id for :directory.") 135 (dirinode :documentation "The inode id for :directory.")
136 (file :type string 136 (file :type string
137 :initarg :file 137 :initarg :file
138 :documentation "File name where this project is stored.") 138 :documentation "The File uniquely tagging this project instance.
139For some project types, this will be the file that stores the project configuration.
140In other projects types, this file is merely a unique identifier to this type of project.")
139 (rootproject ; :initarg - no initarg, don't save this slot! 141 (rootproject ; :initarg - no initarg, don't save this slot!
140 :initform nil 142 :initform nil
141 :type (or null ede-project-placeholder-child) 143 :type (or null ede-project-placeholder-child)
@@ -350,12 +352,12 @@ All specific project types must derive from this project."
350(defun ede-load-cache () 352(defun ede-load-cache ()
351 "Load the cache of EDE projects." 353 "Load the cache of EDE projects."
352 (save-excursion 354 (save-excursion
353 (let ((cachebuffer nil)) 355 (let ((cachebuffer (get-buffer-create "*ede cache*")))
354 (condition-case nil 356 (condition-case nil
355 (progn 357 (with-current-buffer cachebuffer
356 (setq cachebuffer 358 (erase-buffer)
357 (find-file-noselect ede-project-placeholder-cache-file t)) 359 (when (file-exists-p ede-project-placeholder-cache-file)
358 (set-buffer cachebuffer) 360 (insert-file-contents ede-project-placeholder-cache-file))
359 (goto-char (point-min)) 361 (goto-char (point-min))
360 (let ((c (read (current-buffer))) 362 (let ((c (read (current-buffer)))
361 (new nil) 363 (new nil)
@@ -610,6 +612,28 @@ instead of the current project."
610 cp))))) 612 cp)))))
611 613
612 614
615;;; Utility functions
616;;
617
618(defun ede-normalize-file/directory (this project-file-name)
619 "Fills :directory or :file slots if they're missing in project THIS.
620The other slot will be used to calculate values.
621PROJECT-FILE-NAME is a name of project file (short name, like 'pom.xml', etc."
622 (when (and (or (not (slot-boundp this :file))
623 (not (oref this :file)))
624 (slot-boundp this :directory)
625 (oref this :directory))
626 (oset this :file (expand-file-name project-file-name (oref this :directory))))
627 (when (and (or (not (slot-boundp this :directory))
628 (not (oref this :directory)))
629 (slot-boundp this :file)
630 (oref this :file))
631 (oset this :directory (file-name-directory (oref this :file))))
632 )
633
634
635
636
613;;; Hooks & Autoloads 637;;; Hooks & Autoloads
614;; 638;;
615;; These let us watch various activities, and respond appropriately. 639;; These let us watch various activities, and respond appropriately.
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index d31ede723cc..cf2009ced30 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -242,11 +242,11 @@ ROOTPROJ is nil, since there is only one project."
242(ede-add-project-autoload 242(ede-add-project-autoload
243 (ede-project-autoload "cpp-root" 243 (ede-project-autoload "cpp-root"
244 :name "CPP ROOT" 244 :name "CPP ROOT"
245 :file 'ede-cpp-root 245 :file 'ede/cpp-root
246 :proj-file 'ede-cpp-root-project-file-for-dir 246 :proj-file 'ede-cpp-root-project-file-for-dir
247 :proj-root 'ede-cpp-root-project-root 247 :proj-root 'ede-cpp-root-project-root
248 :load-type 'ede-cpp-root-load 248 :load-type 'ede-cpp-root-load
249 :class-sym 'ede-cpp-root 249 :class-sym 'ede-cpp-root-project
250 :new-p nil 250 :new-p nil
251 :safe-p t) 251 :safe-p t)
252 ;; When a user creates one of these, it should override any other project 252 ;; When a user creates one of these, it should override any other project
@@ -272,10 +272,12 @@ ROOTPROJ is nil, since there is only one project."
272;; level include paths, and PreProcessor macro tables. 272;; level include paths, and PreProcessor macro tables.
273 273
274(defclass ede-cpp-root-target (ede-target) 274(defclass ede-cpp-root-target (ede-target)
275 () 275 ((project :initform nil
276 :initarg :project))
276 "EDE cpp-root project target. 277 "EDE cpp-root project target.
277All directories need at least one target.") 278All directories need at least one target.")
278 279
280;;;###autoload
279(defclass ede-cpp-root-project (ede-project eieio-instance-tracker) 281(defclass ede-cpp-root-project (ede-project eieio-instance-tracker)
280 ((tracking-symbol :initform 'ede-cpp-root-project-list) 282 ((tracking-symbol :initform 'ede-cpp-root-project-list)
281 (include-path :initarg :include-path 283 (include-path :initarg :include-path
@@ -339,6 +341,15 @@ The function symbol must take two arguments:
339It should return the fully qualified file name passed in from NAME. If that file does not 341It should return the fully qualified file name passed in from NAME. If that file does not
340exist, it should return nil." 342exist, it should return nil."
341 ) 343 )
344 (compile-command :initarg :compile-command
345 :initform nil
346 :type (or null string function)
347 :documentation
348 "Compilation command that will be used for this project.
349It could be string or function that will accept proj argument and should return string.
350The string will be passed to 'compuile' function that will be issued in root
351directory of project."
352 )
342 ) 353 )
343 "EDE cpp-root project class. 354 "EDE cpp-root project class.
344Each directory needs a project file to control it.") 355Each directory needs a project file to control it.")
@@ -366,7 +377,7 @@ Each directory needs a project file to control it.")
366 (when (or (not (file-exists-p f)) 377 (when (or (not (file-exists-p f))
367 (file-directory-p f)) 378 (file-directory-p f))
368 (delete-instance this) 379 (delete-instance this)
369 (error ":file for ede-cpp-root must be a file")) 380 (error ":file for ede-cpp-root-project must be a file"))
370 (oset this :file f) 381 (oset this :file f)
371 (oset this :directory (file-name-directory f)) 382 (oset this :directory (file-name-directory f))
372 (ede-project-directory-remove-hash (file-name-directory f)) 383 (ede-project-directory-remove-hash (file-name-directory f))
@@ -404,7 +415,8 @@ If one doesn't exist, create a new one for this directory."
404 :name (file-name-nondirectory 415 :name (file-name-nondirectory
405 (directory-file-name dir)) 416 (directory-file-name dir))
406 :path dir 417 :path dir
407 :source nil)) 418 :source nil
419 :project proj))
408 (object-add-to-list proj :targets ans) 420 (object-add-to-list proj :targets ans)
409 ) 421 )
410 ans)) 422 ans))
@@ -481,15 +493,6 @@ This is for project include paths and spp source files."
481 493
482 filename)) 494 filename))
483 495
484(defmethod ede-set-project-variables ((project ede-cpp-root-project) &optional buffer)
485 "Set variables local to PROJECT in BUFFER.
486Also set up the lexical preprocessor map."
487 (call-next-method)
488 (when (and (featurep 'semantic/bovine/c) (featurep 'semantic/lex-spp))
489 (setq semantic-lex-spp-project-macro-symbol-obarray
490 (semantic-lex-make-spp-table (oref project spp-table)))
491 ))
492
493(defmethod ede-system-include-path ((this ede-cpp-root-project)) 496(defmethod ede-system-include-path ((this ede-cpp-root-project))
494 "Get the system include path used by project THIS." 497 "Get the system include path used by project THIS."
495 (oref this system-include-path)) 498 (oref this system-include-path))
@@ -506,11 +509,18 @@ Also set up the lexical preprocessor map."
506 (table (when expfile 509 (table (when expfile
507 (semanticdb-file-table-object expfile))) 510 (semanticdb-file-table-object expfile)))
508 ) 511 )
509 (if (not table) 512 (cond
510 (message "Cannot find file %s in project." F) 513 ((not (file-exists-p expfile))
514 (message "Cannot find file %s in project." F))
515 ((string= expfile (buffer-file-name))
516 ;; Don't include this file in it's own spp table.
517 )
518 ((not table)
519 (message "No db table available for %s." expfile))
520 (t
511 (when (semanticdb-needs-refresh-p table) 521 (when (semanticdb-needs-refresh-p table)
512 (semanticdb-refresh-table table)) 522 (semanticdb-refresh-table table))
513 (setq spp (append spp (oref table lexical-table)))))) 523 (setq spp (append spp (oref table lexical-table)))))))
514 (oref this spp-files)) 524 (oref this spp-files))
515 spp)) 525 spp))
516 526
@@ -522,6 +532,29 @@ Also set up the lexical preprocessor map."
522 "Get the pre-processor map for project THIS." 532 "Get the pre-processor map for project THIS."
523 (ede-preprocessor-map (ede-target-parent this))) 533 (ede-preprocessor-map (ede-target-parent this)))
524 534
535(defmethod project-compile-project ((proj ede-cpp-root-project) &optional command)
536 "Compile the entire current project PROJ.
537Argument COMMAND is the command to use when compiling."
538 ;; we need to be in the proj root dir for this to work
539 (let* ((cmd (oref proj :compile-command))
540 (ov (oref proj :local-variables))
541 (lcmd (when ov (cdr (assoc 'compile-command ov))))
542 (cmd-str (cond
543 ((stringp cmd) cmd)
544 ((functionp cmd) (funcall cmd proj))
545 ((stringp lcmd) lcmd)
546 ((functionp lcmd) (funcall lcmd proj)))))
547 (when cmd-str
548 (let ((default-directory (ede-project-root-directory proj)))
549 (compile cmd-str)))))
550
551(defmethod project-compile-target ((obj ede-cpp-root-target) &optional command)
552 "Compile the current target OBJ.
553Argument COMMAND is the command to use for compiling the target."
554 (when (oref obj :project)
555 (project-compile-project (oref obj :project) command)))
556
557
525;;; Quick Hack 558;;; Quick Hack
526(defun ede-create-lots-of-projects-under-dir (dir projfile &rest attributes) 559(defun ede-create-lots-of-projects-under-dir (dir projfile &rest attributes)
527 "Create a bunch of projects under directory DIR. 560 "Create a bunch of projects under directory DIR.
diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index 925730c8121..f5a85f4a01b 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -59,7 +59,7 @@ DIR is the directory to search from."
59 "Get the root directory for DIR." 59 "Get the root directory for DIR."
60 (when (not dir) (setq dir default-directory)) 60 (when (not dir) (setq dir default-directory))
61 (let ((case-fold-search t) 61 (let ((case-fold-search t)
62 (proj (ede-emacs-file-existing dir))) 62 (proj (ede-files-find-existing dir ede-emacs-project-list)))
63 (if proj 63 (if proj
64 (ede-up-directory (file-name-directory 64 (ede-up-directory (file-name-directory
65 (oref proj :file))) 65 (oref proj :file)))
@@ -134,7 +134,7 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])")
134Return nil if there isn't one. 134Return nil if there isn't one.
135Argument DIR is the directory it is created for. 135Argument DIR is the directory it is created for.
136ROOTPROJ is nil, since there is only one project." 136ROOTPROJ is nil, since there is only one project."
137 (or (ede-emacs-file-existing dir) 137 (or (ede-files-find-existing dir ede-emacs-project-list)
138 ;; Doesn't already exist, so let's make one. 138 ;; Doesn't already exist, so let's make one.
139 (let* ((vertuple (ede-emacs-version dir)) 139 (let* ((vertuple (ede-emacs-version dir))
140 (proj (ede-emacs-project 140 (proj (ede-emacs-project
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el
index 015f4fd9663..91433add7b0 100644
--- a/lisp/cedet/ede/files.el
+++ b/lisp/cedet/ede/files.el
@@ -50,12 +50,13 @@
50There is no completion at the prompt. FILE is searched for within 50There is no completion at the prompt. FILE is searched for within
51the current EDE project." 51the current EDE project."
52 (interactive "sFile: ") 52 (interactive "sFile: ")
53 (let ((fname (ede-expand-filename (ede-current-project) file)) 53 (let* ((proj (ede-current-project))
54 (fname (ede-expand-filename proj file))
54 ) 55 )
55 (unless fname 56 (unless fname
56 (error "Could not find %s in %s" 57 (error "Could not find %s in %s"
57 file 58 file
58 (ede-project-root-directory (ede-current-project)))) 59 (ede-project-root-directory proj)))
59 (find-file fname))) 60 (find-file fname)))
60 61
61(defun ede-flush-project-hash () 62(defun ede-flush-project-hash ()
@@ -508,6 +509,26 @@ Argument DIR is the directory to trim upwards."
508 nil 509 nil
509 fnd))) 510 fnd)))
510 511
512(defun ede-find-project-root (prj-file-name &optional dir)
513 "Tries to find directory with given project file"
514 (let ((prj-dir (locate-dominating-file (or dir default-directory)
515 prj-file-name)))
516 (when prj-dir
517 (expand-file-name prj-dir))))
518
519(defun ede-files-find-existing (dir prj-list)
520 "Find a project in the list of projects stored in given variable.
521DIR is the directory to search from."
522 (let ((projs prj-list)
523 (ans nil))
524 (while (and projs (not ans))
525 (let ((root (ede-project-root-directory (car projs))))
526 (when (string-match (concat "^" (regexp-quote root)) dir)
527 (setq ans (car projs))))
528 (setq projs (cdr projs)))
529 ans))
530
531
511(provide 'ede/files) 532(provide 'ede/files)
512 533
513;; Local variables: 534;; Local variables:
diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el
index 072e2c2666a..3dbe3153680 100644
--- a/lisp/cedet/ede/locate.el
+++ b/lisp/cedet/ede/locate.el
@@ -163,7 +163,7 @@ that created this EDE locate object."
163 "Create or update the database for the current project. 163 "Create or update the database for the current project.
164You cannot create projects for the baseclass." 164You cannot create projects for the baseclass."
165 (error "Cannot create/update a database of type %S" 165 (error "Cannot create/update a database of type %S"
166 (object-name loc))) 166 (eieio-object-name loc)))
167 167
168;;; LOCATE 168;;; LOCATE
169;; 169;;
diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el
index 310014a0b64..a29e3720ea2 100644
--- a/lisp/cedet/ede/pconf.el
+++ b/lisp/cedet/ede/pconf.el
@@ -152,7 +152,7 @@ don't do it. A value of nil means to just do it.")
152(defmethod ede-proj-configure-recreate ((this ede-proj-project)) 152(defmethod ede-proj-configure-recreate ((this ede-proj-project))
153 "Delete project THIS's configure script and start over." 153 "Delete project THIS's configure script and start over."
154 (if (not (ede-proj-configure-file this)) 154 (if (not (ede-proj-configure-file this))
155 (error "Could not determine configure.ac for %S" (object-name this))) 155 (error "Could not determine configure.ac for %S" (eieio-object-name this)))
156 (let ((b (get-file-buffer (ede-proj-configure-file this)))) 156 (let ((b (get-file-buffer (ede-proj-configure-file this))))
157 ;; Destroy all evidence of the old configure.ac 157 ;; Destroy all evidence of the old configure.ac
158 (delete-file (ede-proj-configure-file this)) 158 (delete-file (ede-proj-configure-file this))
diff --git a/lisp/cedet/ede/proj-elisp.el b/lisp/cedet/ede/proj-elisp.el
index 8b426aa183f..d7720f25681 100644
--- a/lisp/cedet/ede/proj-elisp.el
+++ b/lisp/cedet/ede/proj-elisp.el
@@ -170,7 +170,7 @@ Bonus: Return a cons cell: (COMPILED . UPTODATE)."
170 (setq utd (1+ utd))))))) 170 (setq utd (1+ utd)))))))
171 171
172 (oref obj source)) 172 (oref obj source))
173 (message "All Emacs Lisp sources are up to date in %s" (object-name obj)) 173 (message "All Emacs Lisp sources are up to date in %s" (eieio-object-name obj))
174 (cons comp utd))) 174 (cons comp utd)))
175 175
176(defmethod ede-update-version-in-source ((this ede-proj-target-elisp) version) 176(defmethod ede-update-version-in-source ((this ede-proj-target-elisp) version)
@@ -194,7 +194,8 @@ is found, such as a `-version' variable, or the standard header."
194 (goto-char (match-beginning 1)) 194 (goto-char (match-beginning 1))
195 (insert version))))) 195 (insert version)))))
196 (setq vs (cdr vs))) 196 (setq vs (cdr vs)))
197 (if (not match) (call-next-method))))) 197 ;; The next method will include comments such as "Version:"
198 (call-next-method))))
198 199
199 200
200;;; Makefile generation functions 201;;; Makefile generation functions
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index 2da2737d377..702e35f0b1f 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -512,11 +512,11 @@ Optional argument COMMAND is the s the alternate command to use."
512 512
513(defmethod project-debug-target ((obj ede-proj-target)) 513(defmethod project-debug-target ((obj ede-proj-target))
514 "Run the current project target OBJ in a debugger." 514 "Run the current project target OBJ in a debugger."
515 (error "Debug-target not supported by %s" (object-name obj))) 515 (error "Debug-target not supported by %s" (eieio-object-name obj)))
516 516
517(defmethod project-run-target ((obj ede-proj-target)) 517(defmethod project-run-target ((obj ede-proj-target))
518 "Run the current project target OBJ." 518 "Run the current project target OBJ."
519 (error "Run-target not supported by %s" (object-name obj))) 519 (error "Run-target not supported by %s" (eieio-object-name obj)))
520 520
521(defmethod ede-proj-makefile-target-name ((this ede-proj-target)) 521(defmethod ede-proj-makefile-target-name ((this ede-proj-target))
522 "Return the name of the main target for THIS target." 522 "Return the name of the main target for THIS target."
diff --git a/lisp/cedet/ede/util.el b/lisp/cedet/ede/util.el
index 88a3e0a4512..71a79a1b706 100644
--- a/lisp/cedet/ede/util.el
+++ b/lisp/cedet/ede/util.el
@@ -49,7 +49,7 @@ Argument NEWVERSION is the version number to use in the current project."
49(defmethod project-update-version ((ot ede-project)) 49(defmethod project-update-version ((ot ede-project))
50 "The :version of the project OT has been updated. 50 "The :version of the project OT has been updated.
51Handle saving, or other detail." 51Handle saving, or other detail."
52 (error "project-update-version not supported by %s" (object-name ot))) 52 (error "project-update-version not supported by %s" (eieio-object-name ot)))
53 53
54(defmethod ede-update-version-in-source ((this ede-project) version) 54(defmethod ede-update-version-in-source ((this ede-project) version)
55 "Change occurrences of a version string in sources. 55 "Change occurrences of a version string in sources.