Skip to content

Commit

Permalink
Merge pull request #1319 from rasaha91/fix-incorrect-version
Browse files Browse the repository at this point in the history
set version before build
  • Loading branch information
rasaha91 committed Aug 3, 2022
2 parents e5fe3b7 + e08ef6b commit 38a5b65
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .ado/android-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch

- template: templates/android-build-office-setup.yml

- template: templates/android-build-office.yml

- template: templates/download-android-dependencies.yml
Expand Down
4 changes: 3 additions & 1 deletion .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ jobs:
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch

- template: templates/android-build-office.yml
- template: templates/android-build-office-setup.yml

- template: templates/apple-node-setup.yml

Expand All @@ -230,6 +230,8 @@ jobs:
inputs:
script: node .ado/removeWorkspaceConfig.js

- template: templates/android-build-office.yml

# Enumerate and download all dependencies ..
- template: templates/download-android-dependencies.yml
parameters:
Expand Down
62 changes: 62 additions & 0 deletions .ado/templates/android-build-office-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
steps:
- task: UseNode@1
inputs:
version: '16.x'

- template: apple-droid-node-patching.yml
parameters:
apply_office_patches: true

# Install NuGet
- task: CmdLine@2
displayName: Install NuGet
inputs:
script: curl -o $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe --create-dirs https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

- task: CmdLine@2
displayName: "Rename package to react-native"
inputs:
script: node .ado/renamePackageForOffice.js

- task: CmdLine@2
displayName: yarn install
inputs:
script: yarn install --frozen-lockfile

# scripts/set-rn-version.js
#
# update the following files to the commit id.
# package.json (-> npm package version)
# gradle.properties (-> aar version)
# gradle.properties (-> aar version)
#
# The following files are updated for runtime version checking.
# ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java
# React/Base/RCTVersion.m
# ReactCommon/cxxreact/ReactNativeVersion.h
# Libraries/Core/ReactNativeVersion.js
#
# --nightly --autogenerateVersionNumber => version = `0.0.0-${currentCommit.slice(0, 9)}`;
# When on main branch or non-stable branch.
- task: CmdLine@2
displayName: Set canary package version
inputs:
script: node scripts/set-rn-version.js --nightly --autogenerateVersionNumber --skipUpdateRuby # TODO(macOS GH#1148): Remove --skipUpdateRuby flag once we clean up version update scripts
condition: or(eq(variables['Build.SourceBranchName'], 'main'), not(contains(variables['Build.SourceBranchName'], '-stable')))

# TODO: We don't seem to be running set-rn-version.js for stable branches, hence we would end up publishing using the values in the repository.

- task: CmdLine@2
displayName: nuget restore
inputs:
script: mono $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe restore $(System.DefaultWorkingDirectory)/ReactAndroid/packages.config -PackagesDirectory $(System.DefaultWorkingDirectory)/ReactAndroid/packages/ -Verbosity Detailed -NonInteractive

- task: CmdLine@2
displayName: Setup Build Dependencies
inputs:
script: chmod +x .ado/setup_droid_deps.sh && .ado/setup_droid_deps.sh

- task: CmdLine@2
displayName: Remove RNTesterApp.android.bundle
inputs:
script: rm -f ./packages/rn-tester/js/RNTesterApp.android.bundle
62 changes: 0 additions & 62 deletions .ado/templates/android-build-office.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,4 @@
steps:
- task: UseNode@1
inputs:
version: '16.x'

- template: apple-droid-node-patching.yml
parameters:
apply_office_patches: true

# Install NuGet
- task: CmdLine@2
displayName: Install NuGet
inputs:
script: curl -o $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe --create-dirs https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

- task: CmdLine@2
displayName: "Rename package to react-native"
inputs:
script: node .ado/renamePackageForOffice.js

- task: CmdLine@2
displayName: yarn install
inputs:
script: yarn install --frozen-lockfile

# scripts/set-rn-version.js
#
# update the following files to the commit id.
# package.json (-> npm package version)
# gradle.properties (-> aar version)
# gradle.properties (-> aar version)
#
# The following files are updated for runtime version checking.
# ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java
# React/Base/RCTVersion.m
# ReactCommon/cxxreact/ReactNativeVersion.h
# Libraries/Core/ReactNativeVersion.js
#
# --nightly --autogenerateVersionNumber => version = `0.0.0-${currentCommit.slice(0, 9)}`;
# When on main branch or non-stable branch.
- task: CmdLine@2
displayName: Set canary package version
inputs:
script: node scripts/set-rn-version.js --nightly --autogenerateVersionNumber --skipUpdateRuby # TODO(macOS GH#1148): Remove --skipUpdateRuby flag once we clean up version update scripts
condition: or(eq(variables['Build.SourceBranchName'], 'main'), not(contains(variables['Build.SourceBranchName'], '-stable')))

# TODO: We don't seem to be running set-rn-version.js for stable branches, hence we would end up publishing using the values in the repository.

- task: CmdLine@2
displayName: nuget restore
inputs:
script: mono $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe restore $(System.DefaultWorkingDirectory)/ReactAndroid/packages.config -PackagesDirectory $(System.DefaultWorkingDirectory)/ReactAndroid/packages/ -Verbosity Detailed -NonInteractive

- task: CmdLine@2
displayName: Setup Build Dependencies
inputs:
script: chmod +x .ado/setup_droid_deps.sh && .ado/setup_droid_deps.sh

- task: CmdLine@2
displayName: Remove RNTesterApp.android.bundle
inputs:
script: rm -f ./packages/rn-tester/js/RNTesterApp.android.bundle

- task: CmdLine@2
displayName: Create RNTester bundle
inputs:
Expand Down

0 comments on commit 38a5b65

Please sign in to comment.