Skip to content

Proposal: manage all the source code in one repo #49

@luchsh

Description

@luchsh

Background

The CompoundVM JDK was built from source code of two repositories: modified jdk17u (aka this-repo), unmodified jdk8u. and the jdk8u source code was downloaded using wget at build time, see cvm.mk:150.

This approach has two drawbacks:

  • the external dependency may be unstable, affected by network, permission, etc.;
  • it would be hard to maintain changes in the downloaded package;

Proposal

This proposal tries to maintain all the source code in one repository (this one).

Design

multiple jdk*u upstreams

  • add different upstreams using git remote, below commands use jdk8u as example.
cd compoundVM/
git remote add jdk8u https://github.com/openjdk/jdk8u.git
git fetch jdk8u
git checkout -b up/jdk8u/master jdk8u/master
git push origin HEAD

Branch up/jdk8u/master has many shared history nodes with CompoundVM/master, thus no need to duplicate the whole git history tree.

  • since CVM project has got extra patches on upstream branches, we must create a CVM-jdk*u for each upstream
git checkout -b cvm8/jdk8u jdk8u/master
# add our patches

the new cvm master

  • create a new cvm master branch with no OpenJDK commit logs
git checkout jdk17u-target8
git checkout --orphan cvm8/master
rm -rf ADDITIONAL_LICENSE_INFO ASSEMBLY_EXCEPTION configure CONTRIBUTING.md doc make Makefile SECURITY.md src bin .jcheck
mv cvm/* ./
rmdir cvm
git add *
git commit -m 'initial load the cvm8/master branch'

accomodate multiple worktrees

  • Modify cvm.mk (now renamed to Makefile) to checkout the upstream branches into different worktrees at build time.
-jdk8u/jdk/src:
-       wget -nc https://github.com/openjdk/jdk8u/archive/refs/tags/jdk8u452-ga.tar.gz
-       [[ -d $(JDK8_SRCROOT) ]] || (mkdir -p $(JDK8_SRCROOT) && tar -xzf jdk8u452-ga.tar.gz -C $(JDK8_SRCROOT) --strip-components=1)
+$(JDK8_SRCROOT)/jdk/src:
+       git worktree add $(JDK8_SRCROOT) cvm8/jdk8u
+
+$(JDK17_SRCROOT)/src:
+       git worktree add $(JDK17_SRCROOT) cvm8/jdk17u

Demo

I've created a demo in my forked repo, steps to play with this demo:

git clone https://github.com/luchsh/CompoundVM.git cvm_test
cd cvm_test
make cvm8

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions