forked from rojo-rbx/rojo
Implement glob ignores (#272)
* Add Glob wrapper type with better serialization * Introduce PathIgnoreRule struct * Implement equality for Glob type * Add PathIgnoreRule to InstanceContext * Implement glob ignores in directory middleware * Fix up filters * Use Iterator::all instead of loop * Add project-level configuration for glob ignores * Add test project for glob ignores * Wire up project file and snapshots to make glob ignores work * Better codepaths for adding ignore rules with empty iterators * Add test for globs inherited from parent projects * Add test details, support glob ignores in nested projects * Add feature flag for globs * Switch to use ExactSizeIterator instead of size_hint * Remove glob visitor
This commit is contained in:
committed by
GitHub
parent
ae811aafd0
commit
e261e7a2c7
@@ -5,6 +5,11 @@ authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
unstable_glob_ignore_paths = []
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.6.2"
|
||||
log = "0.4.8"
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">ignore_glob_inner</string>
|
||||
</Properties>
|
||||
<Item class="Folder" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">src</string>
|
||||
</Properties>
|
||||
<Item class="ModuleScript" referent="2">
|
||||
<Properties>
|
||||
<string name="Name">outer.spec</string>
|
||||
<string name="Source">-- This file should be included.</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
<Item class="Folder" referent="3">
|
||||
<Properties>
|
||||
<string name="Name">subproject</string>
|
||||
</Properties>
|
||||
<Item class="ModuleScript" referent="4">
|
||||
<Properties>
|
||||
<string name="Name">inner</string>
|
||||
<string name="Source">-- This file should be included.</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">ignore_glob_nested</string>
|
||||
</Properties>
|
||||
<Item class="ModuleScript" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">include</string>
|
||||
<string name="Source">-- This file must be present.</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">ignore_glob_spec</string>
|
||||
</Properties>
|
||||
<Item class="ModuleScript" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">shouldBeIncluded</string>
|
||||
<string name="Source">-- this file should be present</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
2
rojo-test/build-tests/ignore_glob_inner/README.md
Normal file
2
rojo-test/build-tests/ignore_glob_inner/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# ignore_glob_inner
|
||||
Tests that glob ignores defined *inside* nested projects apply to those projects, but not anywhere else.
|
||||
14
rojo-test/build-tests/ignore_glob_inner/default.project.json
Normal file
14
rojo-test/build-tests/ignore_glob_inner/default.project.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "ignore_glob_inner",
|
||||
"tree": {
|
||||
"$className": "Folder",
|
||||
|
||||
"src": {
|
||||
"$path": "src"
|
||||
},
|
||||
|
||||
"subproject": {
|
||||
"$path": "subproject"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This file should be included.
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "subproject",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This file should be included.
|
||||
@@ -0,0 +1 @@
|
||||
-- This file should not be included.
|
||||
2
rojo-test/build-tests/ignore_glob_nested/README.md
Normal file
2
rojo-test/build-tests/ignore_glob_nested/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# ignore_glob_nested
|
||||
Tests that glob ignores defined in the root project also apply to nested projects.
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "ignore_glob_nested",
|
||||
"tree": {
|
||||
"$path": "subproject"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "subproject",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This file must not be present.
|
||||
@@ -0,0 +1 @@
|
||||
-- This file must be present.
|
||||
2
rojo-test/build-tests/ignore_glob_spec/README.md
Normal file
2
rojo-test/build-tests/ignore_glob_spec/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# ignore_glob_spec
|
||||
Tests that glob ignores work for the original use case: ignoring files in the same project that end in `.spec.lua`.
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "ignore_glob_spec",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
},
|
||||
"globIgnorePaths": [
|
||||
"**/*.spec.lua"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- this file should be present
|
||||
@@ -0,0 +1 @@
|
||||
-- this file should not be present
|
||||
@@ -45,6 +45,13 @@ gen_build_tests! {
|
||||
txt_in_folder,
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable_glob_ignore_paths")]
|
||||
gen_build_tests! {
|
||||
ignore_glob_inner,
|
||||
ignore_glob_nested,
|
||||
ignore_glob_spec,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_plain_txt() {
|
||||
run_build_test("plain.txt");
|
||||
|
||||
Reference in New Issue
Block a user