If you want to import files from the OpenJDK into libcore/
, you are reading the right documentation.
The general idea is to get a change from OpenJDK into libcore in AOSP by git merge
from an OpenJDK branch. However, each file in ojluni/
can come from a different OpenJDK version. expected_upstream
is a staging branch storing the OpenJDK version of each file. Thus, we can use git merge
when we update an ojluni/
file from a new upstream version, and the command should automatically merge the file if no merge conflict.
in the aosp/expected_upstream
branch.
ojluni/
aosp/master
EXPECTED_UPSTREAM
fileojluni/
,
separatortools/expected_upstream/
aosp/expected_upstream
branchIn general, if you want to change an ojluni/
file by a text editor / IDE manually, you should make the change on aosp/master
.
luni/
folder, you can make the change directly on aosp/master
ojluni/
fileaosp/master
. Please follow this patch style guideline.ojluni/
file to a particular upstream version. If you can't but still want to cherry-pick a upstream fix, you should do so on the aosp/master
branch.ojluni/
aosp/master
.aosp/expected_upstream
branchexpected_upstream
into aosp/master
branch.ojluni/
file that originally came from the OpenJDKaosp/master
and aosp/expected_upstream
branches. Don't forget to remove the entry in the EXPECTED_UPSTREAM
too.aosp/master
from expected_upstream
aosp/master
, you should probably revert the change aosp/expected_upstream
as well.git
doesn't allow you to merge the same commit twice into the same branch. You have 2 optionsexpected_upsteam
too and start over again when you reland your changeCommit graph of a typical change
----11.0.13-ga---------------- openjdk/jdk11u \ A \ ------------B-----C------------ expected_upstream \ --------------------D---E------ master
Typically, you will need 5 CLs
A
imports the file and moves the file in the ojluni/
folderB
merges the file into the expected_upstream with other ojluni
filesA
and B
are created by the ojluni_refresh_files
scriptC
edits the entry in the EXPECTED_UPSTREAM
fileD
is a merge commit created by git merge
E
adds Android patchesAndroid.bp
, api/current.txt
.A
, B
and C
?git blame
with the upstream history.aosp
is setup in your local git repositorygit branch <local_branch> aosp/expected_upstream git checkout <local_branch>
source ./tools/expected_upstream/install_tools.sh
For example, upgrade java.lang.String
to 11.0.13-ga version:
ojluni_modify_expectation modify java.lang.String jdk11u/jdk-11.0.13-ga ojluni_refresh_files
or if java.lang.String
is missing in EXPECTED_UPSTREAM:
ojluni_modify_expectation add jdk11u/jdk-11.0.13-ga java.lang.String ojluni_refresh_files
2 commits should be created to update the ojluni/src/main/java/java/lang/String.java
. You can verify and view the diff by the following command
git diff aosp/expected_upstream -- ojluni/src/main/java/java/lang/String.java
You can then upload your change to AOSP gerrit.
repo upload --cbr -t . # -t sets a topic to the CLs in the gerrit
Remember to commit your EXPECTED_UPSTREAM file change into a new commit
git commit -- EXPECTED_UPSTREAM
Then upload your change to AOSP gerrit.
repo upload --cbr .
Then you can switch back to your local master
branch to apply the changes
git checkout <local_master_branch> git merge local_expected_upstream # Resolve any merge conflict git commit --amend # Amend the commit message and add the bug number you are working on repo upload .
The process is similar to the above commands, but needs to run ojluni_modify_expectation
with an add
subcommand.
For example, add a test for String.isEmpty()
method:
ojluni_modify_expectation add jdk8u/jdk8u121-b13 java.lang.String.IsEmpty
Note: java.lang.String.IsEmpty
is a test class in the upstream repository.
----11.0.13-ga---------------- openjdk/jdk11u \ A \ ------------B-----C------------ expected_upstream \ --------------------D---E------ master
Here are the order of events / votes required to submit your CL on gerrit as of Nov 2021.
Presubmit-Verified +2
on all 5 CLsBypass-Presubmit +1
on commit A
and B
if the presubmit fails.Code-review +2
on all 5 CLs from an Android Core Library team memberAPI-review +1
on commit E
from an Android API council memberAutosubmit +1
on commit B
, C
and E
A
individually without submitting B
together.A
without submitting B
.C
before submitting B
first manually, even though B
is the direct parent of C
. So just submit B
yourself manually.repo upload
may not succeed because gerrit returns error.repo upload
again!git
objects have been uploaded.repo upload
returns TimeOutException, but the CL has been uploaded. Just find your CL in http://r.android.com/. See http://b/202848945git rev-parse HEAD # a sha is printed and you will need it later git reset HEAD~1 # reset to a earlier commit repo upload --cbr . # try to upload it again git reset <the sha printed above>
ojluni_modify_expectation add
and ojluni_refresh_files
, a git commit -a
would include more files than just EXPECTED_UPSTREAM, because git
, e.g. git status
, isn't aware of changes in the working tree / in the file system. This can lead to an error when checking out the branch that is based on master.git checkout --hard <initial commit before the add>
ojluni_modify_expectation add
and ojluni_refresh_files
git stash && git stash pop
git reset aosp/expected_upstream