Unverified Commit 697547c3 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Fix prepare package (#76898)

parent 24bf6b81
...@@ -370,9 +370,29 @@ class ArchiveCreator { ...@@ -370,9 +370,29 @@ class ArchiveCreator {
// Yes, we could just skip all .packages files when constructing // Yes, we could just skip all .packages files when constructing
// the archive, but some are checked in, and we don't want to skip // the archive, but some are checked in, and we don't want to skip
// those. // those.
await _runGit(<String>['clean', '-f', '-X', '**/.packages']); await _runGit(<String>[
'clean',
'-f',
// Do not -X as it could lead to entire bin/cache getting cleaned
'-x',
'--',
'**/.packages',
]);
/// Remove package_config files and any contents in .dart_tool /// Remove package_config files and any contents in .dart_tool
await _runGit(<String>['clean', '-f', '-X', '**/.dart_tool']); await _runGit(<String>[
'clean',
'-f',
'-x',
'--',
'**/.dart_tool/',
]);
// Ensure the above commands do not clean out the cache
final Directory flutterCache = Directory(path.join(flutterRoot.absolute.path, 'bin', 'cache'));
if (!flutterCache.existsSync()) {
throw Exception('The flutter cache was not found at ${flutterCache.path}!');
}
/// Remove git subfolder from .pub-cache, this contains the flutter goldens /// Remove git subfolder from .pub-cache, this contains the flutter goldens
/// and new flutter_gallery. /// and new flutter_gallery.
final Directory gitCache = Directory(path.join(flutterRoot.absolute.path, '.pub-cache', 'git')); final Directory gitCache = Directory(path.join(flutterRoot.absolute.path, '.pub-cache', 'git'));
......
...@@ -70,6 +70,7 @@ void main() { ...@@ -70,6 +70,7 @@ void main() {
ArchiveCreator creator; ArchiveCreator creator;
Directory tempDir; Directory tempDir;
Directory flutterDir; Directory flutterDir;
Directory cacheDir;
FakeProcessManager processManager; FakeProcessManager processManager;
final List<List<String>> args = <List<String>>[]; final List<List<String>> args = <List<String>>[];
final List<Map<Symbol, dynamic>> namedArgs = <Map<Symbol, dynamic>>[]; final List<Map<Symbol, dynamic>> namedArgs = <Map<Symbol, dynamic>>[];
...@@ -86,6 +87,8 @@ void main() { ...@@ -86,6 +87,8 @@ void main() {
tempDir = Directory.systemTemp.createTempSync('flutter_prepage_package_test.'); tempDir = Directory.systemTemp.createTempSync('flutter_prepage_package_test.');
flutterDir = Directory(path.join(tempDir.path, 'flutter')); flutterDir = Directory(path.join(tempDir.path, 'flutter'));
flutterDir.createSync(recursive: true); flutterDir.createSync(recursive: true);
cacheDir = Directory(path.join(flutterDir.path, 'bin', 'cache'));
cacheDir.createSync(recursive: true);
creator = ArchiveCreator( creator = ArchiveCreator(
tempDir, tempDir,
tempDir, tempDir,
...@@ -120,8 +123,8 @@ void main() { ...@@ -120,8 +123,8 @@ void main() {
'$flutter create --template=app ${createBase}app': null, '$flutter create --template=app ${createBase}app': null,
'$flutter create --template=package ${createBase}package': null, '$flutter create --template=package ${createBase}package': null,
'$flutter create --template=plugin ${createBase}plugin': null, '$flutter create --template=plugin ${createBase}plugin': null,
'git clean -f -X **/.packages': null, 'git clean -f -x -- **/.packages': null,
'git clean -f -X **/.dart_tool': null, 'git clean -f -x -- **/.dart_tool/': null,
if (platform.isWindows) 'attrib -h .git': null, if (platform.isWindows) 'attrib -h .git': null,
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
...@@ -156,8 +159,8 @@ void main() { ...@@ -156,8 +159,8 @@ void main() {
'$flutter create --template=app ${createBase}app': null, '$flutter create --template=app ${createBase}app': null,
'$flutter create --template=package ${createBase}package': null, '$flutter create --template=package ${createBase}package': null,
'$flutter create --template=plugin ${createBase}plugin': null, '$flutter create --template=plugin ${createBase}plugin': null,
'git clean -f -X **/.packages': null, 'git clean -f -x -- **/.packages': null,
'git clean -f -X **/.dart_tool': null, 'git clean -f -x -- **/.dart_tool/': null,
if (platform.isWindows) 'attrib -h .git': null, if (platform.isWindows) 'attrib -h .git': null,
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
...@@ -206,8 +209,8 @@ void main() { ...@@ -206,8 +209,8 @@ void main() {
'$flutter create --template=app ${createBase}app': null, '$flutter create --template=app ${createBase}app': null,
'$flutter create --template=package ${createBase}package': null, '$flutter create --template=package ${createBase}package': null,
'$flutter create --template=plugin ${createBase}plugin': null, '$flutter create --template=plugin ${createBase}plugin': null,
'git clean -f -X **/.packages': null, 'git clean -f -x -- **/.packages': null,
'git clean -f -X **/.dart_tool': null, 'git clean -f -x -- **/.dart_tool/': null,
if (platform.isWindows) 'attrib -h .git': null, if (platform.isWindows) 'attrib -h .git': null,
if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null if (platform.isWindows) '7za a -tzip -mx=9 $archiveName flutter': null
else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null else if (platform.isMacOS) 'zip -r -9 $archiveName flutter': null
......
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