1*71ea6032SKudo Chienimport spawnAsync from '@expo/spawn-async'; 2*71ea6032SKudo Chienimport assert from 'assert'; 3*71ea6032SKudo Chienimport fs from 'fs'; 4*71ea6032SKudo Chienimport path from 'path'; 5*71ea6032SKudo Chien 6*71ea6032SKudo Chienimport { EXPOTOOLS_DIR } from '../../Constants'; 7*71ea6032SKudo Chien 8*71ea6032SKudo Chienexport async function buildManifestMergerJarAsync(): Promise<string> { 9*71ea6032SKudo Chien const manifestMergerDir = path.join( 10*71ea6032SKudo Chien EXPOTOOLS_DIR, 11*71ea6032SKudo Chien 'src', 12*71ea6032SKudo Chien 'versioning', 13*71ea6032SKudo Chien 'android', 14*71ea6032SKudo Chien 'android-manifest-merger' 15*71ea6032SKudo Chien ); 16*71ea6032SKudo Chien await spawnAsync('./gradlew', ['build'], { 17*71ea6032SKudo Chien cwd: manifestMergerDir, 18*71ea6032SKudo Chien stdio: 'ignore', 19*71ea6032SKudo Chien }); 20*71ea6032SKudo Chien const buildDir = path.join(manifestMergerDir, 'app', 'build'); 21*71ea6032SKudo Chien const tarBall = path.join(buildDir, 'distributions', 'app.tar'); 22*71ea6032SKudo Chien assert(fs.existsSync(tarBall), `Expected ${tarBall} to exist`); 23*71ea6032SKudo Chien await spawnAsync('tar', ['-xf', tarBall, '-C', buildDir], { 24*71ea6032SKudo Chien cwd: manifestMergerDir, 25*71ea6032SKudo Chien stdio: 'ignore', 26*71ea6032SKudo Chien }); 27*71ea6032SKudo Chien const executablePath = path.join(buildDir, 'app', 'bin', 'app'); 28*71ea6032SKudo Chien assert(fs.existsSync(executablePath), `Expected ${executablePath} to exist`); 29*71ea6032SKudo Chien return executablePath; 30*71ea6032SKudo Chien} 31