Added experimental new build script
This commit is contained in:
parent
e9e7e8105b
commit
86f6e2e14c
|
@ -0,0 +1,127 @@
|
|||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
void main() async {
|
||||
if (Directory.current.path.endsWith('scripts')) {
|
||||
Directory.current = Directory.current.parent;
|
||||
}
|
||||
|
||||
String flutterExecutable = Platform.isWindows ? 'flutter.bat' : 'flutter';
|
||||
|
||||
print("Build script for Ollama App by JHubi1");
|
||||
print("Report issues at: https://github.com/JHubi1/ollama-app/issues");
|
||||
|
||||
print('----------');
|
||||
|
||||
print('Extracting version from pubspec.yaml ...');
|
||||
var pubspec = File('pubspec.yaml');
|
||||
var versionLine = await pubspec
|
||||
.readAsLines()
|
||||
.then((lines) => lines.firstWhere((line) => line.contains('version')));
|
||||
var version = versionLine.split(':').last.trim().split('+').first.trim();
|
||||
print("Building Ollama App v$version - this may take a while");
|
||||
|
||||
print('----------');
|
||||
|
||||
await execute('Android', flutterExecutable, [
|
||||
'build',
|
||||
'apk',
|
||||
'--obfuscate',
|
||||
'--split-debug-info=build\\debugAndroid'
|
||||
]);
|
||||
|
||||
// ----------
|
||||
|
||||
await execute('Windows x64', flutterExecutable, [
|
||||
'build',
|
||||
'windows',
|
||||
'--obfuscate',
|
||||
'--split-debug-info=build\\debugWindows'
|
||||
]);
|
||||
|
||||
await execute(
|
||||
'Windows x64 installer',
|
||||
'iscc.exe',
|
||||
['windows_installer/x64.iss', '/qp', '/dAppVersion=$version'],
|
||||
" > Inno Setup is not installed. Please install it from https://www.jrsoftware.org/isdl.php#stable\n Then add the Inno Setup directory to your PATH environment variable.");
|
||||
|
||||
// ----------
|
||||
|
||||
// not supported by flutter yet
|
||||
|
||||
// await execute('Windows arm64', flutterExecutable, [
|
||||
// 'build',
|
||||
// 'windows',
|
||||
// '--obfuscate',
|
||||
// '--split-debug-info=build\\debugWindows'
|
||||
// ]);
|
||||
|
||||
// await execute(
|
||||
// 'Windows arm64 installer',
|
||||
// 'iscc.exe',
|
||||
// ['windows_installer/arm64.iss', '/qp', '/dAppVersion=$version'],
|
||||
// " > Inno Setup is not installed. Please install it from https://www.jrsoftware.org/isdl.php#stable\n Then add the Inno Setup directory to your PATH environment variable.");
|
||||
|
||||
print('----------');
|
||||
|
||||
stdout.write('Copying build output to build\\.output ');
|
||||
try {
|
||||
var outputDir = Directory('build\\.output');
|
||||
if (await outputDir.exists()) {
|
||||
await outputDir.delete(recursive: true);
|
||||
}
|
||||
await outputDir.create();
|
||||
|
||||
await copyFile('build\\app\\outputs\\flutter-apk\\app-release.apk',
|
||||
'build\\.output\\ollama.apk');
|
||||
await copyFile('build\\windows\\x64\\runner\\ollama-v$version-x64.exe',
|
||||
'build\\.output\\ollama-v$version-x64.exe');
|
||||
print('- done');
|
||||
} catch (_) {
|
||||
print('- failed');
|
||||
}
|
||||
|
||||
print("Output: ${Directory('build\\.output').absolute.path.toString()}");
|
||||
|
||||
stdout.write('Done. Press Enter to exit. ');
|
||||
|
||||
stdin.readLineSync();
|
||||
}
|
||||
|
||||
Future<void> copyFile(String sourcePath, String destinationPath) async {
|
||||
var sourceFile = File(sourcePath);
|
||||
if (await sourceFile.exists()) {
|
||||
await sourceFile.copy(destinationPath);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> execute(String title, String command, List<String> arguments,
|
||||
[String? errorText]) async {
|
||||
stdout.write('$title ');
|
||||
ProcessResult process;
|
||||
try {
|
||||
process = await Process.run(command, arguments);
|
||||
} catch (e) {
|
||||
print('- failed');
|
||||
print("> Errors:");
|
||||
stdout.write('\x1B[31m');
|
||||
print(e);
|
||||
stdout.write('\x1B[0m');
|
||||
if (errorText != null) {
|
||||
print(errorText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
process.exitCode != 0 ? print('- failed') : print('- done');
|
||||
if (process.exitCode != 0) {
|
||||
print("> Errors:");
|
||||
stdout.write('\x1B[31m');
|
||||
process.stderr.toString().split('\n').forEach(print);
|
||||
stdout.write('\x1B[0m');
|
||||
if (errorText != null) {
|
||||
print(errorText);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
; #define AppVersion "1.0.1"
|
||||
|
||||
#define AppName "Ollama App"
|
||||
#define AppPublisher "JHubi1"
|
||||
#define AppURL "https://jhubi1.com"
|
||||
#define AppExeName "ollama.exe"
|
||||
#define AppArchitectures "arm64"
|
||||
|
||||
[Setup]
|
||||
SourceDir=..
|
||||
AppId={{4ACF8C84-5D9B-455C-9FED-93D29E2F71DC}
|
||||
AppName={#AppName}
|
||||
AppVersion={#AppVersion}
|
||||
AppVerName={#AppName} v{#AppVersion}
|
||||
AppPublisher={#AppPublisher}
|
||||
AppPublisherURL={#AppURL}
|
||||
ArchitecturesAllowed={#AppArchitectures}
|
||||
AppSupportURL=https://github.com/JHubi1/ollama-app/issues
|
||||
AppUpdatesURL=https://github.com/JHubi1/ollama-app/releases
|
||||
DefaultDirName={autopf}\OllamaApp
|
||||
DisableProgramGroupPage=yes
|
||||
LicenseFile=windows_installer\docs\license.txt
|
||||
InfoBeforeFile=windows_installer\docs\before.txt
|
||||
InfoAfterFile=windows_installer\docs\after.txt
|
||||
; Uncomment the following line to run in non administrative install mode (install for current user only.)
|
||||
;PrivilegesRequired=lowest
|
||||
PrivilegesRequiredOverridesAllowed=dialog
|
||||
OutputDir=build\windows\{#AppArchitectures}\runner
|
||||
OutputBaseFilename=ollama-v{#AppVersion}-{#AppArchitectures}
|
||||
SetupIconFile=windows\runner\resources\app_icon.ico
|
||||
;Password=enterPasswordInCaseOfSecretBuild
|
||||
;Encryption=yes
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "build\windows\{#AppArchitectures}\runner\Release\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "build\windows\{#AppArchitectures}\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#AppName}"; Filename: "{app}\{#AppExeName}"
|
||||
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
; #define AppVersion "1.0.1"
|
||||
|
||||
#define AppName "Ollama App"
|
||||
#define AppVersion "1.0.1"
|
||||
#define AppPublisher "JHubi1"
|
||||
#define AppURL "https://jhubi1.com"
|
||||
#define AppExeName "ollama.exe"
|
||||
#define AppArchitectures "x64"
|
||||
|
||||
[Setup]
|
||||
SourceDir=..
|
||||
|
@ -15,6 +17,7 @@ AppVersion={#AppVersion}
|
|||
AppVerName={#AppName} v{#AppVersion}
|
||||
AppPublisher={#AppPublisher}
|
||||
AppPublisherURL={#AppURL}
|
||||
ArchitecturesAllowed={#AppArchitectures}
|
||||
AppSupportURL=https://github.com/JHubi1/ollama-app/issues
|
||||
AppUpdatesURL=https://github.com/JHubi1/ollama-app/releases
|
||||
DefaultDirName={autopf}\OllamaApp
|
||||
|
@ -25,8 +28,8 @@ InfoAfterFile=windows_installer\docs\after.txt
|
|||
; Uncomment the following line to run in non administrative install mode (install for current user only.)
|
||||
;PrivilegesRequired=lowest
|
||||
PrivilegesRequiredOverridesAllowed=dialog
|
||||
OutputDir=build\windows\x64\runner
|
||||
OutputBaseFilename=ollama-v{#AppVersion}-x64
|
||||
OutputDir=build\windows\{#AppArchitectures}\runner
|
||||
OutputBaseFilename=ollama-v{#AppVersion}-{#AppArchitectures}
|
||||
SetupIconFile=windows\runner\resources\app_icon.ico
|
||||
;Password=enterPasswordInCaseOfSecretBuild
|
||||
;Encryption=yes
|
||||
|
@ -42,8 +45,8 @@ Name: "german"; MessagesFile: "compiler:Languages\German.isl"
|
|||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "build\windows\x64\runner\Release\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "build\windows\x64\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "build\windows\{#AppArchitectures}\runner\Release\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "build\windows\{#AppArchitectures}\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#AppName}"; Filename: "{app}\{#AppExeName}"
|
||||
|
|
Loading…
Reference in New Issue