react-native-legal
Version:
Acknowledge OSS libraries used in your React Native app
28 lines (27 loc) • 1.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyAndConfigureAboutLibrariesPlugin = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const android_1 = require("../../../plugin-utils/build/android");
const utils_1 = require("./utils");
/**
* Modifies application's build.gradle with AboutLibraries plugin
*
* NOTE: As of now, it doesn't support build.gradle.kts (Gradle Kotlin Script)
*/
function applyAndConfigureAboutLibrariesPlugin(androidProjectPath) {
if (fs_1.default.existsSync(path_1.default.join(androidProjectPath, 'app', 'build.gradle.kts'))) {
console.warn('Gradle Kotlin scripts are not supported yet');
}
else if (fs_1.default.existsSync(path_1.default.join(androidProjectPath, 'app', 'build.gradle'))) {
(0, utils_1.modifyFileContent)(path_1.default.join(androidProjectPath, 'app', 'build.gradle'), android_1.applyAndConfigureAboutLibrariesPluginUtil);
}
else {
console.warn('Cannot find app/build.gradle file');
}
}
exports.applyAndConfigureAboutLibrariesPlugin = applyAndConfigureAboutLibrariesPlugin;