Skip to content
Merged
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
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
applicationId project.ext.react.applicationId
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode reactTestApp.versionCode
versionName reactTestApp.versionName
versionCode getVersionCode()
versionName getVersionName()

buildConfigField "boolean", "ReactTestApp_useFabric", project.ext.react.enableFabric.toString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class Component(
data class Manifest(
val name: String,
val displayName: String,
val version: String?,
val bundleRoot: String?,
val singleApp: String?,
val components: List<Component>?,
Expand Down
5 changes: 0 additions & 5 deletions android/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ static String versionOf(String spec) {
}

ext {
reactTestApp = [
versionCode: 1,
versionName: "1.0"
]

compileSdkVersion = 31
minSdkVersion = 23
targetSdkVersion = 29
Expand Down
7 changes: 4 additions & 3 deletions android/support/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ repositories {

android {
def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply(from: "$androidDir/dependencies.gradle")
apply(from: "${androidDir}/dependencies.gradle")
apply(from: "${androidDir}/test-app-util.gradle")

compileSdkVersion project.ext.compileSdkVersion

defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode reactTestApp.versionCode
versionName reactTestApp.versionName
versionCode getVersionCode()
versionName getVersionName()
}

compileOptions {
Expand Down
24 changes: 24 additions & 0 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,30 @@ ext.getSingleAppMode = {
return false
}

ext.getVersionCode = {
def manifest = getManifest()
if (manifest != null) {
def config = manifest["android"]
if (config instanceof Object && config.containsKey("versionCode")) {
return config["versionCode"]
}
}

return 1
}

ext.getVersionName = {
def manifest = getManifest()
if (manifest != null) {
def version = manifest["version"]
if (version instanceof String) {
return version
}
}

return "1.0"
}

ext.isFabricEnabled = { baseDir ->
return project.hasProperty("USE_FABRIC") &&
project.getProperty("USE_FABRIC") == "1" &&
Expand Down
1 change: 1 addition & 0 deletions example/ios/ExampleTests/ManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ManifestTests: XCTestCase {
let expected = Manifest(
name: "Name",
displayName: "Display Name",
version: "1.0",
bundleRoot: nil,
singleApp: nil,
components: expectedComponents
Expand Down
4 changes: 2 additions & 2 deletions ios/ReactTestApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(PRODUCT_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -29,7 +29,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(PRODUCT_BUILD_NUMBER)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>linkedin</string>
Expand Down
1 change: 1 addition & 0 deletions ios/ReactTestApp/Manifest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct Component: Decodable {
struct Manifest: Decodable {
let name: String
let displayName: String
let version: String?
let bundleRoot: String?
let singleApp: String?
let components: [Component]?
Expand Down
16 changes: 10 additions & 6 deletions ios/test_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def app_config(project_root)
manifest = app_manifest(project_root)
return [nil, nil, nil] if manifest.nil?

[manifest['name'], manifest['displayName'], manifest['singleApp']]
[manifest['name'], manifest['displayName'], manifest['version'], manifest['singleApp']]
end

def autolink_script_path
Expand Down Expand Up @@ -163,7 +163,7 @@ def make_project!(xcodeproj, project_root, target_platform, options)
# Copy Xcode project files
FileUtils.mkdir_p(destination)
FileUtils.cp_r(xcodeproj_src, destination)
name, display_name, single_app = app_config(project_root)
name, display_name, version, single_app = app_config(project_root)
unless name.nil?
xcschemes_path = File.join(xcodeproj_dst, 'xcshareddata', 'xcschemes')
FileUtils.cp(File.join(xcschemes_path, 'ReactTestApp.xcscheme'),
Expand Down Expand Up @@ -209,9 +209,9 @@ def make_project!(xcodeproj, project_root, target_platform, options)
end

react_native = react_native_path(project_root, target_platform)
version = package_version(react_native.to_s).segments
version = (version[0] * 10_000) + (version[1] * 100) + version[2]
version_macro = "REACT_NATIVE_VERSION=#{version}"
rn_version = package_version(react_native.to_s).segments
rn_version = (rn_version[0] * 10_000) + (rn_version[1] * 100) + rn_version[2]
version_macro = "REACT_NATIVE_VERSION=#{rn_version}"

build_settings = {}
tests_build_settings = {}
Expand Down Expand Up @@ -242,9 +242,13 @@ def make_project!(xcodeproj, project_root, target_platform, options)
end

build_settings['PRODUCT_DISPLAY_NAME'] = display_name
build_settings['PRODUCT_VERSION'] = version || '1.0'

build_number = platform_config('buildNumber', project_root, target_platform)
build_settings['PRODUCT_BUILD_NUMBER'] = build_number || '1'

supports_flipper = target_platform == :ios && flipper_enabled?
use_fabric = options[:fabric_enabled] && version >= 6800
use_fabric = options[:fabric_enabled] && rn_version >= 6800

app_project = Xcodeproj::Project.open(xcodeproj_dst)
app_project.native_targets.each do |target|
Expand Down
4 changes: 2 additions & 2 deletions macos/ReactTestApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(PRODUCT_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(PRODUCT_BUILD_NUMBER)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Loading