Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gradle-client/rnrepo-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This will make the plugin use the specified React Native root directory instead
#### Disabling the RNRepo plugin
You can disable the RNRepo plugin execution by setting the `DISABLE_RNREPO` environment variable to any value:
```bash
DISABLE_RNREPO=true ./gradlew assembleDebug
DISABLE_RNREPO=true ./gradlew :app:assembleDebug
```

## Unittests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class PrebuildsPlugin : Plugin<Project> {
if (shouldPluginExecute(project, extension)) {
logger.lifecycle("RN Repo plugin v${BuildConstants.PLUGIN_VERSION} is enabled")

// Warn if command was launched from root context instead of app context
checkAndWarnCommandContext(project)

// Check what packages are in project and which are we supporting
getProjectPackages(project.rootProject.allprojects, extension)
loadDenyList(extension)
Expand Down Expand Up @@ -181,6 +184,19 @@ class PrebuildsPlugin : Plugin<Project> {
defaultValue: String,
): String = System.getenv(propertyName) ?: (project.findProperty(propertyName) as? String) ?: defaultValue

private fun checkAndWarnCommandContext(project: Project) {
val taskNames = project.gradle.startParameter.taskNames
val allTasksFromProject = taskNames.all { it.startsWith(":${project.name}") || it.startsWith(project.name) }

if (!allTasksFromProject) {
logger.warn(
"Command was launched from root context (e.g., './gradlew assembleRelease'). " +
"It should be launched from ${project.name} module context (e.g., './gradlew :${project.name}:assembleRelease'). " +
"This may cause build issues.",
)
}
}

private fun addDependency(
project: Project,
configurationName: String,
Expand Down