diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..d74523bf021 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,29 @@ + + +* **Project**: +* **Version**: +* **Mobile device**: +* **Mobile OS and version**: +* **Development Node.js**: +* **Development platform**: + + diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.md b/.github/ISSUE_TEMPLATE/1-bug-report.md deleted file mode 100644 index 2a2e94d411f..00000000000 --- a/.github/ISSUE_TEMPLATE/1-bug-report.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: "\U0001F41B Bug report" -about: Create a report to help us improve - ---- - - - -* **Version**: -* **Platform**: -* **Subsystem**: - -### What steps will reproduce the bug? - - - -### How often does it reproduce? Is there a required condition? - -### What is the expected behavior? - - - -### What do you see instead? - - - -### Additional information - - diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.md b/.github/ISSUE_TEMPLATE/2-feature-request.md deleted file mode 100644 index 0d40bfdd110..00000000000 --- a/.github/ISSUE_TEMPLATE/2-feature-request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: "\U0001F680 Feature request" -about: Suggest an idea for this project - ---- - - - -**Is your feature request related to a problem? Please describe.** -Please describe the problem you are trying to solve. - -**Describe the solution you'd like** -Please describe the desired behavior. - -**Describe alternatives you've considered** -Please describe alternative solutions or features you have considered. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 428bbf678a3..00000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,8 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: ⁉️ Need help with Node.js? - url: https://github.com/nodejs/help - about: Please file an issue in our help repo. - - name: 🌐 Found a problem with nodejs.org beyond the API reference docs? - url: https://github.com/nodejs/nodejs.org/issues/new/choose - about: Please file an issue in the Node.js website repo. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 66efca5cd00..f85c224898d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,31 +14,3 @@ Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md - [ ] tests and/or benchmarks are included - [ ] documentation is changed or added - [ ] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines) - - diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md deleted file mode 100644 index d3af8e68191..00000000000 --- a/.github/SUPPORT.md +++ /dev/null @@ -1,27 +0,0 @@ -# Support - -Node.js contributors have limited availability to address general support -questions. Please make sure you are using a [currently-supported version of -Node.js](https://github.com/nodejs/Release#release-schedule). - -When looking for support, please first search for your question in these venues: - -* [Node.js Website](https://nodejs.org/en/), especially the - [API docs](https://nodejs.org/api/) -* [Node.js Help](https://github.com/nodejs/help) -* [Open or closed issues in the Node.js GitHub organization](https://github.com/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+org%3Anodejs+is%3Aissue) - -If you didn't find an answer in the resources above, try these unofficial -resources: - -* [Questions tagged 'node.js' on Stack Overflow](https://stackoverflow.com/questions/tagged/node.js) -* [#nodejs](https://openjs-foundation.slack.com/archives/CK9Q4MB53) channel on the OpenJS Foundation Slack ([join here](https://slack-invite.openjsf.org/)) -* [#node.js channel on chat.freenode.net](https://webchat.freenode.net?channels=node.js&uio=d4) -* [Node.js Slack Community](https://node-js.slack.com/) - * To register: [nodeslackers.com](https://www.nodeslackers.com/) - -GitHub issues are for tracking enhancements and bugs, not general support. - -The open source license grants you the freedom to use Node.js. It does not -guarantee commitments of other people's time. Please be respectful and manage -your expectations. diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml deleted file mode 100644 index 7d7a8167308..00000000000 --- a/.github/workflows/build-windows.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: build-windows - -on: [push, pull_request] - -env: - PYTHON_VERSION: 2.7 - FLAKY_TESTS: dontcare - -jobs: - build-windows: - runs-on: windows-2016 - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Install deps - run: choco install nasm - - name: Environment Information - run: npx envinfo - - name: Build - run: ./vcbuild.bat diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml deleted file mode 100644 index 4453db5c751..00000000000 --- a/.github/workflows/linters.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: linters - -on: [push, pull_request] - -env: - PYTHON_VERSION: 3.8 - NODE_VERSION: 10.x - -jobs: - lint-addon-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint addon docs - run: NODE=$(which node) make lint-addon-docs - lint-cpp: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint C/C++ files - run: make lint-cpp - lint-md: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint docs - run: | - echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" - NODE=$(which node) make lint-md - lint-js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint JavaScript files - run: NODE=$(which node) make lint-js - lint-py: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint Python - run: | - make lint-py-build || true - NODE=$(which node) make lint-py diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml deleted file mode 100644 index 6161326b938..00000000000 --- a/.github/workflows/misc.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: misc - -on: [push, pull_request] - -env: - NODE_VERSION: 12.x - -jobs: - build-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Build - run: NODE=$(which node) make doc-only - - uses: actions/upload-artifact@v1 - with: - name: docs - path: out/doc - - name: Check links - run: node tools/doc/checkLinks.js . diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml deleted file mode 100644 index 9ff5e9a39d8..00000000000 --- a/.github/workflows/pythonpackage.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Python 3 testing - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - max-parallel: 1 - matrix: - python-version: [3.8] # [2.7, 3.5, 3.6, 3.7] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Compile Node.js - run: | - python ./configure.py - make -j2 V=1 - - name: Test JS Suites - run: | - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare default - - name: Test C++ Suites - run: | - make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api - - name: Make lint - run: | - make lint-py-build || true - NODE=$(which node) make lint lint-py diff --git a/.github/workflows/remark-lint-problem-matcher.json b/.github/workflows/remark-lint-problem-matcher.json deleted file mode 100644 index cfb281310a9..00000000000 --- a/.github/workflows/remark-lint-problem-matcher.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "remark-lint", - "pattern": [ - { - "regexp": "^(?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)*$", - "file": 1 - }, - { - "regexp": "^\\s+(?:\\d+:\\d+-)?(\\d+):(\\d+)\\s+\\S*(error|warning|info)\\S*\\s+(.+)\\s+(\\S+)\\s+(?:\\S+)$", - "line": 1, - "column": 2, - "severity": 3, - "message": 4, - "code": 5, - "loop": true - } - ] - } - ] -} diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml deleted file mode 100644 index bec9884f6c8..00000000000 --- a/.github/workflows/test-linux.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: test-linux - -on: [push, pull_request] - -env: - PYTHON_VERSION: 2.7 - FLAKY_TESTS: dontcare - -jobs: - test-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Build - run: make build-ci -j2 V=1 - - name: Test - run: make run-ci -j2 V=1 TEST_CI_ARGS="-p dots" diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml deleted file mode 100644 index b9794bde31b..00000000000 --- a/.github/workflows/test-macos.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: test-macOS - -on: [push, pull_request] - -env: - PYTHON_VERSION: 2.7 - FLAKY_TESTS: dontcare - -jobs: - test-macOS: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Build - run: make build-ci -j8 V=1 - - name: Test - run: make run-ci -j8 V=1 TEST_CI_ARGS="-p dots" diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 00000000000..b2cc0dcc4c8 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,49 @@ +# Frequently Asked Questions + +- [Can I use npm node-modules with nodejs-mobile?](#can-i-use-npm-node-modules-with-nodejs-mobile) +- [Are all Node.js APIs supported on mobile?](#are-all-nodejs-apis-supported-on-mobile) +- [Trying to write a file results in an error. What's going on?](#trying-to-write-a-file-results-in-an-error-whats-going-on) +- [Are Node.js native modules supported?](#are-nodejs-native-modules-supported) +- [How can I improve Node.js load times?](#how-can-i-improve-nodejs-load-times) +- [Can I run two or more Node.js instances?](#can-i-run-two-or-more-nodejs-instances) +- [Can I run Node.js code in a WebView?](#can-i-run-nodejs-code-in-a-webview) +- [Can you support a plugin for the X mobile framework?](#can-you-support-a-plugin-for-the-x-mobile-framework) + +## Can I use npm node-modules with nodejs-mobile? + +npm modules can be used with nodejs-mobile. They need to be installed at development time in the application source folder that contains the Node.js project files. There are samples that show how to use npm modules for [Android](https://github.com/janeasystems/nodejs-mobile-samples/tree/master/android/native-gradle-node-folder) and [iOS](https://github.com/janeasystems/nodejs-mobile-samples/tree/master/ios/native-xcode-node-folder) when using the native library directly. There are instructions in the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#node-modules) and [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#node-modules) plugins README on how to use them. + +## Are all Node.js APIs supported on mobile? + +Not every API is supported on mobile, the main reason for this being that the mobile operating systems won't allow applications to call certain APIs that are expected to be available on other operating systems. Examples: +- APIs that create new processes, such as `child_process.spawn()` or `child_process.fork()` will run into permission issues. +- Using `process.exit()` is not allowed by the Apple App Store guildelines. +- `os.cpus()` may return inconsistent/unreliable results, since different OS versions will have different permissions for accessing CPU information. + +## Trying to write a file results in an error. What's going on? + +Mobile platforms are different than the usual desktop platforms in that they require applications to write in specific sandboxed paths and don't have permissions to write elsewhere. You should pass an appropriate writable path for your use case to the Node.js runtime and write there. An API call to return the path most regularly used for data in each platform has been added to the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#cordovaappdatadir) and [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#rn_bridgeappdatadir) plugins. + +## Are Node.js native modules supported? + +Node native modules, which contain native code, are able to run on nodejs-mobile, as long as they can be cross-compiled for the target platform / CPU. The cross-compiling feature is integrated into the plugins and instructions can be found in the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#native-modules) or in the [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#native-modules) README, but only Linux and MacOS development machines are currently supported. Modules that contain custom build steps and platform specific code may need workarounds/changes to get them to work. We've created a github repository so that the workarounds/changes can be discussed and shared: https://github.com/janeasystems/nodejs-mobile-module-compat + +## How can I improve Node.js load times? + +Applications that contain a large number of files in the Node.js project can have their load times decreased by reducing the number of files. While installing npm modules, these can be installed with the `--production` flag, so that modules that are used for development only are not included in your project, e.g.: `npm install --production `. Using tools that merge all nodejs project files into a bundle, such as [`noderify`](https://www.npmjs.com/package/noderify) and using the bundle instead has been observed to improve load times in most situations. + +## Can I run two or more Node.js instances? + +No. The runtime expects to be run as a single instance in the process. In practice this should not preclude any usage scenarios, given node's asynchronous nature. Multiple sub-tasks can be executed by simply loading all the corresponding modules with `require` from a main script. + +## Can I run Node.js code in a WebView? + +No. Node.js uses a libuv event loop at its core, which is different than the event loop in the WebView. Having the node runtime run in its own thread also prevents Node.js tasks for interfering with the UI, which might cause responsiveness issues. +The supported usage scenario is that nodejs-mobile runs in a background thread and the UI (in this case a WebView) must use a communication mechanism to send/receive data from Node.js. +This technique is used in the `nodejs-mobile-cordova` plugin, where Cordova uses a dedicated thread to run Node.js alongside the WebView. + +## Can you support a plugin for the X mobile framework? + +We are currently focused on supporting cordova and react-native plugins only, but we are open to community contributions for other frameworks. +If you are interested in a particular framework, please see if [an issue](https://github.com/janeasystems/nodejs-mobile/issues/) for it has already been opened, and let us know about your interest in there. Otherwise, feel free to open a new issue. + diff --git a/NodeMobile.podspec b/NodeMobile.podspec new file mode 100644 index 00000000000..1170405eb4d --- /dev/null +++ b/NodeMobile.podspec @@ -0,0 +1,27 @@ +Pod::Spec.new do |s| + s.name = 'NodeMobile' + s.version = '0.3.0' + s.summary = 'Node.js for Mobile Apps' + + s.description = <<-DESC.strip_heredoc + [Node.js for Mobile Apps](https://code.janeasystems.com/nodejs-mobile) - A toolkit for integrating Node.js into mobile applications. + DESC + + s.homepage = 'https://code.janeasystems.com/nodejs-mobile' + s.license = { type: 'Mixed', file: 'LICENSE' } + + s.documentation_url = 'https://code.janeasystems.com/nodejs-mobile/getting-started-ios' + + s.author = 'Janea Systems' + + s.ios.deployment_target = '9.0' + + s.source = { git: 'https://github.com/janeasystems/nodejs-mobile.git', + tag: "nodejs-mobile-v#{s.version}" } + + s.vendored_frameworks = 'out_ios/Release-universal/NodeMobile.framework' + + s.prepare_command = <<-CMD.strip_heredoc + tools/ios_framework_prepare.sh + CMD +end diff --git a/README.md b/README.md index ecacab8921c..10fa698031c 100644 --- a/README.md +++ b/README.md @@ -1,639 +1,173 @@ - -

- - Node.js - -

- -Node.js is an open-source, cross-platform, JavaScript runtime environment. It -executes JavaScript code outside of a browser. For more information on using -Node.js, see the [Node.js Website][]. - -The Node.js project uses an [open governance model](./GOVERNANCE.md). The -[OpenJS Foundation][] provides support for the project. - -**This project is bound by a [Code of Conduct][].** - -# Table of Contents - -* [Support](#support) -* [Release Types](#release-types) - * [Download](#download) - * [Current and LTS Releases](#current-and-lts-releases) - * [Nightly Releases](#nightly-releases) - * [API Documentation](#api-documentation) - * [Verifying Binaries](#verifying-binaries) -* [Building Node.js](#building-nodejs) -* [Security](#security) -* [Contributing to Node.js](#contributing-to-nodejs) -* [Current Project Team Members](#current-project-team-members) - * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) - * [Collaborators](#collaborators) - * [Release Keys](#release-keys) - -## Support - -Looking for help? Check out the -[instructions for getting support](.github/SUPPORT.md). - -## Release Types - -* **Current**: Under active development. Code for the Current release is in the - branch for its major version number (for example, - [v10.x](https://github.com/nodejs/node/tree/v10.x)). Node.js releases a new - major version every 6 months, allowing for breaking changes. This happens in - April and October every year. Releases appearing each October have a support - life of 8 months. Releases appearing each April convert to LTS (see below) - each October. -* **LTS**: Releases that receive Long-term Support, with a focus on stability - and security. Every even-numbered major version will become an LTS release. - LTS releases receive 12 months of _Active LTS_ support and a further 18 months - of _Maintenance_. LTS release lines have alphabetically-ordered codenames, - beginning with v4 Argon. There are no breaking changes or feature additions, - except in some special circumstances. -* **Nightly**: Code from the Current branch built every 24-hours when there are - changes. Use with caution. - -Current and LTS releases follow [Semantic Versioning](https://semver.org). A -member of the Release Team [signs](#release-keys) each Current and LTS release. -For more information, see the -[Release README](https://github.com/nodejs/Release#readme). - -### Download - -Binaries, installers, and source tarballs are available at -. - -#### Current and LTS Releases - - -The [latest](https://nodejs.org/download/release/latest/) directory is an -alias for the latest Current release. The latest-_codename_ directory is an -alias for the latest release from an LTS line. For example, the -[latest-carbon](https://nodejs.org/download/release/latest-carbon/) directory -contains the latest Carbon (Node.js 8) release. - -#### Nightly Releases - - -Each directory name and filename contains a date (in UTC) and the commit -SHA at the HEAD of the release. - -#### API Documentation - -Documentation for the latest Current release is at . -Version-specific documentation is available in each release directory in the -_docs_ subdirectory. Version-specific documentation is also at -. - -### Verifying Binaries - -Download directories contain a `SHASUMS256.txt` file with SHA checksums for the -files. - -To download `SHASUMS256.txt` using `curl`: - -```console -$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt +Node.js for Mobile Apps +==================================== + +This is the main repository for [Node.js for Mobile Apps](https://code.janeasystems.com/nodejs-mobile), a toolkit for integrating Node.js into mobile applications. + +## Resources for Newcomers +* [Website](https://code.janeasystems.com/nodejs-mobile) +* [Gitter channel](https://gitter.im/nodejs-mobile/community) +* [Frequently Asked Questions](FAQ.md) + +This is the central repository for reporting **all issues** related to the Node.js for Mobile Apps project, including issues pertaining to the React Native and Cordova plugins. + +The core library source code is in this repo. If you are looking for the *source code* for the plugins, you can find it at: + +* [React Native plugin source repo](https://github.com/janeasystems/nodejs-mobile-react-native) +* [Cordova plugin source repo](https://github.com/janeasystems/nodejs-mobile-cordova) + + +## Project Goals + +1. To provide the fixes necessary to run Node.js on mobile operating systems. +1. To investigate which features need to be added to Node.js in order to make it a useful tool for mobile app development. +1. To diverge as little as possible from nodejs/node, while fulfilling goals (1) and (2). + +## Download +Binaries for Android and iOS are available at https://github.com/janeasystems/nodejs-mobile/releases. + +## Documentation +Documentation can be found on the [project website](https://code.janeasystems.com/nodejs-mobile). Sample code is available in the [samples repo](https://github.com/janeasystems/nodejs-mobile-samples/). + +***Disclaimer:*** documentation found in this repository is currently unchanged from the parent repository and may only be applicable to upstream node. + +## Build Instructions + +### Prerequisites to build the Android library on Linux Ubuntu/Debian: + +#### Basic build tools: +```sh +sudo apt-get install -y build-essential git python ``` -To check that a downloaded file matches the checksum, run -it through `sha256sum` with a command such as: +#### Install curl and unzip (needed to download the Android NDK): +```sh +sudo apt-get install -y curl unzip +``` + +#### Install Android NDK r21b for Linux: +Choose a location where you want to install the Android NDK and run: +```sh +curl https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip -o ndk.zip +unzip ndk.zip +``` +It will create a `android-ndk-r21b` folder. Save that path for later. + +### Prerequisites to build the Android library on macOS: + +#### Git: + +Run `git` in a terminal window, it will show a prompt to install it if not already present. +As an alternative, installing one of these will install `git`: +* Xcode, with the Command Line Tools. +* [Homebrew](https://brew.sh/) +* [Git-SCM](https://git-scm.com/download/mac) + +#### Install Android NDK r21b for macOS: +Choose a location where you want to install the Android NDK and run: +```sh +curl https://dl.google.com/android/repository/android-ndk-r21b-darwin-x86_64.zip -o ndk.zip +unzip ndk.zip +``` +It will create a `android-ndk-r21b` folder. Save that path for later. + +### Building the Android library on Linux or macOS: -```console -$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c - +#### 1) Clone this repo and check out the `mobile-master` branch: + +```sh +git clone https://github.com/janeasystems/nodejs-mobile +cd nodejs-mobile +git checkout mobile-master ``` -For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in -`SHASUMS256.txt.sig`. You can use it with `gpg` to verify the integrity of -`SHASUM256.txt`. You will first need to import -[the GPG keys of individuals authorized to create releases](#release-keys). To -import the keys: +#### 2a) Using the Android helper script: + +The `tools/android_build.sh` script takes as first argument the Android NDK path (in our case is `~/android-ndk-r21b`). The second argument is optional and is the target architecture, which can be one of the following: `arm`, `x86`, `arm64` or `x86_64`. If no target architecture is provided, it will build all available architectures. +Run: -```console -$ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D +```sh +./tools/android_build.sh ~/android-ndk-r21b ``` -See the bottom of this README for a full script to import active release keys. +When done, each built shared library will be placed in `out_android/$(ARCHITECTURE)/libnode.so`. -Next, download the `SHASUMS256.txt.sig` for the release: +#### 2b) Configure and build manually: +Run the `android-configure` script to configure the build with the path to the downloaded NDK and the desired target architecture. -```console -$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig +```sh +source ./android-configure ../android-ndk-r21b arm ``` -Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify -the file's signature. - -## Building Node.js - -See [BUILDING.md](BUILDING.md) for instructions on how to build Node.js from -source and a list of supported platforms. - -## Security - -For information on reporting security vulnerabilities in Node.js, see -[SECURITY.md](./SECURITY.md). - -## Contributing to Node.js - -* [Contributing to the project][] -* [Working Groups][] -* [Strategic Initiatives][] -* [Technical values and prioritization][] - -## Current Project Team Members - -For information about the governance of the Node.js project, see -[GOVERNANCE.md](./GOVERNANCE.md). - -### TSC (Technical Steering Committee) - - -* [apapirovski](https://github.com/apapirovski) - -**Anatoli Papirovski** <apapirovski@mac.com> (he/him) -* [BethGriggs](https://github.com/BethGriggs) - -**Beth Griggs** <Bethany.Griggs@uk.ibm.com> (she/her) -* [BridgeAR](https://github.com/BridgeAR) - -**Ruben Bridgewater** <ruben@bridgewater.de> (he/him) -* [ChALkeR](https://github.com/ChALkeR) - -**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) -* [cjihrig](https://github.com/cjihrig) - -**Colin Ihrig** <cjihrig@gmail.com> (he/him) -* [codebytere](https://github.com/codebytere) - -**Shelley Vohr** <codebytere@gmail.com> (she/her) -* [danbev](https://github.com/danbev) - -**Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) -* [fhinkel](https://github.com/fhinkel) - -**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) -* [gabrielschulhof](https://github.com/gabrielschulhof) - -**Gabriel Schulhof** <gabriel.schulhof@intel.com> -* [gireeshpunathil](https://github.com/gireeshpunathil) - -**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) -* [jasnell](https://github.com/jasnell) - -**James M Snell** <jasnell@gmail.com> (he/him) -* [joyeecheung](https://github.com/joyeecheung) - -**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) -* [mcollina](https://github.com/mcollina) - -**Matteo Collina** <matteo.collina@gmail.com> (he/him) -* [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <midawson@redhat.com> (he/him) -* [mmarchini](https://github.com/mmarchini) - -**Mary Marchini** <oss@mmarchini.me> (she/her) -* [MylesBorins](https://github.com/MylesBorins) - -**Myles Borins** <myles.borins@gmail.com> (he/him) -* [targos](https://github.com/targos) - -**Michaël Zasso** <targos@protonmail.com> (he/him) -* [tniessen](https://github.com/tniessen) - -**Tobias Nießen** <tniessen@tnie.de> -* [Trott](https://github.com/Trott) - -**Rich Trott** <rtrott@gmail.com> (he/him) - -### TSC Emeriti - -* [addaleax](https://github.com/addaleax) - -**Anna Henningsen** <anna@addaleax.net> (she/her) -* [bnoordhuis](https://github.com/bnoordhuis) - -**Ben Noordhuis** <info@bnoordhuis.nl> -* [chrisdickinson](https://github.com/chrisdickinson) - -**Chris Dickinson** <christopher.s.dickinson@gmail.com> -* [evanlucas](https://github.com/evanlucas) - -**Evan Lucas** <evanlucas@me.com> (he/him) -* [Fishrock123](https://github.com/Fishrock123) - -**Jeremiah Senkpiel** <fishrock123@rocketmail.com> (he/they) -* [gibfahn](https://github.com/gibfahn) - -**Gibson Fahnestock** <gibfahn@gmail.com> (he/him) -* [indutny](https://github.com/indutny) - -**Fedor Indutny** <fedor.indutny@gmail.com> -* [isaacs](https://github.com/isaacs) - -**Isaac Z. Schlueter** <i@izs.me> -* [joshgav](https://github.com/joshgav) - -**Josh Gavant** <josh.gavant@outlook.com> -* [mscdex](https://github.com/mscdex) - -**Brian White** <mscdex@mscdex.net> -* [nebrius](https://github.com/nebrius) - -**Bryan Hughes** <bryan@nebri.us> -* [ofrobots](https://github.com/ofrobots) - -**Ali Ijaz Sheikh** <ofrobots@google.com> (he/him) -* [orangemocha](https://github.com/orangemocha) - -**Alexis Campailla** <orangemocha@nodejs.org> -* [piscisaureus](https://github.com/piscisaureus) - -**Bert Belder** <bertbelder@gmail.com> -* [rvagg](https://github.com/rvagg) - -**Rod Vagg** <r@va.gg> -* [sam-github](https://github.com/sam-github) - -**Sam Roberts** <vieuxtech@gmail.com> -* [shigeki](https://github.com/shigeki) - -**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) -* [thefourtheye](https://github.com/thefourtheye) - -**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) -* [TimothyGu](https://github.com/TimothyGu) - -**Tiancheng "Timothy" Gu** <timothygu99@gmail.com> (he/him) -* [trevnorris](https://github.com/trevnorris) - -**Trevor Norris** <trev.norris@gmail.com> - -### Collaborators - -* [addaleax](https://github.com/addaleax) - -**Anna Henningsen** <anna@addaleax.net> (she/her) -* [ak239](https://github.com/ak239) - -**Aleksei Koziatinskii** <ak239spb@gmail.com> -* [AndreasMadsen](https://github.com/AndreasMadsen) - -**Andreas Madsen** <amwebdk@gmail.com> (he/him) -* [antsmartian](https://github.com/antsmartian) - -**Anto Aravinth** <anto.aravinth.cse@gmail.com> (he/him) -* [apapirovski](https://github.com/apapirovski) - -**Anatoli Papirovski** <apapirovski@mac.com> (he/him) -* [AshCripps](https://github.com/AshCripps) - -**Ash Cripps** <acripps@redhat.com> -* [bcoe](https://github.com/bcoe) - -**Ben Coe** <bencoe@gmail.com> (he/him) -* [bengl](https://github.com/bengl) - -**Bryan English** <bryan@bryanenglish.com> (he/him) -* [benjamingr](https://github.com/benjamingr) - -**Benjamin Gruenbaum** <benjamingr@gmail.com> -* [BethGriggs](https://github.com/BethGriggs) - -**Beth Griggs** <Bethany.Griggs@uk.ibm.com> (she/her) -* [bmeck](https://github.com/bmeck) - -**Bradley Farias** <bradley.meck@gmail.com> -* [bmeurer](https://github.com/bmeurer) - -**Benedikt Meurer** <benedikt.meurer@gmail.com> -* [bnoordhuis](https://github.com/bnoordhuis) - -**Ben Noordhuis** <info@bnoordhuis.nl> -* [boneskull](https://github.com/boneskull) - -**Christopher Hiller** <boneskull@boneskull.com> (he/him) -* [BridgeAR](https://github.com/BridgeAR) - -**Ruben Bridgewater** <ruben@bridgewater.de> (he/him) -* [bzoz](https://github.com/bzoz) - -**Bartosz Sosnowski** <bartosz@janeasystems.com> -* [cclauss](https://github.com/cclauss) - -**Christian Clauss** <cclauss@me.com> (he/him) -* [ChALkeR](https://github.com/ChALkeR) - -**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) -* [cjihrig](https://github.com/cjihrig) - -**Colin Ihrig** <cjihrig@gmail.com> (he/him) -* [codebytere](https://github.com/codebytere) - -**Shelley Vohr** <codebytere@gmail.com> (she/her) -* [danbev](https://github.com/danbev) - -**Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) -* [danielleadams](https://github.com/danielleadams) - -**Danielle Adams** <adamzdanielle@gmail.com> (she/her) -* [davisjam](https://github.com/davisjam) - -**Jamie Davis** <davisjam@vt.edu> (he/him) -* [DerekNonGeneric](https://github.com/DerekNonGeneric) - -**Derek Lewis** <DerekNonGeneric@inf.is> (he/him) -* [devnexen](https://github.com/devnexen) - -**David Carlier** <devnexen@gmail.com> -* [devsnek](https://github.com/devsnek) - -**Gus Caplan** <me@gus.host> (they/them) -* [edsadr](https://github.com/edsadr) - -**Adrian Estrada** <edsadr@gmail.com> (he/him) -* [eugeneo](https://github.com/eugeneo) - -**Eugene Ostroukhov** <eostroukhov@google.com> -* [evanlucas](https://github.com/evanlucas) - -**Evan Lucas** <evanlucas@me.com> (he/him) -* [fhinkel](https://github.com/fhinkel) - -**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) -* [Fishrock123](https://github.com/Fishrock123) - -**Jeremiah Senkpiel** <fishrock123@rocketmail.com> (he/they) -* [Flarna](https://github.com/Flarna) - -**Gerhard Stöbich** <deb2001-github@yahoo.de> (he/they) -* [gabrielschulhof](https://github.com/gabrielschulhof) - -**Gabriel Schulhof** <gabriel.schulhof@intel.com> -* [gdams](https://github.com/gdams) - -**George Adams** <george.adams@uk.ibm.com> (he/him) -* [geek](https://github.com/geek) - -**Wyatt Preul** <wpreul@gmail.com> -* [gengjiawen](https://github.com/gengjiawen) - -**Jiawen Geng** <technicalcute@gmail.com> -* [GeoffreyBooth](https://github.com/geoffreybooth) - -**Geoffrey Booth** <webmaster@geoffreybooth.com> (he/him) -* [gireeshpunathil](https://github.com/gireeshpunathil) - -**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) -* [guybedford](https://github.com/guybedford) - -**Guy Bedford** <guybedford@gmail.com> (he/him) -* [HarshithaKP](https://github.com/HarshithaKP) - -**Harshitha K P** <harshitha014@gmail.com> (she/her) -* [hashseed](https://github.com/hashseed) - -**Yang Guo** <yangguo@chromium.org> (he/him) -* [himself65](https://github.com/himself65) - -**Zeyu Yang** <himself65@outlook.com> (he/him) -* [hiroppy](https://github.com/hiroppy) - -**Yuta Hiroto** <hello@hiroppy.me> (he/him) -* [indutny](https://github.com/indutny) - -**Fedor Indutny** <fedor.indutny@gmail.com> -* [JacksonTian](https://github.com/JacksonTian) - -**Jackson Tian** <shyvo1987@gmail.com> -* [jasnell](https://github.com/jasnell) - -**James M Snell** <jasnell@gmail.com> (he/him) -* [jdalton](https://github.com/jdalton) - -**John-David Dalton** <john.david.dalton@gmail.com> -* [jkrems](https://github.com/jkrems) - -**Jan Krems** <jan.krems@gmail.com> (he/him) -* [joaocgreis](https://github.com/joaocgreis) - -**João Reis** <reis@janeasystems.com> -* [joyeecheung](https://github.com/joyeecheung) - -**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) -* [juanarbol](https://github.com/juanarbol) - -**Juan José Arboleda** <soyjuanarbol@gmail.com> (he/him) -* [JungMinu](https://github.com/JungMinu) - -**Minwoo Jung** <nodecorelab@gmail.com> (he/him) -* [lance](https://github.com/lance) - -**Lance Ball** <lball@redhat.com> (he/him) -* [legendecas](https://github.com/legendecas) - -**Chengzhong Wu** <legendecas@gmail.com> (he/him) -* [Leko](https://github.com/Leko) - -**Shingo Inoue** <leko.noor@gmail.com> (he/him) -* [lpinca](https://github.com/lpinca) - -**Luigi Pinca** <luigipinca@gmail.com> (he/him) -* [lundibundi](https://github.com/lundibundi) - -**Denys Otrishko** <shishugi@gmail.com> (he/him) -* [mafintosh](https://github.com/mafintosh) - -**Mathias Buus** <mathiasbuus@gmail.com> (he/him) -* [mcollina](https://github.com/mcollina) - -**Matteo Collina** <matteo.collina@gmail.com> (he/him) -* [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <midawson@redhat.com> (he/him) -* [mildsunrise](https://github.com/mildsunrise) - -**Alba Mendez** <me@alba.sh> (she/her) -* [misterdjules](https://github.com/misterdjules) - -**Julien Gilli** <jgilli@nodejs.org> -* [mmarchini](https://github.com/mmarchini) - -**Mary Marchini** <oss@mmarchini.me> (she/her) -* [mscdex](https://github.com/mscdex) - -**Brian White** <mscdex@mscdex.net> -* [MylesBorins](https://github.com/MylesBorins) - -**Myles Borins** <myles.borins@gmail.com> (he/him) -* [ofrobots](https://github.com/ofrobots) - -**Ali Ijaz Sheikh** <ofrobots@google.com> (he/him) -* [oyyd](https://github.com/oyyd) - -**Ouyang Yadong** <oyydoibh@gmail.com> (he/him) -* [psmarshall](https://github.com/psmarshall) - -**Peter Marshall** <petermarshall@chromium.org> (he/him) -* [puzpuzpuz](https://github.com/puzpuzpuz) - -**Andrey Pechkurov** <apechkurov@gmail.com> (he/him) -* [Qard](https://github.com/Qard) - -**Stephen Belanger** <admin@stephenbelanger.com> (he/him) -* [refack](https://github.com/refack) - -**Refael Ackermann (רפאל פלחי)** <refack@gmail.com> (he/him/הוא/אתה) -* [rexagod](https://github.com/rexagod) - -**Pranshu Srivastava** <rexagod@gmail.com> (he/him) -* [richardlau](https://github.com/richardlau) - -**Richard Lau** <riclau@uk.ibm.com> -* [rickyes](https://github.com/rickyes) - -**Ricky Zhou** <0x19951125@gmail.com> (he/him) -* [ronag](https://github.com/ronag) - -**Robert Nagy** <ronagy@icloud.com> -* [ronkorving](https://github.com/ronkorving) - -**Ron Korving** <ron@ronkorving.nl> -* [rubys](https://github.com/rubys) - -**Sam Ruby** <rubys@intertwingly.net> -* [ruyadorno](https://github.com/ruyadorno) - -**Ruy Adorno** <ruyadorno@github.com> (he/him) -* [rvagg](https://github.com/rvagg) - -**Rod Vagg** <rod@vagg.org> -* [ryzokuken](https://github.com/ryzokuken) - -**Ujjwal Sharma** <ryzokuken@disroot.org> (he/him) -* [saghul](https://github.com/saghul) - -**Saúl Ibarra Corretgé** <saghul@gmail.com> -* [santigimeno](https://github.com/santigimeno) - -**Santiago Gimeno** <santiago.gimeno@gmail.com> -* [seishun](https://github.com/seishun) - -**Nikolai Vavilov** <vvnicholas@gmail.com> -* [shigeki](https://github.com/shigeki) - -**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) -* [shisama](https://github.com/shisama) - -**Masashi Hirano** <shisama07@gmail.com> (he/him) -* [silverwind](https://github.com/silverwind) - -**Roman Reiss** <me@silverwind.io> -* [srl295](https://github.com/srl295) - -**Steven R Loomis** <srloomis@us.ibm.com> -* [starkwang](https://github.com/starkwang) - -**Weijia Wang** <starkwang@126.com> -* [sxa](https://github.com/sxa) - -**Stewart X Addison** <sxa@uk.ibm.com> -* [targos](https://github.com/targos) - -**Michaël Zasso** <targos@protonmail.com> (he/him) -* [TimothyGu](https://github.com/TimothyGu) - -**Tiancheng "Timothy" Gu** <timothygu99@gmail.com> (he/him) -* [tniessen](https://github.com/tniessen) - -**Tobias Nießen** <tniessen@tnie.de> -* [trivikr](https://github.com/trivikr) - -**Trivikram Kamat** <trivikr.dev@gmail.com> -* [Trott](https://github.com/Trott) - -**Rich Trott** <rtrott@gmail.com> (he/him) -* [vdeturckheim](https://github.com/vdeturckheim) - -**Vladimir de Turckheim** <vlad2t@hotmail.com> (he/him) -* [watilde](https://github.com/watilde) - -**Daijiro Wachi** <daijiro.wachi@gmail.com> (he/him) -* [watson](https://github.com/watson) - -**Thomas Watson** <w@tson.dk> -* [XadillaX](https://github.com/XadillaX) - -**Khaidi Chu** <i@2333.moe> (he/him) -* [yhwang](https://github.com/yhwang) - -**Yihong Wang** <yh.wang@ibm.com> -* [yorkie](https://github.com/yorkie) - -**Yorkie Liu** <yorkiefixer@gmail.com> -* [yosuke-furukawa](https://github.com/yosuke-furukawa) - -**Yosuke Furukawa** <yosuke.furukawa@gmail.com> -* [ZYSzys](https://github.com/ZYSzys) - -**Yongsheng Zhang** <zyszys98@gmail.com> (he/him) - -### Collaborator Emeriti - -* [andrasq](https://github.com/andrasq) - -**Andras** <andras@kinvey.com> -* [AnnaMag](https://github.com/AnnaMag) - -**Anna M. Kedzierska** <anna.m.kedzierska@gmail.com> -* [aqrln](https://github.com/aqrln) - -**Alexey Orlenko** <eaglexrlnk@gmail.com> (he/him) -* [brendanashworth](https://github.com/brendanashworth) - -**Brendan Ashworth** <brendan.ashworth@me.com> -* [calvinmetcalf](https://github.com/calvinmetcalf) - -**Calvin Metcalf** <calvin.metcalf@gmail.com> -* [chrisdickinson](https://github.com/chrisdickinson) - -**Chris Dickinson** <christopher.s.dickinson@gmail.com> -* [claudiorodriguez](https://github.com/claudiorodriguez) - -**Claudio Rodriguez** <cjrodr@yahoo.com> -* [DavidCai1993](https://github.com/DavidCai1993) - -**David Cai** <davidcai1993@yahoo.com> (he/him) -* [digitalinfinity](https://github.com/digitalinfinity) - -**Hitesh Kanwathirtha** <digitalinfinity@gmail.com> (he/him) -* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) - -**Robert Jefe Lindstaedt** <robert.lindstaedt@gmail.com> -* [estliberitas](https://github.com/estliberitas) - -**Alexander Makarenko** <estliberitas@gmail.com> -* [firedfox](https://github.com/firedfox) - -**Daniel Wang** <wangyang0123@gmail.com> -* [gibfahn](https://github.com/gibfahn) - -**Gibson Fahnestock** <gibfahn@gmail.com> (he/him) -* [glentiki](https://github.com/glentiki) - -**Glen Keane** <glenkeane.94@gmail.com> (he/him) -* [iarna](https://github.com/iarna) - -**Rebecca Turner** <me@re-becca.org> -* [imran-iq](https://github.com/imran-iq) - -**Imran Iqbal** <imran@imraniqbal.org> -* [imyller](https://github.com/imyller) - -**Ilkka Myller** <ilkka.myller@nodefield.com> -* [isaacs](https://github.com/isaacs) - -**Isaac Z. Schlueter** <i@izs.me> -* [italoacasas](https://github.com/italoacasas) - -**Italo A. Casas** <me@italoacasas.com> (he/him) -* [jasongin](https://github.com/jasongin) - -**Jason Ginchereau** <jasongin@microsoft.com> -* [jbergstroem](https://github.com/jbergstroem) - -**Johan Bergström** <bugs@bergstroem.nu> -* [jhamhader](https://github.com/jhamhader) - -**Yuval Brik** <yuval@brik.org.il> -* [joshgav](https://github.com/joshgav) - -**Josh Gavant** <josh.gavant@outlook.com> -* [julianduque](https://github.com/julianduque) - -**Julian Duque** <julianduquej@gmail.com> (he/him) -* [kfarnung](https://github.com/kfarnung) - -**Kyle Farnung** <kfarnung@microsoft.com> (he/him) -* [kunalspathak](https://github.com/kunalspathak) - -**Kunal Pathak** <kunal.pathak@microsoft.com> -* [lucamaraschi](https://github.com/lucamaraschi) - -**Luca Maraschi** <luca.maraschi@gmail.com> (he/him) -* [lxe](https://github.com/lxe) - -**Aleksey Smolenchuk** <lxe@lxe.co> -* [maclover7](https://github.com/maclover7) - -**Jon Moss** <me@jonathanmoss.me> (he/him) -* [matthewloring](https://github.com/matthewloring) - -**Matthew Loring** <mattloring@google.com> -* [micnic](https://github.com/micnic) - -**Nicu Micleușanu** <micnic90@gmail.com> (he/him) -* [mikeal](https://github.com/mikeal) - -**Mikeal Rogers** <mikeal.rogers@gmail.com> -* [monsanto](https://github.com/monsanto) - -**Christopher Monsanto** <chris@monsan.to> -* [MoonBall](https://github.com/MoonBall) - -**Chen Gang** <gangc.cxy@foxmail.com> -* [not-an-aardvark](https://github.com/not-an-aardvark) - -**Teddy Katz** <teddy.katz@gmail.com> (he/him) -* [Olegas](https://github.com/Olegas) - -**Oleg Elifantiev** <oleg@elifantiev.ru> -* [orangemocha](https://github.com/orangemocha) - -**Alexis Campailla** <orangemocha@nodejs.org> -* [othiym23](https://github.com/othiym23) - -**Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) -* [petkaantonov](https://github.com/petkaantonov) - -**Petka Antonov** <petka_antonov@hotmail.com> -* [phillipj](https://github.com/phillipj) - -**Phillip Johnsen** <johphi@gmail.com> -* [piscisaureus](https://github.com/piscisaureus) - -**Bert Belder** <bertbelder@gmail.com> -* [pmq20](https://github.com/pmq20) - -**Minqi Pan** <pmq2001@gmail.com> -* [princejwesley](https://github.com/princejwesley) - -**Prince John Wesley** <princejohnwesley@gmail.com> -* [rlidwka](https://github.com/rlidwka) - -**Alex Kocharin** <alex@kocharin.ru> -* [rmg](https://github.com/rmg) - -**Ryan Graham** <r.m.graham@gmail.com> -* [robertkowalski](https://github.com/robertkowalski) - -**Robert Kowalski** <rok@kowalski.gd> -* [romankl](https://github.com/romankl) - -**Roman Klauke** <romaaan.git@gmail.com> -* [RReverser](https://github.com/RReverser) - -**Ingvar Stepanyan** <me@rreverser.com> -* [sam-github](https://github.com/sam-github) - -**Sam Roberts** <vieuxtech@gmail.com> -* [sebdeckers](https://github.com/sebdeckers) - -**Sebastiaan Deckers** <sebdeckers83@gmail.com> -* [stefanmb](https://github.com/stefanmb) - -**Stefan Budeanu** <stefan@budeanu.com> -* [tellnes](https://github.com/tellnes) - -**Christian Tellnes** <christian@tellnes.no> -* [thefourtheye](https://github.com/thefourtheye) - -**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) -* [thlorenz](https://github.com/thlorenz) - -**Thorsten Lorenz** <thlorenz@gmx.de> -* [trevnorris](https://github.com/trevnorris) - -**Trevor Norris** <trev.norris@gmail.com> -* [tunniclm](https://github.com/tunniclm) - -**Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> -* [vkurchatkin](https://github.com/vkurchatkin) - -**Vladimir Kurchatkin** <vladimir.kurchatkin@gmail.com> -* [vsemozhetbyt](https://github.com/vsemozhetbyt) - -**Vse Mozhet Byt** <vsemozhetbyt@gmail.com> (he/him) -* [whitlockjc](https://github.com/whitlockjc) - -**Jeremy Whitlock** <jwhitlock@apache.org> - - -Collaborators follow the [Collaborator Guide](./doc/guides/collaborator-guide.md) in -maintaining the Node.js project. - -### Release Keys - -Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys): - -* **Beth Griggs** <bethany.griggs@uk.ibm.com> -`4ED778F539E3634C779C87C6D7062848A1AB005C` -* **Colin Ihrig** <cjihrig@gmail.com> -`94AE36675C464D64BAFA68DD7434390BDBE9B9C5` -* **James M Snell** <jasnell@keybase.io> -`71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` -* **Michaël Zasso** <targos@protonmail.com> -`8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600` -* **Myles Borins** <myles.borins@gmail.com> -`C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8` -* **Richard Lau** <riclau@uk.ibm.com> -`C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C` -* **Rod Vagg** <rod@vagg.org> -`DD8F2338BAE7501E3DD5AC78C273792F7D83545D` -* **Ruben Bridgewater** <ruben@bridgewater.de> -`A48C2BEE680E841632CD4E44F07496B3EB3C1762` -* **Ruy Adorno** <ruyadorno@hotmail.com> -`108F52B48DB57BB0CC439B2997B01419BD92F80A` -* **Shelley Vohr** <shelley.vohr@gmail.com> -`B9E2F5981AA6E0CD28160D9FF13993A75599653C` - -To import the full set of trusted release keys: - -```bash -gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C -gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 -gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 -gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 -gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 -gpg --keyserver pool.sks-keyservers.net --recv-keys C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C -gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D -gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762 -gpg --keyserver pool.sks-keyservers.net --recv-keys 108F52B48DB57BB0CC439B2997B01419BD92F80A -gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C +Start the build phase: +```sh +make ``` -See the section above on [Verifying Binaries](#verifying-binaries) for how to -use these keys to verify a downloaded file. - -Other keys used to sign some previous releases: - -* **Chris Dickinson** <christopher.s.dickinson@gmail.com> -`9554F04D7259F04124DE6B476D5A82AC7E37093B` -* **Evan Lucas** <evanlucas@me.com> -`B9AE9905FFD7803F25714661B63B535A4C206CA9` -* **Gibson Fahnestock** <gibfahn@gmail.com> -`77984A986EBC2AA786BC0F66B01FBB92821C587A` -* **Isaac Z. Schlueter** <i@izs.me> -`93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` -* **Italo A. Casas** <me@italoacasas.com> -`56730D5401028683275BD23C23EFEFE93C4CFFFE` -* **Jeremiah Senkpiel** <fishrock@keybase.io> -`FD3A5288F042B6850C66B31F09FE44734EB7990E` -* **Julien Gilli** <jgilli@fastmail.fm> -`114F43EE0176B71C7BC219DD50A3051F888C628D` -* **Timothy J Fontaine** <tjfontaine@gmail.com> -`7937DFD2AB06298B2293C3187D33FF9D0246406D` - -[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md -[Contributing to the project]: CONTRIBUTING.md -[Node.js Website]: https://nodejs.org/ -[OpenJS Foundation]: https://openjsf.org/ -[Strategic Initiatives]: https://github.com/nodejs/TSC/blob/master/Strategic-Initiatives.md -[Technical values and prioritization]: doc/guides/technical-values.md -[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md +This will create the Android `armeabi-v7a` shared library in `out/Release/lib.target/libnode.so`. + +### Prerequisites to build the iOS .framework library on macOS: + +#### Xcode 11 with Command Line Tools + +Install Xcode 11 or higher, from the App Store, and then install the Command Line Tools by running the following command: + +```sh +xcode-select --install +``` + +That installs `git`, as well. + +#### CMake + +To install `CMake`, you can use a package installer like [Homebrew](https://brew.sh/). + +First, install `HomeBrew`, if you don't have it already. + +```sh +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +Then, use it to install `CMake`: + +```sh +brew install cmake +``` + +### Building the iOS library using CocoaPods: + +Add this to your `Podfile`: + +```ruby +pod 'NodeMobile', :git => 'https://github.com/janeasystems/nodejs-mobile.git' +``` + +### Building the iOS .framework library on macOS: + +#### 1) Clone this repo and check out the `mobile-master` branch: + +```sh +git clone https://github.com/janeasystems/nodejs-mobile +cd nodejs-mobile +git checkout mobile-master +``` + +#### 2) Run the helper script: + +```sh +./tools/ios_framework_prepare.sh +``` + +That will configure `gyp` to build Node.js and its dependencies as static libraries for iOS on the arm64 and x64 architectures, using the `v8` engine configured to start with JIT disabled. The script copies those libraries to `tools/ios-framework/bin/arm64` and `tools/ios-framework/bin/x64`, respectively. It also merges them into static libraries that contain strips for both architectures, which will be placed in `tools/ios-framework/bin` and used by the `tools/ios-framework/NodeMobile.xcodeproj` Xcode project. + +The helper script builds the `tools/ios-framework/NodeMobile.xcodeproj` Xcode project into three frameworks: + - The framework to run on iOS devices: `out_ios/Release-iphoneos/NodeMobile.framework` + - The framework to run on the iOS simulator: `out_ios/Release-iphonesimulator/NodeMobile.framework` + - The universal framework, that runs on iOS devices and simulators: `out_ios/Release-universal/NodeMobile.framework` + +While the universal framework is useful for faster Application development, due to supporting both iOS devices and simulators, frameworks containing simulator strips will not be accepted on the App Store. Before trying to submit your application, it would be advisable to use the `Release-iphoneos/NodeMobile.framework` in your submission archive or strip the x64 slices from the universal framework's binaries before submitting. + +## Running tests +Please see the [TESTING.md](./doc_mobile/TESTING.md) file in the `doc_mobile` folder in this source distribution. + +## Contributing +Please see the [CONTRIBUTING](./doc_mobile/CONTRIBUTING.md) file in the `doc_mobile` folder in this source distribution. diff --git a/android-configure b/android-configure index a7cb2b9c8b4..fe054813ac1 100755 --- a/android-configure +++ b/android-configure @@ -8,39 +8,38 @@ # modules with npm. Also, don't forget to set the arch in npm config using # 'npm config set arch=' -if [ $# -ne 3 ]; then - echo "$0 should have 3 parameters: ndk_path, target_arch and sdk_version" - exit 1 -fi - -NDK_PATH=$1 -ARCH="$2" -ANDROID_SDK_VERSION=$3 -if [ $ANDROID_SDK_VERSION -lt 23 ]; then - echo "$ANDROID_SDK_VERSION should equal or later than 23(Android 6.0)" +if [ -z "$2" ]; then + ARCH=arm +else + ARCH="$2" fi CC_VER="4.9" - case $ARCH in arm) - DEST_CPU="arm" - TOOLCHAIN_NAME="armv7-linux-androideabi" + DEST_CPU="$ARCH" + V8_ARCH="$ARCH" + SUFFIX="$ARCH-linux-androideabi" + TOOLCHAIN_NAME="$SUFFIX" ;; x86) DEST_CPU="ia32" - TOOLCHAIN_NAME="i686-linux-android" + V8_ARCH="ia32" + SUFFIX="i686-linux-android" + TOOLCHAIN_NAME="$ARCH" ;; x86_64) DEST_CPU="x64" - TOOLCHAIN_NAME="x86_64-linux-android" - ARCH="x64" + V8_ARCH="x64" + SUFFIX="$ARCH-linux-android" + TOOLCHAIN_NAME="$ARCH" ;; - arm64|aarch64) + arm64) DEST_CPU="arm64" - TOOLCHAIN_NAME="aarch64-linux-android" - ARCH="arm64" + V8_ARCH="arm64" + SUFFIX="aarch64-linux-android" + TOOLCHAIN_NAME="aarch64" ;; *) echo "Unsupported architecture provided: $ARCH" @@ -48,38 +47,52 @@ case $ARCH in ;; esac -HOST_OS="linux" -HOST_ARCH="x86_64" -export CC_host=$(which gcc) -export CXX_host=$(which g++) +NDK_PATH=$1 +function make_toolchain { + $NDK_PATH/build/tools/make-standalone-toolchain.sh \ + --toolchain=$TOOLCHAIN_NAME-$CC_VER \ + --arch=$ARCH \ + --install-dir=$TOOLCHAIN \ + --stl=libc++ \ + --force \ + --platform=android-21 +} -host_gcc_version=$($CC_host --version | grep gcc | awk '{print $NF}') -major=$(echo $host_gcc_version | awk -F . '{print $1}') -minor=$(echo $host_gcc_version | awk -F . '{print $2}') -if [ -z $major ] || [ -z $minor ] || [ $major -lt 6 ] || [ $major -eq 6 -a $minor -lt 3 ]; then - echo "host gcc $host_gcc_version is too old, need gcc 6.3.0" - exit 1 +export TOOLCHAIN=$PWD/android-toolchain +if [ -d "$TOOLCHAIN" ]; then + read -r -p "NDK toolchain already exists. Replace it? [y/N]" response + case "$response" in + [Yy]) + rm -rf "$TOOLCHAIN" + make_toolchain + esac +else + make_toolchain fi -SUFFIX="$TOOLCHAIN_NAME$ANDROID_SDK_VERSION" -TOOLCHAIN=$NDK_PATH/toolchains/llvm/prebuilt/$HOST_OS-$HOST_ARCH - -export PATH=$TOOLCHAIN/bin:$PATH -export CC=$TOOLCHAIN/bin/$SUFFIX-clang -export CXX=$TOOLCHAIN/bin/$SUFFIX-clang++ - +export AR_host="$(which ar)" +export AR=$TOOLCHAIN/bin/$SUFFIX-ar +export AR_target=$TOOLCHAIN/bin/$SUFFIX-ar +export CC_target=$TOOLCHAIN/bin/$SUFFIX-gcc +export CXX_target=$TOOLCHAIN/bin/$SUFFIX-g++ +export LINK_target=$TOOLCHAIN/bin/$SUFFIX-g++ GYP_DEFINES="target_arch=$ARCH" -GYP_DEFINES+=" v8_target_arch=$ARCH" +GYP_DEFINES+=" v8_target_arch=$V8_ARCH" GYP_DEFINES+=" android_target_arch=$ARCH" -GYP_DEFINES+=" host_os=$HOST_OS OS=android" +if [ "$(uname -s)" == "Darwin" ]; then + GYP_DEFINES+=" host_os=mac target_os=android" +else + GYP_DEFINES+=" host_os=linux target_os=android" +fi export GYP_DEFINES if [ -f "configure" ]; then ./configure \ --dest-cpu=$DEST_CPU \ --dest-os=android \ - --without-snapshot \ --openssl-no-asm \ - --cross-compiling + --with-intl=none \ + --cross-compiling \ + --shared fi diff --git a/common.gypi b/common.gypi index b0ff365b7fd..84be79f945c 100644 --- a/common.gypi +++ b/common.gypi @@ -103,7 +103,7 @@ 'obj_dir': '<(PRODUCT_DIR)/obj', 'v8_base': '<(PRODUCT_DIR)/lib/libv8_snapshot.a', }], - ['OS == "mac"', { + ['OS == "mac" or OS == "ios"', { 'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a', }], @@ -121,7 +121,7 @@ 'obj_dir': '<(PRODUCT_DIR)/obj', 'v8_base': '<(PRODUCT_DIR)/lib/libv8_nosnapshot.a', }], - ['OS == "mac"', { + ['OS == "mac" or OS == "ios"', { 'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'v8_base': '<(PRODUCT_DIR)/libv8_nosnapshot.a', }], @@ -132,7 +132,7 @@ }, { 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)', }], - ['OS=="mac"', { + ['OS=="mac" or OS == "ios"', { 'clang%': 1, }], ['target_arch in "ppc64 s390x"', { @@ -203,7 +203,7 @@ # pull in V8's postmortem metadata 'ldflags': [ '-Wl,-z,allextract' ] }], - ['OS!="mac" and OS!="win"', { + ['OS!="mac" and OS!="ios" and OS!="win"', { 'cflags': [ '-fno-omit-frame-pointer' ], }], ['OS=="linux"', { @@ -317,7 +317,7 @@ [ 'target_arch=="arm64"', { 'msvs_configuration_platform': 'arm64', }], - ['asan == 1 and OS != "mac"', { + ['asan == 1 and OS != "mac" and OS !="ios"', { 'cflags+': [ '-fno-omit-frame-pointer', '-fsanitize=address', @@ -327,7 +327,7 @@ 'cflags!': [ '-fomit-frame-pointer' ], 'ldflags': [ '-fsanitize=address' ], }], - ['asan == 1 and OS == "mac"', { + ['asan == 1 and (OS == "mac" or OS=="ios")', { 'xcode_settings': { 'OTHER_CFLAGS+': [ '-fno-omit-frame-pointer', @@ -454,9 +454,26 @@ 'defines': [ '_GLIBCXX_USE_C99_MATH' ], 'libraries': [ '-llog' ], }], - ['_toolset=="host"', { - 'cflags': [ '-pthread' ], - 'ldflags': [ '-pthread' ], + ['_type=="loadable_module"', { + 'conditions': [ + # While loading a native node module, Android needs to have a + # (NEEDED) entry for libnode.so, or it won't be able to locate + # referenced symbols. + # We link to the binary libraries that are distributed with the + # nodejs-mobile headers so the (NEEDED) entry is created + [ 'target_arch=="arm"', { + 'libraries': ['>(node_root_dir)/bin/armeabi-v7a/libnode.so'], + }], + [ 'target_arch=="arm64"', { + 'libraries': ['>(node_root_dir)/bin/arm64-v8a/libnode.so'], + }], + [ 'target_arch=="x86"', { + 'libraries': ['>(node_root_dir)/bin/x86/libnode.so'], + }], + [ 'target_arch=="x86_64"', { + 'libraries': ['>(node_root_dir)/bin/x86_64/libnode.so'], + }], + ], }], ], }], @@ -517,6 +534,79 @@ }], ], }], + ['OS=="ios"', { + 'defines': ['_DARWIN_USE_64_BIT_INODE=1'], + 'xcode_settings': { + 'ALWAYS_SEARCH_USER_PATHS': 'NO', + 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks + 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic + # (Equivalent to -fPIC) + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions + 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti + 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings + 'PREBINDING': 'NO', # No -Wl,-prebind + 'IPHONEOS_DEPLOYMENT_TARGET': '9.0', # -miphoneos-version-min=9.0 + 'USE_HEADERMAP': 'NO', + 'OTHER_CFLAGS': [ + '-fno-strict-aliasing', + ], + 'WARNING_CFLAGS': [ + '-Wall', + '-Wendif-labels', + '-W', + '-Wno-unused-parameter', + ], + }, + 'target_conditions': [ + ['_type!="static_library"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-no_pie', + '-Wl,-search_paths_first', + ], + }, + }], + ], + 'conditions': [ + ['target_arch=="ia32"', { + 'xcode_settings': {'ARCHS': ['i386']}, + }], + ['target_arch=="x64"', { + 'xcode_settings': {'ARCHS': ['x86_64']}, + }], + [ 'target_arch in "arm64 arm armv7s"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-fembed-bitcode' + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '-fembed-bitcode' + ], + } + }], + [ 'target_arch=="arm64"', { + 'xcode_settings': {'ARCHS': ['arm64']}, + }], + [ 'target_arch=="arm"', { + 'xcode_settings': {'ARCHS': ['armv7']}, + }], + [ 'target_arch=="armv7s"', { + 'xcode_settings': {'ARCHS': ['armv7s']}, + }], + ['clang==1', { + 'xcode_settings': { + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++1y', # -std=gnu++1y + 'CLANG_CXX_LIBRARY': 'libc++', + }, + }], + ['target_arch=="x64" or target_arch=="ia32"', { + 'xcode_settings': { 'SDKROOT': 'iphonesimulator' }, + }, { + 'xcode_settings': { 'SDKROOT': 'iphoneos', 'ENABLE_BITCODE': 'YES' }, + }], + ], + }], ['OS=="freebsd" and node_use_dtrace=="true"', { 'libraries': [ '-lelf' ], }], diff --git a/configure.py b/configure.py index e6485a7b383..c9bc1e228b7 100755 --- a/configure.py +++ b/configure.py @@ -47,7 +47,7 @@ parser = optparse.OptionParser() valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', - 'android', 'aix', 'cloudabi') + 'android', 'aix', 'cloudabi', 'ios') valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', 'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x') valid_arm_float_abi = ('soft', 'softfp', 'hard') @@ -1032,6 +1032,8 @@ def gcc_version_ge(version_checked): def configure_node(o): + if options.dest_os == 'ios': + o['variables']['OS'] = 'ios' if options.dest_os == 'android': o['variables']['OS'] = 'android' o['variables']['node_prefix'] = options.prefix @@ -1057,7 +1059,7 @@ def configure_node(o): else target_arch != host_arch) want_snapshots = not options.without_snapshot o['variables']['want_separate_host_toolset'] = int( - cross_compiling and want_snapshots) + cross_compiling) if options.without_node_snapshot or options.node_builtin_modules_path: o['variables']['node_use_node_snapshot'] = 'false' diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp index 02b2774c026..c0687c6215c 100644 --- a/deps/cares/cares.gyp +++ b/deps/cares/cares.gyp @@ -153,7 +153,7 @@ 'include_dirs': [ 'config/linux' ], 'sources': [ 'config/linux/ares_config.h' ] }], - [ 'OS=="mac"', { + [ 'OS=="mac" or OS=="ios"', { 'include_dirs': [ 'config/darwin' ], 'sources': [ 'config/darwin/ares_config.h' ] }], diff --git a/deps/cares/config/android/ares_config.h b/deps/cares/config/android/ares_config.h index 50c8114396b..6d7cb4cc51c 100644 --- a/deps/cares/config/android/ares_config.h +++ b/deps/cares/config/android/ares_config.h @@ -128,7 +128,9 @@ #define HAVE_GETNAMEINFO 1 /* Define to 1 if you have the getservbyport_r function. */ -/* #undef HAVE_GETSERVBYPORT_R */ +#ifndef __ANDROID__ +#define HAVE_GETSERVBYPORT_R 1 +#endif /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 diff --git a/deps/openssl/config/opensslconf.h b/deps/openssl/config/opensslconf.h index 9c492032b05..f5b3b013d86 100644 --- a/deps/openssl/config/opensslconf.h +++ b/deps/openssl/config/opensslconf.h @@ -17,6 +17,13 @@ #ifndef OPENSSL_NO_HW_PADLOCK # define OPENSSL_NO_HW_PADLOCK #endif +/* iOS app store won't allow getcontext, setcontext, makecontext */ +#if defined(__APPLE__) && defined(__MACH__) +# include +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define OPENSSL_NO_ASYNC +# endif +#endif /* musl in Alpine Linux does not support getcontext etc.*/ #if defined(OPENSSL_LINUX) && !defined(__GLIBC__) && !defined(__clang__) # define OPENSSL_NO_ASYNC diff --git a/deps/openssl/openssl_no_asm.gypi b/deps/openssl/openssl_no_asm.gypi index de4820d6fe4..30a5e8439d0 100644 --- a/deps/openssl/openssl_no_asm.gypi +++ b/deps/openssl/openssl_no_asm.gypi @@ -19,7 +19,7 @@ 'includes': ['config/archs/linux-aarch64/no-asm/openssl.gypi'], }, 'target_arch=="ia32" and OS=="freebsd"', { 'includes': ['config/archs/BSD-x86/no-asm/openssl.gypi'], - }, 'target_arch=="ia32" and OS=="linux"', { + }, 'target_arch=="ia32" and OS in ("linux", "android")', { 'includes': ['config/archs/linux-elf/no-asm/openssl.gypi'], }, 'target_arch=="ia32" and OS=="mac"', { 'includes': ['config/archs/darwin-i386-cc/no-asm/openssl.gypi'], @@ -42,7 +42,7 @@ 'includes': ['config/archs/VC-WIN64A/no-asm/openssl.gypi'], }, 'target_arch=="arm64" and OS=="win"', { 'includes': ['config/archs/VC-WIN64-ARM/no-asm/openssl.gypi'], - }, 'target_arch=="x64" and OS=="linux"', { + }, 'target_arch=="x64" and OS in ("linux", "android")', { 'includes': ['config/archs/linux-x86_64/no-asm/openssl.gypi'], }, 'target_arch=="mips64el" and OS=="linux"', { 'includes': ['config/archs/linux64-mips64/no-asm/openssl.gypi'], diff --git a/deps/uv/include/uv/android-ifaddrs.h b/deps/uv/include/uv/android-ifaddrs.h index 9cd19fec129..908b84349a2 100644 --- a/deps/uv/include/uv/android-ifaddrs.h +++ b/deps/uv/include/uv/android-ifaddrs.h @@ -26,23 +26,7 @@ #ifndef _IFADDRS_H_ #define _IFADDRS_H_ -struct ifaddrs { - struct ifaddrs *ifa_next; - char *ifa_name; - unsigned int ifa_flags; - struct sockaddr *ifa_addr; - struct sockaddr *ifa_netmask; - struct sockaddr *ifa_dstaddr; - void *ifa_data; -}; - -/* - * This may have been defined in . Note that if is - * to be included it must be included before this header file. - */ -#ifndef ifa_broadaddr -#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ -#endif +#include #include diff --git a/deps/uv/src/unix/android-ifaddrs.c b/deps/uv/src/unix/android-ifaddrs.c index 4765cc06b57..5b2b8c92723 100644 --- a/deps/uv/src/unix/android-ifaddrs.c +++ b/deps/uv/src/unix/android-ifaddrs.c @@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include typedef struct NetlinkList { @@ -534,7 +535,7 @@ static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, { if(l_entry->ifa_addr) { - l_entry->ifa_dstaddr = (struct sockaddr *)l_addr; + l_entry->ifa_ifu.ifu_dstaddr = (struct sockaddr *)l_addr; } else { @@ -545,7 +546,7 @@ static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, { if(l_entry->ifa_addr) { - l_entry->ifa_dstaddr = l_entry->ifa_addr; + l_entry->ifa_ifu.ifu_dstaddr = l_entry->ifa_addr; } l_entry->ifa_addr = (struct sockaddr *)l_addr; } @@ -652,8 +653,52 @@ static int interpretAddrs(int p_socket, pid_t p_pid, NetlinkList *p_netlinkList, return 0; } +// Tries to get the system's getifaddrs if it's available. +void *_dlopen_ifaddrs_handle = NULL; +void init_dlopen_ifaddrs_handle(void) __attribute__((constructor)); +void destroy_dlopen_ifaddrs_handle(void) __attribute__((destructor)); + +void init_dlopen_ifaddrs_handle(void) +{ + _dlopen_ifaddrs_handle = dlopen("libc.so", RTLD_NOW|RTLD_LOCAL); +} + +void destroy_dlopen_ifaddrs_handle(void) +{ + if (_dlopen_ifaddrs_handle != NULL) + { + dlclose(_dlopen_ifaddrs_handle); + _dlopen_ifaddrs_handle = NULL; + } +} + +int (*get_getifaddrs_native_func(void))(struct ifaddrs **) +{ + if (!_dlopen_ifaddrs_handle) + { + return NULL; + } + return dlsym(_dlopen_ifaddrs_handle, "getifaddrs"); +} + +void (*get_freeifaddrs_native_func(void))(struct ifaddrs *) +{ + if (!_dlopen_ifaddrs_handle) + { + return NULL; + } + return dlsym(_dlopen_ifaddrs_handle, "freeifaddrs"); +} + int getifaddrs(struct ifaddrs **ifap) { + // If the native getifaddrs is available, call it. + int (*getifaddrs_native)(struct ifaddrs **) = get_getifaddrs_native_func(); + if (getifaddrs_native != NULL) + { + return getifaddrs_native(ifap); + } + int l_socket; int l_result; int l_numLinks; @@ -703,6 +748,14 @@ int getifaddrs(struct ifaddrs **ifap) void freeifaddrs(struct ifaddrs *ifa) { + // If the native freeifaddrs is available, call it. + void (*freeifaddrs_native)(struct ifaddrs *) = get_freeifaddrs_native_func(); + if (freeifaddrs_native != NULL) + { + freeifaddrs_native(ifa); + return; + } + struct ifaddrs *l_cur; while(ifa) { diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c index d0ecd452d87..70c4fa5954e 100644 --- a/deps/uv/src/unix/darwin.c +++ b/deps/uv/src/unix/darwin.c @@ -185,6 +185,7 @@ int uv_uptime(double* uptime) { return 0; } +#if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE static int uv__get_cpu_speed(uint64_t* speed) { /* IOKit */ void (*pIOObjectRelease)(io_object_t); @@ -315,6 +316,7 @@ static int uv__get_cpu_speed(uint64_t* speed) { return err; } +#endif int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), @@ -335,9 +337,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { return UV__ERR(errno); } +#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE + // You can't get cpu frequency on iOS devices. Defaults to 0. + cpuspeed = 0; +#else err = uv__get_cpu_speed(&cpuspeed); if (err < 0) return err; +#endif if (host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numcpus, (processor_info_array_t*)&info, diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index 87cb8b816ae..976f84d28ee 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -889,6 +889,8 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { off = req->off; #ifdef __linux__ +#if !defined(__ANDROID__) || (!defined(__i386__) && !defined(__arm__)) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64) +// copy_file_range needs large offsets. { static int copy_file_range_support = 1; @@ -903,6 +905,7 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { } } } +#endif #endif r = sendfile(out_fd, in_fd, &off, req->bufsml[0].len); @@ -928,7 +931,9 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { return -1; } -#elif defined(__APPLE__) || \ +#elif (defined(__APPLE__) && \ + !TARGET_OS_IPHONE \ + ) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 14d5f0c04a9..caaf3ce8830 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -874,7 +874,11 @@ static int read_times(FILE* statfile_fp, ts.irq = irq * multiplier; ci[num++].cpu_times = ts; } + +#ifndef __ANDROID__ + /* On Android, the number of cores may change during run time. */ assert(num == numcpus); +#endif return 0; } diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 7fc7e0601b9..a9a36355701 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -3,6 +3,12 @@ 'conditions': [ ['OS=="win"', { 'shared_unix_defines': [ ], + }, 'OS=="android" and target_arch in ("arm","ia32")', { + # Android on API < 24 will miss function definitions for + #_FILE_OFFSET_BITS=64 + 'shared_unix_defines': [ + '_LARGEFILE_SOURCE', + ], }, { 'shared_unix_defines': [ '_LARGEFILE_SOURCE', diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c index acc25c3dba2..37a1905d72e 100644 --- a/deps/uvwasi/src/uvwasi.c +++ b/deps/uvwasi/src/uvwasi.c @@ -1316,9 +1316,10 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, dir->nentries = UVWASI__READDIR_NUM_ENTRIES; uv_fs_req_cleanup(&req); -#ifndef _WIN32 +#if !(defined(_WIN32) || (defined(__ANDROID__) && __ANDROID_API__ < 23)) /* TODO(cjihrig): Need a Windows equivalent of this logic. */ /* Seek to the proper location in the directory. */ + /* seekdir is also not available on Android API < 23. */ if (cookie != UVWASI_DIRCOOKIE_START) seekdir(dir->dir, cookie); #endif @@ -1338,7 +1339,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, consistently across platforms. In other words, d_next should always be 8 bytes, d_ino should always be 8 bytes, d_namlen should always be 4 bytes, and d_type should always be 1 byte. */ -#ifndef _WIN32 +#if !(defined(_WIN32) || (defined(__ANDROID__) && __ANDROID_API__ < 23)) tell = telldir(dir->dir); if (tell < 0) { err = uvwasi__translate_uv_error(uv_translate_sys_error(errno)); @@ -1347,6 +1348,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, } #else tell = 0; /* TODO(cjihrig): Need to support Windows. */ + /* seekdir is also not available on Android API < 23. */ #endif /* _WIN32 */ name_len = strlen(dirents[i].name); diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index c50cdd7a98e..4debb3b3e39 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -200,7 +200,7 @@ void* OS::GetRandomMmapAddr() { GetPlatformRandomNumberGenerator()->NextBytes(&raw_addr, sizeof(raw_addr)); } #if defined(__APPLE__) -#if V8_TARGET_ARCH_ARM64 +#if V8_TARGET_ARCH_ARM64 && V8_OS_IOS DCHECK_EQ(1 << 14, AllocatePageSize()); raw_addr = RoundDown(raw_addr, 1 << 14); #endif diff --git a/doc/api/os.md b/doc/api/os.md index 4bde3f6dc27..48a44dcb598 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -122,6 +122,13 @@ The properties included on each object include: `nice` values are POSIX-only. On Windows, the `nice` values of all processors are always 0. +*Note*: On iOS, CPU speed values are always 0. + +*Note*: On Android, returns undefined since Android 8.0. On earlier Android +versions the CPU values can be inconsistent, since some devices can turn CPU +cores on and off as an energy saving strategy. Properties can be returned as +zero for cores that have been turned off while getting them. + ## `os.endianness()` + + + diff --git a/tools/mobile-test/android/testnode/build.gradle b/tools/mobile-test/android/testnode/build.gradle new file mode 100644 index 00000000000..d0ddbb377b9 --- /dev/null +++ b/tools/mobile-test/android/testnode/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.2.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + google() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/tools/mobile-test/android/testnode/gradle.properties b/tools/mobile-test/android/testnode/gradle.properties new file mode 100644 index 00000000000..aac7c9b4614 --- /dev/null +++ b/tools/mobile-test/android/testnode/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.jar b/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..13372aef5e2 Binary files /dev/null and b/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.jar differ diff --git a/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.properties b/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..ba220a488b4 --- /dev/null +++ b/tools/mobile-test/android/testnode/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Nov 06 10:48:47 GMT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/tools/mobile-test/android/testnode/gradlew b/tools/mobile-test/android/testnode/gradlew new file mode 100755 index 00000000000..9d82f789151 --- /dev/null +++ b/tools/mobile-test/android/testnode/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/tools/mobile-test/android/testnode/gradlew.bat b/tools/mobile-test/android/testnode/gradlew.bat new file mode 100644 index 00000000000..aec99730b4e --- /dev/null +++ b/tools/mobile-test/android/testnode/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/tools/mobile-test/android/testnode/settings.gradle b/tools/mobile-test/android/testnode/settings.gradle new file mode 100644 index 00000000000..e7b4def49cb --- /dev/null +++ b/tools/mobile-test/android/testnode/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/tools/mobile-test/ios/node-ios-proxy.sh b/tools/mobile-test/ios/node-ios-proxy.sh new file mode 100755 index 00000000000..2ef754ae653 --- /dev/null +++ b/tools/mobile-test/ios/node-ios-proxy.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$DEVICE_ID" = "" ]; then + TARGET_DEVICE="" +else + TARGET_DEVICE="-i $DEVICE_ID" +fi + +TEMP_COMMAND="$BASH_SOURCE $@" + +PROXY_BASE_DIR="$( cd "$( dirname "$0" )" && pwd )" +LOG_FILE_PATH="$PROXY_BASE_DIR/testsrun_$DEVICE_ID.log" +STDOUT_FILE_PATH="$PROXY_BASE_DIR/stdout_$DEVICE_ID.log" +STDERR_FILE_PATH="$PROXY_BASE_DIR/stderr_$DEVICE_ID.log" +IOS_APP_PATH="$PROXY_BASE_DIR/Release-iphoneos/testnode.app" + +TEST_BASE_DIR="$( cd "$( dirname "$0" )" && cd .. && cd .. && cd test && pwd )" + +echo "Time: $(date '+%FT%T') -> Proxying testcase: $TEMP_COMMAND" >> "$LOG_FILE_PATH" + +ios-deploy -t 240 --noinstall $TARGET_DEVICE -b "$IOS_APP_PATH" --output "$STDOUT_FILE_PATH" --error_output "$STDERR_FILE_PATH" --noninteractive --args "--substitute-dir $TEST_BASE_DIR $*" | sed $'s/\r$//' | tee -a "$LOG_FILE_PATH" | sed '1,/(lldb) autoexit/d' | sed -E '/Process [0-9]+ exited with status.*|PROCESS_EXITED/,$d' + +OUTPUT_VALUE=${PIPESTATUS[0]} + +cat "$STDOUT_FILE_PATH" | sed $'s/\r$//' >&1 +cat "$STDERR_FILE_PATH" | sed $'s/\r$//' >&2 + +exit $OUTPUT_VALUE diff --git a/tools/mobile-test/ios/prepare-ios-tests.sh b/tools/mobile-test/ios/prepare-ios-tests.sh new file mode 100755 index 00000000000..ede761ceaa7 --- /dev/null +++ b/tools/mobile-test/ios/prepare-ios-tests.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +if [ "$DEVICE_ID" = "" ]; then + TARGET_DEVICE="" +else + TARGET_DEVICE="-i $DEVICE_ID" +fi + +SCRIPT_BASE_DIR="$( cd "$( dirname "$0" )" && pwd )" +NODEJS_BASE_DIR="$( cd "$( dirname "$0" )" && cd .. && cd .. && cd .. && pwd )" +TEST_PROXY_TARGETDIR="$( cd "$NODEJS_BASE_DIR" && mkdir -p ./out/ios.release/ && cd ./out/ios.release/ && pwd )" + +# Remove symbolic links, which might make the iOS application invalid to install +set +e +unlink "$NODEJS_BASE_DIR/test/fixtures/wasi/subdir/input_link.txt" +unlink "$NODEJS_BASE_DIR/test/fixtures/wasi/subdir/loop1" +unlink "$NODEJS_BASE_DIR/test/fixtures/wasi/subdir/loop2" +unlink "$NODEJS_BASE_DIR/test/fixtures/wasi/subdir/outside.txt" +set -e + +xcodebuild build -project "$SCRIPT_BASE_DIR/testnode/testnode.xcodeproj" -target "testnode" -configuration Release -arch arm64 -sdk "iphoneos" SYMROOT="$TEST_PROXY_TARGETDIR" + +cp "$SCRIPT_BASE_DIR/node-ios-proxy.sh" "$TEST_PROXY_TARGETDIR/node" + +ios-deploy -t 120 --uninstall $TARGET_DEVICE -b "$TEST_PROXY_TARGETDIR/Release-iphoneos/testnode.app" -u --noninteractive --args "--copy-path-for-testing" + +exit ${PIPESTATUS[0]} diff --git a/tools/mobile-test/ios/testnode/testnode.xcodeproj/project.pbxproj b/tools/mobile-test/ios/testnode/testnode.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..83b5e477661 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode.xcodeproj/project.pbxproj @@ -0,0 +1,385 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 3308AA461FB2376800BEB534 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3308AA451FB2376800BEB534 /* AppDelegate.m */; }; + 3308AA491FB2376800BEB534 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3308AA481FB2376800BEB534 /* ViewController.m */; }; + 3308AA4C1FB2376800BEB534 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3308AA4A1FB2376800BEB534 /* Main.storyboard */; }; + 3308AA4E1FB2376800BEB534 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3308AA4D1FB2376800BEB534 /* Assets.xcassets */; }; + 3308AA511FB2376800BEB534 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3308AA4F1FB2376800BEB534 /* LaunchScreen.storyboard */; }; + 3308AA541FB2376800BEB534 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3308AA531FB2376800BEB534 /* main.m */; }; + 3308AA5B1FB241B900BEB534 /* NodeRunner.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3308AA5A1FB241B900BEB534 /* NodeRunner.mm */; }; + 331C21271FB9AEA800B04CA8 /* test in Resources */ = {isa = PBXBuildFile; fileRef = 331C21261FB9AEA800B04CA8 /* test */; }; + 33AC9D9126BC3E21007AAC14 /* NodeMobile.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33AC9D9026BC3E21007AAC14 /* NodeMobile.xcframework */; }; + 33AC9D9226BC3E21007AAC14 /* NodeMobile.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 33AC9D9026BC3E21007AAC14 /* NodeMobile.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 335DC89B204DC83200BF9697 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 33AC9D9226BC3E21007AAC14 /* NodeMobile.xcframework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3308AA411FB2376800BEB534 /* testnode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testnode.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3308AA441FB2376800BEB534 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 3308AA451FB2376800BEB534 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 3308AA471FB2376800BEB534 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 3308AA481FB2376800BEB534 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 3308AA4B1FB2376800BEB534 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 3308AA4D1FB2376800BEB534 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3308AA501FB2376800BEB534 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 3308AA521FB2376800BEB534 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3308AA531FB2376800BEB534 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 3308AA5A1FB241B900BEB534 /* NodeRunner.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NodeRunner.mm; sourceTree = ""; }; + 3308AA5C1FB241F200BEB534 /* NodeRunner.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = NodeRunner.hpp; sourceTree = ""; }; + 331C21261FB9AEA800B04CA8 /* test */ = {isa = PBXFileReference; lastKnownFileType = folder; name = test; path = ../../../../test; sourceTree = ""; }; + 33AC9D9026BC3E21007AAC14 /* NodeMobile.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = NodeMobile.xcframework; path = ../../../../out_ios/NodeMobile.xcframework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3308AA3E1FB2376800BEB534 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 33AC9D9126BC3E21007AAC14 /* NodeMobile.xcframework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3308AA381FB2376800BEB534 = { + isa = PBXGroup; + children = ( + 331C21261FB9AEA800B04CA8 /* test */, + 3308AA431FB2376800BEB534 /* testnode */, + 3308AA421FB2376800BEB534 /* Products */, + 33AC9D8F26BC3E21007AAC14 /* Frameworks */, + ); + sourceTree = ""; + }; + 3308AA421FB2376800BEB534 /* Products */ = { + isa = PBXGroup; + children = ( + 3308AA411FB2376800BEB534 /* testnode.app */, + ); + name = Products; + sourceTree = ""; + }; + 3308AA431FB2376800BEB534 /* testnode */ = { + isa = PBXGroup; + children = ( + 3308AA441FB2376800BEB534 /* AppDelegate.h */, + 3308AA451FB2376800BEB534 /* AppDelegate.m */, + 3308AA471FB2376800BEB534 /* ViewController.h */, + 3308AA481FB2376800BEB534 /* ViewController.m */, + 3308AA4A1FB2376800BEB534 /* Main.storyboard */, + 3308AA4D1FB2376800BEB534 /* Assets.xcassets */, + 3308AA4F1FB2376800BEB534 /* LaunchScreen.storyboard */, + 3308AA521FB2376800BEB534 /* Info.plist */, + 3308AA531FB2376800BEB534 /* main.m */, + 3308AA5A1FB241B900BEB534 /* NodeRunner.mm */, + 3308AA5C1FB241F200BEB534 /* NodeRunner.hpp */, + ); + path = testnode; + sourceTree = ""; + }; + 33AC9D8F26BC3E21007AAC14 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 33AC9D9026BC3E21007AAC14 /* NodeMobile.xcframework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3308AA401FB2376800BEB534 /* testnode */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3308AA571FB2376800BEB534 /* Build configuration list for PBXNativeTarget "testnode" */; + buildPhases = ( + 3308AA3D1FB2376800BEB534 /* Sources */, + 3308AA3E1FB2376800BEB534 /* Frameworks */, + 3308AA3F1FB2376800BEB534 /* Resources */, + 335DC89B204DC83200BF9697 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = testnode; + productName = testnode; + productReference = 3308AA411FB2376800BEB534 /* testnode.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3308AA391FB2376800BEB534 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Node.js Mobile"; + TargetAttributes = { + 3308AA401FB2376800BEB534 = { + CreatedOnToolsVersion = 9.0.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 3308AA3C1FB2376800BEB534 /* Build configuration list for PBXProject "testnode" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3308AA381FB2376800BEB534; + productRefGroup = 3308AA421FB2376800BEB534 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3308AA401FB2376800BEB534 /* testnode */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3308AA3F1FB2376800BEB534 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C21271FB9AEA800B04CA8 /* test in Resources */, + 3308AA511FB2376800BEB534 /* LaunchScreen.storyboard in Resources */, + 3308AA4E1FB2376800BEB534 /* Assets.xcassets in Resources */, + 3308AA4C1FB2376800BEB534 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3308AA3D1FB2376800BEB534 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3308AA491FB2376800BEB534 /* ViewController.m in Sources */, + 3308AA541FB2376800BEB534 /* main.m in Sources */, + 3308AA461FB2376800BEB534 /* AppDelegate.m in Sources */, + 3308AA5B1FB241B900BEB534 /* NodeRunner.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 3308AA4A1FB2376800BEB534 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3308AA4B1FB2376800BEB534 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 3308AA4F1FB2376800BEB534 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3308AA501FB2376800BEB534 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 3308AA551FB2376800BEB534 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 3308AA561FB2376800BEB534 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3308AA581FB2376800BEB534 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../../../../out_ios/Release-iphoneos/", + ); + INFOPLIST_FILE = testnode/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + OTHER_LDFLAGS = "-Wl,-stack_size,0x200000"; + PRODUCT_BUNDLE_IDENTIFIER = nodejsmobile.test; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3308AA591FB2376800BEB534 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../../../../out_ios/Release-iphoneos/", + ); + INFOPLIST_FILE = testnode/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + OTHER_LDFLAGS = "-Wl,-stack_size,0x200000"; + PRODUCT_BUNDLE_IDENTIFIER = nodejsmobile.test; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3308AA3C1FB2376800BEB534 /* Build configuration list for PBXProject "testnode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3308AA551FB2376800BEB534 /* Debug */, + 3308AA561FB2376800BEB534 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3308AA571FB2376800BEB534 /* Build configuration list for PBXNativeTarget "testnode" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3308AA581FB2376800BEB534 /* Debug */, + 3308AA591FB2376800BEB534 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3308AA391FB2376800BEB534 /* Project object */; +} diff --git a/tools/mobile-test/ios/testnode/testnode/AppDelegate.h b/tools/mobile-test/ios/testnode/testnode/AppDelegate.h new file mode 100644 index 00000000000..3f627fa9793 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/AppDelegate.h @@ -0,0 +1,14 @@ +// +// AppDelegate.h +// testnode +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/tools/mobile-test/ios/testnode/testnode/AppDelegate.m b/tools/mobile-test/ios/testnode/testnode/AppDelegate.m new file mode 100644 index 00000000000..b7321cb5999 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/AppDelegate.m @@ -0,0 +1,48 @@ +// +// AppDelegate.m +// testnode +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/tools/mobile-test/ios/testnode/testnode/Assets.xcassets/AppIcon.appiconset/Contents.json b/tools/mobile-test/ios/testnode/testnode/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..d8db8d65fd7 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/tools/mobile-test/ios/testnode/testnode/Base.lproj/LaunchScreen.storyboard b/tools/mobile-test/ios/testnode/testnode/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000000..f83f6fd5810 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/mobile-test/ios/testnode/testnode/Base.lproj/Main.storyboard b/tools/mobile-test/ios/testnode/testnode/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..d7c78a1255c --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/mobile-test/ios/testnode/testnode/Info.plist b/tools/mobile-test/ios/testnode/testnode/Info.plist new file mode 100644 index 00000000000..16be3b68112 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/tools/mobile-test/ios/testnode/testnode/NodeRunner.hpp b/tools/mobile-test/ios/testnode/testnode/NodeRunner.hpp new file mode 100644 index 00000000000..18d9d08b0fb --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/NodeRunner.hpp @@ -0,0 +1,14 @@ +// +// NodeRunner.hpp +// testnode +// +#import +#ifndef NodeRunner_hpp +#define NodeRunner_hpp +@interface NodeRunner : NSObject +{ +} ++ (void) CopyTestDir:(NSString*)srcTestsPath:(NSString*)dstTestsPath; ++ (int) startEngineWithArguments:(NSArray*)arguments; +@end +#endif /* NodeRunner_h */ diff --git a/tools/mobile-test/ios/testnode/testnode/NodeRunner.mm b/tools/mobile-test/ios/testnode/testnode/NodeRunner.mm new file mode 100644 index 00000000000..da981a0daff --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/NodeRunner.mm @@ -0,0 +1,72 @@ +// +// NodeRunner.m +// testnode +// + +#include "NodeRunner.hpp" +#include +#include + +@implementation NodeRunner + ++ (void) CopyTestDir:(NSString*)srcTestsPath:(NSString*)dstTestsPath +{ + BOOL isDir; + if ([[NSFileManager defaultManager] fileExistsAtPath:dstTestsPath isDirectory:&isDir] && isDir) { + [[NSFileManager defaultManager] removeItemAtPath:dstTestsPath error:nil]; + } + + NSLog(@"Copying test files to documents..."); + NSError *copyError = nil; + if (![[NSFileManager defaultManager] copyItemAtPath:srcTestsPath toPath:dstTestsPath error:©Error]) { + NSLog(@"Error copying files: %@", [copyError localizedDescription]); + exit(1); + } +} + +//node's libUV requires all arguments being on contiguous memory. ++ (int) startEngineWithArguments:(NSArray*)arguments +{ + //Set the builtin_modules path to NODE_PATH + + int c_arguments_size=0; + + //Compute byte size need for all arguments in contiguous memory. + for (id argElement in arguments) + { + c_arguments_size+=strlen([argElement UTF8String]); + c_arguments_size++; // for '\0' + } + + //Stores arguments in contiguous memory. + char* args_buffer=(char*)calloc(c_arguments_size, sizeof(char)); + + //argv to pass into node. + char* argv[[arguments count]]; + + //To iterate through the expected start position of each argument in args_buffer. + char* current_args_position=args_buffer; + + //Argc + int argument_count=0; + + //Populate the args_buffer and argv. + for (id argElement in arguments) + { + const char* current_argument=[argElement UTF8String]; + + //Copy current argument to its expected position in args_buffer + strncpy(current_args_position, current_argument, strlen(current_argument)); + + //Save current argument start position in argv and increment argc. + argv[argument_count]=current_args_position; + argument_count++; + + //Increment to the next argument's expected position. + current_args_position+=strlen(current_args_position)+1; + } + //Start node, with argc and argv. + return node_start(argument_count,argv); +} + +@end diff --git a/tools/mobile-test/ios/testnode/testnode/ViewController.h b/tools/mobile-test/ios/testnode/testnode/ViewController.h new file mode 100644 index 00000000000..28c21a54e1a --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/ViewController.h @@ -0,0 +1,12 @@ +// +// ViewController.h +// testnode +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/tools/mobile-test/ios/testnode/testnode/ViewController.m b/tools/mobile-test/ios/testnode/testnode/ViewController.m new file mode 100644 index 00000000000..fedd59d1480 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/ViewController.m @@ -0,0 +1,26 @@ +// +// ViewController.m +// testnode +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + +@end diff --git a/tools/mobile-test/ios/testnode/testnode/main.m b/tools/mobile-test/ios/testnode/testnode/main.m new file mode 100644 index 00000000000..16341023602 --- /dev/null +++ b/tools/mobile-test/ios/testnode/testnode/main.m @@ -0,0 +1,56 @@ +// +// main.m +// testnode +// + +#import +#import "AppDelegate.h" +#import "NodeRunner.hpp" +int main(int argc, char * argv[]) { + + if(argc<2) + { + //This application needs some arguments to pass to node. + return 0; + } else { + //If we receive arguments we are probably running tests. + + NSString* srcTestsPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:nil]; + NSString* dstTestsPath = [NSString stringWithFormat:@"%@/test", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]]; + + //--copy-path-for-testing indicates that we should copy the test folder to Documents. + if(strncmp(argv[1],"--copy-path-for-testing",strlen("--copy-path-for-testing"))==0) { + [NodeRunner CopyTestDir:srcTestsPath:dstTestsPath]; + return 0; + } + + //NSArray to manipulate the arguments in, to use the NodeRunner startEngineWithArguments interface. + NSMutableArray *arguments=[NSMutableArray array]; + [arguments addObject:@"node"]; //first argument. + int i=1; + NSString* file_replace_prefix=NULL; + + //--substitute-dir indicates a path prefix that should be replaced with the test path in Documents. + if(argc>=3 && strncmp(argv[1],"--substitute-dir",strlen("--substitute-dir"))==0) { + file_replace_prefix=[[NSString alloc] initWithCString:argv[2] encoding:NSUTF8StringEncoding]; + i+=2; + } + + //Add following arguments to the node invocation. + for(; i < argc; i++) { + NSString *str = [[NSString alloc] initWithCString:argv[i] encoding:NSUTF8StringEncoding]; + if(file_replace_prefix!=NULL && [str hasPrefix:file_replace_prefix]) + { + //If the argument starts with the prefix, it needs to be translated into a Documents path. + str = [NSString stringWithFormat:@"%@/%@", dstTestsPath, [str substringFromIndex:[file_replace_prefix length]]]; + } else if([str hasPrefix:@"./test/"]) { + // Some arguments are passed as a relative path to where the node binary is supposed to be while testing. Translate into a Documents path. + str = [NSString stringWithFormat:@"%@/%@", dstTestsPath, [str substringFromIndex:[@"./test" length]]]; + } + [arguments addObject:str]; + } + + //start Node + return [NodeRunner startEngineWithArguments:arguments] ; + } +} diff --git a/tools/test.py b/tools/test.py index 532b855479b..1f70a80de42 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1606,6 +1606,12 @@ def Main(): 'arch': vmArch, 'type': get_env_type(vm, options.type, context), } + # If arch is android, system is android as well. + if arch.lower() == "android": + env['system'] = "android" + # If arch is ios, system is iOS as well. + elif arch.lower() == "ios": + env['system'] = "ios" test_list = root.ListTests([], path, context, arch, mode) unclassified_tests += test_list cases, unused_rules = config.ClassifyTests(test_list, env) diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi index 0876b16b46a..8b77611dd39 100644 --- a/tools/v8_gypfiles/toolchain.gypi +++ b/tools/v8_gypfiles/toolchain.gypi @@ -1094,6 +1094,25 @@ }], ], }], + ['OS=="ios"', { + 'target_conditions': [ + ['_toolset=="host" and host_os=="mac"', { + 'xcode_settings': { + 'SDKROOT': '', + 'IPHONEOS_DEPLOYMENT_TARGET': '', + 'MACOSX_DEPLOYMENT_TARGET': '10.10', + }, + 'conditions':[ + ['target_arch=="arm64"', { + 'xcode_settings': { + 'ARCHS!': ['arm64'], + 'ARCHS': ['x86_64'], + }, + }], + ], + }], + ] + }], ], # conditions 'configurations': { 'Debug': { diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 26b8e56e834..cbe964788ab 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -723,6 +723,17 @@ ], }], ], + 'target_conditions': [ + ['_toolset == "host"', { + 'target_conditions': [ + ['host_os in ("mac", "linux")', { + 'sources': [ + '