-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c52d408
commit 6d88c45
Showing
6 changed files
with
209 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1 @@ | ||
# Defines a default set of lint rules enforced for | ||
# projects at Google. For details and rationale, | ||
# see https://github.com/dart-lang/pedantic#enabled-lints. | ||
include: package:tekartik_lints/strict.yaml | ||
|
||
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints. | ||
# Uncomment to specify additional rules. | ||
# linter: | ||
# rules: | ||
# - camel_case_types | ||
|
||
analyzer: | ||
# exclude: | ||
# - path/to/excluded/files/** | ||
include: package:tekartik_lints/package.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export 'app_build.dart'; | ||
export 'src/app_build_menu.dart' | ||
show menuFlutterWebAppBuilderContent, menuFlutterWebAppContent; | ||
export 'src/controller.dart' show BuildShellController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import 'package:dev_build/menu/menu.dart'; | ||
import 'package:dev_build/shell.dart'; | ||
import 'package:path/path.dart'; | ||
import 'package:tekartik_flutter_build/app_build.dart'; | ||
|
||
import 'controller.dart'; | ||
|
||
/// Single builder menu | ||
void menuFlutterWebAppBuilderContent({required FlutterWebAppBuilder builder}) { | ||
//shellDebug = devWarning(true); | ||
var path = builder.options.path; | ||
var shell = Shell(workingDirectory: path); | ||
var buildController = BuildShellController(shell: shell); | ||
builder = builder.copyWith(controller: buildController); | ||
|
||
enter(() async { | ||
write('App path: ${absolute(path)}'); | ||
}); | ||
|
||
void cancel() { | ||
buildController.cancel(); | ||
} | ||
|
||
item('cancel current build/server', () async { | ||
cancel(); | ||
}); | ||
|
||
if (builder.deployer != null) { | ||
item('build and deploy', () async { | ||
cancel(); | ||
await builder.buildAndDeploy(); | ||
}); | ||
} | ||
|
||
item('build', () async { | ||
cancel(); | ||
await builder.build(); | ||
}); | ||
|
||
item('run', () async { | ||
cancel(); | ||
await builder.run(); | ||
}); | ||
|
||
item('serve', () async { | ||
cancel(); | ||
await builder.serve(); | ||
}); | ||
if (builder.deployer != null) { | ||
item('deploy', () async { | ||
cancel(); | ||
await builder.deploy(); | ||
}); | ||
} | ||
|
||
item('build and serve', () async { | ||
cancel(); | ||
await builder.buildAndServe(); | ||
}); | ||
item('clean', () async { | ||
cancel(); | ||
await builder.clean(); | ||
}); | ||
item('generateVersion', () async { | ||
await builder.generateVersion(); | ||
}); | ||
} | ||
|
||
/// Menu | ||
void menuFlutterWebAppContent({required List<FlutterWebAppBuilder> builders}) { | ||
if (builders.length >= 2) { | ||
for (var builder in builders) { | ||
menu('target ${builder.target}', () { | ||
menuFlutterWebAppBuilderContent(builder: builder); | ||
}); | ||
} | ||
|
||
menu('all', () { | ||
var actionController = BuildShellController(); | ||
|
||
void cancel() { | ||
actionController.cancel(); | ||
} | ||
|
||
item('build', () async { | ||
cancel(); | ||
for (var builder in builders) { | ||
await builder.build(); | ||
} | ||
}); | ||
|
||
item('build and deploy', () async { | ||
cancel(); | ||
for (var builder in builders) { | ||
await builder.buildAndDeploy(); | ||
} | ||
}); | ||
item('deploy', () async { | ||
cancel(); | ||
for (var builder in builders) { | ||
await builder.deploy(); | ||
} | ||
}); | ||
|
||
item('clean', () async { | ||
cancel(); | ||
for (var builder in builders) { | ||
await builder.clean(); | ||
} | ||
}); | ||
}); | ||
} else { | ||
menuFlutterWebAppBuilderContent(builder: builders.first); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:dev_build/shell.dart'; | ||
|
||
/// Shell controller | ||
class BuildShellController { | ||
/// Constructor | ||
BuildShellController({Shell? shell}) { | ||
_shell = shell; | ||
} | ||
|
||
/// Shell | ||
Shell get shell => _shell!; | ||
Shell? _shell; | ||
|
||
/// Cancel current shell | ||
void cancel() { | ||
_shell?.kill(ProcessSignal.sigkill); | ||
} | ||
} | ||
|
||
/// Private extension to set the shell | ||
extension BuildShellControllerPrvExt on BuildShellController { | ||
set shell(Shell shell) { | ||
_shell = shell; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters