Skip to content

Commit

Permalink
[tools-public] Remove check-dynamic-macros-android.sh (#7919)
Browse files Browse the repository at this point in the history
# Why

Follow-up to expo/expo-cli#1933.

# How

Since we won't use `check-dynamic-macros-android.sh` when building standalone apps and there is no other place we use it we can remove it. Let's believe in `expotools`!

# Test Plan

I will cherry-pick that commit to `sdk-37` and push a new image to Android staging.
  • Loading branch information
sjchmiela committed Apr 20, 2020
1 parent 5d99c0f commit 088a855
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 74 deletions.
4 changes: 0 additions & 4 deletions buildAndroidTarballLocally.sh
Expand Up @@ -10,10 +10,6 @@ mkdir -p $ARTIFACTS_DIR
rm -rf $TEMP_DIR
mkdir -p $TEMP_DIR

# only check-dynamic-macros-android.sh is used
mkdir -p $TEMP_DIR/tools-public
ln -s ${ROOT_DIR}/tools-public/check-dynamic-macros-android.sh $TEMP_DIR/tools-public/check-dynamic-macros-android.sh

# we use the root android project as a shell app template
ln -s ${ROOT_DIR}/android $TEMP_DIR/android
# We wouldn't want to use any versioned ABI in a standalone app
Expand Down
1 change: 0 additions & 1 deletion template-files/android-paths.check-ignore

This file was deleted.

14 changes: 9 additions & 5 deletions template-files/android-paths.json
@@ -1,7 +1,11 @@
{
"AndroidManifest.xml": "android/app/src/main/AndroidManifest.xml",
"google-services.json": "android/app/google-services.json",
"ExponentKeys.java": "android/expoview/src/main/java/host/exp/exponent/generated/ExponentKeys.java",
"fabric.properties": "android/app/fabric.properties",
"bare-expo/android/app/google-services.json": "apps/bare-expo/android/app/google-services.json"
"paths": {
"AndroidManifest.xml": "android/app/src/main/AndroidManifest.xml",
"google-services.json": "android/app/google-services.json",
"ExponentKeys.java": "android/expoview/src/main/java/host/exp/exponent/generated/ExponentKeys.java",
"fabric.properties": "android/app/fabric.properties"
},
"generateOnly": {
"bare-expo/android/app/google-services.json": "apps/bare-expo/android/app/google-services.json"
}
}
1 change: 0 additions & 1 deletion template-files/ios-paths.check-ignore

This file was deleted.

8 changes: 6 additions & 2 deletions template-files/ios-paths.json
@@ -1,4 +1,8 @@
{
"GoogleService-Info.plist": "ios/Exponent/Supporting/GoogleService-Info.plist",
"bare-expo/ios/BareExpo/GoogleService-Info.plist": "apps/bare-expo/ios/BareExpo/GoogleService-Info.plist"
"paths": {
"GoogleService-Info.plist": "ios/Exponent/Supporting/GoogleService-Info.plist"
},
"generateOnly": {
"bare-expo/ios/BareExpo/GoogleService-Info.plist": "apps/bare-expo/ios/BareExpo/GoogleService-Info.plist"
}
}
46 changes: 0 additions & 46 deletions tools-public/check-dynamic-macros-android.sh

This file was deleted.

24 changes: 9 additions & 15 deletions tools/expotools/src/dynamic-macros/generateDynamicMacros.ts
Expand Up @@ -141,14 +141,18 @@ async function copyTemplateFileAsync(
}

type TemplatePaths = Record<string, string>;
type CheckIgnoredTemplatePaths = string[];
type TemplatePathsFile = {
paths: TemplatePaths;
generateOnly: TemplatePaths;
};

async function copyTemplateFilesAsync(platform: string, args: any, templateSubstitutions: any) {
const templateFilesPath = args.templateFilesPath || path.join(EXPO_DIR, 'template-files');
const templatePaths = (await new JsonFile(
const templatePathsFile = (await new JsonFile(
path.join(templateFilesPath, `${platform}-paths.json`)
).readAsync()) as TemplatePaths;
const checkIgnoredTemplatePaths = await readCheckIgnoredTemplatePaths(platform);
).readAsync()) as TemplatePathsFile;
const templatePaths = { ...templatePathsFile.paths, ...templatePathsFile.generateOnly };
const checkIgnoredTemplatePaths = Object.values(templatePathsFile.generateOnly);
const promises: Promise<any>[] = [];
const skipTemplates: string[] = args.skipTemplates || [];
for (const [source, dest] of Object.entries(templatePaths)) {
Expand All @@ -160,7 +164,7 @@ async function copyTemplateFilesAsync(platform: string, args: any, templateSubst
continue;
}

const isOptional = checkIgnoredTemplatePaths.includes(source);
const isOptional = checkIgnoredTemplatePaths.includes(dest);
console.log(
'Rendering %s from template %s %s...',
chalk.cyan(path.join(EXPO_DIR, dest)),
Expand All @@ -182,14 +186,4 @@ async function copyTemplateFilesAsync(platform: string, args: any, templateSubst
await Promise.all(promises);
}

async function readCheckIgnoredTemplatePaths(platform: string): Promise<CheckIgnoredTemplatePaths> {
const fileContents = (await readExistingSourceAsync(`${platform}-paths.check-ignore`)) || '';
const fileContentsTrimmed = fileContents.trim();
if (fileContentsTrimmed) {
return fileContentsTrimmed.split('\n');
} else {
return [];
}
}

export { generateDynamicMacrosAsync, cleanupDynamicMacrosAsync, getTemplateSubstitutionsAsync };

0 comments on commit 088a855

Please sign in to comment.