diff --git a/.circleci/config.yml b/.circleci/config.yml index e59189f66..7d53b492b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,315 +1,315 @@ -version: 2.1 -description: Ruffle - Flash Player emulator written in Rust -orbs: - win: circleci/windows@1.0.0 - -jobs: - # General testing, linux + web build - build: - docker: - - image: circleci/rust:1.37 - steps: - # Git checkout - - checkout - - # Restore cached assets (cargo registry) - - restore_cache: - keys: - - v1-cargo-cache-linux-{{ .Revision }} - - v1-cargo-cache-linux- - - # Install dependencies - - run: - name: Setup - command: | - rustup toolchain install stable - rustup run stable rustc --version --verbose - rustup component add --toolchain stable clippy - rustup run stable cargo clippy --version - rustup component add --toolchain stable rustfmt - rustup run stable cargo fmt --version - sudo apt-get update - sudo apt-get -y install libasound2-dev # Required for cpal crate on Linux - curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - - sudo apt-get install -y nodejs - mkdir workspace - - # Run tests - - run: - name: Tests - command: | - rustup run stable cargo test --package=ruffle_core - - # Run cargo clippy and fmt - - run: - name: Clippy + Format - command: | - rustup run stable cargo clippy --all --tests -- -D warnings - rustup run stable cargo fmt --all -- --check - - # Build the linux binary - - run: - name: Linux Build - command: | - rustup run stable cargo build --package ruffle_desktop --release - mkdir linux - cp target/release/ruffle_desktop linux/ruffle - cp README.md LICENSE_APACHE LICENSE_MIT linux - cd linux - tar -czvf ../workspace/linux.tar.gz * - - # Build the wasm binary - - run: - name: Web Build - command: | - cd web/demo - npm install - npm run build -- --mode=production - cd ../.. - mkdir -p workspace/web-demo - cp web/demo/dist/* workspace/web-demo - - # Build the web extension - - run: - name: Extension Build - command: | - cd web/extension - npm install - wasm-pack build --release --target=no-modules --out-dir=extension/build/dist .. - npx webpack - cd build - cp ../../../README.md . - cp ../../../LICENSE_APACHE . - cp ../../../LICENSE_MIT . - zip -r extension.zip . - cd ../../.. - cp web/extension/build/extension.zip workspace - - # Save cached assets - - save_cache: - key: v1-cargo-cache-linux-{{ .Revision }} - paths: - - "/usr/local/cargo/registry" - - "./target" - - # Persist build artifacts for deploy job - - persist_to_workspace: - root: workspace - paths: - - linux.tar.gz - - extension.zip - - web-demo - - # OSX Build - build_osx: - macos: - xcode: "9.3.0" - steps: - # Git checkout - - checkout - - # Restore cached assets (cargo registry) - - restore_cache: - keys: - - v1-cargo-cache-osx-{{ .Revision }} - - v1-cargo-cache-osx- - - # Install dependencies - - run: - name: Setup - command: | - # Install rustup - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source $HOME/.cargo/env - - # Install stable rust toolchain - rustup toolchain install stable - rustup run stable rustc --version --verbose - rustup run stable cargo --version --verbose - - mkdir workspace - - # Build the OSX binary - - run: - name: OSX Build - command: | - source $HOME/.cargo/env - rustup run stable cargo build --package ruffle_desktop --release - mkdir osx - cp target/release/ruffle_desktop osx/ruffle - cp README.md LICENSE_APACHE LICENSE_MIT osx - cd osx - tar -czvf ../workspace/osx.tar.gz * - - # Save cached assets - - save_cache: - key: v1-cargo-cache-osx-{{ .Revision }} - paths: - - "~/.cargo/registry" - - "./target" - - # Persist build artifacts for deploy job - - persist_to_workspace: - root: workspace - paths: - - osx.tar.gz - - # Windows build - build_windows: - executor: - name: win/vs2019 - shell: powershell.exe - steps: - # Git checkout - - checkout - - # Restore cached assets (cargo registry) - - restore_cache: - keys: - - v1-cargo-cache-windows-{{ .Revision }} - - v1-cargo-cache-windows- - - # Install dependencies - - run: - name: Install dependencies - command: | - # Install rustup - $client = new-object System.Net.WebClient - $client.DownloadFile('https://win.rustup.rs', "$pwd\rustup-init.exe") - .\rustup-init.exe -y - - mkdir workspace - - # Build the Windows binary - - run: - name: Windows Build - command: | - # This is necessary because otherwise cargo fails when trying to use git? - mkdir .cargo - Add-Content .cargo\config "[net]`ngit-fetch-with-cli = true" - - rustup run stable rustc --version --verbose - rustup run stable cargo --version --verbose - rustup run stable cargo build --package ruffle_desktop --release - mkdir windows - copy target\release\ruffle_desktop.exe windows\ruffle.exe - copy README.md windows - copy LICENSE_APACHE windows - copy LICENSE_MIT windows\ - - # Have to turn off progress bar or CI explodes?! - $progressPreference = 'silentlyContinue' - Compress-Archive -Path windows\* -CompressionLevel Optimal -DestinationPath workspace\windows.zip - - # Save cached assets - - save_cache: - key: v1-cargo-cache-windows-{{ .Revision }} - paths: - - c:\users\circleci\.cargo\registry - - target - - # Persist build artifacts for deploy job - - persist_to_workspace: - root: workspace - paths: - - windows.zip - - # Upload builds to S3 - deploy: - docker: - - image: circleci/python:3.7-stretch - steps: - # Access build artifacts in workspace - - attach_workspace: - at: workspace - - # Set environment variables for nightly build name - - run: - name: Environment vars - command: | - echo 'export SHORT_GIT_HASH=$(echo $CIRCLE_SHA1 | cut -c -7)' >> $BASH_ENV - echo 'export BUILD_ID=$(date +"%Y-%m-%d")_${SHORT_GIT_HASH}' >> $BASH_ENV - echo 'export NUM_BUILDS=27' >> $BASH_ENV - - # Install AWS CLI - - run: - name: Install awscli - command: sudo pip install awscli - - - run: - name: Sync with S3 - command: | - mkdir -p builds - aws s3 sync s3://ruffle-rs/builds builds - - - run: - name: Check if stale build - command: | - # Check if files exist with this Git commit ID. - # If so, this isn't a new commit, so cancel the deployment. - if ls builds/linux/*${SHORT_GIT_HASH}.tar.gz 1> /dev/null 2>&1; then - echo "No new commits; cancelling deploy" - circleci-agent step halt - fi - - - run: - name: Deploy to S3 - command: | - rm -f builds/web-demo/*.wasm - rm -f builds/web-demo/*.js - rm -f builds/web-demo/*.html - mkdir -p builds/linux - cp -f workspace/linux.tar.gz builds/linux/ruffle_linux_latest.tar.gz - cp -f workspace/linux.tar.gz builds/linux/ruffle_linux_${BUILD_ID}.tar.gz - mkdir -p builds/osx - cp -f workspace/osx.tar.gz builds/osx/ruffle_osx_latest.tar.gz - cp -f workspace/osx.tar.gz builds/osx/ruffle_osx_${BUILD_ID}.tar.gz - mkdir -p builds/windows - cp -f workspace/windows.zip builds/windows/ruffle_windows_latest.zip - cp -f workspace/windows.zip builds/windows/ruffle_windows_${BUILD_ID}.zip - mkdir -p builds/extension - cp -f workspace/extension.zip builds/extension/ruffle_extension_latest.zip - cp -f workspace/extension.zip builds/extension/ruffle_extension_${BUILD_ID}.zip - - # Only keep a certain # of builds. - ls -1t builds/linux/* | tail -n +${NUM_BUILDS} | xargs rm -f - ls -1t builds/osx/* | tail -n +${NUM_BUILDS} | xargs rm -f - ls -1t builds/windows/* | tail -n +${NUM_BUILDS} | xargs rm -f - ls -1t builds/extension/* | tail -n +${NUM_BUILDS} | xargs rm -f - - # Copy over web demo. - cp -rf workspace/web-demo builds - - # Upload to S3. - # S3 currently gives .wasm files the wrong MIME type, so have to upload that separately. - aws s3 sync builds s3://ruffle-rs/builds --acl public-read --exclude '*.wasm' --delete - aws s3 sync builds s3://ruffle-rs/builds --acl public-read --exclude '*' --include '*.wasm' --delete --content-type 'application/wasm' - - # By default, S3 serves - -workflows: - version: 2 - - # Basic linux build on each push or pull request to the repo - commit_build: - jobs: - - build - - # Nightly builds - nightly_build: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - jobs: - - build - - build_osx - - build_windows - - deploy: - requires: - - build - - build_osx - - build_windows +version: 2.1 +description: Ruffle - Flash Player emulator written in Rust +orbs: + win: circleci/windows@1.0.0 + +jobs: + # General testing, linux + web build + build: + docker: + - image: circleci/rust:1.37 + steps: + # Git checkout + - checkout + + # Restore cached assets (cargo registry) + - restore_cache: + keys: + - v1-cargo-cache-linux-{{ .Revision }} + - v1-cargo-cache-linux- + + # Install dependencies + - run: + name: Setup + command: | + rustup toolchain install stable + rustup run stable rustc --version --verbose + rustup component add --toolchain stable clippy + rustup run stable cargo clippy --version + rustup component add --toolchain stable rustfmt + rustup run stable cargo fmt --version + sudo apt-get update + sudo apt-get -y install libasound2-dev # Required for cpal crate on Linux + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - + sudo apt-get install -y nodejs + mkdir workspace + + # Run tests + - run: + name: Tests + command: | + rustup run stable cargo test --package=ruffle_core + + # Run cargo clippy and fmt + - run: + name: Clippy + Format + command: | + rustup run stable cargo clippy --all --tests -- -D warnings + rustup run stable cargo fmt --all -- --check + + # Build the linux binary + - run: + name: Linux Build + command: | + rustup run stable cargo build --package ruffle_desktop --release + mkdir linux + cp target/release/ruffle_desktop linux/ruffle + cp README.md LICENSE_APACHE LICENSE_MIT linux + cd linux + tar -czvf ../workspace/linux.tar.gz * + + # Build the wasm binary + - run: + name: Web Build + command: | + cd web/demo + npm install + npm run build -- --mode=production + cd ../.. + mkdir -p workspace/web-demo + cp web/demo/dist/* workspace/web-demo + + # Build the web extension + - run: + name: Extension Build + command: | + cd web/extension + npm install + wasm-pack build --release --target=no-modules --out-dir=extension/build/dist .. + npx webpack + cd build + cp ../../../README.md . + cp ../../../LICENSE_APACHE . + cp ../../../LICENSE_MIT . + zip -r extension.zip . + cd ../../.. + cp web/extension/build/extension.zip workspace + + # Save cached assets + - save_cache: + key: v1-cargo-cache-linux-{{ .Revision }} + paths: + - "/usr/local/cargo/registry" + - "./target" + + # Persist build artifacts for deploy job + - persist_to_workspace: + root: workspace + paths: + - linux.tar.gz + - extension.zip + - web-demo + + # OSX Build + build_osx: + macos: + xcode: "9.3.0" + steps: + # Git checkout + - checkout + + # Restore cached assets (cargo registry) + - restore_cache: + keys: + - v1-cargo-cache-osx-{{ .Revision }} + - v1-cargo-cache-osx- + + # Install dependencies + - run: + name: Setup + command: | + # Install rustup + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source $HOME/.cargo/env + + # Install stable rust toolchain + rustup toolchain install stable + rustup run stable rustc --version --verbose + rustup run stable cargo --version --verbose + + mkdir workspace + + # Build the OSX binary + - run: + name: OSX Build + command: | + source $HOME/.cargo/env + rustup run stable cargo build --package ruffle_desktop --release + mkdir osx + cp target/release/ruffle_desktop osx/ruffle + cp README.md LICENSE_APACHE LICENSE_MIT osx + cd osx + tar -czvf ../workspace/osx.tar.gz * + + # Save cached assets + - save_cache: + key: v1-cargo-cache-osx-{{ .Revision }} + paths: + - "~/.cargo/registry" + - "./target" + + # Persist build artifacts for deploy job + - persist_to_workspace: + root: workspace + paths: + - osx.tar.gz + + # Windows build + build_windows: + executor: + name: win/vs2019 + shell: powershell.exe + steps: + # Git checkout + - checkout + + # Restore cached assets (cargo registry) + - restore_cache: + keys: + - v1-cargo-cache-windows-{{ .Revision }} + - v1-cargo-cache-windows- + + # Install dependencies + - run: + name: Install dependencies + command: | + # Install rustup + $client = new-object System.Net.WebClient + $client.DownloadFile('https://win.rustup.rs', "$pwd\rustup-init.exe") + .\rustup-init.exe -y + + mkdir workspace + + # Build the Windows binary + - run: + name: Windows Build + command: | + # This is necessary because otherwise cargo fails when trying to use git? + mkdir .cargo + Add-Content .cargo\config "[net]`ngit-fetch-with-cli = true" + + rustup run stable rustc --version --verbose + rustup run stable cargo --version --verbose + rustup run stable cargo build --package ruffle_desktop --release + mkdir windows + copy target\release\ruffle_desktop.exe windows\ruffle.exe + copy README.md windows + copy LICENSE_APACHE windows + copy LICENSE_MIT windows\ + + # Have to turn off progress bar or CI explodes?! + $progressPreference = 'silentlyContinue' + Compress-Archive -Path windows\* -CompressionLevel Optimal -DestinationPath workspace\windows.zip + + # Save cached assets + - save_cache: + key: v1-cargo-cache-windows-{{ .Revision }} + paths: + - c:\users\circleci\.cargo\registry + - target + + # Persist build artifacts for deploy job + - persist_to_workspace: + root: workspace + paths: + - windows.zip + + # Upload builds to S3 + deploy: + docker: + - image: circleci/python:3.7-stretch + steps: + # Access build artifacts in workspace + - attach_workspace: + at: workspace + + # Set environment variables for nightly build name + - run: + name: Environment vars + command: | + echo 'export SHORT_GIT_HASH=$(echo $CIRCLE_SHA1 | cut -c -7)' >> $BASH_ENV + echo 'export BUILD_ID=$(date +"%Y-%m-%d")_${SHORT_GIT_HASH}' >> $BASH_ENV + echo 'export NUM_BUILDS=27' >> $BASH_ENV + + # Install AWS CLI + - run: + name: Install awscli + command: sudo pip install awscli + + - run: + name: Sync with S3 + command: | + mkdir -p builds + aws s3 sync s3://ruffle-rs/builds builds + + - run: + name: Check if stale build + command: | + # Check if files exist with this Git commit ID. + # If so, this isn't a new commit, so cancel the deployment. + if ls builds/linux/*${SHORT_GIT_HASH}.tar.gz 1> /dev/null 2>&1; then + echo "No new commits; cancelling deploy" + circleci-agent step halt + fi + + - run: + name: Deploy to S3 + command: | + rm -f builds/web-demo/*.wasm + rm -f builds/web-demo/*.js + rm -f builds/web-demo/*.html + mkdir -p builds/linux + cp -f workspace/linux.tar.gz builds/linux/ruffle_linux_latest.tar.gz + cp -f workspace/linux.tar.gz builds/linux/ruffle_linux_${BUILD_ID}.tar.gz + mkdir -p builds/osx + cp -f workspace/osx.tar.gz builds/osx/ruffle_osx_latest.tar.gz + cp -f workspace/osx.tar.gz builds/osx/ruffle_osx_${BUILD_ID}.tar.gz + mkdir -p builds/windows + cp -f workspace/windows.zip builds/windows/ruffle_windows_latest.zip + cp -f workspace/windows.zip builds/windows/ruffle_windows_${BUILD_ID}.zip + mkdir -p builds/extension + cp -f workspace/extension.zip builds/extension/ruffle_extension_latest.zip + cp -f workspace/extension.zip builds/extension/ruffle_extension_${BUILD_ID}.zip + + # Only keep a certain # of builds. + ls -1t builds/linux/* | tail -n +${NUM_BUILDS} | xargs rm -f + ls -1t builds/osx/* | tail -n +${NUM_BUILDS} | xargs rm -f + ls -1t builds/windows/* | tail -n +${NUM_BUILDS} | xargs rm -f + ls -1t builds/extension/* | tail -n +${NUM_BUILDS} | xargs rm -f + + # Copy over web demo. + cp -rf workspace/web-demo builds + + # Upload to S3. + # S3 currently gives .wasm files the wrong MIME type, so have to upload that separately. + aws s3 sync builds s3://ruffle-rs/builds --acl public-read --exclude '*.wasm' --delete + aws s3 sync builds s3://ruffle-rs/builds --acl public-read --exclude '*' --include '*.wasm' --delete --content-type 'application/wasm' + + # By default, S3 serves + +workflows: + version: 2 + + # Basic linux build on each push or pull request to the repo + commit_build: + jobs: + - build + + # Nightly builds + nightly_build: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - master + jobs: + - build + - build_osx + - build_windows + - deploy: + requires: + - build + - build_osx + - build_windows diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32a8acf3d..e57096a07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,126 +1,126 @@ -# Contributing to Ruffle - -🎉 Thanks for your interest in Ruffle! Contributions of all kinds are welcome. - -This document serves as a general guide for contributing to Ruffle. Follow your best judgement in following these guidelines. - -## Table of Contents - - * [Getting Started](#getting-started) - * [Ways to Contribute](#ways-to-contribute) - * [Test your favorite Flash content](#test-your-favorite-flash-content) - * [Improve documentation](#improve-documentation) - * [Fix interesting issues](#fix-interesting-issues) - * [Implement missing Flash functionality](#implement-missing-flash-functionality) - * [Reporting Bugs](#reporting-bugs) - * [Code Guidelines](#code-guidelines) - * [Commit Message Guidelines](#commit-guidelines) - * [Pull Requests](#pull-requests) - -## Getting Started - -The [Ruffle wiki](https://github.com/ruffle-rs/ruffle/wiki) is a great way to familiarize yourself with the project. It contains info on how to building Ruffle, using Ruffle, and links to helpful documentation about the Flash format. - -Feel free to ask questions in our [Discord server](https://discord.gg/J8hgCQN). - -## Ways to Contribute - -We love new contributors! You can contribute to Ruffle in several ways: - -### Test your favorite Flash content - -Try out your favorite SWF content in Ruffle and see how it works! Follow the instructions on the [Using Ruffle](https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle) page to get Ruffle for your desired platform. You can run the SWF through the desktop player, the web demo, or try the extension on live websites. - -If you encounter specific issues with content, please follow the guidelines on filing an issue. - -### Improve documentation - -Improving documentation is a great way to learn the codebase. Adding documentation to both the wiki and the code eases the learning curve for both end users and new contributors. - -For documentation in the code, we follow the [rustdoc](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments) guidelines. - -### Fix interesting issues - -Try your hand at fixing [issues that are interesting to you](https://github.com/ruffle-rs/ruffle/issues). Follow the instructions on [building Ruffle](https://github.com/ruffle-rs/ruffle/wiki/Building-Ruffle), familiarize yourself with the [project layout](https://github.com/ruffle-rs/ruffle/wiki/Project-Layout), and use [SWF resources and decompilers](https://github.com/ruffle-rs/ruffle/wiki/Helpful-Resources) to help debug the issue. - -You can also ask for mentoring on our [Discord server](https://discord.gg/J8hgCQN). - -### Implement missing Flash functionality - -Ruffle is a young project, and there is still much Flash functionality that is unimplemented. Check for the ["unimplemented"](https://github.com/ruffle-rs/ruffle/issues?q=is%3Aissue+is%3Aopen+label%3Aunimplemented) in issues. - -## Reporting bugs - -[Issue reports and feature requests](https://github.com/ruffle-rs/ruffle/issues) are encouraged, and are a great way to measure our progress! - -When filing an issue, if possible, please include: - - * A clear description of the problem - * The platform you are testing on (web, desktop, OS) - * A link/attachment to the SWF demonstrating the issue, if possible - * Screenshots if the issue is a visible problem - * Bonus points for including the correct output from the official Flash Player - -These types of focused issues are helpful: - - * Tracking issues for specific Flash features (ActionScript 3.0, drawing API, etc.) - * Bug reports for specific content that works but isn't quite right (art not looking correct, etc.) - * Platform-specific issues - * Enhancement requests to improve user experience - -The project is still in the early stages, so many Flash features are unimplemented and not yet expected to work. Please avoid filing generic issues such as: - - * A "this SWF doesn't work at all" report (what about it doesn't work?) - * Duplicate issues for each piece of content using an unimplemented feature - * Asking for dates when a feature will be implemented - -## Code Guidelines - -Ruffle is built using the latest stable version of the Rust compiler. Nightly and unstable features should be avoided. - -The Rust code in Ruffle strives to be idiomatic. The Rust compiler should emit no warnings when building the project. Additionally, all code should be formatted using [`rustfmt`](https://github.com/rust-lang/rustfmt) and linted using [`clippy`](https://github.com/rust-lang/rust-clippy). You can install these tools using `rustup`: - -``` -rustup component add rustfmt -rustup component add clippy -``` - -You can auto-format your changes with `rustfmt`: - -`cargo run fmt --all` - -and you can run the clippy lints: - -`cargo clippy --all --tests` - -Specific warnings and clippy lints can be allowed when appropriate using attributes, such as: - -`#[allow(clippy::float_cmp)]` - -## Commit Message Guidelines - -Here is a sample commit message: - -`web: Fix incorrect rendering of gradients (close #23)` - - * If applicable, prefix the first line with a tag indicating the relevant area of changes: - * `core:` - * `desktop:` - * `web:` - * `avm1:` - * `docs:` - * `chore:` - * Capitalize the first letter following the tag - * Limit line length to 72 characters - * Use the present tense and imperative mood ("fix", not "fixed" nor "fixes") - * Reference any PRs or issues in the first line - * Use keywords to close/address issues when applicable ("close #23") - * Write more detailed info on following lines when applicable - -## Pull Requests - -Pull requests are the primary way to contribute code to Ruffle. Pull requests should be made against the latest `master` branch. Your pull request should not contain merges; you should always rebase when bringing the latest changes into your branch from the `master` branch. If there are merge conflicts, or if your commit history is messy, please rebase onto the latest master. [`git rebase -i`](https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history#interactive-rebase) is a great way to clean up your pull request. - -When you make a pull request, our [CI](https://circleci.com/gh/ruffle-rs/ruffle) will build your changes and run them through all tests and style checks. All of these tests should pass before your pull request can be accepted. - -One of [our regular contributors](https://github.com/orgs/ruffle-rs/people) will review your changes and try their best to helpfully suggest any changes. If all goes well, your PR should be merged without much delay. We use both standard merge commits and fast-forward merges depending on the size of the changes. Thanks for your contribution! +# Contributing to Ruffle + +🎉 Thanks for your interest in Ruffle! Contributions of all kinds are welcome. + +This document serves as a general guide for contributing to Ruffle. Follow your best judgement in following these guidelines. + +## Table of Contents + + * [Getting Started](#getting-started) + * [Ways to Contribute](#ways-to-contribute) + * [Test your favorite Flash content](#test-your-favorite-flash-content) + * [Improve documentation](#improve-documentation) + * [Fix interesting issues](#fix-interesting-issues) + * [Implement missing Flash functionality](#implement-missing-flash-functionality) + * [Reporting Bugs](#reporting-bugs) + * [Code Guidelines](#code-guidelines) + * [Commit Message Guidelines](#commit-guidelines) + * [Pull Requests](#pull-requests) + +## Getting Started + +The [Ruffle wiki](https://github.com/ruffle-rs/ruffle/wiki) is a great way to familiarize yourself with the project. It contains info on how to building Ruffle, using Ruffle, and links to helpful documentation about the Flash format. + +Feel free to ask questions in our [Discord server](https://discord.gg/J8hgCQN). + +## Ways to Contribute + +We love new contributors! You can contribute to Ruffle in several ways: + +### Test your favorite Flash content + +Try out your favorite SWF content in Ruffle and see how it works! Follow the instructions on the [Using Ruffle](https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle) page to get Ruffle for your desired platform. You can run the SWF through the desktop player, the web demo, or try the extension on live websites. + +If you encounter specific issues with content, please follow the guidelines on filing an issue. + +### Improve documentation + +Improving documentation is a great way to learn the codebase. Adding documentation to both the wiki and the code eases the learning curve for both end users and new contributors. + +For documentation in the code, we follow the [rustdoc](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments) guidelines. + +### Fix interesting issues + +Try your hand at fixing [issues that are interesting to you](https://github.com/ruffle-rs/ruffle/issues). Follow the instructions on [building Ruffle](https://github.com/ruffle-rs/ruffle/wiki/Building-Ruffle), familiarize yourself with the [project layout](https://github.com/ruffle-rs/ruffle/wiki/Project-Layout), and use [SWF resources and decompilers](https://github.com/ruffle-rs/ruffle/wiki/Helpful-Resources) to help debug the issue. + +You can also ask for mentoring on our [Discord server](https://discord.gg/J8hgCQN). + +### Implement missing Flash functionality + +Ruffle is a young project, and there is still much Flash functionality that is unimplemented. Check for the ["unimplemented"](https://github.com/ruffle-rs/ruffle/issues?q=is%3Aissue+is%3Aopen+label%3Aunimplemented) in issues. + +## Reporting bugs + +[Issue reports and feature requests](https://github.com/ruffle-rs/ruffle/issues) are encouraged, and are a great way to measure our progress! + +When filing an issue, if possible, please include: + + * A clear description of the problem + * The platform you are testing on (web, desktop, OS) + * A link/attachment to the SWF demonstrating the issue, if possible + * Screenshots if the issue is a visible problem + * Bonus points for including the correct output from the official Flash Player + +These types of focused issues are helpful: + + * Tracking issues for specific Flash features (ActionScript 3.0, drawing API, etc.) + * Bug reports for specific content that works but isn't quite right (art not looking correct, etc.) + * Platform-specific issues + * Enhancement requests to improve user experience + +The project is still in the early stages, so many Flash features are unimplemented and not yet expected to work. Please avoid filing generic issues such as: + + * A "this SWF doesn't work at all" report (what about it doesn't work?) + * Duplicate issues for each piece of content using an unimplemented feature + * Asking for dates when a feature will be implemented + +## Code Guidelines + +Ruffle is built using the latest stable version of the Rust compiler. Nightly and unstable features should be avoided. + +The Rust code in Ruffle strives to be idiomatic. The Rust compiler should emit no warnings when building the project. Additionally, all code should be formatted using [`rustfmt`](https://github.com/rust-lang/rustfmt) and linted using [`clippy`](https://github.com/rust-lang/rust-clippy). You can install these tools using `rustup`: + +``` +rustup component add rustfmt +rustup component add clippy +``` + +You can auto-format your changes with `rustfmt`: + +`cargo run fmt --all` + +and you can run the clippy lints: + +`cargo clippy --all --tests` + +Specific warnings and clippy lints can be allowed when appropriate using attributes, such as: + +`#[allow(clippy::float_cmp)]` + +## Commit Message Guidelines + +Here is a sample commit message: + +`web: Fix incorrect rendering of gradients (close #23)` + + * If applicable, prefix the first line with a tag indicating the relevant area of changes: + * `core:` + * `desktop:` + * `web:` + * `avm1:` + * `docs:` + * `chore:` + * Capitalize the first letter following the tag + * Limit line length to 72 characters + * Use the present tense and imperative mood ("fix", not "fixed" nor "fixes") + * Reference any PRs or issues in the first line + * Use keywords to close/address issues when applicable ("close #23") + * Write more detailed info on following lines when applicable + +## Pull Requests + +Pull requests are the primary way to contribute code to Ruffle. Pull requests should be made against the latest `master` branch. Your pull request should not contain merges; you should always rebase when bringing the latest changes into your branch from the `master` branch. If there are merge conflicts, or if your commit history is messy, please rebase onto the latest master. [`git rebase -i`](https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history#interactive-rebase) is a great way to clean up your pull request. + +When you make a pull request, our [CI](https://circleci.com/gh/ruffle-rs/ruffle) will build your changes and run them through all tests and style checks. All of these tests should pass before your pull request can be accepted. + +One of [our regular contributors](https://github.com/orgs/ruffle-rs/people) will review your changes and try their best to helpfully suggest any changes. If all goes well, your PR should be merged without much delay. We use both standard merge commits and fast-forward merges depending on the size of the changes. Thanks for your contribution! diff --git a/core/tests/swfs/avm1/goto_advance1/output.txt b/core/tests/swfs/avm1/goto_advance1/output.txt index 4b68fe3c1..ebe26a721 100644 --- a/core/tests/swfs/avm1/goto_advance1/output.txt +++ b/core/tests/swfs/avm1/goto_advance1/output.txt @@ -1 +1 @@ -child frame 1 +child frame 1 diff --git a/core/tests/swfs/avm1/goto_advance2/output.txt b/core/tests/swfs/avm1/goto_advance2/output.txt index c2b44ceb6..bebe2a0ce 100644 --- a/core/tests/swfs/avm1/goto_advance2/output.txt +++ b/core/tests/swfs/avm1/goto_advance2/output.txt @@ -1,2 +1,2 @@ -child frame 1 -child frame 1 +child frame 1 +child frame 1 diff --git a/core/tests/swfs/avm1/goto_both_ways1/output.txt b/core/tests/swfs/avm1/goto_both_ways1/output.txt index e345dd723..4dc7505ac 100644 --- a/core/tests/swfs/avm1/goto_both_ways1/output.txt +++ b/core/tests/swfs/avm1/goto_both_ways1/output.txt @@ -1,3 +1,3 @@ -gotoAndPlay(3) -child frame 1 -gotoAndStop(2) +gotoAndPlay(3) +child frame 1 +gotoAndStop(2) diff --git a/core/tests/swfs/avm1/goto_both_ways2/output.txt b/core/tests/swfs/avm1/goto_both_ways2/output.txt index b589d4fb3..dc442eaa7 100644 --- a/core/tests/swfs/avm1/goto_both_ways2/output.txt +++ b/core/tests/swfs/avm1/goto_both_ways2/output.txt @@ -1,3 +1,3 @@ -child frame 1 -gotoAndPlay(5) -gotoAndStop(3) +child frame 1 +gotoAndPlay(5) +gotoAndStop(3) diff --git a/core/tests/swfs/avm1/goto_rewind1/output.txt b/core/tests/swfs/avm1/goto_rewind1/output.txt index 4b68fe3c1..ebe26a721 100644 --- a/core/tests/swfs/avm1/goto_rewind1/output.txt +++ b/core/tests/swfs/avm1/goto_rewind1/output.txt @@ -1 +1 @@ -child frame 1 +child frame 1 diff --git a/core/tests/swfs/avm1/goto_rewind2/output.txt b/core/tests/swfs/avm1/goto_rewind2/output.txt index 79931489f..37548b306 100644 --- a/core/tests/swfs/avm1/goto_rewind2/output.txt +++ b/core/tests/swfs/avm1/goto_rewind2/output.txt @@ -1,3 +1,3 @@ -child frame 1 -child frame 1 -child frame 1 +child frame 1 +child frame 1 +child frame 1 diff --git a/core/tests/swfs/avm1/goto_rewind3/output.txt b/core/tests/swfs/avm1/goto_rewind3/output.txt index b720b27be..34ee9e41a 100644 --- a/core/tests/swfs/avm1/goto_rewind3/output.txt +++ b/core/tests/swfs/avm1/goto_rewind3/output.txt @@ -1,2 +1,2 @@ -gotoAndPlay(4) -child frame 1 +gotoAndPlay(4) +child frame 1 diff --git a/core/tests/swfs/avm1/tell_target/output.txt b/core/tests/swfs/avm1/tell_target/output.txt index b2de9e9f0..53f73b91f 100644 --- a/core/tests/swfs/avm1/tell_target/output.txt +++ b/core/tests/swfs/avm1/tell_target/output.txt @@ -1,9 +1,9 @@ -n: 1 -tellTarget('clip2') { - n: 2 - tellTarget('INVALID') { - n: 9 - } - n: 2 -} -n: 1 +n: 1 +tellTarget('clip2') { + n: 2 + tellTarget('INVALID') { + n: 9 + } + n: 2 +} +n: 1 diff --git a/core/tests/swfs/avm1/typeof/output.txt b/core/tests/swfs/avm1/typeof/output.txt index f19955fa7..2b6b764af 100755 --- a/core/tests/swfs/avm1/typeof/output.txt +++ b/core/tests/swfs/avm1/typeof/output.txt @@ -1,14 +1,14 @@ -number -number -boolean -boolean -null -undefined -string -string -string -string -string -string -string -string +number +number +boolean +boolean +null +undefined +string +string +string +string +string +string +string +string diff --git a/core/tests/swfs/avm1/typeof_globals/output.txt b/core/tests/swfs/avm1/typeof_globals/output.txt index 3dad7101e..76dfc6acb 100755 --- a/core/tests/swfs/avm1/typeof_globals/output.txt +++ b/core/tests/swfs/avm1/typeof_globals/output.txt @@ -1,7 +1,7 @@ -number -string -number -string -number -string -string +number +string +number +string +number +string +string diff --git a/swf/Cargo.toml b/swf/Cargo.toml index d2778c5d4..58407c8a6 100644 --- a/swf/Cargo.toml +++ b/swf/Cargo.toml @@ -1,23 +1,23 @@ -[package] -name = "swf" -version = "0.1.2" -edition = "2018" -authors = ["Mike Welsh"] -repository = "https://github.com/ruffle-rs/ruffle" -homepage = "https://github.com/ruffle-rs/ruffle" -license = "MIT OR Apache-2.0" -readme = "README.md" -description = "Read and write the Adobe Flash SWF file format." - -[dependencies] -byteorder = "1.0" -num-derive = "0.2" -num-traits = "0.2" -libflate = {version = "0.1", optional = true} -log = "0.4" -flate2 = {version = "1.0", optional = true} -xz2 = {version = "0.1.5", optional = true} - -[features] -default = ["libflate"] +[package] +name = "swf" +version = "0.1.2" +edition = "2018" +authors = ["Mike Welsh"] +repository = "https://github.com/ruffle-rs/ruffle" +homepage = "https://github.com/ruffle-rs/ruffle" +license = "MIT OR Apache-2.0" +readme = "README.md" +description = "Read and write the Adobe Flash SWF file format." + +[dependencies] +byteorder = "1.0" +num-derive = "0.2" +num-traits = "0.2" +libflate = {version = "0.1", optional = true} +log = "0.4" +flate2 = {version = "1.0", optional = true} +xz2 = {version = "0.1.5", optional = true} + +[features] +default = ["libflate"] lzma-support = ["xz2"] \ No newline at end of file diff --git a/swf/tests/swfs/AddPlaceObject4Data.jsfl b/swf/tests/swfs/AddPlaceObject4Data.jsfl index a5cc0da10..6e7c7b9fe 100644 --- a/swf/tests/swfs/AddPlaceObject4Data.jsfl +++ b/swf/tests/swfs/AddPlaceObject4Data.jsfl @@ -1,12 +1,12 @@ -var document = fl.getDocumentDOM(); -if(document) { - var element = document.getTimeline().layers[0].frames[0].elements[0]; - if(element) { - element.setPersistentData("test", "string", "Testing!"); - element.setPublishPersistentData("test", "_EMBED_SWF_", true); - document.setPublishDocumentData("_EMBED_SWF_", true); +var document = fl.getDocumentDOM(); +if(document) { + var element = document.getTimeline().layers[0].frames[0].elements[0]; + if(element) { + element.setPersistentData("test", "string", "Testing!"); + element.setPublishPersistentData("test", "_EMBED_SWF_", true); + document.setPublishDocumentData("_EMBED_SWF_", true); alert("Added PlaceObject4 data for clip."); - } else { + } else { alert("Please select a symbol in the library."); } } \ No newline at end of file diff --git a/swf/tests/swfs/Avm2Test.as b/swf/tests/swfs/Avm2Test.as index d0acde1af..b58841ee6 100644 --- a/swf/tests/swfs/Avm2Test.as +++ b/swf/tests/swfs/Avm2Test.as @@ -1,6 +1,6 @@ -package { - public function Avm2Test():void { +package { + public function Avm2Test():void { trace("Test"); - } - Avm2Test(); -} + } + Avm2Test(); +} diff --git a/swf/tests/swfs/EmbedData.as b/swf/tests/swfs/EmbedData.as index d3e9ad19a..fdcb342f1 100644 --- a/swf/tests/swfs/EmbedData.as +++ b/swf/tests/swfs/EmbedData.as @@ -1,7 +1,7 @@ -package { - import flash.utils.ByteArray; - - [Embed(source="embed-data.txt", mimeType="application/octet-stream")] - public class EmbedData extends ByteArray { - } +package { + import flash.utils.ByteArray; + + [Embed(source="embed-data.txt", mimeType="application/octet-stream")] + public class EmbedData extends ByteArray { + } } \ No newline at end of file