From 814b1b0eda102afb9fc87e81638a9cf5b650bb10 Mon Sep 17 00:00:00 2001 From: Jiawen Geng <3759816+gengjiawen@users.noreply.github.com> Date: Thu, 27 May 2021 22:05:04 +0800 Subject: [PATCH] feat(gyp): update gyp to v0.9.1 (#2402) --- gyp/.github/workflows/release-please.yml | 2 +- gyp/CHANGELOG.md | 20 ++++++++++++++++++++ gyp/CODE_OF_CONDUCT.md | 4 ++-- gyp/CONTRIBUTING.md | 2 +- gyp/pylib/gyp/generator/make.py | 2 +- gyp/pylib/gyp/generator/ninja.py | 6 +++++- gyp/pylib/gyp/xcodeproj_file.py | 19 +++++++++++-------- gyp/setup.py | 2 +- gyp/tools/emacs/gyp-tests.el | 2 +- gyp/tools/emacs/gyp.el | 2 +- 10 files changed, 44 insertions(+), 17 deletions(-) diff --git a/gyp/.github/workflows/release-please.yml b/gyp/.github/workflows/release-please.yml index c8e98fbb56..288afdb3b3 100644 --- a/gyp/.github/workflows/release-please.yml +++ b/gyp/.github/workflows/release-please.yml @@ -1,7 +1,7 @@ on: push: branches: - - master + - main name: release-please jobs: diff --git a/gyp/CHANGELOG.md b/gyp/CHANGELOG.md index 2f8bbb6249..6d66b3acd2 100644 --- a/gyp/CHANGELOG.md +++ b/gyp/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +### [0.9.1](https://www.github.com/nodejs/gyp-next/compare/v0.9.0...v0.9.1) (2021-05-14) + + +### Bug Fixes + +* py lint ([3b6a8ee](https://www.github.com/nodejs/gyp-next/commit/3b6a8ee7a66193a8a6867eba9e1d2b70bdf04402)) + +## [0.9.0](https://www.github.com/nodejs/gyp-next/compare/v0.8.1...v0.9.0) (2021-05-13) + + +### Features + +* use LDFLAGS_host for host toolset ([#98](https://www.github.com/nodejs/gyp-next/issues/98)) ([bea5c7b](https://www.github.com/nodejs/gyp-next/commit/bea5c7bd67d6ad32acbdce79767a5481c70675a2)) + + +### Bug Fixes + +* msvs.py: remove overindentation ([#102](https://www.github.com/nodejs/gyp-next/issues/102)) ([3f83e99](https://www.github.com/nodejs/gyp-next/commit/3f83e99056d004d9579ceb786e06b624ddc36529)) +* update gyp.el to change case to cl-case ([#93](https://www.github.com/nodejs/gyp-next/issues/93)) ([13d5b66](https://www.github.com/nodejs/gyp-next/commit/13d5b66aab35985af9c2fb1174fdc6e1c1407ecc)) + ### [0.8.1](https://www.github.com/nodejs/gyp-next/compare/v0.8.0...v0.8.1) (2021-02-18) diff --git a/gyp/CODE_OF_CONDUCT.md b/gyp/CODE_OF_CONDUCT.md index 4c21140559..d724027fd9 100644 --- a/gyp/CODE_OF_CONDUCT.md +++ b/gyp/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ # Code of Conduct -* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) -* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md) +* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md) +* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md) diff --git a/gyp/CONTRIBUTING.md b/gyp/CONTRIBUTING.md index f9dd574a47..1a0bcde2b4 100644 --- a/gyp/CONTRIBUTING.md +++ b/gyp/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Code of Conduct -This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md). +This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md). ## Developer's Certificate of Origin 1.1 diff --git a/gyp/pylib/gyp/generator/make.py b/gyp/pylib/gyp/generator/make.py index 857875a564..eb9102dd15 100644 --- a/gyp/pylib/gyp/generator/make.py +++ b/gyp/pylib/gyp/generator/make.py @@ -319,7 +319,7 @@ def CalculateGeneratorInputInfo(params): CXX.host ?= %(CXX.host)s CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) LINK.host ?= %(LINK.host)s -LDFLAGS.host ?= +LDFLAGS.host ?= $(LDFLAGS_host) AR.host ?= %(AR.host)s # Define a dir function that can handle spaces. diff --git a/gyp/pylib/gyp/generator/ninja.py b/gyp/pylib/gyp/generator/ninja.py index c57bec6abb..ca032aef20 100644 --- a/gyp/pylib/gyp/generator/ninja.py +++ b/gyp/pylib/gyp/generator/ninja.py @@ -1417,7 +1417,11 @@ def WriteLinkForArch( is_executable = spec["type"] == "executable" # The ldflags config key is not used on mac or win. On those platforms # linker flags are set via xcode_settings and msvs_settings, respectively. - env_ldflags = os.environ.get("LDFLAGS", "").split() + if self.toolset == "target": + env_ldflags = os.environ.get("LDFLAGS", "").split() + elif self.toolset == "host": + env_ldflags = os.environ.get("LDFLAGS_host", "").split() + if self.flavor == "mac": ldflags = self.xcode_settings.GetLdflags( config_name, diff --git a/gyp/pylib/gyp/xcodeproj_file.py b/gyp/pylib/gyp/xcodeproj_file.py index bca4fb79d0..5863ef45df 100644 --- a/gyp/pylib/gyp/xcodeproj_file.py +++ b/gyp/pylib/gyp/xcodeproj_file.py @@ -138,7 +138,9 @@ """ import gyp.common +from functools import cmp_to_key import hashlib +from operator import attrgetter import posixpath import re import struct @@ -423,6 +425,8 @@ def _HashUpdate(hash, data): """ hash.update(struct.pack(">i", len(data))) + if isinstance(data, str): + data = data.encode("utf-8") hash.update(data) if seed_hash is None: @@ -1483,7 +1487,7 @@ def TakeOverOnlyChild(self, recurse=False): def SortGroup(self): self._properties["children"] = sorted( - self._properties["children"], cmp=lambda x, y: x.Compare(y) + self._properties["children"], key=cmp_to_key(lambda x, y: x.Compare(y)) ) # Recurse. @@ -2891,7 +2895,7 @@ def SortGroups(self): # according to their defined order. self._properties["mainGroup"]._properties["children"] = sorted( self._properties["mainGroup"]._properties["children"], - cmp=lambda x, y: x.CompareRootGroup(y), + key=cmp_to_key(lambda x, y: x.CompareRootGroup(y)), ) # Sort everything else by putting group before files, and going @@ -2986,9 +2990,7 @@ def AddOrGetProjectReference(self, other_pbxproject): # Xcode seems to sort this list case-insensitively self._properties["projectReferences"] = sorted( self._properties["projectReferences"], - cmp=lambda x, y: cmp( - x["ProjectRef"].Name().lower(), y["ProjectRef"].Name().lower() - ), + key=lambda x: x["ProjectRef"].Name().lower ) else: # The link already exists. Pull out the relevnt data. @@ -3120,7 +3122,8 @@ def CompareProducts(x, y, remote_products): product_group = ref_dict["ProductGroup"] product_group._properties["children"] = sorted( product_group._properties["children"], - cmp=lambda x, y, rp=remote_products: CompareProducts(x, y, rp), + key=cmp_to_key( + lambda x, y, rp=remote_products: CompareProducts(x, y, rp)), ) @@ -3155,7 +3158,7 @@ def Print(self, file=sys.stdout): else: self._XCPrint(file, 0, "{\n") for property, value in sorted( - self._properties.items(), cmp=lambda x, y: cmp(x, y) + self._properties.items() ): if property == "objects": self._PrintObjects(file) @@ -3183,7 +3186,7 @@ def _PrintObjects(self, file): self._XCPrint(file, 0, "\n") self._XCPrint(file, 0, "/* Begin " + class_name + " section */\n") for object in sorted( - objects_by_class[class_name], cmp=lambda x, y: cmp(x.id, y.id) + objects_by_class[class_name], key=attrgetter("id") ): object.Print(file) self._XCPrint(file, 0, "/* End " + class_name + " section */\n") diff --git a/gyp/setup.py b/gyp/setup.py index de0e3f5f61..f4a9481937 100644 --- a/gyp/setup.py +++ b/gyp/setup.py @@ -15,7 +15,7 @@ setup( name="gyp-next", - version="0.8.1", + version="0.9.1", description="A fork of the GYP build system for use in the Node.js projects", long_description=long_description, long_description_content_type="text/markdown", diff --git a/gyp/tools/emacs/gyp-tests.el b/gyp/tools/emacs/gyp-tests.el index 11b8497886..07afc58a93 100644 --- a/gyp/tools/emacs/gyp-tests.el +++ b/gyp/tools/emacs/gyp-tests.el @@ -30,7 +30,7 @@ "For the purposes of face comparison, we're not interested in the differences between certain faces. For example, the difference between font-lock-comment-delimiter and font-lock-comment-face." - (case face + (cl-case face ((font-lock-comment-delimiter-face) font-lock-comment-face) (t face))) diff --git a/gyp/tools/emacs/gyp.el b/gyp/tools/emacs/gyp.el index b98b155ced..042ff3a925 100644 --- a/gyp/tools/emacs/gyp.el +++ b/gyp/tools/emacs/gyp.el @@ -213,7 +213,7 @@ string-start) (setq string-start (gyp-parse-to limit)) (if string-start - (setq group (case (gyp-section-at-point) + (setq group (cl-case (gyp-section-at-point) ('dependencies 1) ('variables 2) ('conditions 2)