brick-module 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Usage: Add to settings.gradle only:
6
6
  * apply from: file("../node_modules/brick-module/android/brick_modules.gradle")
7
- * applyBrickModules(settings)
7
+ * applyBrickModules(settings, [projectRoot: "../", appProject: "app"])
8
8
  */
9
9
 
10
10
  import groovy.json.JsonSlurper
@@ -107,19 +107,26 @@ ext.runBrickCodegen = { workingDir ->
107
107
  // Main Configuration
108
108
  // =============================================================================
109
109
 
110
- ext.applyBrickModules = { settings, args = [:] ->
111
- def appPath = (args instanceof Map) ? args.appPath : args
112
- if (!appPath) {
113
- throw new GradleException("Brick: appPath is required. Call applyBrickModules(settings, [appPath: '/absolute/path/to/app'])")
110
+ ext.applyBrickModules = { settings, args ->
111
+ def projectRootPath = args.projectRoot
112
+ def appProjectName = args.appProject
113
+
114
+ if (!projectRootPath) {
115
+ throw new GradleException("Brick: projectRoot is required. Call applyBrickModules(settings, [projectRoot: '../', appProject: 'app'])")
116
+ }
117
+
118
+ if (!appProjectName) {
119
+ throw new GradleException("Brick: appProject is required. Call applyBrickModules(settings, [projectRoot: '../', appProject: 'app'])")
114
120
  }
115
- // Support relative appPath (relative to settings.rootDir)
116
- def appPathFile = new File(appPath.toString())
117
- def projectRoot = (appPathFile.isAbsolute() ? appPathFile : new File(settings.rootDir, appPathFile.path)).canonicalFile
121
+
122
+ // Support relative projectRoot (relative to settings.rootDir)
123
+ def projectRootFile = new File(projectRootPath.toString())
124
+ def projectRoot = (projectRootFile.isAbsolute() ? projectRootFile : new File(settings.rootDir, projectRootFile.path)).canonicalFile
118
125
 
119
- // Validate package.json exists in appPath
126
+ // Validate package.json exists in projectRoot
120
127
  def packageJsonFile = new File(projectRoot, 'package.json')
121
128
  if (!packageJsonFile.exists()) {
122
- throw new GradleException("Brick: package.json not found at ${projectRoot}. Please pass a valid appPath.")
129
+ throw new GradleException("Brick: package.json not found at ${projectRoot}. Please pass a valid projectRoot.")
123
130
  }
124
131
 
125
132
  def foundModules = []
@@ -208,14 +215,16 @@ ext.applyBrickModules = { settings, args = [:] ->
208
215
  gradle.rootProject.ext.brickModulesData = brickModulesData
209
216
  gradle.rootProject.ext.brickModulesList = foundModules
210
217
  gradle.rootProject.ext.brickProjectRoot = projectRoot
218
+ gradle.rootProject.ext.brickAppProjectName = appProjectName
211
219
  configureAppProject(gradle)
212
220
  }
213
221
  }
214
222
 
215
223
  // Configure the app project
216
224
  def configureAppProject(gradle) {
225
+ def appProjectName = gradle.rootProject.ext.brickAppProjectName
217
226
  gradle.rootProject.subprojects { project ->
218
- if (project.name == 'app') {
227
+ if (project.name == appProjectName) {
219
228
  project.afterEvaluate {
220
229
  configureBrickModules(project)
221
230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brick-module",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Better React Native native module development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -62,7 +62,7 @@
62
62
  "brick-codegen": "./bin/brick-codegen.js"
63
63
  },
64
64
  "dependencies": {
65
- "brick-codegen": "0.1.8"
65
+ "brick-codegen": "0.1.10"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": ">=18.2.0",