Commit 6e539c17 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

Bug 1322769 - Move dummy geckolib to toolkit/library, change taskgraph detection; r=froydnj

I want to get Servo vendored into servo/. The previous plan was to
replace the dummy geckolib with the real deal when the vendoring is
done. Unfortunately, this will require a significant `cargo vendor`
change, which we want to punt on for a bit.

So, this commit moves our dummy geckolib outside of servo/ so we
don't need to `cargo update` or `cargo vendor` when the real servo/
is installed.

The change to toolkit/library/rust/shared/Cargo.toml can be reverted
in the stylo repo to allow it to use the real geckolib.

We also update the taskgraph code for detecting Servo. Previously,
it looked for a file in the possibly-vendored servo/ directory. Once
the vendoring happens, this check will always pass. But without the
real geckolib, the Servo builds will fail. So, we change the check
to look for the real geckolib. This is implemented a bit hackily.
But it will be short-lived until we run `cargo vendor`.

MozReview-Commit-ID: CxGTwy6bK9j

--HG--
rename : servo/ports/geckolib/Cargo.toml => toolkit/library/geckolib/Cargo.toml
rename : servo/ports/geckolib/lib.rs => toolkit/library/geckolib/lib.rs
extra : rebase_source : c0e9c867ae74c4eb124e72dc481fd8dc814e65e7
parent b5ceb295
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -41,10 +41,16 @@ def filter_target_tasks(graph, parameters):
@filter_task('check_servo')
def filter_servo(graph, parameters):
    """Filters out tasks requiring Servo if Servo isn't present."""
    if os.path.exists(os.path.join(GECKO, 'servo', 'components', 'style')):
    # This filter is temporary until Servo's dependencies are vendored.
    cargo = os.path.join(GECKO, 'toolkit', 'library', 'rust', 'shared',
                         'Cargo.toml')
    with open(cargo, 'rb') as fh:
        cargo = fh.read()

    if b'servo/ports/geckolib' in cargo:
        return graph.tasks.keys()

    logger.info('servo/ directory not present; removing tasks requiring it')
    logger.info('real servo geckolib not used; removing tasks requiring it')

    SERVO_PLATFORMS = {
        'linux64-stylo',
+12 −3
Original line number Diff line number Diff line
@@ -40,11 +40,20 @@ class TestServoFilter(unittest.TestCase):
            'c': TestTask(kind='desktop-test', label='c', attributes={}),
        }, graph=Graph(nodes={'a', 'b', 'c'}, edges=set()))

        # Missing servo/ directory should prune tasks requiring Servo.
        shared = os.path.join(self._tmpdir, 'toolkit', 'library', 'rust', 'shared')
        cargo = os.path.join(shared, 'Cargo.toml')
        os.makedirs(shared)
        with open(cargo, 'a'):
            pass

        # Default Cargo.toml should result in Servo tasks being pruned.
        self.assertEqual(set(filter_tasks.filter_servo(graph, {})), {'a', 'c'})

        # Servo tasks should be retained if servo/components/style/ present.
        os.makedirs(os.path.join(self._tmpdir, 'servo', 'components', 'style'))
        # Servo tasks should be retained if real geckolib is present.
        with open(cargo, 'wb') as fh:
            fh.write(b'[dependencies]\n')
            fh.write(b'geckoservo = { path = "../../../../servo/ports/geckolib" }\n')

        self.assertEqual(set(filter_tasks.filter_servo(graph, {})),
                         {'a', 'b', 'c'})

+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ license = "MPL-2.0"
description = "Shared Rust code for libxul"

[dependencies]
geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
geckoservo = { path = "../../geckolib", optional = true }
mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" }