From 517c08e801191f8566422be987e8f91b79a6d4c5 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 3 Oct 2019 11:07:53 -0700 Subject: [PATCH] Make output directory a build input (#41862) --- .../flutter_tools/lib/src/build_system/build_system.dart | 3 +-- .../test/general.shard/build_system/build_system_test.dart | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/build_system/build_system.dart b/packages/flutter_tools/lib/src/build_system/build_system.dart index e2bdbb8ccd..0184f5cb9a 100644 --- a/packages/flutter_tools/lib/src/build_system/build_system.dart +++ b/packages/flutter_tools/lib/src/build_system/build_system.dart @@ -292,8 +292,7 @@ class Environment { buffer.write(key); buffer.write(defines[key]); } - // in case there was no configuration, provide some value. - buffer.write('Flutter is awesome'); + buffer.write(outputDir.path); final String output = buffer.toString(); final Digest digest = md5.convert(utf8.encode(output)); buildPrefix = hex.encode(digest.bytes); diff --git a/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart b/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart index b872ec7ea1..809ea0349f 100644 --- a/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart @@ -334,6 +334,13 @@ void main() { await buildSystem.build(target, environment); expect(called, 1); })); + + test('output directory is an input to the build', () => testbed.run(() async { + final Environment environmentA = Environment(projectDir: fs.currentDirectory, outputDir: fs.directory('a')); + final Environment environmentB = Environment(projectDir: fs.currentDirectory, outputDir: fs.directory('b')); + + expect(environmentA.buildDir.path, isNot(environmentB.buildDir.path)); + })); } class MockPlatform extends Mock implements Platform {}