MCPcopy Create free account
hub / github.com/ionic-team/capacitor / checkBuildGradle

Function checkBuildGradle

cli/src/android/doctor.ts:162–181  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

160}
161
162async function checkBuildGradle(config: Config) {
163 const fileName = 'build.gradle';
164 const filePath = join(config.android.appDirAbs, fileName);
165
166 if (!(await pathExists(filePath))) {
167 return `${c.strong(fileName)} file is missing in ${c.strong(config.android.appDir)}`;
168 }
169
170 let fileContent = await readFile(filePath, { encoding: 'utf-8' });
171
172 fileContent = fileContent.replace(/'|"/g, '').replace(/\s+/g, ' ');
173
174 const searchFor = `applicationId`;
175
176 if (fileContent.indexOf(searchFor) === -1) {
177 return `${c.strong('build.gradle')} file missing ${c.input(`applicationId`)} config in ${filePath}`;
178 }
179
180 return null;
181}
182
183async function checkGradlew(config: Config) {
184 const fileName = 'gradlew';

Callers 1

checkPackageFunction · 0.85

Calls 1

readFileFunction · 0.85

Tested by

no test coverage detected