Skip to content

Commit 5add8d1

Browse files
fix(modules): Android builds without ext config, auto create assets dir for modules (#2652)
1 parent 3e296af commit 5add8d1

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Android builds without ext config, auto create assets dir for modules ([#2652](https://github.com/getsentry/sentry-react-native/pull/2652))
8+
39
## 4.10.0
410

511
### Features

sentry.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ gradle.projectsEvaluated {
163163

164164
workingDir reactRoot
165165

166-
def collectModulesScript = config.containsKey('collectModulesScript')
166+
def collectModulesScript = config.collectModulesScript
167167
? file(config.collectModulesScript).getAbsolutePath()
168168
: "$reactRoot/node_modules/@sentry/react-native/dist/js/tools/collectModules.js"
169-
def modulesPaths = config.containsKey('modulesPaths')
169+
def modulesPaths = config.modulesPaths
170170
? config.modulesPaths.join(',')
171171
: "$reactRoot/node_modules"
172172
def args = ["node",
@@ -179,7 +179,7 @@ gradle.projectsEvaluated {
179179
project.logger.info("Sentry-CollectModules arguments: ${args}")
180180
commandLine(*args)
181181

182-
def skip = config.containsKey('skipCollectModules')
182+
def skip = config.skipCollectModules
183183
? config.skipCollectModules == true
184184
: false
185185
enabled !skip

src/js/tools/collectModules.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { logger } from '@sentry/utils';
2-
import { readFileSync, writeFileSync } from 'fs';
2+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
3+
import { dirname } from 'path';
34
import { argv, exit } from 'process';
45

56
import ModulesCollector from './ModulesCollector';
@@ -28,6 +29,10 @@ if (!map.sources) {
2829
const sources: string[] = map.sources;
2930
const modules = ModulesCollector.collect(sources, modulesPaths);
3031

32+
const outputModulesDirPath = dirname(outputModulesPath);
33+
if (!existsSync(outputModulesDirPath)) {
34+
mkdirSync(outputModulesDirPath, { recursive: true });
35+
}
3136
writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));
3237

3338
function exitGracefully(message: string): never {

0 commit comments

Comments
 (0)