Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed test command.
  • Loading branch information
matanlurey committed May 15, 2024
commit 36a81aa536e5dd3bb51aa96bfa3ecdfa974185f5
4 changes: 2 additions & 2 deletions tools/engine_tool/lib/src/commands/build_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ et build //flutter/fml:fml_benchmarks # Build a specific target in `//flutter/f
final Gn gn = Gn.fromEnvironment(environment);
final Set<Label> allTargets = <Label>{};
for (final String pattern in argResults!.rest) {
final TargetPattern targetPattern = TargetPattern.parse(pattern);
final TargetPattern target = TargetPattern.parse(pattern);
final List<BuildTarget> targets = await gn.desc(
'out/${build.ninja.config}',
targetPattern,
target,
);
allTargets.addAll(targets.map((BuildTarget target) => target.label));
}
Expand Down
2 changes: 1 addition & 1 deletion tools/engine_tool/lib/src/commands/test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ et test //flutter/fml:fml_benchmarks # Run a single test target in `//flutter/f
for (final ExecutableBuildTarget target in testTargets) {
final List<String> commandLine = <String>[target.executable];
tasks.add(ProcessTask(
target.label.toNinjaLabel(),
target.label.toString(),
environment,
environment.engine.srcDir,
commandLine,
Expand Down
33 changes: 32 additions & 1 deletion tools/engine_tool/lib/src/gn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ interface class Gn {
if (target == null) {
return null;
}
return target;
}).whereType<BuildTarget>().toList();
}
}
Expand Down Expand Up @@ -111,7 +112,8 @@ sealed class BuildTarget {
'executable' => ExecutableBuildTarget(
label: Label.parseGn(label),
testOnly: testOnly,
executable: json.stringList('outputs').first,
// Remove the leading // from the path.
executable: json.stringList('outputs').first.substring(2),
),
'shared_library' || 'static_library' => LibraryBuildTarget(
label: Label.parseGn(label),
Expand All @@ -126,6 +128,14 @@ sealed class BuildTarget {

/// Whether a target is only used for testing.
final bool testOnly;

@mustBeOverridden
@override
bool operator ==(Object other);

@mustBeOverridden
@override
int get hashCode;
}

/// A build target that produces a [shared library][] or [static library][].
Expand All @@ -138,6 +148,16 @@ final class LibraryBuildTarget extends BuildTarget {
required super.label,
required super.testOnly,
});

@override
bool operator ==(Object other) {
return other is LibraryBuildTarget &&
label == other.label &&
testOnly == other.testOnly;
}

@override
int get hashCode => Object.hash(label, testOnly);
}

/// A build target that produces an [executable][] program.
Expand All @@ -153,4 +173,15 @@ final class ExecutableBuildTarget extends BuildTarget {

/// The path to the executable program.
final String executable;

@override
bool operator ==(Object other) {
return other is ExecutableBuildTarget &&
label == other.label &&
testOnly == other.testOnly &&
executable == other.executable;
}

@override
int get hashCode => Object.hash(label, testOnly, executable);
}