-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathsync_with_awaken_os.dart
66 lines (58 loc) · 2.29 KB
/
sync_with_awaken_os.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'dart:io';
import 'package:yaml/yaml.dart';
import 'tools/extended_codename_creator.dart';
import 'tools/is_supported.dart';
import 'tools/add_to_support.dart';
void main() async {
stdout.write("Cloning https://github.com/Project-Awaken/official_devices.git...");
int numberOfCovered = 0;
int numberOfNotCovered = 0;
List<String> listOfNotCovered = [];
// List<String> listOfCovered = [];
Directory cacheDir = Directory(".cache/AwakenOSSync");
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);
}
cacheDir.createSync(recursive: true);
Process.runSync("git", ["clone", "-b", "ursa", "https://github.com/Project-Awaken/official_devices.git", cacheDir.path]);
stdout.write("OK\n");
for (FileSystemEntity entity in Directory("${cacheDir.path}/devices").listSync()) {
if (entity is File && entity.path.endsWith(".json")) {
stdout.write("${entity.path}\n");
String entityContent = await entity.readAsString();
YamlMap ydoc = loadYaml(entityContent);
String readCodename = ydoc["device_display_codename"];
String deviceName = ydoc["device_display_name"];
String readVendor = deviceName.split(" ")[0];
if (readVendor.toLowerCase() == "redmi") {
readVendor = "xiaomi";
}
String extendedCodename = extendedCodenameCreator(readCodename: readCodename, readVendor: readVendor);
bool isActive = ydoc["active"];
String androidVersion = ydoc["android_version"].toString();
if (isSupported(extendedCodename: extendedCodename)) {
numberOfCovered += 1;
addToSupport(
androidVersion: androidVersion,
extendedCodename: extendedCodename,
romName: "AwakenOS",
romState: isActive ? "Official" : "Discontinued",
romSupport: true,
romNotes: "",
romWebpage: "https://awakenos.vercel.app/",
deviceWebpage: "https://awakenos.vercel.app/downloads/$readCodename"
);
// listOfCovered += [extendedCodename];
}
else {
numberOfNotCovered += 1;
listOfNotCovered += [extendedCodename];
}
}
}
stdout.write("Covered: $numberOfCovered\n");
stdout.write("Not covered: $numberOfNotCovered\n");
for (var deviceNotCovered in listOfNotCovered) {
stdout.write("$deviceNotCovered\n");
}
}