- 
                Notifications
    
You must be signed in to change notification settings  - Fork 44
 
fix: support dump_syms on macOS #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 10 commits
      Commits
    
    
            Show all changes
          
          
            13 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      c6f375f
              
                fix: submodule not being instantiated
              
              
                aminya 06e1601
              
                fix: use postinstall to make sure the script runs on installation as …
              
              
                aminya ab6210c
              
                fix: support macos - add new target and exe path
              
              
                aminya a058317
              
                fix: add includes needed for mac target
              
              
                aminya f93e26e
              
                use xcodebuild to build dump_syms on mac
              
              
                nornagon 88f85af
              
                exit non-0 when build fails
              
              
                nornagon e3d7d62
              
                fix lint
              
              
                nornagon 8bddbe7
              
                fix: add dump_syms support on windows
              
              
                aminya c7ab644
              
                fix: change prepare to prepublishOnly + update readme
              
              
                aminya 0089bcc
              
                Revert "fix: add dump_syms support on windows"
              
              
                aminya 38c7bb3
              
                Update package.json
              
              
                nornagon 1c68340
              
                Update build.js
              
              
                nornagon f5f9ace
              
                Update build.js
              
              
                nornagon File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,23 +1,40 @@ | ||
| const fs = require('fs') | ||
| const path = require('path') | ||
| const { spawnSync } = require('child_process') | ||
| const childProcess = require('child_process') | ||
| 
     | 
||
| function spawnSync (...args) { | ||
| const result = childProcess.spawnSync(...args) | ||
| if (result.status !== 0) { | ||
| process.exit(result.status) | ||
| } | ||
| } | ||
| 
     | 
||
| const buildDir = path.join(__dirname, 'build') | ||
| if (!fs.existsSync(buildDir)) { | ||
| fs.mkdirSync(buildDir, { recursive: true }) | ||
| } | ||
| 
     | 
||
| let includes = `-I${path.relative(buildDir, path.join(__dirname, 'deps'))}` | ||
| 
     | 
||
| spawnSync(path.join(__dirname, 'deps', 'breakpad', 'configure'), [], { | ||
| cwd: buildDir, | ||
| env: { | ||
| ...process.env, | ||
| CPPFLAGS: `-I${path.relative(buildDir, path.join(__dirname, 'deps'))}` | ||
| CPPFLAGS: includes | ||
| }, | ||
| stdio: 'inherit' | ||
| }) | ||
| const targets = ['src/processor/minidump_stackwalk', 'src/processor/minidump_dump'] | ||
| if (process.platform === 'linux') { | ||
| targets.push('src/tools/linux/dump_syms/dump_syms') | ||
| } | ||
| spawnSync('make', ['-C', buildDir, '-j', require('os').cpus().length, ...targets], { | ||
| 
     | 
||
| spawnSync('make', [includes, '-C', buildDir, '-j', require('os').cpus().length, ...targets], { | ||
| stdio: 'inherit' | ||
| }) | ||
| 
     | 
||
| if (process.platform === 'darwin') { | ||
| spawnSync('xcodebuild', ['-project', path.join(__dirname, 'deps', 'breakpad', 'src', 'tools', 'mac', 'dump_syms', 'dump_syms.xcodeproj'), 'build'], { | ||
| stdio: 'inherit' | ||
| }) | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not convinced this is correct,
preinstallscripts run when the package is a dependency. I checked this with the following steps:The
preinstallscript ran and the module was compiled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll commit the dump_syms on macOS code for now and we can come back to the submodule/install stuff later if we need to.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the minimum, you should not remove prepublishOnly! That way, you or someone else may forgot to instantiate submodules, and they publish the package without instantiating the submodules that are the required files
preinstall works but it does not make sense here. It works because minidump does not use any dependency in build.js. postinstall is more general. It allows bootstrapping the dependencies, and then running the build. -> Using preinstall also makes it impossible to use prepublishOnly.