From ef7a5ba6e9ddb58e534f562a953ac497c7e2b83b Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Dec 2020 04:16:48 -0600 Subject: [PATCH 01/14] Add standard variable + use c++14 --- binding.gyp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index 249e9e82..c096277b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -67,7 +67,8 @@ ], "variables": { - "tests": 0 + "tests": 0, + "STANDARD": 14, }, "conditions": [ @@ -111,9 +112,8 @@ }] }] ], - "target_defaults": { - "cflags_cc": ["-std=c++11"], + "cflags_cc": [ "-std=c++<(STANDARD)" ], "conditions": [ ['OS=="mac"', { "xcode_settings": { From a8296f11198ef0685ed887e4850d46ca7c4abb81 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Dec 2020 04:17:10 -0600 Subject: [PATCH 02/14] Add MACOSX_DEPLOYMENT_TARGET variable --- binding.gyp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index c096277b..7134ff69 100644 --- a/binding.gyp +++ b/binding.gyp @@ -69,6 +69,7 @@ "variables": { "tests": 0, "STANDARD": 14, + "MACOSX_DEPLOYMENT_TARGET": "10.8" }, "conditions": [ @@ -101,11 +102,11 @@ "conditions": [ ['OS=="mac"', { 'cflags': [ - '-mmacosx-version-min=10.8' + "-mmacosx-version-min=<(MACOSX_DEPLOYMENT_TARGET)" ], "xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES", - 'MACOSX_DEPLOYMENT_TARGET': '10.8', + 'MACOSX_DEPLOYMENT_TARGET': '<(MACOSX_DEPLOYMENT_TARGET)', } }] ] From d3f3d4038d89f9168a0cbfc8fabdf52703127742 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Dec 2020 04:19:48 -0600 Subject: [PATCH 03/14] Add Release configurations and optimizations --- binding.gyp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index 7134ff69..d2463875 100644 --- a/binding.gyp +++ b/binding.gyp @@ -130,6 +130,40 @@ "NOMINMAX" ], }] - ] - } + ], + 'default_configuration': 'Release', + 'configurations': { + # Release Settings + 'Release': { + 'defines': [ 'NDEBUG' ], + "cflags": [ "-fno-exceptions", "-Ofast" ], + "cflags_cc": [ "-fno-exceptions", "-Ofast", "-std=c++<(STANDARD)" ], + "xcode_settings": { + 'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os + "CLANG_CXX_LIBRARY": "libc++", + "CLANG_CXX_LANGUAGE_STANDARD": "c++<(STANDARD)", + 'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)" + }, # XCODE + "msvs_settings": { + "VCCLCompilerTool": { + 'ExceptionHandling': 0, # /EHsc + 'MultiProcessorCompilation': 'true', + 'RuntimeTypeInfo': 'false', + 'Optimization': 3, # full optimizations /O2 == /Og /Oi /Ot /Oy /Ob2 /GF /Gy + 'StringPooling': 'true', # pool string literals + "AdditionalOptions": [ + # C++ standard + "/std:c++<(STANDARD)", + + # Optimizations + "/O2", + # "/Ob3", # aggressive inline + "/GL", # whole Program Optimization # /LTCG is implied with /GL. + "/DNDEBUG" # turn off asserts + ], + } + } # MSVC + }, # Release + }, # configurations + } # target-defaults } From 490e7856f05834e2bcd84bf45ff7b861776c20d6 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Dec 2020 04:29:56 -0600 Subject: [PATCH 04/14] Use C++17 standard --- binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index d2463875..85981bbb 100644 --- a/binding.gyp +++ b/binding.gyp @@ -68,7 +68,7 @@ "variables": { "tests": 0, - "STANDARD": 14, + "STANDARD": 17, "MACOSX_DEPLOYMENT_TARGET": "10.8" }, From 18aac6514b8897636da3576d97594cb01e26afed Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Dec 2020 04:40:36 -0600 Subject: [PATCH 05/14] Use Visual Studio 17 on AppVeyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index aa43e41e..132e2c69 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -image: Visual Studio 2015 +image: Visual Studio 2017 environment: matrix: From 38128a3658a147896617674fd1bfa3f423e830fb Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 5 Dec 2020 15:51:38 -0600 Subject: [PATCH 06/14] Use Clang 9 on Travis --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1831c829..d7698859 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,10 @@ node_js: - "10" - "12.14.1" +distro: bionic + before_install: - - export CXX="g++-4.9" CC="gcc-4.9" + - export CXX="clang-9.0" CC="clang++-9.0" script: - npm run standard @@ -31,5 +33,5 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-4.9 - - g++-4.9 + - clang-9.0 + - clang++-9.0 From 9be829e93ff7e2361d9607461bdeaa490e73b360 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 20:32:55 -0700 Subject: [PATCH 07/14] Revert "Remove other ci configs and update badge" This reverts commit 833f7dd5af2dc52507d064ffa2fc377e8216b0ab. Update README.md --- .github/workflows/ci.yml | 6 +++++- README.md | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 906ec387..11737170 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,10 @@ jobs: - ubuntu-latest - macos-latest - windows-latest + node_version: + - 10 + - 12 + - 14 name: Node ${{ matrix.node_version }} on ${{ matrix.os }} steps: @@ -30,7 +34,7 @@ jobs: - name: Setup node uses: actions/setup-node@v2-beta with: - node-version: 14 + node-version: ${{ matrix.node_version }} - name: Install dependencies run: npm install diff --git a/README.md b/README.md index c39c6ea5..8387b218 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Superstring -[![ci](https://github.com/atom/superstring/actions/workflows/ci.yml/badge.svg)](https://github.com/atom/superstring/actions/workflows/ci.yml) +[![macOS Build Status](https://circleci.com/gh/atom/superstring/tree/master.svg?style=shield)](https://circleci.com/gh/atom/superstring) +[![Dependency Status](https://david-dm.org/atom/superstring.svg)](https://david-dm.org/atom/superstring) + + Native library at the core of Atom's text editor. From d8de3806c65ca99f95663ab37500bbd58adf5af7 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 20:53:06 -0700 Subject: [PATCH 08/14] ci: update setup-node and actions/checkout --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11737170..8da6f050 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,20 +21,21 @@ jobs: name: Node ${{ matrix.node_version }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | 'node_modules' key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json') }} - name: Setup node - uses: actions/setup-node@v2-beta + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} + architecture: x64 - name: Install dependencies run: npm install From 3c509621733c10bea908f526eee697401814f7e4 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 20:55:00 -0700 Subject: [PATCH 09/14] ci: use setup-cpp for the cpp environment --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8da6f050..6e986acc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,13 @@ jobs: node-version: ${{ matrix.node_version }} architecture: x64 + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + vcvarsall: true + architecture: x64 + python: true + - name: Install dependencies run: npm install From cf240616aba5277fcd5a24c646751d0312288566 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 20:59:09 -0700 Subject: [PATCH 10/14] ci: use windows-2019 image --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e986acc..e0398f65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: os: - ubuntu-latest - macos-latest - - windows-latest + - windows-2019 node_version: - 10 - 12 From 214bec16abfa46d8db46f19184ee129a076efd53 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 21:01:32 -0700 Subject: [PATCH 11/14] ci: run push CI only on master [skip ci] --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0398f65..461c6a76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,8 @@ name: ci on: - - pull_request - - push + pull_request: + push: + branches: [master] jobs: Test: From a38ec436d531627442359f4f27e7c5241234e1b1 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 21:23:31 -0700 Subject: [PATCH 12/14] chore: report the status of the browser build --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d5df9424..6c67263c 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,12 @@ "browser": "./browser", "scripts": { "build:node": "node-gyp rebuild", - "build:browser": "script/build-browser-version.sh", + "build:browser": "bash -c script/build-browser-version.sh || echo 'the browser build is unsupported'", "build": "npm run build:node && npm run build:browser", "test:native": "node ./script/test-native.js", "test:node": "mocha test/js/*.js", - "test:browser": "SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js", - "test": "npm run test:node && npm run test:browser", + "test:browser": "cross-env SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js || echo 'the browser tests are unsupported'", + "test": "npm run test:node && npm run test:native && npm run test:browser", "benchmark": "node benchmark/marker-index.benchmark.js", "prepublishOnly": "git submodule update --init --recursive && npm run build:browser", "standard": "standard --recursive src test" @@ -35,6 +35,7 @@ }, "devDependencies": { "chai": "^2.0.0", + "cross-env": "^7.0.3", "mocha": "^2.3.4", "random-seed": "^0.2.0", "standard": "^4.5.4", From c0591e63c6bed0aa61beacc7c74b62839d0f94eb Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 21:28:40 -0700 Subject: [PATCH 13/14] build: increase the macos target to 10.15 --- binding.gyp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index 85981bbb..e541749b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -69,7 +69,7 @@ "variables": { "tests": 0, "STANDARD": 17, - "MACOSX_DEPLOYMENT_TARGET": "10.8" + "MACOSX_DEPLOYMENT_TARGET": "10.15" }, "conditions": [ @@ -119,7 +119,7 @@ ['OS=="mac"', { "xcode_settings": { 'CLANG_CXX_LIBRARY': 'libc++', - 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'CLANG_CXX_LANGUAGE_STANDARD':'c++(STANDARD)', } }], ['OS=="win"', { From 2b6943d50339800add347ce27bb75c2c754665e9 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 3 Jul 2022 21:32:19 -0700 Subject: [PATCH 14/14] build: use -O3 instead of -Ofast --- binding.gyp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index e541749b..cce9d221 100644 --- a/binding.gyp +++ b/binding.gyp @@ -136,8 +136,8 @@ # Release Settings 'Release': { 'defines': [ 'NDEBUG' ], - "cflags": [ "-fno-exceptions", "-Ofast" ], - "cflags_cc": [ "-fno-exceptions", "-Ofast", "-std=c++<(STANDARD)" ], + "cflags": [ "-fno-exceptions", "-O3" ], + "cflags_cc": [ "-fno-exceptions", "-O3", "-std=c++<(STANDARD)" ], "xcode_settings": { 'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os "CLANG_CXX_LIBRARY": "libc++",