Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1639 from james-criscuolo/master
Browse files Browse the repository at this point in the history
ios: remove legacy build system as its no longer needed:
  • Loading branch information
EddyVerbruggen authored Jul 14, 2020
2 parents 33dadef + 8117b0c commit d9cf845
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 187 deletions.
93 changes: 0 additions & 93 deletions publish/scripts/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ function promptQuestionsResult(result) {
writePodFile(result);
writeGoogleServiceCopyHook();
writeBuildscriptHookForCrashlytics(isSelected(result.crashlytics));
writeBuildscriptHookForFirestore(isSelected(result.firestore));
activateIOSCrashlyticsFramework(isSelected(result.crashlytics));
activateIOSMLKitCameraFramework(isSelected(result.ml_kit));
}
Expand Down Expand Up @@ -597,98 +596,6 @@ module.exports = function($logger, $projectData, hookArgs) {
}
}

/**
* Create the iOS build script for setting the workspace to the legacy build system (for now).
*
* @param {any} enable is Firestore enabled
*/
function writeBuildscriptHookForFirestore(enable) {
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "firebase-firestore-buildscript.js");

if (!enable) {
if (fs.existsSync(scriptPath)) {
fs.unlinkSync(scriptPath);
}
return
}

console.log("Install Firestore buildscript hook.");
try {
var scriptContent =
`const fs = require('fs-extra');
const path = require('path');
module.exports = function($logger, $projectData, hookArgs) {
const platformFromHookArgs = hookArgs && (hookArgs.platform || (hookArgs.prepareData && hookArgs.prepareData.platform));
const platform = (platformFromHookArgs || '').toLowerCase();
return new Promise(function(resolve, reject) {
const isNativeProjectPrepared = hookArgs.prepareData ? (!hookArgs.prepareData.nativePrepare || !hookArgs.prepareData.nativePrepare.skipNativePrepare) : (!hookArgs.nativePrepare || !hookArgs.nativePrepare.skipNativePrepare);
if (isNativeProjectPrepared) {
try {
if (platform !== 'ios') {
resolve();
return;
}
const sanitizedAppName = path.basename($projectData.projectDir).split('').filter((c) => /[a-zA-Z0-9]/.test(c)).join('');
const xcodeWorkspacePath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace');
if (!fs.existsSync(xcodeWorkspacePath)) {
$logger.error(xcodeWorkspacePath + ' is missing.');
reject();
return;
}
const xcodeWorkspaceShareddataPath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace', 'xcshareddata');
$logger.trace('Using Xcode workspace settings path', xcodeWorkspaceShareddataPath);
console.log('Using Xcode workspace settings path: ' + xcodeWorkspaceShareddataPath);
if (!fs.existsSync(xcodeWorkspaceShareddataPath)) {
fs.mkdirSync(xcodeWorkspaceShareddataPath);
}
const xcodeWorkspaceSettingsFile = path.join(xcodeWorkspaceShareddataPath, 'WorkspaceSettings.xcsettings');
// for this temp fix we assume that if the file is there, it contains the correct config
if (!fs.existsSync(xcodeWorkspaceSettingsFile)) {
fs.writeFileSync(xcodeWorkspaceSettingsFile, \`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
\`);
$logger.trace('Xcode workspace file written');
}
resolve();
} catch (e) {
$logger.error('Unknown error during prepare Firestore', e);
reject();
}
} else {
$logger.trace("Native project not prepared.");
resolve();
}
});
};
`;
var afterPrepareDirPath = path.dirname(scriptPath);
var hooksDirPath = path.dirname(afterPrepareDirPath);
if (!fs.existsSync(afterPrepareDirPath)) {
if (!fs.existsSync(hooksDirPath)) {
fs.mkdirSync(hooksDirPath);
}
fs.mkdirSync(afterPrepareDirPath);
}
fs.writeFileSync(scriptPath, scriptContent);
} catch (e) {
console.log("Failed to install Firestore buildscript hook.");
console.log(e);
}
}

/**
* Create the Android Gradle for installing the Firebase Android dependencies and service dependencies
*
Expand Down
95 changes: 1 addition & 94 deletions src/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -3051,7 +3051,6 @@ function promptQuestionsResult(result) {
writePodFile(result);
writeGoogleServiceCopyHook();
writeBuildscriptHookForCrashlytics(isSelected(result.crashlytics));
writeBuildscriptHookForFirestore(isSelected(result.firestore));
activateIOSCrashlyticsFramework(isSelected(result.crashlytics));
activateIOSMLKitCameraFramework(isSelected(result.ml_kit));
}
Expand Down Expand Up @@ -3395,98 +3394,6 @@ module.exports = function($logger, $projectData, hookArgs) {
}
}

/**
* Create the iOS build script for setting the workspace to the legacy build system (for now).
*
* @param {any} enable is Firestore enabled
*/
function writeBuildscriptHookForFirestore(enable) {
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "firebase-firestore-buildscript.js");

if (!enable) {
if (fs.existsSync(scriptPath)) {
fs.unlinkSync(scriptPath);
}
return
}

console.log("Install Firestore buildscript hook.");
try {
var scriptContent =
`const fs = require('fs-extra');
const path = require('path');
module.exports = function($logger, $projectData, hookArgs) {
const platformFromHookArgs = hookArgs && (hookArgs.platform || (hookArgs.prepareData && hookArgs.prepareData.platform));
const platform = (platformFromHookArgs || '').toLowerCase();
return new Promise(function(resolve, reject) {
const isNativeProjectPrepared = hookArgs.prepareData ? (!hookArgs.prepareData.nativePrepare || !hookArgs.prepareData.nativePrepare.skipNativePrepare) : (!hookArgs.nativePrepare || !hookArgs.nativePrepare.skipNativePrepare);
if (isNativeProjectPrepared) {
try {
if (platform !== 'ios') {
resolve();
return;
}
const sanitizedAppName = path.basename($projectData.projectDir).split('').filter((c) => /[a-zA-Z0-9]/.test(c)).join('');
const xcodeWorkspacePath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace');
if (!fs.existsSync(xcodeWorkspacePath)) {
$logger.error(xcodeWorkspacePath + ' is missing.');
reject();
return;
}
const xcodeWorkspaceShareddataPath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcworkspace', 'xcshareddata');
$logger.trace('Using Xcode workspace settings path', xcodeWorkspaceShareddataPath);
console.log('Using Xcode workspace settings path: ' + xcodeWorkspaceShareddataPath);
if (!fs.existsSync(xcodeWorkspaceShareddataPath)) {
fs.mkdirSync(xcodeWorkspaceShareddataPath);
}
const xcodeWorkspaceSettingsFile = path.join(xcodeWorkspaceShareddataPath, 'WorkspaceSettings.xcsettings');
// for this temp fix we assume that if the file is there, it contains the correct config
if (!fs.existsSync(xcodeWorkspaceSettingsFile)) {
fs.writeFileSync(xcodeWorkspaceSettingsFile, \`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
\`);
$logger.trace('Xcode workspace file written');
}
resolve();
} catch (e) {
$logger.error('Unknown error during prepare Firestore', e);
reject();
}
} else {
$logger.trace("Native project not prepared.");
resolve();
}
});
};
`;
var afterPrepareDirPath = path.dirname(scriptPath);
var hooksDirPath = path.dirname(afterPrepareDirPath);
if (!fs.existsSync(afterPrepareDirPath)) {
if (!fs.existsSync(hooksDirPath)) {
fs.mkdirSync(hooksDirPath);
}
fs.mkdirSync(afterPrepareDirPath);
}
fs.writeFileSync(scriptPath, scriptContent);
} catch (e) {
console.log("Failed to install Firestore buildscript hook.");
console.log(e);
}
}

/**
* Create the Android Gradle for installing the Firebase Android dependencies and service dependencies
*
Expand Down Expand Up @@ -3958,4 +3865,4 @@ function isPresent(value) {


/***/ })
/******/ ]);
/******/ ]);

0 comments on commit d9cf845

Please sign in to comment.