@@ -7,15 +7,15 @@ import { Input } from '../types';
77import jetifier from '../utils/jetifier' ;
88
99type TargetOptions = {
10- androidPath : string ,
10+ androidPath : string ;
1111 androidBundleName : string ;
12- reverseJetify : boolean
12+ reverseJetify : boolean ;
1313} ;
1414
1515const defaultOptions : TargetOptions = {
16- androidPath : " android" ,
17- androidBundleName : " android.aar" ,
18- reverseJetify : false
16+ androidPath : ' android' ,
17+ androidBundleName : ' android.aar' ,
18+ reverseJetify : false ,
1919} ;
2020
2121type Options = Input & {
@@ -24,7 +24,10 @@ type Options = Input & {
2424
2525async function createGradleFile ( file : string ) {
2626 await fs . createFile ( file ) ;
27- await fs . writeFile ( file , 'configurations.maybeCreate("default")\nartifacts.add("default", file(\'android.aar\'))' )
27+ await fs . writeFile (
28+ file ,
29+ 'configurations.maybeCreate("default")\nartifacts.add("default", file(\'android.aar\'))'
30+ ) ;
2831}
2932
3033export default async function build ( {
@@ -35,7 +38,7 @@ export default async function build({
3538} : Options ) {
3639 const targetOptions = {
3740 ...defaultOptions ,
38- ...options
41+ ...options ,
3942 } ;
4043
4144 report . info (
@@ -44,18 +47,32 @@ export default async function build({
4447
4548 await del ( [ output ] ) ;
4649
47- await androidAssemble ( { root, androidPath : targetOptions . androidPath , report } ) ;
50+ await androidAssemble ( {
51+ root,
52+ androidPath : targetOptions . androidPath ,
53+ report,
54+ } ) ;
4855
4956 report . info (
50- `Creating new output directory at ${ chalk . blue ( path . relative ( root , output ) ) } `
57+ `Creating new output directory at ${ chalk . blue (
58+ path . relative ( root , output )
59+ ) } `
5160 ) ;
5261 await fs . mkdir ( output ) ;
5362
54- const sourceAar = path . join ( targetOptions . androidPath , 'build' , 'outputs' , 'aar' , targetOptions . androidBundleName ) ;
63+ const sourceAar = path . join (
64+ targetOptions . androidPath ,
65+ 'build' ,
66+ 'outputs' ,
67+ 'aar' ,
68+ targetOptions . androidBundleName
69+ ) ;
5570 const targetAar = path . join ( output , targetOptions . androidBundleName ) ;
5671
5772 report . info (
58- `Copying AAR from ${ chalk . blue ( path . relative ( root , sourceAar ) ) } to ${ chalk . blue ( path . relative ( root , targetAar ) ) } `
73+ `Copying AAR from ${ chalk . blue (
74+ path . relative ( root , sourceAar )
75+ ) } to ${ chalk . blue ( path . relative ( root , targetAar ) ) } `
5976 ) ;
6077 await fs . copyFile ( sourceAar , targetAar ) ;
6178
@@ -68,31 +85,38 @@ export default async function build({
6885 if ( targetOptions . reverseJetify ) {
6986 const supportOutputPath = path . join ( output , 'support' ) ;
7087 report . info (
71- `Creating new support output directory at ${ chalk . blue ( path . relative ( root , supportOutputPath ) ) } `
88+ `Creating new support output directory at ${ chalk . blue (
89+ path . relative ( root , supportOutputPath )
90+ ) } `
7291 ) ;
7392 await fs . mkdir ( supportOutputPath ) ;
7493
75- const supportAar = path . join ( supportOutputPath , targetOptions . androidBundleName ) ;
94+ const supportAar = path . join (
95+ supportOutputPath ,
96+ targetOptions . androidBundleName
97+ ) ;
7698 report . info (
77- `Using Jetifier to convert AAR from AndroidX to Support AAR at ${ chalk . blue ( path . relative ( root , supportAar ) ) } `
99+ `Using Jetifier to convert AAR from AndroidX to Support AAR at ${ chalk . blue (
100+ path . relative ( root , supportAar )
101+ ) } `
78102 ) ;
79103
80104 await jetifier ( {
81105 root,
82106 report,
83107 input : targetAar ,
84108 output : supportAar ,
85- reverse : true
109+ reverse : true ,
86110 } ) ;
87111
88112 const supportGradleFile = path . join ( supportOutputPath , 'build.gradle' ) ;
89113 report . info (
90- `Creating Support AAR Gradle file at ${ chalk . blue ( path . relative ( root , supportGradleFile ) ) } `
114+ `Creating Support AAR Gradle file at ${ chalk . blue (
115+ path . relative ( root , supportGradleFile )
116+ ) } `
91117 ) ;
92118 await createGradleFile ( supportGradleFile ) ;
93119 }
94120
95- report . success (
96- `Wrote files to ${ chalk . blue ( path . relative ( root , output ) ) } `
97- ) ;
121+ report . success ( `Wrote files to ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
98122}
0 commit comments