Unverified Commit 2b8c75d5 authored by Emmanuel Garcia's avatar Emmanuel Garcia Committed by GitHub

Copy the local engine repo in the output directory (#49276)

parent 10fb0182
...@@ -33,7 +33,7 @@ void configureProject(Project project, String outputDir) { ...@@ -33,7 +33,7 @@ void configureProject(Project project, String outputDir) {
project.android.libraryVariants.all { variant -> project.android.libraryVariants.all { variant ->
addAarTask(project, variant) addAarTask(project, variant)
} }
project.uploadArchives { project.uploadArchives {
repositories { repositories {
mavenDeployer { mavenDeployer {
......
...@@ -546,6 +546,19 @@ Future<void> buildGradleAar({ ...@@ -546,6 +546,19 @@ Future<void> buildGradleAar({
command.add('-Plocal-engine-repo=${localEngineRepo.path}'); command.add('-Plocal-engine-repo=${localEngineRepo.path}');
command.add('-Plocal-engine-build-mode=${androidBuildInfo.buildInfo.modeName}'); command.add('-Plocal-engine-build-mode=${androidBuildInfo.buildInfo.modeName}');
command.add('-Plocal-engine-out=${localEngineArtifacts.engineOutPath}'); command.add('-Plocal-engine-out=${localEngineArtifacts.engineOutPath}');
// Copy the local engine repo in the output directory.
try {
fsUtils.copyDirectorySync(
localEngineRepo,
getRepoDirectory(outputDirectory),
);
} on FileSystemException catch(_) {
throwToolExit(
'Failed to copy the local engine ${localEngineRepo.path} repo '
'in ${outputDirectory.path}'
);
}
} }
command.add(aarTask); command.add(aarTask);
......
...@@ -1055,10 +1055,12 @@ plugin1=${plugin1.path} ...@@ -1055,10 +1055,12 @@ plugin1=${plugin1.path}
MockProcessManager mockProcessManager; MockProcessManager mockProcessManager;
FakePlatform android; FakePlatform android;
FileSystem fileSystem; FileSystem fileSystem;
FileSystemUtils fileSystemUtils;
Cache cache; Cache cache;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem(); fileSystem = MemoryFileSystem();
fileSystemUtils = MockFileSystemUtils();
mockAndroidSdk = MockAndroidSdk(); mockAndroidSdk = MockAndroidSdk();
mockAndroidStudio = MockAndroidStudio(); mockAndroidStudio = MockAndroidStudio();
mockArtifacts = MockLocalEngineArtifacts(); mockArtifacts = MockLocalEngineArtifacts();
...@@ -1773,6 +1775,12 @@ plugin1=${plugin1.path} ...@@ -1773,6 +1775,12 @@ plugin1=${plugin1.path}
''' '''
); );
fileSystem.directory('.android/gradle')
.createSync(recursive: true);
fileSystem.directory('.android/gradle/wrapper')
.createSync(recursive: true);
fileSystem.file('.android/gradlew').createSync(recursive: true); fileSystem.file('.android/gradlew').createSync(recursive: true);
fileSystem.file('.android/gradle.properties') fileSystem.file('.android/gradle.properties')
...@@ -1790,6 +1798,8 @@ plugin1=${plugin1.path} ...@@ -1790,6 +1798,8 @@ plugin1=${plugin1.path}
fileSystem.directory('build/outputs/repo').createSync(recursive: true); fileSystem.directory('build/outputs/repo').createSync(recursive: true);
when(fileSystemUtils.copyDirectorySync(any, any)).thenReturn(null);
await buildGradleAar( await buildGradleAar(
androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null)), androidBuildInfo: const AndroidBuildInfo(BuildInfo(BuildMode.release, null)),
project: FlutterProject.current(), project: FlutterProject.current(),
...@@ -1812,6 +1822,15 @@ plugin1=${plugin1.path} ...@@ -1812,6 +1822,15 @@ plugin1=${plugin1.path}
expect(actualGradlewCall, contains('-Plocal-engine-build-mode=release')); expect(actualGradlewCall, contains('-Plocal-engine-build-mode=release'));
expect(actualGradlewCall, contains('-PbuildNumber=2.0')); expect(actualGradlewCall, contains('-PbuildNumber=2.0'));
// Verify the local engine repo is copied into the generated Maven repo.
final List<dynamic> copyDirectoryArguments = verify(
fileSystemUtils.copyDirectorySync(captureAny, captureAny)
).captured;
expect(copyDirectoryArguments.length, 2);
expect((copyDirectoryArguments.first as Directory).path, '/.tmp_rand0/flutter_tool_local_engine_repo.rand0');
expect((copyDirectoryArguments.last as Directory).path, 'build/outputs/repo');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
AndroidSdk: () => mockAndroidSdk, AndroidSdk: () => mockAndroidSdk,
AndroidStudio: () => mockAndroidStudio, AndroidStudio: () => mockAndroidStudio,
...@@ -1819,6 +1838,7 @@ plugin1=${plugin1.path} ...@@ -1819,6 +1838,7 @@ plugin1=${plugin1.path}
Cache: () => cache, Cache: () => cache,
Platform: () => android, Platform: () => android,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
FileSystemUtils: () => fileSystemUtils,
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
}); });
...@@ -2047,6 +2067,7 @@ class MockAndroidProject extends Mock implements AndroidProject {} ...@@ -2047,6 +2067,7 @@ class MockAndroidProject extends Mock implements AndroidProject {}
class MockAndroidStudio extends Mock implements AndroidStudio {} class MockAndroidStudio extends Mock implements AndroidStudio {}
class MockDirectory extends Mock implements Directory {} class MockDirectory extends Mock implements Directory {}
class MockFile extends Mock implements File {} class MockFile extends Mock implements File {}
class MockFileSystemUtils extends Mock implements FileSystemUtils {}
class MockFlutterProject extends Mock implements FlutterProject {} class MockFlutterProject extends Mock implements FlutterProject {}
class MockLocalEngineArtifacts extends Mock implements LocalEngineArtifacts {} class MockLocalEngineArtifacts extends Mock implements LocalEngineArtifacts {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment