-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(shorebird_cli): use aot-tools.dill for linking if available #1596
Changes from 5 commits
880a683
575f127
1851bf3
bb268bd
183384a
9a5e299
adf32e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,12 +137,15 @@ abstract class CachedArtifact { | |
|
||
String get storageUrl; | ||
|
||
List<String> get executables => []; | ||
String get fileName; | ||
|
||
bool get isExecutable; | ||
|
||
bool get required => true; | ||
|
||
Future<void> extractArtifact(http.ByteStream stream, String outputPath) { | ||
final file = File(p.join(outputPath, name))..createSync(recursive: true); | ||
final file = File(p.join(outputPath, fileName)) | ||
..createSync(recursive: true); | ||
return stream.pipe(file.openWrite()); | ||
} | ||
|
||
|
@@ -179,12 +182,10 @@ allowed to access $storageUrl.''', | |
|
||
await extractArtifact(response.stream, location.path); | ||
|
||
if (platform.isWindows) return; | ||
|
||
for (final executable in executables) { | ||
if (!platform.isWindows && isExecutable) { | ||
final result = await process.start( | ||
'chmod', | ||
['+x', p.join(location.path, executable)], | ||
['+x', p.join(location.path, fileName)], | ||
); | ||
await result.exitCode; | ||
} | ||
|
@@ -197,8 +198,13 @@ class AotToolsArtifact extends CachedArtifact { | |
@override | ||
String get name => 'aot-tools'; | ||
|
||
// Not technically an executable, but this is where the file should end up and | ||
// is how it will be consumed. | ||
@override | ||
List<String> get executables => ['aot-tools']; | ||
String get fileName => 'aot-tools.dill'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why couldn't we change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the artifact path is |
||
|
||
@override | ||
bool get isExecutable => false; | ||
|
||
/// The aot-tools are only available for revisions that support mixed-mode. | ||
@override | ||
|
@@ -213,18 +219,8 @@ class AotToolsArtifact extends CachedArtifact { | |
); | ||
|
||
@override | ||
String get storageUrl { | ||
var artifactName = 'aot-tools-'; | ||
if (platform.isMacOS) { | ||
artifactName += 'darwin-x64'; | ||
} else if (platform.isLinux) { | ||
artifactName += 'linux-x64'; | ||
} else if (platform.isWindows) { | ||
artifactName += 'windows-x64'; | ||
} | ||
|
||
return '${cache.storageBaseUrl}/${cache.storageBucket}/shorebird/${shorebirdEnv.shorebirdEngineRevision}/$artifactName'; | ||
} | ||
String get storageUrl => | ||
'${cache.storageBaseUrl}/${cache.storageBucket}/shorebird/${shorebirdEnv.shorebirdEngineRevision}/aot-tools.dill'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could ¯_(ツ)_/¯ |
||
} | ||
|
||
class PatchArtifact extends CachedArtifact { | ||
|
@@ -234,7 +230,10 @@ class PatchArtifact extends CachedArtifact { | |
String get name => 'patch'; | ||
|
||
@override | ||
List<String> get executables => ['patch']; | ||
String get fileName => 'patch'; | ||
|
||
@override | ||
bool get isExecutable => true; | ||
|
||
@override | ||
Future<void> extractArtifact( | ||
|
@@ -268,6 +267,12 @@ class BundleToolArtifact extends CachedArtifact { | |
@override | ||
String get name => 'bundletool.jar'; | ||
|
||
@override | ||
String get fileName => 'bundletool.jar'; | ||
|
||
@override | ||
bool get isExecutable => false; | ||
|
||
@override | ||
String get storageUrl { | ||
return 'https://github.com/google/bundletool/releases/download/1.15.6/bundletool-all-1.15.6.jar'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this to executableName to avoid confusion? I don't think it's obvious what the difference between name and fileName is at first glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add some comments. I changed
executables
toexecutable
(because our artifacts only ever have one file) tofileName
(because our artifacts aren't always executable).