forked from olcxjas-softworks/LarpixClient
fix gitignore again
This commit is contained in:
parent
ce5a1e330b
commit
5da5c2afe2
3329 changed files with 364540 additions and 3 deletions
47
electron/node_modules/native-run/dist/android/utils/sdk/api.js
generated
vendored
Normal file
47
electron/node_modules/native-run/dist/android/utils/sdk/api.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.findPackageBySchemaPath = exports.findPackageBySchema = exports.findUnsatisfiedPackages = exports.getAPILevels = void 0;
|
||||
const Debug = require("debug");
|
||||
const modulePrefix = 'native-run:android:utils:sdk:api';
|
||||
async function getAPILevels(packages) {
|
||||
const debug = Debug(`${modulePrefix}:${getAPILevels.name}`);
|
||||
const levels = [
|
||||
...new Set(packages.map((pkg) => pkg.apiLevel).filter((apiLevel) => typeof apiLevel !== 'undefined')),
|
||||
].sort((a, b) => (a <= b ? 1 : -1));
|
||||
const apis = levels.map((apiLevel) => ({
|
||||
apiLevel,
|
||||
packages: packages.filter((pkg) => pkg.apiLevel === apiLevel),
|
||||
}));
|
||||
debug('Discovered installed API Levels: %O', apis.map((api) => ({ ...api, packages: api.packages.map((pkg) => pkg.path) })));
|
||||
return apis;
|
||||
}
|
||||
exports.getAPILevels = getAPILevels;
|
||||
function findUnsatisfiedPackages(packages, schemas) {
|
||||
return schemas.filter((pkg) => !findPackageBySchema(packages, pkg));
|
||||
}
|
||||
exports.findUnsatisfiedPackages = findUnsatisfiedPackages;
|
||||
function findPackageBySchema(packages, pkg) {
|
||||
const apiPkg = findPackageBySchemaPath(packages, pkg.path);
|
||||
if (apiPkg) {
|
||||
if (typeof pkg.version === 'string') {
|
||||
if (pkg.version === apiPkg.version) {
|
||||
return apiPkg;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (apiPkg.version.match(pkg.version)) {
|
||||
return apiPkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.findPackageBySchema = findPackageBySchema;
|
||||
function findPackageBySchemaPath(packages, path) {
|
||||
return packages.find((pkg) => {
|
||||
if (typeof path !== 'string') {
|
||||
return !!pkg.path.match(path);
|
||||
}
|
||||
return path === pkg.path;
|
||||
});
|
||||
}
|
||||
exports.findPackageBySchemaPath = findPackageBySchemaPath;
|
||||
169
electron/node_modules/native-run/dist/android/utils/sdk/index.js
generated
vendored
Normal file
169
electron/node_modules/native-run/dist/android/utils/sdk/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.supplementProcessEnv = exports.resolveAVDHome = exports.resolveEmulatorHome = exports.resolveSDKRoot = exports.getSDKPackage = exports.findAllSDKPackages = exports.getSDK = exports.SDK_DIRECTORIES = void 0;
|
||||
const utils_fs_1 = require("@ionic/utils-fs");
|
||||
const Debug = require("debug");
|
||||
const os = require("os");
|
||||
const pathlib = require("path");
|
||||
const errors_1 = require("../../../errors");
|
||||
const fs_1 = require("../../../utils/fs");
|
||||
const xml_1 = require("./xml");
|
||||
const modulePrefix = 'native-run:android:utils:sdk';
|
||||
const homedir = os.homedir();
|
||||
exports.SDK_DIRECTORIES = new Map([
|
||||
['darwin', [pathlib.join(homedir, 'Library', 'Android', 'sdk')]],
|
||||
['linux', [pathlib.join(homedir, 'Android', 'sdk')]],
|
||||
['win32', [pathlib.join(process.env.LOCALAPPDATA || pathlib.join(homedir, 'AppData', 'Local'), 'Android', 'Sdk')]],
|
||||
]);
|
||||
async function getSDK() {
|
||||
const root = await resolveSDKRoot();
|
||||
const emulatorHome = await resolveEmulatorHome();
|
||||
const avdHome = await resolveAVDHome();
|
||||
return { root, emulatorHome, avdHome };
|
||||
}
|
||||
exports.getSDK = getSDK;
|
||||
const pkgcache = new Map();
|
||||
async function findAllSDKPackages(sdk) {
|
||||
const debug = Debug(`${modulePrefix}:${findAllSDKPackages.name}`);
|
||||
if (sdk.packages) {
|
||||
return sdk.packages;
|
||||
}
|
||||
const sourcesRe = /^sources\/android-\d+\/.+\/.+/;
|
||||
debug('Walking %s to discover SDK packages', sdk.root);
|
||||
const contents = await (0, utils_fs_1.readdirp)(sdk.root, {
|
||||
filter: (item) => pathlib.basename(item.path) === 'package.xml',
|
||||
onError: (err) => debug('Error while walking SDK: %O', err),
|
||||
walkerOptions: {
|
||||
pathFilter: (p) => {
|
||||
if ([
|
||||
'bin',
|
||||
'bin64',
|
||||
'lib',
|
||||
'lib64',
|
||||
'include',
|
||||
'clang-include',
|
||||
'skins',
|
||||
'data',
|
||||
'examples',
|
||||
'resources',
|
||||
'systrace',
|
||||
'extras',
|
||||
// 'm2repository',
|
||||
].includes(pathlib.basename(p))) {
|
||||
return false;
|
||||
}
|
||||
if (p.match(sourcesRe)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
sdk.packages = await Promise.all(contents.map((p) => pathlib.dirname(p)).map((p) => getSDKPackage(p)));
|
||||
sdk.packages.sort((a, b) => (a.name >= b.name ? 1 : -1));
|
||||
return sdk.packages;
|
||||
}
|
||||
exports.findAllSDKPackages = findAllSDKPackages;
|
||||
async function getSDKPackage(location) {
|
||||
const debug = Debug(`${modulePrefix}:${getSDKPackage.name}`);
|
||||
let pkg = pkgcache.get(location);
|
||||
if (!pkg) {
|
||||
const packageXmlPath = pathlib.join(location, 'package.xml');
|
||||
debug('Parsing %s', packageXmlPath);
|
||||
try {
|
||||
const packageXml = await (0, xml_1.readPackageXml)(packageXmlPath);
|
||||
const name = (0, xml_1.getNameFromPackageXml)(packageXml);
|
||||
const version = (0, xml_1.getVersionFromPackageXml)(packageXml);
|
||||
const path = (0, xml_1.getPathFromPackageXml)(packageXml);
|
||||
const apiLevel = (0, xml_1.getAPILevelFromPackageXml)(packageXml);
|
||||
pkg = {
|
||||
path,
|
||||
location,
|
||||
version,
|
||||
name,
|
||||
apiLevel,
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
debug('Encountered error with %s: %O', packageXmlPath, e);
|
||||
if (e.code === 'ENOENT') {
|
||||
throw new errors_1.SDKException(`SDK package not found by location: ${location}.`, errors_1.ERR_SDK_PACKAGE_NOT_FOUND);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
pkgcache.set(location, pkg);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
exports.getSDKPackage = getSDKPackage;
|
||||
async function resolveSDKRoot() {
|
||||
const debug = Debug(`${modulePrefix}:${resolveSDKRoot.name}`);
|
||||
debug('Looking for $ANDROID_HOME');
|
||||
// $ANDROID_HOME is deprecated, but still overrides $ANDROID_SDK_ROOT if
|
||||
// defined and valid.
|
||||
if (process.env.ANDROID_HOME && (await (0, fs_1.isDir)(process.env.ANDROID_HOME))) {
|
||||
debug('Using $ANDROID_HOME at %s', process.env.ANDROID_HOME);
|
||||
return process.env.ANDROID_HOME;
|
||||
}
|
||||
debug('Looking for $ANDROID_SDK_ROOT');
|
||||
// No valid $ANDROID_HOME, try $ANDROID_SDK_ROOT.
|
||||
if (process.env.ANDROID_SDK_ROOT && (await (0, fs_1.isDir)(process.env.ANDROID_SDK_ROOT))) {
|
||||
debug('Using $ANDROID_SDK_ROOT at %s', process.env.ANDROID_SDK_ROOT);
|
||||
return process.env.ANDROID_SDK_ROOT;
|
||||
}
|
||||
const sdkDirs = exports.SDK_DIRECTORIES.get(process.platform);
|
||||
if (!sdkDirs) {
|
||||
throw new errors_1.SDKException(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
debug('Looking at following directories: %O', sdkDirs);
|
||||
for (const sdkDir of sdkDirs) {
|
||||
if (await (0, fs_1.isDir)(sdkDir)) {
|
||||
debug('Using %s', sdkDir);
|
||||
return sdkDir;
|
||||
}
|
||||
}
|
||||
throw new errors_1.SDKException(`No valid Android SDK root found.`, errors_1.ERR_SDK_NOT_FOUND);
|
||||
}
|
||||
exports.resolveSDKRoot = resolveSDKRoot;
|
||||
async function resolveEmulatorHome() {
|
||||
const debug = Debug(`${modulePrefix}:${resolveEmulatorHome.name}`);
|
||||
debug('Looking for $ANDROID_EMULATOR_HOME');
|
||||
if (process.env.ANDROID_EMULATOR_HOME && (await (0, fs_1.isDir)(process.env.ANDROID_EMULATOR_HOME))) {
|
||||
debug('Using $ANDROID_EMULATOR_HOME at %s', process.env.ANDROID_EMULATOR_HOME);
|
||||
return process.env.ANDROID_EMULATOR_HOME;
|
||||
}
|
||||
debug('Looking at $HOME/.android');
|
||||
const homeEmulatorHome = pathlib.join(homedir, '.android');
|
||||
if (await (0, fs_1.isDir)(homeEmulatorHome)) {
|
||||
debug('Using $HOME/.android/ at %s', homeEmulatorHome);
|
||||
return homeEmulatorHome;
|
||||
}
|
||||
throw new errors_1.SDKException(`No valid Android Emulator home found.`, errors_1.ERR_EMULATOR_HOME_NOT_FOUND);
|
||||
}
|
||||
exports.resolveEmulatorHome = resolveEmulatorHome;
|
||||
async function resolveAVDHome() {
|
||||
const debug = Debug(`${modulePrefix}:${resolveAVDHome.name}`);
|
||||
debug('Looking for $ANDROID_AVD_HOME');
|
||||
if (process.env.ANDROID_AVD_HOME && (await (0, fs_1.isDir)(process.env.ANDROID_AVD_HOME))) {
|
||||
debug('Using $ANDROID_AVD_HOME at %s', process.env.ANDROID_AVD_HOME);
|
||||
return process.env.ANDROID_AVD_HOME;
|
||||
}
|
||||
debug('Looking at $HOME/.android/avd');
|
||||
const homeAvdHome = pathlib.join(homedir, '.android', 'avd');
|
||||
if (!(await (0, fs_1.isDir)(homeAvdHome))) {
|
||||
debug('Creating directory: %s', homeAvdHome);
|
||||
await (0, utils_fs_1.mkdirp)(homeAvdHome);
|
||||
}
|
||||
debug('Using $HOME/.android/avd/ at %s', homeAvdHome);
|
||||
return homeAvdHome;
|
||||
}
|
||||
exports.resolveAVDHome = resolveAVDHome;
|
||||
function supplementProcessEnv(sdk) {
|
||||
return {
|
||||
...process.env,
|
||||
ANDROID_SDK_ROOT: sdk.root,
|
||||
ANDROID_EMULATOR_HOME: sdk.emulatorHome,
|
||||
ANDROID_AVD_HOME: sdk.avdHome,
|
||||
};
|
||||
}
|
||||
exports.supplementProcessEnv = supplementProcessEnv;
|
||||
58
electron/node_modules/native-run/dist/android/utils/sdk/xml.js
generated
vendored
Normal file
58
electron/node_modules/native-run/dist/android/utils/sdk/xml.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getVersionFromPackageXml = exports.getNameFromPackageXml = exports.getPathFromPackageXml = exports.readPackageXml = exports.getAPILevelFromPackageXml = void 0;
|
||||
const utils_fs_1 = require("@ionic/utils-fs");
|
||||
const errors_1 = require("../../../errors");
|
||||
function getAPILevelFromPackageXml(packageXml) {
|
||||
var _a;
|
||||
const apiLevel = packageXml.find('./localPackage/type-details/api-level');
|
||||
return (_a = apiLevel === null || apiLevel === void 0 ? void 0 : apiLevel.text) === null || _a === void 0 ? void 0 : _a.toString();
|
||||
}
|
||||
exports.getAPILevelFromPackageXml = getAPILevelFromPackageXml;
|
||||
async function readPackageXml(path) {
|
||||
const et = await Promise.resolve().then(() => require('elementtree'));
|
||||
const contents = await (0, utils_fs_1.readFile)(path, { encoding: 'utf8' });
|
||||
const etree = et.parse(contents);
|
||||
return etree;
|
||||
}
|
||||
exports.readPackageXml = readPackageXml;
|
||||
function getPathFromPackageXml(packageXml) {
|
||||
const localPackage = packageXml.find('./localPackage');
|
||||
if (!localPackage) {
|
||||
throw new errors_1.SDKException(`Invalid SDK package.`, errors_1.ERR_INVALID_SDK_PACKAGE);
|
||||
}
|
||||
const path = localPackage.get('path');
|
||||
if (!path) {
|
||||
throw new errors_1.SDKException(`Invalid SDK package path.`, errors_1.ERR_INVALID_SDK_PACKAGE);
|
||||
}
|
||||
return path.toString();
|
||||
}
|
||||
exports.getPathFromPackageXml = getPathFromPackageXml;
|
||||
function getNameFromPackageXml(packageXml) {
|
||||
const name = packageXml.find('./localPackage/display-name');
|
||||
if (!(name === null || name === void 0 ? void 0 : name.text)) {
|
||||
throw new errors_1.SDKException(`Invalid SDK package name.`, errors_1.ERR_INVALID_SDK_PACKAGE);
|
||||
}
|
||||
return name.text.toString();
|
||||
}
|
||||
exports.getNameFromPackageXml = getNameFromPackageXml;
|
||||
function getVersionFromPackageXml(packageXml) {
|
||||
const versionElements = [
|
||||
packageXml.find('./localPackage/revision/major'),
|
||||
packageXml.find('./localPackage/revision/minor'),
|
||||
packageXml.find('./localPackage/revision/micro'),
|
||||
];
|
||||
const textFromElement = (e) => ((e === null || e === void 0 ? void 0 : e.text) ? e.text.toString() : '');
|
||||
const versions = [];
|
||||
for (const version of versionElements.map(textFromElement)) {
|
||||
if (!version) {
|
||||
break;
|
||||
}
|
||||
versions.push(version);
|
||||
}
|
||||
if (versions.length === 0) {
|
||||
throw new errors_1.SDKException(`Invalid SDK package version.`, errors_1.ERR_INVALID_SDK_PACKAGE);
|
||||
}
|
||||
return versions.join('.');
|
||||
}
|
||||
exports.getVersionFromPackageXml = getVersionFromPackageXml;
|
||||
Loading…
Add table
Add a link
Reference in a new issue