-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate predefined counter styles (allows atoms crate to be published) #99
Open
nicoburns
wants to merge
3
commits into
servo:main
Choose a base branch
from
nicoburns:duplicate-predefined-counter-styles
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
workflow_dispatch: | ||
merge_group: | ||
types: [checks_requested] | ||
|
||
|
||
jobs: | ||
linux-debug: | ||
name: Linux (Debug) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Run Tests | ||
run: cargo build --features servo | ||
env: | ||
RUST_BACKTRACE: 1 | ||
|
||
linux-release: | ||
name: Linux (Release) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Run Tests | ||
run: cargo build --release --features servo | ||
env: | ||
RUST_BACKTRACE: 1 | ||
|
||
build-result: | ||
name: Result | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
needs: | ||
- linux-debug | ||
- linux-release | ||
steps: | ||
- name: Success | ||
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | ||
run: exit 0 | ||
- name: Failure | ||
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | ||
run: exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 🪞 Mirror `main` | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
mirror: | ||
name: Mirror | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get branch name | ||
id: branch-name | ||
run: | | ||
first_commit=$(git log --pretty=\%H --grep='Servo initial downstream commit') | ||
upstream_base="$first_commit~" | ||
echo BRANCH_NAME=$(git log -n1 --pretty='%as' $upstream_base) >> $GITHUB_OUTPUT | ||
- uses: google/[email protected] | ||
name: Mirror to ${{ steps.branch-name.outputs.BRANCH_NAME }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
source: main | ||
dest: ${{ steps.branch-name.outputs.BRANCH_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Sync upstream with mozilla-central | ||
|
||
on: | ||
schedule: | ||
- cron: '0 13 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync: | ||
name: Sync | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: _cache/upstream | ||
key: upstream | ||
- run: | | ||
./sync.sh _filtered | ||
git fetch -f --progress ./_filtered master:upstream | ||
git push -fu --progress origin upstream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/_cache/ | ||
/_filtered/ | ||
/target/ | ||
/style/properties/__pycache__/ | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"dom", | ||
"malloc_size_of", | ||
"rustfmt.toml", | ||
"selectors", | ||
"servo_arc", | ||
"style", | ||
"style_derive", | ||
"style_static_prefs", | ||
"style_traits", | ||
"to_shmem", | ||
"to_shmem_derive", | ||
] | ||
default-members = ["style"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
Stylo | ||
===== | ||
|
||
This repo contains Servo’s downstream fork of [Stylo](https://searchfox.org/mozilla-central/source/servo). | ||
|
||
The branches are as follows: | ||
|
||
- [`upstream`](https://github.com/servo/style/tree/upstream) has upstream mozilla-central filtered to the paths we care about ([style.paths](style.paths)), but is otherwise unmodified | ||
- [`main`](https://github.com/servo/style/tree/ci) has our downstream patches, plus the scripts and workflows for syncing with mozilla-central, to be rebased onto `upstream` | ||
|
||
## Building Servo against your local Stylo | ||
|
||
Assuming your local `servo` and `stylo` directories are siblings, you can build `servo` against `stylo` by adding the following to `servo/Cargo.toml`: | ||
|
||
```toml | ||
[patch."https://github.com/servo/stylo.git"] | ||
derive_common = { path = "../stylo/derive_common" } | ||
malloc_size_of = { path = "../stylo/malloc_size_of" } | ||
selectors = { path = "../stylo/selectors" } | ||
servo_arc = { path = "../stylo/servo_arc" } | ||
servo_atoms = { path = "../stylo/atoms" } | ||
size_of_test = { path = "../stylo/size_of_test" } | ||
static_prefs = { path = "../stylo/style_static_prefs" } | ||
style_config = { path = "../stylo/style_config" } | ||
style_derive = { path = "../stylo/style_derive" } | ||
style = { path = "../stylo/style" } | ||
style_traits = { path = "../stylo/style_traits" } | ||
``` | ||
|
||
## Syncing `upstream` with mozilla-central | ||
|
||
Start by generating a filtered copy of mozilla-central. This will cache the raw mozilla-central in `_cache/upstream`, storing the result in `_filtered`: | ||
|
||
```sh | ||
$ ./sync.sh _filtered | ||
``` | ||
|
||
If `_filtered` already exists, you will need to delete it and try again: | ||
|
||
```sh | ||
$ rm -Rf _filtered | ||
``` | ||
|
||
Now overwrite our `upstream` with those commits and push: | ||
|
||
```sh | ||
$ git fetch -f --progress ./_filtered master:upstream | ||
$ git push -fu --progress origin upstream | ||
``` | ||
|
||
## Rebasing `main` onto `upstream` | ||
|
||
Start by fetching `upstream` into your local repo: | ||
|
||
```sh | ||
$ git fetch -f origin upstream:upstream | ||
``` | ||
|
||
In general, the filtering process is deterministic, yielding the same commit hashes each time, so we can rebase normally: | ||
|
||
```sh | ||
$ git rebase upstream | ||
``` | ||
|
||
But if the filtering config changes or Mozilla moves to GitHub, the commit hashes on `upstream` may change. In this case, we need to tell git where the old upstream ends and our own commits start (notice the `~`): | ||
|
||
```sh | ||
$ git log --pretty=\%H --grep='Servo initial downstream commit' | ||
e62d7f0090941496e392e1dc91df103a38e3f488 | ||
|
||
$ git rebase --onto upstream e62d7f0090941496e392e1dc91df103a38e3f488~ | ||
Successfully rebased and updated refs/heads/main. | ||
``` | ||
|
||
`start-rebase.sh` takes care of this automatically, but you should still use `git rebase` for subsequent steps like `--continue` and `--abort`: | ||
|
||
```sh | ||
$ ./start-rebase.sh upstream | ||
$ ./start-rebase.sh upstream -i # interactive | ||
$ git rebase --continue # not ./start-rebase.sh --continue | ||
$ git rebase --abort # not ./start-rebase.sh --abort | ||
``` | ||
|
||
Or if we aren’t ready to rebase onto the tip of upstream: | ||
|
||
```sh | ||
$ ./start-rebase.sh upstream~10 -i | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "servo_atoms" | ||
version = "0.0.1" | ||
authors = ["The Servo Project Developers"] | ||
license = "MPL-2.0" | ||
edition = "2018" | ||
publish = false | ||
build = "build.rs" | ||
|
||
[lib] | ||
path = "lib.rs" | ||
|
||
[dependencies] | ||
string_cache = "0.8" | ||
|
||
[build-dependencies] | ||
string_cache_codegen = "0.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
use std::env; | ||
use std::fs::File; | ||
use std::io::{BufRead, BufReader}; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
let static_atoms = | ||
Path::new(&env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("static_atoms.txt"); | ||
let static_atoms = BufReader::new(File::open(&static_atoms).unwrap()); | ||
let mut atom_type = string_cache_codegen::AtomType::new("Atom", "atom!"); | ||
|
||
macro_rules! predefined { | ||
($($name: expr,)+) => { | ||
{ | ||
$( | ||
atom_type.atom($name); | ||
)+ | ||
} | ||
} | ||
} | ||
include!("./predefined_counter_styles.rs"); | ||
|
||
atom_type | ||
.atoms(static_atoms.lines().map(Result::unwrap)) | ||
.write_to_file(&Path::new(&env::var_os("OUT_DIR").unwrap()).join("atom.rs")) | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
include!(concat!(env!("OUT_DIR"), "/atom.rs")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
// THIS FILE IS DUPLICATED FROM style/counter_style/predefined.rs. | ||
// TO UPDATE IT: | ||
// - Run `python style/counter_style/updated_predefined.py` | ||
// - Re-copy style/counter_style/predefined.rs to this location | ||
|
||
predefined! { | ||
"decimal", | ||
"decimal-leading-zero", | ||
"arabic-indic", | ||
"armenian", | ||
"upper-armenian", | ||
"lower-armenian", | ||
"bengali", | ||
"cambodian", | ||
"khmer", | ||
"cjk-decimal", | ||
"devanagari", | ||
"georgian", | ||
"gujarati", | ||
"gurmukhi", | ||
"hebrew", | ||
"kannada", | ||
"lao", | ||
"malayalam", | ||
"mongolian", | ||
"myanmar", | ||
"oriya", | ||
"persian", | ||
"lower-roman", | ||
"upper-roman", | ||
"tamil", | ||
"telugu", | ||
"thai", | ||
"tibetan", | ||
"lower-alpha", | ||
"lower-latin", | ||
"upper-alpha", | ||
"upper-latin", | ||
"cjk-earthly-branch", | ||
"cjk-heavenly-stem", | ||
"lower-greek", | ||
"hiragana", | ||
"hiragana-iroha", | ||
"katakana", | ||
"katakana-iroha", | ||
"disc", | ||
"circle", | ||
"square", | ||
"disclosure-open", | ||
"disclosure-closed", | ||
"japanese-informal", | ||
"japanese-formal", | ||
"korean-hangul-formal", | ||
"korean-hanja-informal", | ||
"korean-hanja-formal", | ||
"simp-chinese-informal", | ||
"simp-chinese-formal", | ||
"trad-chinese-informal", | ||
"trad-chinese-formal", | ||
"cjk-ideographic", | ||
"ethiopic-numeric", | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better way to do this would probably be to have the import script duplicate this file into the atoms directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think about that but this directory doesn't exist at import time either (at least not when calling git filter-repo) because it's not upstream. I suppose we could add a post rebase step to sync and squash this file? But that seems like it might be quite fragile?