Skip to content

Commit

Permalink
refactor(bob)!: remove AAR target support (#463)
Browse files Browse the repository at this point in the history
### Summary

This removes the (non-working) support for `aar` targets.
Originally, the `aar` support was added with #4 to support AndroidX.
However, it's not needed anymore so we are removing the support.

### Test plan

1. Create a new library with `npx create-react-native-library`
2. Add `aar` to targets
3. run `yarn prepack`
4. Make sure an error is printed and the program stops.
  • Loading branch information
atlj authored Sep 15, 2023
1 parent ef37512 commit 7bd99b9
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 214 deletions.
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ This will ask you few questions about your project and generate a new project in
- ES modules build for bundlers such as webpack
- Flow definitions (copies .js files to .flow files)
- TypeScript definitions (uses `tsc` to generate declaration files)
- Android AAR files

If you created a project with `create-react-native-library`, `react-native-builder-bob` is **already pre-configured to build your project**. You don't need to configure it again.

Expand Down Expand Up @@ -209,24 +208,6 @@ Example:
["typescript", { "project": "tsconfig.build.json" }]
```

##### `aar`

Enable assembling Android AAR files for a library for React Native modules including native code.

The following options are supported:

- `reverseJetify` (`boolean`): If your package is using [AndroidX](https://developer.android.com/jetpack/androidx), it's possible to convert the AAR with the `reverseJetify` option to use the [Android support Library](https://developer.android.com/topic/libraries/support-library) using the [`jetifier`](https://www.npmjs.com/package/jetifier) package. This is useful to publish packages for older projects which haven't migrated to AndroidX.

- `androidPath` (`string`): You can specify a custom path to the `android` directory if it's not in the default location (`android` in the root of your project).

- `androidBundleName`: By default, the generated `aar` file is named as `android.aar`. You can specify a custom name using this option.

Example:

```json
["aar", { "reverseJetify": true }]
```

### Commands

The `bob` CLI exposes the following commands:
Expand Down
3 changes: 0 additions & 3 deletions packages/create-react-native-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
"validate-npm-package-name": "^4.0.0",
"yargs": "^17.5.1"
},
"optionalDependencies": {
"jetifier": "^2.0.0"
},
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.18.5",
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native-builder-bob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
"which": "^2.0.2",
"yargs": "^17.5.1"
},
"optionalDependencies": {
"jetifier": "^2.0.0"
},
"devDependencies": {
"@babel/cli": "^7.17.10",
"@types/babel__core": "^7.1.19",
Expand Down
15 changes: 0 additions & 15 deletions packages/react-native-builder-bob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { cosmiconfigSync } from 'cosmiconfig';
import isGitDirty from 'is-git-dirty';
import prompts, { type PromptObject } from './utils/prompts';
import * as logger from './utils/logger';
import buildAAR from './targets/aar';
import buildCommonJS from './targets/commonjs';
import buildModule from './targets/module';
import buildTypescript from './targets/typescript';
Expand Down Expand Up @@ -123,11 +122,6 @@ yargs
value: 'typescript',
selected: /\.tsx?$/.test(entryFile),
},
{
title: 'aar - bundle android code to a binary',
value: 'aar',
selected: false,
},
],
validate: (input: string) => Boolean(input.length),
},
Expand Down Expand Up @@ -407,15 +401,6 @@ yargs
report.info(`Building target ${kleur.blue(targetName)}`);

switch (targetName) {
case 'aar':
await buildAAR({
root,
source: path.resolve(root, source as string),
output: path.resolve(root, output as string, 'aar'),
options: targetOptions,
report,
});
break;
case 'commonjs':
await buildCommonJS({
root,
Expand Down
122 changes: 0 additions & 122 deletions packages/react-native-builder-bob/src/targets/aar.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react-native-builder-bob/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type Input = {
report: Report;
};

export type Target = 'aar' | 'commonjs' | 'module' | 'typescript';
export type Target = 'commonjs' | 'module' | 'typescript';

export type Options = {
source?: string;
Expand Down
46 changes: 0 additions & 46 deletions packages/react-native-builder-bob/src/utils/jetifier.ts

This file was deleted.

5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4381,11 +4381,6 @@ jake@^10.8.5:
filelist "^1.0.1"
minimatch "^3.0.4"

jetifier@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/jetifier/-/jetifier-2.0.0.tgz#699391367ca1fe7bc4da5f8bf691eb117758e4cb"
integrity sha512-J4Au9KuT74te+PCCCHKgAjyLlEa+2VyIAEPNCdE5aNkAJ6FAJcAqcdzEkSnzNksIa9NkGmC4tPiClk2e7tCJuQ==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
Expand Down

0 comments on commit 7bd99b9

Please sign in to comment.