From 5e3e95c82d65ac18fe46d7b4f6b40161c7a59723 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 15 Sep 2023 14:21:39 -0700 Subject: [PATCH 1/4] test: Build with Eask --- .github/dependabot.yml | 6 +++++ .github/workflows/test.yml | 54 ++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + Eask | 25 ++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/test.yml create mode 100644 Eask 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 From 9348f8a8315134f71f22d51789e27c459d53ba8c Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 15 Sep 2023 14:27:22 -0700 Subject: [PATCH 2/4] fix version header --- ede-php-autoload.el | 1 + 1 file changed, 1 insertion(+) diff --git a/ede-php-autoload.el b/ede-php-autoload.el index 144b6fb..0c45436 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 From dc0c7feb5666722e0eaf7135ce521e149b2f4a1f Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 15 Sep 2023 14:29:28 -0700 Subject: [PATCH 3/4] Remove test for 29.1 for now --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fff42f0..6240cb2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - 26.3 - 27.2 - 28.2 - - 29.1 + #- 29.1 experimental: [false] include: - os: ubuntu-latest From bebbe50bceaff20c5fa9bd7b200f1cff0cbf646b Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 15 Sep 2023 14:48:14 -0700 Subject: [PATCH 4/4] Fix compile error above 29.1 --- .github/workflows/test.yml | 2 +- ede-php-autoload.el | 20 ++++++++++---------- ede-php-autoload/class-loader/aggregate.el | 6 +++--- ede-php-autoload/class-loader/classmap.el | 6 +++--- ede-php-autoload/class-loader/core.el | 8 ++++---- ede-php-autoload/class-loader/psr0.el | 6 +++--- ede-php-autoload/class-loader/psr4.el | 6 +++--- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6240cb2..fff42f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - 26.3 - 27.2 - 28.2 - #- 29.1 + - 29.1 experimental: [false] include: - os: ubuntu-latest diff --git a/ede-php-autoload.el b/ede-php-autoload.el index 0c45436..770e878 100644 --- a/ede-php-autoload.el +++ b/ede-php-autoload.el @@ -217,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) @@ -246,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 @@ -261,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)) @@ -281,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. @@ -304,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. @@ -313,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.