@expo/config-plugins 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/android/BuildProperties.d.ts +28 -0
- package/build/android/BuildProperties.js +96 -0
- package/build/android/BuildProperties.js.map +1 -0
- package/build/android/Package.js +1 -1
- package/build/android/Package.js.map +1 -1
- package/build/android/index.d.ts +2 -2
- package/build/android/index.js +18 -18
- package/build/android/index.js.map +1 -1
- package/build/ios/BuildProperties.d.ts +27 -0
- package/build/ios/BuildProperties.js +83 -0
- package/build/ios/BuildProperties.js.map +1 -0
- package/build/ios/BuildScheme.js +6 -3
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/Entitlements.d.ts +5 -1
- package/build/ios/Entitlements.js +57 -58
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Locales.js +1 -1
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Paths.d.ts +1 -3
- package/build/ios/Paths.js +12 -16
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Target.d.ts +1 -0
- package/build/ios/Target.js +11 -1
- package/build/ios/Target.js.map +1 -1
- package/build/ios/index.d.ts +2 -2
- package/build/ios/index.js +19 -19
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +2 -1
- package/build/ios/utils/Xcodeproj.js +4 -1
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/withIosBaseMods.js +27 -7
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +25 -0
- package/build/utils/BuildProperties.types.js +2 -0
- package/build/utils/BuildProperties.types.js.map +1 -0
- package/build/utils/modules.js +1 -1
- package/build/utils/modules.js.map +1 -1
- package/build/utils/versions.js +2 -2
- package/build/utils/versions.js.map +1 -1
- package/package.json +2 -2
- package/build/android/JsEngine.d.ts +0 -8
- package/build/android/JsEngine.js +0 -59
- package/build/android/JsEngine.js.map +0 -1
- package/build/ios/JsEngine.d.ts +0 -8
- package/build/ios/JsEngine.js +0 -47
- package/build/ios/JsEngine.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import type { ConfigPlugin } from '../Plugin.types';
|
|
3
|
+
import { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';
|
|
4
|
+
import type { PropertiesItem } from './Properties';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.
|
|
7
|
+
*
|
|
8
|
+
* The factory supports two modes from generic type inference
|
|
9
|
+
* ```ts
|
|
10
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
11
|
+
* createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
12
|
+
*
|
|
13
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
14
|
+
* createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param configToPropertyRules config to property mapping rules
|
|
18
|
+
* @param name the config plugin name
|
|
19
|
+
*/
|
|
20
|
+
export declare function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[], name?: string): ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType>;
|
|
21
|
+
/**
|
|
22
|
+
* A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
|
|
23
|
+
*/
|
|
24
|
+
export declare const withJsEngineGradleProps: ConfigPlugin<void>;
|
|
25
|
+
export declare function updateAndroidBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(config: SourceConfigType, gradleProperties: PropertiesItem[], configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]): PropertiesItem[];
|
|
26
|
+
export declare function updateAndroidBuildProperty(gradleProperties: PropertiesItem[], name: string, value: string | null | undefined, options?: {
|
|
27
|
+
removePropWhenValueIsNull?: boolean;
|
|
28
|
+
}): PropertiesItem[];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createBuildGradlePropsConfigPlugin = createBuildGradlePropsConfigPlugin;
|
|
7
|
+
exports.updateAndroidBuildPropertiesFromConfig = updateAndroidBuildPropertiesFromConfig;
|
|
8
|
+
exports.updateAndroidBuildProperty = updateAndroidBuildProperty;
|
|
9
|
+
exports.withJsEngineGradleProps = void 0;
|
|
10
|
+
|
|
11
|
+
function _androidPlugins() {
|
|
12
|
+
const data = require("../plugins/android-plugins");
|
|
13
|
+
|
|
14
|
+
_androidPlugins = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.
|
|
23
|
+
*
|
|
24
|
+
* The factory supports two modes from generic type inference
|
|
25
|
+
* ```ts
|
|
26
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
27
|
+
* createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
28
|
+
*
|
|
29
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
30
|
+
* createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param configToPropertyRules config to property mapping rules
|
|
34
|
+
* @param name the config plugin name
|
|
35
|
+
*/
|
|
36
|
+
function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
|
|
37
|
+
const withUnknown = (config, sourceConfig) => (0, _androidPlugins().withGradleProperties)(config, config => {
|
|
38
|
+
config.modResults = updateAndroidBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules);
|
|
39
|
+
return config;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (name) {
|
|
43
|
+
Object.defineProperty(withUnknown, 'name', {
|
|
44
|
+
value: name
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return withUnknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
|
|
56
|
+
propName: 'expo.jsEngine',
|
|
57
|
+
propValueGetter: config => {
|
|
58
|
+
var _ref, _config$android$jsEng, _config$android;
|
|
59
|
+
|
|
60
|
+
return (_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'jsc';
|
|
61
|
+
}
|
|
62
|
+
}], 'withJsEngineGradleProps');
|
|
63
|
+
exports.withJsEngineGradleProps = withJsEngineGradleProps;
|
|
64
|
+
|
|
65
|
+
function updateAndroidBuildPropertiesFromConfig(config, gradleProperties, configToPropertyRules) {
|
|
66
|
+
for (const configToProperty of configToPropertyRules) {
|
|
67
|
+
const value = configToProperty.propValueGetter(config);
|
|
68
|
+
updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return gradleProperties;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function updateAndroidBuildProperty(gradleProperties, name, value, options) {
|
|
75
|
+
const oldPropIndex = gradleProperties.findIndex(prop => prop.type === 'property' && prop.key === name);
|
|
76
|
+
|
|
77
|
+
if (value) {
|
|
78
|
+
// found the matched value, add or merge new property
|
|
79
|
+
const newProp = {
|
|
80
|
+
type: 'property',
|
|
81
|
+
key: name,
|
|
82
|
+
value
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
if (oldPropIndex >= 0) {
|
|
86
|
+
gradleProperties[oldPropIndex] = newProp;
|
|
87
|
+
} else {
|
|
88
|
+
gradleProperties.push(newProp);
|
|
89
|
+
}
|
|
90
|
+
} else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull && oldPropIndex >= 0) {
|
|
91
|
+
gradleProperties.splice(oldPropIndex, 1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return gradleProperties;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=BuildProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/android/BuildProperties.ts"],"names":["createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","android","jsEngine","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","newProp","push","removePropWhenValueIsNull","splice"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kCAAT,CACLC,qBADK,EAELC,IAFK,EAGL;AACA,QAAMC,WAAwF,GAAG,CAC/FC,MAD+F,EAE/FC,YAF+F,KAI/F,4CAAqBD,MAArB,EAA6BA,MAAM,IAAI;AACrCA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,sCAAsC,CACvDF,YADuD,aACvDA,YADuD,cACvDA,YADuD,GACvCD,MADuC,EAExDA,MAAM,CAACE,UAFiD,EAGxDL,qBAHwD,CAA1D;AA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AgB,CAACI,YAAD,CAAhB,GAAiCK,OAAjC;AACD,KAFD,MAEO;AACLT,MAAAA,gBAAgB,CAACU,IAAjB,CAAsBD,OAAtB;AACD;AACF,GAbD,MAaO,IAAIN,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEQ,yBAAT,IAAsCP,YAAY,IAAI,CAA1D,EAA6D;AAClEJ,IAAAA,gBAAgB,CAACY,MAAjB,CAAwBR,YAAxB,EAAsC,CAAtC;AACD;;AAED,SAAOJ,gBAAP;AACD","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\nimport type { PropertiesItem } from './Properties';\n\n/**\n * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withGradleProperties(config, config => {\n config.modResults = updateAndroidBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config\n */\nexport const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: config => config.android?.jsEngine ?? config.jsEngine ?? 'jsc',\n },\n ],\n 'withJsEngineGradleProps'\n);\n\nexport function updateAndroidBuildPropertiesFromConfig<\n SourceConfigType extends BuildPropertiesConfig\n>(\n config: SourceConfigType,\n gradleProperties: PropertiesItem[],\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);\n }\n\n return gradleProperties;\n}\n\nexport function updateAndroidBuildProperty(\n gradleProperties: PropertiesItem[],\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n const oldPropIndex = gradleProperties.findIndex(\n prop => prop.type === 'property' && prop.key === name\n );\n\n if (value) {\n // found the matched value, add or merge new property\n const newProp: PropertiesItem = {\n type: 'property',\n key: name,\n value,\n };\n\n if (oldPropIndex >= 0) {\n gradleProperties[oldPropIndex] = newProp;\n } else {\n gradleProperties.push(newProp);\n }\n } else if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {\n gradleProperties.splice(oldPropIndex, 1);\n }\n\n return gradleProperties;\n}\n"],"file":"BuildProperties.js"}
|
package/build/android/Package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/Package.ts"],"names":["debug","withPackageManifest","setPackageInAndroidManifest","withPackageGradle","config","modResults","language","contents","setPackageInBuildGradle","withPackageRefactor","renamePackageOnDisk","modRequest","projectRoot","getPackage","android","package","getPackageRoot","type","path","join","getCurrentPackageName","packageRoot","mainApplication","packagePath","dirname","packagePathParts","relative","split","sep","filter","Boolean","getCurrentPackageForProjectFile","fileName","filePath","getCurrentPackageNameForType","newPackageName","renamePackageOnDiskForType","packageName","currentPackageName","currentPackagePath","newPackagePath","fs","mkdirSync","recursive","cwd","forEach","relativePath","filepath","lstatSync","isFile","moveFileSync","oldPathParts","length","pathToCheck","files","readdirSync","rmdirSync","pop","filesToUpdate","absolute","push","readFileSync","toString","replace","RegExp","writeFileSync","e","src","dest","renameSync","buildGradle","pattern","androidManifest","manifest","$","getApplicationIdAsync","buildGradlePath","existsSync","promises","readFile","matchResult","match"],"mappings":";;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA,MAAMA,KAAK,GAAG,sBAAM,qCAAN,CAAd;AAEO,MAAMC,mBAAmB,GAAG,mDACjCC,2BADiC,EAEjC,qBAFiC,CAA5B;;;AAKA,MAAMC,iBAA+B,GAAGC,MAAM,IAAI;AACvD,SAAO,0CAAmBA,MAAnB,EAA2BA,MAAM,IAAI;AAC1C,QAAIA,MAAM,CAACC,UAAP,CAAkBC,QAAlB,KAA+B,QAAnC,EAA6C;AAC3CF,MAAAA,MAAM,CAACC,UAAP,CAAkBE,QAAlB,GAA6BC,uBAAuB,CAACJ,MAAD,EAASA,MAAM,CAACC,UAAP,CAAkBE,QAA3B,CAApD;AACD,KAFD,MAEO;AACL,yCACE,iBADF,EAEG,oEAFH;AAID;;AACD,WAAOH,MAAP;AACD,GAVM,CAAP;AAWD,CAZM;;;;AAcA,MAAMK,mBAAiC,GAAGL,MAAM,IAAI;AACzD,SAAO,0CAAiBA,MAAjB,EAA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B,4BAAlB,CAApB,CANuF,CAOvF;;AACA,0BAAOD,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAG,CAAH,CAAlB,yDAA2B,IAA3B;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withAppBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { directoryExistsAsync } from '../utils/modules';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest } from './Manifest';\nimport { getAppBuildGradleFilePath, getProjectFilePath } from './Paths';\n\nconst debug = Debug('expo:config-plugins:android:package');\n\nexport const withPackageManifest = createAndroidManifestPlugin(\n setPackageInAndroidManifest,\n 'withPackageManifest'\n);\n\nexport const withPackageGradle: ConfigPlugin = config => {\n return withAppBuildGradle(config, config => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setPackageInBuildGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.package',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withPackageRefactor: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n await renamePackageOnDisk(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getPackage(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.package ?? null;\n}\n\nfunction getPackageRoot(projectRoot: string, type: 'main' | 'debug') {\n return path.join(projectRoot, 'android', 'app', 'src', type, 'java');\n}\n\nfunction getCurrentPackageName(projectRoot: string, packageRoot: string) {\n const mainApplication = getProjectFilePath(projectRoot, 'MainApplication');\n const packagePath = path.dirname(mainApplication);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageForProjectFile(\n projectRoot: string,\n packageRoot: string,\n fileName: string,\n type: string\n) {\n const filePath = globSync(\n path.join(projectRoot, `android/app/src/${type}/java/**/${fileName}.@(java|kt)`)\n )[0];\n\n if (!filePath) {\n return null;\n }\n\n const packagePath = path.dirname(filePath);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageNameForType(projectRoot: string, type: string): string | null {\n const packageRoot = getPackageRoot(projectRoot, type as any);\n\n if (type === 'main') {\n return getCurrentPackageName(projectRoot, packageRoot);\n }\n // debug, etc..\n return getCurrentPackageForProjectFile(projectRoot, packageRoot, '*', type);\n}\n\n// NOTE(brentvatne): this assumes that our MainApplication.java file is in the root of the package\n// this makes sense for standard react-native projects but may not apply in customized projects, so if\n// we want this to be runnable in any app we need to handle other possibilities\nexport async function renamePackageOnDisk(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string\n) {\n const newPackageName = getPackage(config);\n if (newPackageName === null) {\n return;\n }\n\n for (const type of ['main', 'debug']) {\n await renamePackageOnDiskForType({ projectRoot, type, packageName: newPackageName });\n }\n}\n\nexport async function renamePackageOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n debug(`Found package \"${currentPackageName}\" for type \"${type}\"`);\n if (!currentPackageName || currentPackageName === packageName) {\n return;\n }\n debug(`Refactor \"${currentPackageName}\" to \"${packageName}\" for type \"${type}\"`);\n const packageRoot = getPackageRoot(projectRoot, type as any);\n // Set up our paths\n if (!(await directoryExistsAsync(packageRoot))) {\n debug(`- skipping refactor of missing directory: ${packageRoot}`);\n return;\n }\n\n const currentPackagePath = path.join(packageRoot, ...currentPackageName.split('.'));\n const newPackagePath = path.join(packageRoot, ...packageName.split('.'));\n\n // Create the new directory\n fs.mkdirSync(newPackagePath, { recursive: true });\n\n // Move everything from the old directory over\n globSync('**/*', { cwd: currentPackagePath }).forEach(relativePath => {\n const filepath = path.join(currentPackagePath, relativePath);\n if (fs.lstatSync(filepath).isFile()) {\n moveFileSync(filepath, path.join(newPackagePath, relativePath));\n } else {\n fs.mkdirSync(filepath, { recursive: true });\n }\n });\n\n // Remove the old directory recursively from com/old/package to com/old and com,\n // as long as the directories are empty\n const oldPathParts = currentPackageName.split('.');\n while (oldPathParts.length) {\n const pathToCheck = path.join(packageRoot, ...oldPathParts);\n try {\n const files = fs.readdirSync(pathToCheck);\n if (files.length === 0) {\n fs.rmdirSync(pathToCheck);\n }\n } finally {\n oldPathParts.pop();\n }\n }\n\n const filesToUpdate = [...globSync('**/*', { cwd: newPackagePath, absolute: true })];\n // Only update the BUCK file to match the main package name\n if (type === 'main') {\n filesToUpdate.push(path.join(projectRoot, 'android', 'app', 'BUCK'));\n }\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile()) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(new RegExp(currentPackageName!, 'g'), packageName);\n fs.writeFileSync(filepath, contents);\n }\n } catch (e) {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nfunction moveFileSync(src: string, dest: string) {\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.renameSync(src, dest);\n}\n\nexport function setPackageInBuildGradle(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const packageName = getPackage(config);\n if (packageName === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`applicationId ['\"].*['\"]`);\n return buildGradle.replace(pattern, `applicationId '${packageName}'`);\n}\n\nexport function setPackageInAndroidManifest(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const packageName = getPackage(config);\n\n if (packageName) {\n androidManifest.manifest.$.package = packageName;\n } else {\n delete androidManifest.manifest.$.package;\n }\n\n return androidManifest;\n}\n\nexport async function getApplicationIdAsync(projectRoot: string): Promise<string | null> {\n const buildGradlePath = getAppBuildGradleFilePath(projectRoot);\n if (!fs.existsSync(buildGradlePath)) {\n return null;\n }\n const buildGradle = await fs.promises.readFile(buildGradlePath, 'utf8');\n const matchResult = buildGradle.match(/applicationId ['\"](.*)['\"]/);\n // TODO add fallback for legacy cases to read from AndroidManifest.xml\n return matchResult?.[1] ?? null;\n}\n"],"file":"Package.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/android/Package.ts"],"names":["debug","withPackageManifest","setPackageInAndroidManifest","withPackageGradle","config","modResults","language","contents","setPackageInBuildGradle","withPackageRefactor","renamePackageOnDisk","modRequest","projectRoot","getPackage","android","package","getPackageRoot","type","path","join","getCurrentPackageName","packageRoot","mainApplication","packagePath","dirname","packagePathParts","relative","split","sep","filter","Boolean","getCurrentPackageForProjectFile","fileName","filePath","getCurrentPackageNameForType","newPackageName","renamePackageOnDiskForType","packageName","currentPackageName","currentPackagePath","newPackagePath","fs","mkdirSync","recursive","cwd","forEach","relativePath","filepath","lstatSync","isFile","moveFileSync","oldPathParts","length","pathToCheck","files","readdirSync","rmdirSync","pop","filesToUpdate","absolute","push","readFileSync","toString","replace","RegExp","writeFileSync","src","dest","renameSync","buildGradle","pattern","androidManifest","manifest","$","getApplicationIdAsync","buildGradlePath","existsSync","promises","readFile","matchResult","match"],"mappings":";;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;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,CAA9B;;AAEA,MAAIiC,WAAJ,EAAiB;AACfkC,IAAAA,eAAe,CAACC,QAAhB,CAAyBC,CAAzB,CAA2B1D,OAA3B,GAAqCsB,WAArC;AACD,GAFD,MAEO;AACL,WAAOkC,eAAe,CAACC,QAAhB,CAAyBC,CAAzB,CAA2B1D,OAAlC;AACD;;AAED,SAAOwD,eAAP;AACD;;AAEM,eAAeG,qBAAf,CAAqC9D,WAArC,EAAkF;AAAA;;AACvF,QAAM+D,eAAe,GAAG,wCAA0B/D,WAA1B,CAAxB;;AACA,MAAI,CAAC6B,cAAGmC,UAAH,CAAcD,eAAd,CAAL,EAAqC;AACnC,WAAO,IAAP;AACD;;AACD,QAAMN,WAAW,GAAG,MAAM5B,cAAGoC,QAAH,CAAYC,QAAZ,CAAqBH,eAArB,EAAsC,MAAtC,CAA1B;AACA,QAAMI,WAAW,GAAGV,WAAW,CAACW,KAAZ,CAAkB,4BAAlB,CAApB,CANuF,CAOvF;;AACA,0BAAOD,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAG,CAAH,CAAlB,yDAA2B,IAA3B;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withAppBuildGradle } from '../plugins/android-plugins';\nimport { withDangerousMod } from '../plugins/withDangerousMod';\nimport { directoryExistsAsync } from '../utils/modules';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest } from './Manifest';\nimport { getAppBuildGradleFilePath, getProjectFilePath } from './Paths';\n\nconst debug = Debug('expo:config-plugins:android:package');\n\nexport const withPackageManifest = createAndroidManifestPlugin(\n setPackageInAndroidManifest,\n 'withPackageManifest'\n);\n\nexport const withPackageGradle: ConfigPlugin = config => {\n return withAppBuildGradle(config, config => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setPackageInBuildGradle(config, config.modResults.contents);\n } else {\n addWarningAndroid(\n 'android.package',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport const withPackageRefactor: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n await renamePackageOnDisk(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport function getPackage(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.package ?? null;\n}\n\nfunction getPackageRoot(projectRoot: string, type: 'main' | 'debug') {\n return path.join(projectRoot, 'android', 'app', 'src', type, 'java');\n}\n\nfunction getCurrentPackageName(projectRoot: string, packageRoot: string) {\n const mainApplication = getProjectFilePath(projectRoot, 'MainApplication');\n const packagePath = path.dirname(mainApplication);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageForProjectFile(\n projectRoot: string,\n packageRoot: string,\n fileName: string,\n type: string\n) {\n const filePath = globSync(\n path.join(projectRoot, `android/app/src/${type}/java/**/${fileName}.@(java|kt)`)\n )[0];\n\n if (!filePath) {\n return null;\n }\n\n const packagePath = path.dirname(filePath);\n const packagePathParts = path.relative(packageRoot, packagePath).split(path.sep).filter(Boolean);\n\n return packagePathParts.join('.');\n}\n\nfunction getCurrentPackageNameForType(projectRoot: string, type: string): string | null {\n const packageRoot = getPackageRoot(projectRoot, type as any);\n\n if (type === 'main') {\n return getCurrentPackageName(projectRoot, packageRoot);\n }\n // debug, etc..\n return getCurrentPackageForProjectFile(projectRoot, packageRoot, '*', type);\n}\n\n// NOTE(brentvatne): this assumes that our MainApplication.java file is in the root of the package\n// this makes sense for standard react-native projects but may not apply in customized projects, so if\n// we want this to be runnable in any app we need to handle other possibilities\nexport async function renamePackageOnDisk(\n config: Pick<ExpoConfig, 'android'>,\n projectRoot: string\n) {\n const newPackageName = getPackage(config);\n if (newPackageName === null) {\n return;\n }\n\n for (const type of ['main', 'debug']) {\n await renamePackageOnDiskForType({ projectRoot, type, packageName: newPackageName });\n }\n}\n\nexport async function renamePackageOnDiskForType({\n projectRoot,\n type,\n packageName,\n}: {\n projectRoot: string;\n type: string;\n packageName: string;\n}) {\n if (!packageName) {\n return;\n }\n\n const currentPackageName = getCurrentPackageNameForType(projectRoot, type);\n debug(`Found package \"${currentPackageName}\" for type \"${type}\"`);\n if (!currentPackageName || currentPackageName === packageName) {\n return;\n }\n debug(`Refactor \"${currentPackageName}\" to \"${packageName}\" for type \"${type}\"`);\n const packageRoot = getPackageRoot(projectRoot, type as any);\n // Set up our paths\n if (!(await directoryExistsAsync(packageRoot))) {\n debug(`- skipping refactor of missing directory: ${packageRoot}`);\n return;\n }\n\n const currentPackagePath = path.join(packageRoot, ...currentPackageName.split('.'));\n const newPackagePath = path.join(packageRoot, ...packageName.split('.'));\n\n // Create the new directory\n fs.mkdirSync(newPackagePath, { recursive: true });\n\n // Move everything from the old directory over\n globSync('**/*', { cwd: currentPackagePath }).forEach(relativePath => {\n const filepath = path.join(currentPackagePath, relativePath);\n if (fs.lstatSync(filepath).isFile()) {\n moveFileSync(filepath, path.join(newPackagePath, relativePath));\n } else {\n fs.mkdirSync(filepath, { recursive: true });\n }\n });\n\n // Remove the old directory recursively from com/old/package to com/old and com,\n // as long as the directories are empty\n const oldPathParts = currentPackageName.split('.');\n while (oldPathParts.length) {\n const pathToCheck = path.join(packageRoot, ...oldPathParts);\n try {\n const files = fs.readdirSync(pathToCheck);\n if (files.length === 0) {\n fs.rmdirSync(pathToCheck);\n }\n } finally {\n oldPathParts.pop();\n }\n }\n\n const filesToUpdate = [...globSync('**/*', { cwd: newPackagePath, absolute: true })];\n // Only update the BUCK file to match the main package name\n if (type === 'main') {\n filesToUpdate.push(path.join(projectRoot, 'android', 'app', 'BUCK'));\n }\n // Replace all occurrences of the path in the project\n filesToUpdate.forEach((filepath: string) => {\n try {\n if (fs.lstatSync(filepath).isFile()) {\n let contents = fs.readFileSync(filepath).toString();\n contents = contents.replace(new RegExp(currentPackageName!, 'g'), packageName);\n fs.writeFileSync(filepath, contents);\n }\n } catch {\n debug(`Error updating \"${filepath}\" for type \"${type}\"`);\n }\n });\n}\n\nfunction moveFileSync(src: string, dest: string) {\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.renameSync(src, dest);\n}\n\nexport function setPackageInBuildGradle(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const packageName = getPackage(config);\n if (packageName === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`applicationId ['\"].*['\"]`);\n return buildGradle.replace(pattern, `applicationId '${packageName}'`);\n}\n\nexport function setPackageInAndroidManifest(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidManifest\n) {\n const packageName = getPackage(config);\n\n if (packageName) {\n androidManifest.manifest.$.package = packageName;\n } else {\n delete androidManifest.manifest.$.package;\n }\n\n return androidManifest;\n}\n\nexport async function getApplicationIdAsync(projectRoot: string): Promise<string | null> {\n const buildGradlePath = getAppBuildGradleFilePath(projectRoot);\n if (!fs.existsSync(buildGradlePath)) {\n return null;\n }\n const buildGradle = await fs.promises.readFile(buildGradlePath, 'utf8');\n const matchResult = buildGradle.match(/applicationId ['\"](.*)['\"]/);\n // TODO add fallback for legacy cases to read from AndroidManifest.xml\n return matchResult?.[1] ?? null;\n}\n"],"file":"Package.js"}
|
package/build/android/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as AllowBackup from './AllowBackup';
|
|
2
|
+
import * as BuildProperties from './BuildProperties';
|
|
2
3
|
import * as Colors from './Colors';
|
|
3
4
|
import * as EasBuild from './EasBuild';
|
|
4
5
|
import * as GoogleMapsApiKey from './GoogleMapsApiKey';
|
|
5
6
|
import * as GoogleServices from './GoogleServices';
|
|
6
7
|
import * as IntentFilters from './IntentFilters';
|
|
7
|
-
import * as JsEngine from './JsEngine';
|
|
8
8
|
import * as Manifest from './Manifest';
|
|
9
9
|
import * as Name from './Name';
|
|
10
10
|
import * as Orientation from './Orientation';
|
|
@@ -22,4 +22,4 @@ import * as Updates from './Updates';
|
|
|
22
22
|
import * as Version from './Version';
|
|
23
23
|
import * as WindowSoftInputMode from './WindowSoftInputMode';
|
|
24
24
|
export { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };
|
|
25
|
-
export { AllowBackup, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version,
|
|
25
|
+
export { AllowBackup, BuildProperties, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version, WindowSoftInputMode, };
|
package/build/android/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.
|
|
6
|
+
exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.IntentFilters = exports.GoogleServices = exports.GoogleMapsApiKey = exports.EasBuild = exports.Colors = exports.BuildProperties = exports.AllowBackup = void 0;
|
|
7
7
|
|
|
8
8
|
function AllowBackup() {
|
|
9
9
|
const data = _interopRequireWildcard(require("./AllowBackup"));
|
|
@@ -22,6 +22,23 @@ Object.defineProperty(exports, "AllowBackup", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
function BuildProperties() {
|
|
26
|
+
const data = _interopRequireWildcard(require("./BuildProperties"));
|
|
27
|
+
|
|
28
|
+
BuildProperties = function () {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(exports, "BuildProperties", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return BuildProperties();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
25
42
|
function Colors() {
|
|
26
43
|
const data = _interopRequireWildcard(require("./Colors"));
|
|
27
44
|
|
|
@@ -107,23 +124,6 @@ Object.defineProperty(exports, "IntentFilters", {
|
|
|
107
124
|
}
|
|
108
125
|
});
|
|
109
126
|
|
|
110
|
-
function JsEngine() {
|
|
111
|
-
const data = _interopRequireWildcard(require("./JsEngine"));
|
|
112
|
-
|
|
113
|
-
JsEngine = function () {
|
|
114
|
-
return data;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return data;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
Object.defineProperty(exports, "JsEngine", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return JsEngine();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
|
|
127
127
|
function Manifest() {
|
|
128
128
|
const data = _interopRequireWildcard(require("./Manifest"));
|
|
129
129
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as
|
|
1
|
+
{"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as BuildProperties from './BuildProperties';\nimport * as Colors from './Colors';\nimport * as EasBuild from './EasBuild';\nimport * as GoogleMapsApiKey from './GoogleMapsApiKey';\nimport * as GoogleServices from './GoogleServices';\nimport * as IntentFilters from './IntentFilters';\nimport * as Manifest from './Manifest';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Package from './Package';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrimaryColor from './PrimaryColor';\nimport * as Properties from './Properties';\nimport * as Resources from './Resources';\nimport * as Scheme from './Scheme';\nimport * as StatusBar from './StatusBar';\nimport * as Strings from './Strings';\nimport * as Styles from './Styles';\nimport * as Updates from './Updates';\nimport * as Version from './Version';\nimport * as WindowSoftInputMode from './WindowSoftInputMode';\n\nexport { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };\n\nexport {\n AllowBackup,\n BuildProperties,\n EasBuild,\n GoogleMapsApiKey,\n GoogleServices,\n IntentFilters,\n Name,\n Orientation,\n Package,\n PrimaryColor,\n StatusBar,\n Updates,\n Version,\n WindowSoftInputMode,\n};\n"],"file":"index.js"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import type { ConfigPlugin } from '../Plugin.types';
|
|
3
|
+
import { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
|
|
6
|
+
*
|
|
7
|
+
* The factory supports two modes from generic type inference
|
|
8
|
+
* ```ts
|
|
9
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
10
|
+
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
11
|
+
*
|
|
12
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
13
|
+
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param configToPropertyRules config to property mapping rules
|
|
17
|
+
* @param name the config plugin name
|
|
18
|
+
*/
|
|
19
|
+
export declare function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[], name?: string): ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType>;
|
|
20
|
+
/**
|
|
21
|
+
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
|
|
22
|
+
*/
|
|
23
|
+
export declare const withJsEnginePodfileProps: ConfigPlugin<void>;
|
|
24
|
+
export declare function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(config: SourceConfigType, podfileProperties: Record<string, string>, configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]): Record<string, string>;
|
|
25
|
+
export declare function updateIosBuildProperty(podfileProperties: Record<string, string>, name: string, value: string | null | undefined, options?: {
|
|
26
|
+
removePropWhenValueIsNull?: boolean;
|
|
27
|
+
}): Record<string, string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createBuildPodfilePropsConfigPlugin = createBuildPodfilePropsConfigPlugin;
|
|
7
|
+
exports.updateIosBuildPropertiesFromConfig = updateIosBuildPropertiesFromConfig;
|
|
8
|
+
exports.updateIosBuildProperty = updateIosBuildProperty;
|
|
9
|
+
exports.withJsEnginePodfileProps = void 0;
|
|
10
|
+
|
|
11
|
+
function _iosPlugins() {
|
|
12
|
+
const data = require("../plugins/ios-plugins");
|
|
13
|
+
|
|
14
|
+
_iosPlugins = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
|
|
23
|
+
*
|
|
24
|
+
* The factory supports two modes from generic type inference
|
|
25
|
+
* ```ts
|
|
26
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
27
|
+
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
28
|
+
*
|
|
29
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
30
|
+
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param configToPropertyRules config to property mapping rules
|
|
34
|
+
* @param name the config plugin name
|
|
35
|
+
*/
|
|
36
|
+
function createBuildPodfilePropsConfigPlugin(configToPropertyRules, name) {
|
|
37
|
+
const withUnknown = (config, sourceConfig) => (0, _iosPlugins().withPodfileProperties)(config, config => {
|
|
38
|
+
config.modResults = updateIosBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules);
|
|
39
|
+
return config;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (name) {
|
|
43
|
+
Object.defineProperty(withUnknown, 'name', {
|
|
44
|
+
value: name
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return withUnknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin([{
|
|
56
|
+
propName: 'expo.jsEngine',
|
|
57
|
+
propValueGetter: config => {
|
|
58
|
+
var _ref, _config$ios$jsEngine, _config$ios;
|
|
59
|
+
|
|
60
|
+
return (_ref = (_config$ios$jsEngine = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.jsEngine) !== null && _config$ios$jsEngine !== void 0 ? _config$ios$jsEngine : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'jsc';
|
|
61
|
+
}
|
|
62
|
+
}], 'withJsEnginePodfileProps');
|
|
63
|
+
exports.withJsEnginePodfileProps = withJsEnginePodfileProps;
|
|
64
|
+
|
|
65
|
+
function updateIosBuildPropertiesFromConfig(config, podfileProperties, configToPropertyRules) {
|
|
66
|
+
for (const configToProperty of configToPropertyRules) {
|
|
67
|
+
const value = configToProperty.propValueGetter(config);
|
|
68
|
+
updateIosBuildProperty(podfileProperties, configToProperty.propName, value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return podfileProperties;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function updateIosBuildProperty(podfileProperties, name, value, options) {
|
|
75
|
+
if (value) {
|
|
76
|
+
podfileProperties[name] = value;
|
|
77
|
+
} else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull) {
|
|
78
|
+
delete podfileProperties[name];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return podfileProperties;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=BuildProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ios/BuildProperties.ts"],"names":["createBuildPodfilePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","modResults","updateIosBuildPropertiesFromConfig","Object","defineProperty","value","withJsEnginePodfileProps","propName","propValueGetter","ios","jsEngine","podfileProperties","configToProperty","updateIosBuildProperty","options","removePropWhenValueIsNull"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mCAAT,CACLC,qBADK,EAELC,IAFK,EAGL;AACA,QAAMC,WAAwF,GAAG,CAC/FC,MAD+F,EAE/FC,YAF+F,KAI/F,yCAAsBD,MAAtB,EAA8BA,MAAM,IAAI;AACtCA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,kCAAkC,CACnDF,YADmD,aACnDA,YADmD,cACnDA,YADmD,GACnCD,MADmC,EAEpDA,MAAM,CAACE,UAF6C,EAGpDL,qBAHoD,CAAtD;AAKA,WAAOG,MAAP;AACD,GAPD,CAJF;;AAYA,MAAIF,IAAJ,EAAU;AACRM,IAAAA,MAAM,CAACC,cAAP,CAAsBN,WAAtB,EAAmC,MAAnC,EAA2C;AACzCO,MAAAA,KAAK,EAAER;AADkC,KAA3C;AAGD;;AACD,SAAOC,WAAP;AACD;AAED;AACA;AACA;;;AACO,MAAMQ,wBAAwB,GAAGX,mCAAmC,CACzE,CACE;AACEY,EAAAA,QAAQ,EAAE,eADZ;AAEEC,EAAAA,eAAe,EAAET,MAAM;AAAA;;AAAA,0DAAIA,MAAM,CAACU,GAAX,gDAAI,YAAYC,QAAhB,uEAA4BX,MAAM,CAACW,QAAnC,uCAA+C,KAA/C;AAAA;AAFzB,CADF,CADyE,EAOzE,0BAPyE,CAApE;;;AAUA,SAASR,kCAAT,CACLH,MADK,EAELY,iBAFK,EAGLf,qBAHK,EAIL;AACA,OAAK,MAAMgB,gBAAX,IAA+BhB,qBAA/B,EAAsD;AACpD,UAAMS,KAAK,GAAGO,gBAAgB,CAACJ,eAAjB,CAAiCT,MAAjC,CAAd;AACAc,IAAAA,sBAAsB,CAACF,iBAAD,EAAoBC,gBAAgB,CAACL,QAArC,EAA+CF,KAA/C,CAAtB;AACD;;AACD,SAAOM,iBAAP;AACD;;AAEM,SAASE,sBAAT,CACLF,iBADK,EAELd,IAFK,EAGLQ,KAHK,EAILS,OAJK,EAKL;AACA,MAAIT,KAAJ,EAAW;AACTM,IAAAA,iBAAiB,CAACd,IAAD,CAAjB,GAA0BQ,KAA1B;AACD,GAFD,MAEO,IAAIS,OAAJ,aAAIA,OAAJ,eAAIA,OAAO,CAAEC,yBAAb,EAAwC;AAC7C,WAAOJ,iBAAiB,CAACd,IAAD,CAAxB;AACD;;AACD,SAAOc,iBAAP;AACD","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\n\n/**\n * Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withPodfileProperties(config, config => {\n config.modResults = updateIosBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config\n */\nexport const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: config => config.ios?.jsEngine ?? config.jsEngine ?? 'jsc',\n },\n ],\n 'withJsEnginePodfileProps'\n);\n\nexport function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(\n config: SourceConfigType,\n podfileProperties: Record<string, string>,\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateIosBuildProperty(podfileProperties, configToProperty.propName, value);\n }\n return podfileProperties;\n}\n\nexport function updateIosBuildProperty(\n podfileProperties: Record<string, string>,\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n if (value) {\n podfileProperties[name] = value;\n } else if (options?.removePropWhenValueIsNull) {\n delete podfileProperties[name];\n }\n return podfileProperties;\n}\n"],"file":"BuildProperties.js"}
|
package/build/ios/BuildScheme.js
CHANGED
|
@@ -60,7 +60,12 @@ function getRunnableSchemesFromXcodeproj(projectRoot, {
|
|
|
60
60
|
let osType = 'iOS';
|
|
61
61
|
const type = (0, _Xcodeproj().unquote)(target.productType);
|
|
62
62
|
|
|
63
|
-
if (type === _Target().TargetType.
|
|
63
|
+
if (type === _Target().TargetType.WATCH) {
|
|
64
|
+
osType = 'watchOS';
|
|
65
|
+
} else if ( // (apps) com.apple.product-type.application
|
|
66
|
+
// (app clips) com.apple.product-type.application.on-demand-install-capable
|
|
67
|
+
// NOTE(EvanBacon): This matches against `watchOS` as well so we check for watch first.
|
|
68
|
+
type.startsWith(_Target().TargetType.APPLICATION)) {
|
|
64
69
|
// Attempt to resolve the platform SDK for each target so we can filter devices.
|
|
65
70
|
const xcConfigurationList = project.hash.project.objects.XCConfigurationList[target.buildConfigurationList];
|
|
66
71
|
|
|
@@ -81,8 +86,6 @@ function getRunnableSchemesFromXcodeproj(projectRoot, {
|
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
|
-
} else if (type === _Target().TargetType.WATCH) {
|
|
85
|
-
osType = 'watchOS';
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ios/BuildScheme.ts"],"names":["getSchemesFromXcodeproj","projectRoot","getRunnableSchemesFromXcodeproj","configuration","project","map","target","osType","type","productType","TargetType","APPLICATION","xcConfigurationList","hash","objects","XCConfigurationList","buildConfigurationList","buildConfiguration","buildConfigurations","find","value","comment","xcBuildConfiguration","XCBuildConfiguration","buildSdkRoot","buildSettings","SDKROOT","
|
|
1
|
+
{"version":3,"sources":["../../src/ios/BuildScheme.ts"],"names":["getSchemesFromXcodeproj","projectRoot","getRunnableSchemesFromXcodeproj","configuration","project","map","target","osType","type","productType","TargetType","WATCH","startsWith","APPLICATION","xcConfigurationList","hash","objects","XCConfigurationList","buildConfigurationList","buildConfiguration","buildConfigurations","find","value","comment","xcBuildConfiguration","XCBuildConfiguration","buildSdkRoot","buildSettings","SDKROOT","name","readSchemeAsync","scheme","allSchemePaths","re","RegExp","schemePath","i","exec","path","Error","getApplicationTargetNameForSchemeAsync","schemeXML","buildActionEntry","Scheme","BuildAction","BuildActionEntries","BuildActionEntry","targetName","length","getBlueprintName","entry","BuildableReference","BuildableName","endsWith","getArchiveBuildConfigurationForSchemeAsync","ArchiveAction","BlueprintName"],"mappings":";;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AA0BO,SAASA,uBAAT,CAAiCC,WAAjC,EAAgE;AACrE,SAAO,8BAAgBA,WAAhB,CAAP;AACD;;AAEM,SAASC,+BAAT,CACLD,WADK,EAEL;AAAEE,EAAAA,aAAa,GAAG;AAAlB,IAAuE,EAFlE,EAG6C;AAClD,QAAMC,OAAO,GAAG,6BAAWH,WAAX,CAAhB;AAEA,SAAO,mCAAoBG,OAApB,EAA6BC,GAA7B,CAAiC,CAAC,GAAGC,MAAH,CAAD,KAAgB;AACtD,QAAIC,MAAM,GAAG,KAAb;AACA,UAAMC,IAAI,GAAG,0BAAQF,MAAM,CAACG,WAAf,CAAb;;AAEA,QAAID,IAAI,KAAKE,qBAAWC,KAAxB,EAA+B;AAC7BJ,MAAAA,MAAM,GAAG,SAAT;AACD,KAFD,MAEO,KACL;AACA;AACA;AACAC,IAAAA,IAAI,CAACI,UAAL,CAAgBF,qBAAWG,WAA3B,CAJK,EAKL;AACA;AACA,YAAMC,mBAAmB,GACvBV,OAAO,CAACW,IAAR,CAAaX,OAAb,CAAqBY,OAArB,CAA6BC,mBAA7B,CAAiDX,MAAM,CAACY,sBAAx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A,SAAS,CAAEE,MAAd,gFAAG,mBAAmBY,aAAtB,oFAAG,sBAAmC,CAAnC,CAAH,qFAAG,uBAAwC,GAAxC,CAAH,2DAAG,uBAA8CpC,kBAAzE;;AACA,MAAI,CAACA,kBAAL,EAAyB;AACvB,UAAM,IAAIoB,KAAJ,CAAW,GAAER,MAAO,iCAApB,CAAN;AACD;;AACD,SAAOZ,kBAAP;AACD;;AAED,SAAS8B,gBAAT,CAA0BC,KAA1B,EAA4E;AAAA;;AAC1E,SAAOA,KAAP,aAAOA,KAAP,iDAAOA,KAAK,CAAEC,kBAAd,qFAAO,uBAA4B,CAA5B,CAAP,qFAAO,uBAAiC,GAAjC,CAAP,2DAAO,uBAAuCK,aAA9C;AACD","sourcesContent":["import { readXMLAsync } from '../utils/XML';\nimport { findSchemeNames, findSchemePaths } from './Paths';\nimport { findSignableTargets, TargetType } from './Target';\nimport { getPbxproj, unquote } from './utils/Xcodeproj';\n\ninterface SchemeXML {\n Scheme?: {\n BuildAction?: {\n BuildActionEntries?: {\n BuildActionEntry?: BuildActionEntryType[];\n }[];\n }[];\n ArchiveAction?: {\n $?: {\n buildConfiguration?: string;\n };\n }[];\n };\n}\n\ninterface BuildActionEntryType {\n BuildableReference?: {\n $?: {\n BlueprintName?: string;\n BuildableName?: string;\n };\n }[];\n}\n\nexport function getSchemesFromXcodeproj(projectRoot: string): string[] {\n return findSchemeNames(projectRoot);\n}\n\nexport function getRunnableSchemesFromXcodeproj(\n projectRoot: string,\n { configuration = 'Debug' }: { configuration?: 'Debug' | 'Release' } = {}\n): { name: string; osType: string; type: string }[] {\n const project = getPbxproj(projectRoot);\n\n return findSignableTargets(project).map(([, target]) => {\n let osType = 'iOS';\n const type = unquote(target.productType);\n\n if (type === TargetType.WATCH) {\n osType = 'watchOS';\n } else if (\n // (apps) com.apple.product-type.application\n // (app clips) com.apple.product-type.application.on-demand-install-capable\n // NOTE(EvanBacon): This matches against `watchOS` as well so we check for watch first.\n type.startsWith(TargetType.APPLICATION)\n ) {\n // Attempt to resolve the platform SDK for each target so we can filter devices.\n const xcConfigurationList =\n project.hash.project.objects.XCConfigurationList[target.buildConfigurationList];\n\n if (xcConfigurationList) {\n const buildConfiguration =\n xcConfigurationList.buildConfigurations.find(\n (value: { comment: string; value: string }) => value.comment === configuration\n ) || xcConfigurationList.buildConfigurations[0];\n if (buildConfiguration?.value) {\n const xcBuildConfiguration =\n project.hash.project.objects.XCBuildConfiguration?.[buildConfiguration.value];\n\n const buildSdkRoot = xcBuildConfiguration.buildSettings.SDKROOT;\n if (\n buildSdkRoot === 'appletvos' ||\n 'TVOS_DEPLOYMENT_TARGET' in xcBuildConfiguration.buildSettings\n ) {\n // Is a TV app...\n osType = 'tvOS';\n } else if (buildSdkRoot === 'iphoneos') {\n osType = 'iOS';\n }\n }\n }\n }\n\n return {\n name: unquote(target.name),\n osType,\n type: unquote(target.productType),\n };\n });\n}\n\nasync function readSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<SchemeXML | undefined> {\n const allSchemePaths = findSchemePaths(projectRoot);\n const re = new RegExp(`/${scheme}.xcscheme`, 'i');\n const schemePath = allSchemePaths.find(i => re.exec(i));\n if (schemePath) {\n return ((await readXMLAsync({ path: schemePath })) as unknown) as SchemeXML | undefined;\n } else {\n throw new Error(`scheme '${scheme}' does not exist, make sure it's marked as shared`);\n }\n}\n\nexport async function getApplicationTargetNameForSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<string> {\n const schemeXML = await readSchemeAsync(projectRoot, scheme);\n const buildActionEntry =\n schemeXML?.Scheme?.BuildAction?.[0]?.BuildActionEntries?.[0]?.BuildActionEntry;\n const targetName =\n buildActionEntry?.length === 1\n ? getBlueprintName(buildActionEntry[0])\n : getBlueprintName(\n buildActionEntry?.find(entry => {\n return entry.BuildableReference?.[0]?.['$']?.BuildableName?.endsWith('.app');\n })\n );\n if (!targetName) {\n throw new Error(`${scheme}.xcscheme seems to be corrupted`);\n }\n return targetName;\n}\n\nexport async function getArchiveBuildConfigurationForSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<string> {\n const schemeXML = await readSchemeAsync(projectRoot, scheme);\n const buildConfiguration = schemeXML?.Scheme?.ArchiveAction?.[0]?.['$']?.buildConfiguration;\n if (!buildConfiguration) {\n throw new Error(`${scheme}.xcscheme seems to be corrupted`);\n }\n return buildConfiguration;\n}\n\nfunction getBlueprintName(entry?: BuildActionEntryType): string | undefined {\n return entry?.BuildableReference?.[0]?.['$']?.BlueprintName;\n}\n"],"file":"BuildScheme.js"}
|
|
@@ -2,4 +2,8 @@ import { ExpoConfig } from '@expo/config-types';
|
|
|
2
2
|
import { JSONObject } from '@expo/json-file';
|
|
3
3
|
export declare const withAssociatedDomains: import("..").ConfigPlugin<void>;
|
|
4
4
|
export declare function setAssociatedDomains(config: ExpoConfig, { 'com.apple.developer.associated-domains': _, ...entitlementsPlist }: JSONObject): JSONObject;
|
|
5
|
-
export declare function getEntitlementsPath(projectRoot: string
|
|
5
|
+
export declare function getEntitlementsPath(projectRoot: string, { targetName, buildConfiguration, }?: {
|
|
6
|
+
targetName?: string;
|
|
7
|
+
buildConfiguration?: string;
|
|
8
|
+
}): string | null;
|
|
9
|
+
export declare function ensureApplicationTargetEntitlementsFileConfigured(projectRoot: string): void;
|