fix merge issues
This commit is contained in:
45
gen/metagen.dart
Normal file
45
gen/metagen.dart
Normal file
@ -0,0 +1,45 @@
|
||||
import 'dart:io';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
void main() {
|
||||
print('generating version file');
|
||||
MetaUpdate('../pubspec.yaml').writeMetaDartFile('../lib/gen/meta.dart');
|
||||
}
|
||||
|
||||
class MetaUpdate {
|
||||
String pathToYaml = '';
|
||||
String metaDartFileContents = '';
|
||||
MetaUpdate(this.pathToYaml);
|
||||
|
||||
void writeMetaDartFile(String metaDartFilePath) {
|
||||
File metaDartFile = File(metaDartFilePath);
|
||||
|
||||
final version = getPubSpec('version');
|
||||
final time = DateTime.now().millisecondsSinceEpoch;
|
||||
print('Version: $version');
|
||||
print('BuildTime: $time');
|
||||
|
||||
String metaDartFileContents = """
|
||||
/// DO NOT EDIT THIS FILE EXCEPT TO ENTER INITIAL VERSION AND OTHER META INFO
|
||||
/// THIS FILE IS AUTOMATICALLY OVERWRITTEN
|
||||
|
||||
class Meta {
|
||||
static const String version = '$version';
|
||||
static const int buildTime = $time;
|
||||
static const bool devBuild = false;
|
||||
}
|
||||
""";
|
||||
|
||||
metaDartFile.writeAsStringSync(metaDartFileContents);
|
||||
}
|
||||
|
||||
String getPubSpec(String pubSpecParam) {
|
||||
File f = File(pathToYaml);
|
||||
|
||||
String yamlText = f.readAsStringSync();
|
||||
// ignore: always_specify_types
|
||||
Map yaml = loadYaml(yamlText);
|
||||
|
||||
return yaml[pubSpecParam];
|
||||
}
|
||||
}
|
47
gen/pubspec.lock
Normal file
47
gen/pubspec.lock
Normal file
@ -0,0 +1,47 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.17.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
yaml:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
sdks:
|
||||
dart: ">=2.18.2 <3.0.0"
|
8
gen/pubspec.yaml
Normal file
8
gen/pubspec.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
name: gen
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
yaml:
|
Reference in New Issue
Block a user