Skip to content

Commit

Permalink
🐞fix(native): fit neon v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YXL76 committed Dec 15, 2020
1 parent 0655784 commit 640a72a
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 383 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,28 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
filename: darwin
- os: ubuntu-latest
filename: linux
- os: windows-latest
filename: win32

name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Installing needed Ubuntu dependencies
if: runner.os == 'ubuntu-latest'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev
sudo apt-get install -y libx11-dev
- name: Cache LLVM and Clang
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: ${{ runner.os }}-llvm-10.0

- name: Install LLVM and Clang
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
Expand Down Expand Up @@ -75,7 +68,7 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
native/target/release
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: yarn
Expand All @@ -85,12 +78,12 @@ jobs:
run: yarn build-native

- name: Build
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
run: yarn build-native
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.filename }}
path: native/index.node
name: ${{ runner.os }}
path: index.node
27 changes: 10 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,28 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
filename: darwin
- os: ubuntu-latest
filename: linux
- os: windows-latest
filename: win32

name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Installing needed Ubuntu dependencies
if: runner.os == 'ubuntu-latest'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev
sudo apt-get install -y libx11-dev
- name: Cache LLVM and Clang
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: ${{ runner.os }}-llvm-10.0

- name: Install LLVM and Clang
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
Expand Down Expand Up @@ -73,7 +66,7 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
native/target/release
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: yarn
Expand All @@ -83,15 +76,15 @@ jobs:
run: yarn build-native

- name: Build
if: runner.os == 'windows-latest'
if: runner.os == 'Windows'
run: yarn build-native
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.filename }}
path: native/index.node
name: ${{ runner.os }}
path: index.node

release:
runs-on: ubuntu-latest
Expand All @@ -106,9 +99,9 @@ jobs:
- name: Copy file
run: |
mkdir -p build
cp .artifact/darwin/index.node build/darwin.node
cp .artifact/linux/index.node build/linux.node
cp .artifact/win32/index.node build/win32.node
cp .artifact/macOS/index.node build/darwin.node
cp .artifact/Linux/index.node build/linux.node
cp .artifact/Windows/index.node build/win32.node
- uses: actions/setup-node@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ node_modules
yarn-error.log

# native module
native/target
native/index.node
native/artifacts.json
target
index.node
artifacts.json

# cache and build file
.cache
Expand Down
5 changes: 4 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ yarn.lock
**/.browserslistrc
**/postcss.config.js
**/tailwind.config.js
Cargo.*

# scoure code
native
src
*.rs

# cache and build file
.cache
.artifact
out
**/*.vsix
target
index.node

# document
doc
Expand Down
16 changes: 8 additions & 8 deletions native/Cargo.lock → Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
2 changes: 1 addition & 1 deletion native/build.rs → build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use neon_build;
extern crate neon_build;

fn main() {
neon_build::setup(); // must be called in build.rs
Expand Down
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@
"generate-css": "postcss src/webview/global.css -o dist/webview.css",
"build": "yarn generate-css && webpack --mode production",
"build-dev": "webpack --mode development",
"build-native": "neon build --release",
"build-native-dev": "neon build",
"build-native": "cargo build --release",
"build-native-dev": "cargo build",
"lint": "eslint src",
"test": "tsc -p tsconfig.json && tsc -p src/webview/tsconfig.json",
"vscode:prepublish": "yarn build"
Expand All @@ -462,7 +462,7 @@
"babel-eslint": "10.1.0",
"copy-webpack-plugin": "7.0.0",
"cssnano": "4.1.10",
"esbuild-loader": "2.6.2",
"esbuild-loader": "2.6.3",
"eslint": "7.15.0",
"eslint-config-prettier": "7.0.0",
"eslint-config-react-app": "6.0.0",
Expand All @@ -473,14 +473,13 @@
"eslint-plugin-prettier": "3.3.0",
"eslint-plugin-react": "7.21.5",
"eslint-plugin-react-hooks": "4.2.0",
"neon-cli": "0.6.0",
"postcss": "8.2.1",
"postcss-cli": "8.3.1",
"postcss-import": "14.0.0",
"prettier": "2.2.1",
"tailwindcss": "2.0.2",
"typescript": "4.1.3",
"webpack": "5.10.1",
"webpack": "5.10.2",
"webpack-cli": "4.2.0"
},
"dependencies": {
Expand All @@ -496,9 +495,5 @@
"node-cache": "5.1.2",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"resolutions": {
"webpack": "5.10.1",
"webpack-cli": "4.2.0"
}
}
15 changes: 8 additions & 7 deletions native/src/lib.rs → src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use neon::prelude::*;

// pub mod download;
// pub mod keyboard;
pub mod player;

// use download::*;
// use keyboard::*;
use player::*;
mod native {
pub mod player;
// pub mod download;
// pub mod keyboard;
}
// use native::download::*;
// use native::keyboard::*;
use native::player::*;

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
Expand Down
File renamed without changes.
Loading

0 comments on commit 640a72a

Please sign in to comment.