Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-swans-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/react-native-brownfield': patch
---

fix: brownfield Gradle Plugin not to depend on \*UpdatesResources task from expo-updates if it is absent
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ jobs:
CLANG_MODULE_CACHE_PATH="$RUNNER_TEMP/swift-cache/clang" \
swift test --scratch-path "$RUNNER_TEMP/swift-cache/swiftpm"

- name: Run brownfield tests including MacOS-only tests
run: |
cd packages/react-native-brownfield
yarn test

android-androidapp-expo:
name: Android road test (AndroidApp - Expo ${{ matrix.version }})
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion apps/RNApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath("com.callstack.react:brownfield-gradle-plugin:2.0.0-alpha02-SNAPSHOT")
classpath("com.callstack.react:brownfield-gradle-plugin:2.0.0-alpha03-SNAPSHOT")
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/scripts/prepare-android-build-gradle-for-ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (!projectDirName) {

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const SNAPSHOT_VERSION = '2.0.0-alpha02-SNAPSHOT';
const SNAPSHOT_VERSION = '2.0.0-alpha03-SNAPSHOT';
const targetPath = path.resolve(
__dirname,
'..',
Expand Down
2 changes: 1 addition & 1 deletion gradle-plugins/react/brownfield/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PROJECT_ID=com.callstack.react.brownfield
ARTIFACT_ID=brownfield-gradle-plugin
VERSION=2.0.0-alpha02
VERSION=2.0.0-alpha03
GROUP=com.callstack.react
IMPLEMENTATION_CLASS=com.callstack.react.brownfield.plugin.RNBrownfieldPlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ class VariantTaskProvider(val project: Project) {
preBuildTask.dependsOn("${appProject.path}:createBundle${capitalizedBundledAssetsVariantName}JsAndAssets")

if (Utils.isExpoProject(project)) {
preBuildTask.dependsOn(
"${appProject.path}:create${capitalizedBundledAssetsVariantName}UpdatesResources",
)
val updatesResourcesTaskName =
"create${capitalizedBundledAssetsVariantName}UpdatesResources"

appProject.tasks
.matching { it.name == updatesResourcesTaskName }
.configureEach { updatesTask ->
preBuildTask.dependsOn(updatesTask)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,76 +65,91 @@ describe('stripFrameworkBinary', () => {
);
});

it('strips binary from ios-arm64 slice', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
]);
const binaryPath = path.join(
xcframeworkPath,
'ios-arm64',
'TestFramework.framework',
'TestFramework'
);
const originalContent = fs.readFileSync(binaryPath, 'utf-8');

stripFrameworkBinary(xcframeworkPath);

const newContent = fs.readFileSync(binaryPath);
expect(newContent.toString()).not.toBe(originalContent);
expect(fs.existsSync(binaryPath)).toBe(true);
expect(mockLoggerSuccess).toHaveBeenCalledWith(
'TestFramework.xcframework is now interface-only'
);
});

it('strips binary from simulator slice with fat binary', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64_x86_64-simulator',
]);
const binaryPath = path.join(
xcframeworkPath,
'ios-arm64_x86_64-simulator',
'TestFramework.framework',
'TestFramework'
);
const originalContent = fs.readFileSync(binaryPath, 'utf-8');

stripFrameworkBinary(xcframeworkPath);

const newContent = fs.readFileSync(binaryPath);
expect(newContent.toString()).not.toBe(originalContent);
describe.skipIf(process.platform !== 'darwin')('with Xcode toolchain', () => {
it('strips binary from ios-arm64 slice', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
]);
const binaryPath = path.join(
xcframeworkPath,
'ios-arm64',
'TestFramework.framework',
'TestFramework'
);
const originalContent = fs.readFileSync(binaryPath, 'utf-8');

stripFrameworkBinary(xcframeworkPath);

const newContent = fs.readFileSync(binaryPath);
expect(newContent.toString()).not.toBe(originalContent);
expect(fs.existsSync(binaryPath)).toBe(true);
expect(mockLoggerSuccess).toHaveBeenCalledWith(
'TestFramework.xcframework is now interface-only'
);
});

const archInfo = execSync(`xcrun lipo -info "${binaryPath}"`, {
encoding: 'utf-8',
it('strips binary from simulator slice with fat binary', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64_x86_64-simulator',
]);
const binaryPath = path.join(
xcframeworkPath,
'ios-arm64_x86_64-simulator',
'TestFramework.framework',
'TestFramework'
);
const originalContent = fs.readFileSync(binaryPath, 'utf-8');

stripFrameworkBinary(xcframeworkPath);

const newContent = fs.readFileSync(binaryPath);
expect(newContent.toString()).not.toBe(originalContent);

const archInfo = execSync(`xcrun lipo -info "${binaryPath}"`, {
encoding: 'utf-8',
});
expect(archInfo).toContain('arm64');
expect(archInfo).toContain('x86_64');
});
expect(archInfo).toContain('arm64');
expect(archInfo).toContain('x86_64');
});

it('handles multiple slices', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
'ios-arm64_x86_64-simulator',
]);
it('handles multiple slices', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
'ios-arm64_x86_64-simulator',
]);

stripFrameworkBinary(xcframeworkPath);

const deviceBinary = path.join(
xcframeworkPath,
'ios-arm64',
'TestFramework.framework',
'TestFramework'
);
const simBinary = path.join(
xcframeworkPath,
'ios-arm64_x86_64-simulator',
'TestFramework.framework',
'TestFramework'
);

expect(fs.existsSync(deviceBinary)).toBe(true);
expect(fs.existsSync(simBinary)).toBe(true);
expect(mockLoggerSuccess).toHaveBeenCalledOnce();
});

stripFrameworkBinary(xcframeworkPath);
it('ignores non-ios directories', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
]);
fs.mkdirSync(path.join(xcframeworkPath, 'macos-arm64'), {
recursive: true,
});

const deviceBinary = path.join(
xcframeworkPath,
'ios-arm64',
'TestFramework.framework',
'TestFramework'
);
const simBinary = path.join(
xcframeworkPath,
'ios-arm64_x86_64-simulator',
'TestFramework.framework',
'TestFramework'
);
stripFrameworkBinary(xcframeworkPath);

expect(fs.existsSync(deviceBinary)).toBe(true);
expect(fs.existsSync(simBinary)).toBe(true);
expect(mockLoggerSuccess).toHaveBeenCalledOnce();
expect(mockLoggerSuccess).toHaveBeenCalledOnce();
});
});

it('warns and skips unknown slice types', () => {
Expand Down Expand Up @@ -164,17 +179,4 @@ describe('stripFrameworkBinary', () => {
expect.stringContaining('No binary found at')
);
});

it('ignores non-ios directories', () => {
const xcframeworkPath = createMockXcframework(tempDir, 'TestFramework', [
'ios-arm64',
]);
fs.mkdirSync(path.join(xcframeworkPath, 'macos-arm64'), {
recursive: true,
});

stripFrameworkBinary(xcframeworkPath);

expect(mockLoggerSuccess).toHaveBeenCalledOnce();
});
});
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const BROWNFIELD_PLUGIN_VERSION = '2.0.0-alpha02';
export const BROWNFIELD_PLUGIN_VERSION = '2.0.0-alpha03';
export const brownfieldGradlePluginDependency = `classpath("com.callstack.react:brownfield-gradle-plugin:${BROWNFIELD_PLUGIN_VERSION}")`;
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ test('supports prerelease versions when finding the previous plugin tag', () =>
const previousTag = findPreviousPluginTag(
[
'brownfield-gradle-plugin/v2.0.0-alpha01',
'brownfield-gradle-plugin/v2.0.0-alpha02',
'brownfield-gradle-plugin/v2.0.0-alpha03',
'brownfield-gradle-plugin/v2.0.0-beta01',
'brownfield-gradle-plugin/v2.0.0',
],
'2.0.0-beta01'
);

assert.equal(previousTag, 'brownfield-gradle-plugin/v2.0.0-alpha02');
assert.equal(previousTag, 'brownfield-gradle-plugin/v2.0.0-alpha03');
});

test('treats a stable release as newer than its prereleases', () => {
Expand All @@ -58,7 +58,8 @@ test('renders scoped release notes grouped by commit category', () => {
},
{
hash: 'dd8b8a0',
subject: 'fix: broken support for custom `appProjectName` in Gradle Plugin (#275)',
subject:
'fix: broken support for custom `appProjectName` in Gradle Plugin (#275)',
},
{
hash: '6ea8da9',
Expand Down
Loading