Skip to content

Commit

Permalink
Update to sidekick_core 3.0.0 preview
Browse files Browse the repository at this point in the history
  • Loading branch information
rehlma committed Jul 16, 2024
1 parent be8c821 commit 1ad7eaa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
8 changes: 4 additions & 4 deletions lib/puro_sidekick_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ export 'package:puro_sidekick_plugin/src/flutter_sdk.dart'
hide createSymlink, puroFlutterSdkPath;
export 'package:puro_sidekick_plugin/src/puro.dart';

void initializePuro(Directory sdk) {
void initializePuro(SdkInitializerContext context) {
// Create folder for flutter sdk symlink
final symlinkPath = flutterSdkSymlink();

final puroRootDir = installPuro();
dcli.env['PURO_ROOT'] = puroRootDir.absolute.path;

// Setup puro environment
_setupFlutterEnvironment();
_setupFlutterEnvironment(context);

// Create symlink to puro flutter sdk
final flutterPath = puroFlutterSdkPath();
print('Use Puro Flutter SDK: $flutterPath');
createSymlink(symlinkPath, flutterPath);
}

void _setupFlutterEnvironment() {
void _setupFlutterEnvironment(SdkInitializerContext context) {
final sdkVersion = VersionParser(
packagePath: entryWorkingDirectory,
packagePath: context.packageDir?.root ?? SidekickContext.projectRoot,
projectRoot: SidekickContext.projectRoot,
).getMaxFlutterSdkVersionFromPubspec();
if (sdkVersion == null) {
Expand Down
9 changes: 8 additions & 1 deletion lib/src/commands/puro_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ class PuroCommand extends ForwardCommand {
Future<void> run() async {
final args = argResults!.arguments;

initializePuro(Directory.current);
initializePuro(
SdkInitializerContext(
flutterSdk: flutterSdk,
dartSdk: dartSdk,
packageDir: SidekickContext.sidekickPackage,
workingDirectory: Directory.current,
),
);

exitCode = puro(args);
}
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ topics:
- puro

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.3.0 <4.0.0'

dependencies:
dcli: ^2.2.0
dcli: ^4.0.0
pub_semver: ^2.1.4
sidekick_core: ^2.0.0
sidekick_core: ^3.0.0-preview.1
yaml: ^3.1.1

dev_dependencies:
analyzer: '>=4.0.0 <6.0.0'
dart_style: ^2.2.0
indent: ^2.0.0
lint: '>=1.5.0 <=3.0.0'
sidekick_plugin_installer: ^1.0.0
sidekick_plugin_installer: ^1.2.1
test: ^1.21.0
14 changes: 10 additions & 4 deletions tool/install.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:puro_sidekick_plugin/puro_sidekick_plugin.dart';
import 'package:sidekick_core/sidekick_core.dart'
hide cliName, mainProject, repository;
import 'package:sidekick_core/sidekick_core.dart' hide cliName, mainProject, repository;
import 'package:sidekick_core/sidekick_core.dart';
import 'package:sidekick_plugin_installer/sidekick_plugin_installer.dart';

Expand Down Expand Up @@ -31,7 +30,7 @@ Future<void> main() async {
"import 'package:puro_sidekick_plugin/puro_sidekick_plugin.dart';",
);
mainSourceFile.registerSdkInitializer(
'addFlutterSdkInitializer(initializePuro);',
'addSdkInitializer(initializePuro);',
);
mainSourceFile.flush();

Expand All @@ -57,7 +56,14 @@ Future<void> main() async {
);
}

initializePuro(Directory.current);
initializePuro(
SdkInitializerContext(
flutterSdk: flutterSdk,
dartSdk: dartSdk,
packageDir: SidekickContext.sidekickPackage,
workingDirectory: Directory.current,
),
);
puro(['flutter', '--version']);

print(green('Successfully installed sidekick Puro plugin'));
Expand Down

0 comments on commit 1ad7eaa

Please sign in to comment.