diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..253bcb7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fff42f0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + emacs-version: + - 26.3 + - 27.2 + - 28.2 + - 29.1 + experimental: [false] + include: + - os: ubuntu-latest + emacs-version: snapshot + experimental: true + - os: macos-latest + emacs-version: snapshot + experimental: true + - os: windows-latest + emacs-version: snapshot + experimental: true + + steps: + - uses: actions/checkout@v4 + + - uses: jcs090218/setup-emacs@master + with: + version: ${{ matrix.emacs-version }} + + - uses: emacs-eask/setup-eask@master + with: + version: 'snapshot' + + - name: Run tests + run: | + eask package + eask install + eask compile diff --git a/.gitignore b/.gitignore index 1dec31c..0825798 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.info *.texi .cask +.eask dist ede-php-autoload-autoloads.el \ No newline at end of file diff --git a/Eask b/Eask new file mode 100644 index 0000000..a2eade3 --- /dev/null +++ b/Eask @@ -0,0 +1,25 @@ +(package "ede-php-autoload" + "1.1.0" + "PHP autoloading implementation for Semantic") + +(website-url "https://github.com/emacs-php/ede-php-autoload") +(keywords "PHP" "project" "ede") + +(package-file "ede-php-autoload.el") +(files + "*.el" + "ede-php-autoload") + +(script "test" "echo \"Error: no test specified\" && exit 1") + +(source 'melpa) + +(depends-on "emacs" "26.1") + +(development + (depends-on "ecukes") + (depends-on "ert-runner") + (depends-on "f") + ) + +(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 diff --git a/ede-php-autoload.el b/ede-php-autoload.el index 144b6fb..770e878 100644 --- a/ede-php-autoload.el +++ b/ede-php-autoload.el @@ -4,6 +4,7 @@ ;; Author: Steven Rémot ;; original code for C++ by Eric M. Ludlam +;; Version: 1.1.0 ;; Keywords: PHP project ede ;; Homepage: https://github.com/emacs-php/ede-php-autoload @@ -216,7 +217,7 @@ ROOT-DIR is the root directory of the project." :type list :documentation "The class autoloads explicitly defined at initialization"))) -(defmethod initialize-instance ((this ede-php-autoload-project) &rest fields) +(cl-defmethod initialize-instance ((this ede-php-autoload-project) &rest fields) "Make sure the :file is fully expanded." (call-next-method this (list :file (plist-get (car fields) :file) @@ -245,7 +246,7 @@ ROOT-DIR is the root directory of the project." (unless (slot-boundp this 'targets) (oset this :targets nil)))) -(defmethod ede-php-autoload-reload-autoloads-for-project ((this ede-php-autoload-project)) +(cl-defmethod ede-php-autoload-reload-autoloads-for-project ((this ede-php-autoload-project)) "Regenerate the class loaders. This can be used when some composer dependencies changed, to take @@ -260,11 +261,11 @@ the new autoloads into account." (oset this class-loader (ede-php-autoload-create-class-loader cleaned-autoloads)))) -(defmethod ede-find-subproject-for-directory ((proj ede-php-autoload-project) dir) +(cl-defmethod ede-find-subproject-for-directory ((proj ede-php-autoload-project) dir) "Return PROJ, for handling all subdirs below DIR." proj) -(defmethod ede-find-target ((proj ede-php-autoload-project) buffer) +(cl-defmethod ede-find-target ((proj ede-php-autoload-project) buffer) "Find an EDE target in PROJ for BUFFER. If one doesn't exist, create a new one for this directory." (let* ((targets (oref proj targets)) @@ -280,21 +281,21 @@ If one doesn't exist, create a new one for this directory." (object-add-to-list proj :targets ans)) ans)) -(defmethod ede-project-root ((this ede-php-autoload-project)) +(cl-defmethod ede-project-root ((this ede-php-autoload-project)) "Return my root." this) -(defmethod ede-project-root-directory ((this ede-php-autoload-project)) +(cl-defmethod ede-project-root-directory ((this ede-php-autoload-project)) "Return my root." (file-name-directory (oref this file))) -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-project) class-name) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-project) class-name) "Find the file in which CLASS-NAME is defined. CLASS-NAME must be the full name of the class, with all its parent namespaces." (ede-php-autoload-find-class-def-file (oref this class-loader) class-name)) -(defmethod ede-php-autoload-get-class-name-for-file +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-project) file-name) "Generate a suitable class name for the current FILE-NAME. @@ -303,7 +304,7 @@ Generate this class name using the class loader information. FILE-NAME must be absolute or relative to the project root." (ede-php-autoload-get-class-name-for-file (oref this class-loader) file-name)) -(defmethod ede-php-autoload-complete ((this ede-php-autoload-project) prefix) +(cl-defmethod ede-php-autoload-complete ((this ede-php-autoload-project) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. @@ -312,7 +313,7 @@ The result is a list of completion suggestions for this prefix." (ede-php-autoload-complete (oref this class-loader) prefix)) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-project) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-project) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. diff --git a/ede-php-autoload/class-loader/aggregate.el b/ede-php-autoload/class-loader/aggregate.el index 9e5cafa..7d6d341 100644 --- a/ede-php-autoload/class-loader/aggregate.el +++ b/ede-php-autoload/class-loader/aggregate.el @@ -32,7 +32,7 @@ They must be instances of `ede-php-autoload-class-loader'.")) "An aggregation of several class loaders.") -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-aggregate-class-loader) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-aggregate-class-loader) class-name) "Find the file in which CLASS-NAME is defined. @@ -44,7 +44,7 @@ Return nil if no file has been found." loaders (cdr loaders))) class-def-file)) -(defmethod ede-php-autoload-get-class-name-for-file +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-aggregate-class-loader) file-name) "Generate a suitable class name for the current FILE-NAME. @@ -58,7 +58,7 @@ FILE-NAME must be absolute or relative to the project root." loaders (cdr loaders))) class-name)) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-aggregate-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-aggregate-class-loader) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. diff --git a/ede-php-autoload/class-loader/classmap.el b/ede-php-autoload/class-loader/classmap.el index 78fdace..f1c7287 100644 --- a/ede-php-autoload/class-loader/classmap.el +++ b/ede-php-autoload/class-loader/classmap.el @@ -40,7 +40,7 @@ :documentation "A hash associating a class name and an absolute path to the file in whcih the class is defined.")) "Class loader for direct association between classes and files.") -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-classmap-class-loader) class-name) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-classmap-class-loader) class-name) "Find the file in which CLASS-NAME is defined. Return nil if no file has been found." @@ -48,7 +48,7 @@ Return nil if no file has been found." (when file (expand-file-name file (ede-project-root-directory (ede-current-project)))))) -(defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-classmap-class-loader) file-name) +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-classmap-class-loader) file-name) "Generate a suitable class name for the current FILE-NAME. Generate this class name using the class loader information. @@ -63,7 +63,7 @@ FILE-NAME must be absolute or relative to the project root." (throw 'class-name class))) (oref this class-hash))))) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-classmap-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-classmap-class-loader) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. diff --git a/ede-php-autoload/class-loader/core.el b/ede-php-autoload/class-loader/core.el index 4d7db30..66c00cb 100644 --- a/ede-php-autoload/class-loader/core.el +++ b/ede-php-autoload/class-loader/core.el @@ -29,14 +29,14 @@ "Base class for finding the file in with some class is defined." :abstract t) -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-class-loader) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-class-loader) class-name) "Find the file in which CLASS-NAME is defined. CLASS-NAME must be the full name of the class, with all its parent namespaces." (error "Method `ede-php-autoload-find-class-def-file' must be overriden")) -(defmethod ede-php-autoload-get-class-name-for-file +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-class-loader) file-name) "Generate a suitable class name for the current FILE-NAME. @@ -45,7 +45,7 @@ Generate this class name using the class loader information. FILE-NAME must be absolute or relative to the project root." (error "Method `ede-php-autoload-find-class-def-file' must be overriden")) -(defmethod ede-php-autoload-complete ((this ede-php-autoload-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete ((this ede-php-autoload-class-loader) prefix) "Get completion suggestions for the PREFIX. PREFIX is the beginning of a fully-qualified name. @@ -66,7 +66,7 @@ prefix." (cl-loop for completion in completions collect (concat ns "\\" completion))))) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-class-loader) prefix) "Get type completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. diff --git a/ede-php-autoload/class-loader/psr0.el b/ede-php-autoload/class-loader/psr0.el index 290aa26..d9914c7 100644 --- a/ede-php-autoload/class-loader/psr0.el +++ b/ede-php-autoload/class-loader/psr0.el @@ -46,7 +46,7 @@ then The class \"Bar_Foo\" is considered to be defined in \"src/test/Bar/Foo\". The include paths can be either a string or a list of strings.")) "Class loader for PSR-0 convention.") -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr0-class-loader) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr0-class-loader) class-name) "Find the file in which CLASS-NAME is defined. @@ -66,7 +66,7 @@ Return nil if no file has been found." (setq namespaces (cdr namespaces)))) class-def-file)) -(defmethod ede-php-autoload-get-class-name-for-file +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-psr0-class-loader) file-name) "Generate a suitable class name for the current FILE-NAME. @@ -137,7 +137,7 @@ PREFIX is the beginning of the type to complete." (car (last split-prefix))))))))) suggestions)) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr0-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr0-class-loader) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name. diff --git a/ede-php-autoload/class-loader/psr4.el b/ede-php-autoload/class-loader/psr4.el index 9d833af..6d32339 100644 --- a/ede-php-autoload/class-loader/psr4.el +++ b/ede-php-autoload/class-loader/psr4.el @@ -45,7 +45,7 @@ For example, if :namespaces has the value '((\"Foo\" . \"src/Foo\") (\"Bar\" . \ then The class \"Bar\\Foo\" is considered to be defined in \"src/test/Bar/Foo\".")) "Class loader for PSR-4 convention.") -(defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr4-class-loader) +(cl-defmethod ede-php-autoload-find-class-def-file ((this ede-php-autoload-psr4-class-loader) class-name) "Find the file in which CLASS-NAME is defined. @@ -88,7 +88,7 @@ TARGET is a string." (setq current-pairs (cdr current-pairs))) longest-pair)) -(defmethod ede-php-autoload-get-class-name-for-file +(cl-defmethod ede-php-autoload-get-class-name-for-file ((this ede-php-autoload-psr4-class-loader) file-name) "Generate a suitable class name for the current FILE-NAME. @@ -158,7 +158,7 @@ PREFIX is the beginning of the type to complete." (car (last split-prefix))))))))) suggestions)) -(defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr4-class-loader) prefix) +(cl-defmethod ede-php-autoload-complete-type-name ((this ede-php-autoload-psr4-class-loader) prefix) "Get completion suggestions for the type PREFIX. PREFIX is the beginning of a fully-qualified name.