cogentcore / core

A free and open source framework for building powerful, fast, elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the web with a single Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.7k stars 79 forks source link

Proposal: Goki monorepo #782

Closed rcoreilly closed 8 months ago

rcoreilly commented 8 months ago

Proposal (from Kai and Randy)

Create a github.com/goki/goki repository that contains all of the dependencies for gi up through the current gix extras repository, with the following exceptions:

We also need to decide about gix -- could draw the line at giv, which would reduce size and dependencies, but probably the marginal benefits there are not worth the cost of maintaining a separate repo. What about etable?

Also, what about: ordmap, glop, grr, gengo, and possibly laser? See discussion below about major con of monorepo: makes it unlikely for others to be able to use these otherwise useful tools. Possible ways of "getting the best of both worlds" include maintaining separate stable versions of select repos, or just allowing others to effectively do the same thing by copying our code into their own projects.

Cons of separate repos

Cons of monorepo

Pros of monorepo

rcoreilly commented 8 months ago

Strategy:

kkoreilly commented 8 months ago

Another key point in favor of a monorepo: it means that you have easily reproducible and functional points in history. If you want to run the code at commit x, you just have to run git checkout x and you are done. With our current polyrepo system, it is basically impossible to do that, because there are tons of incompatible changes across many repositories, so you would have to manually pin down the correct version for tons of repositories. This also applies for end users: with a monorepo, if someone wants to use version x in their app, they can just run go get goki.dev@x. There is one unified version for the whole system that is guaranteed to work. With a polyrepo system, they would have to manage tons of dependency versions to do that. This is also related to the go.work problem: because we are actively developing across multiple repositories, we have to have everything in a work file created with gsm work. However, if someone else wanted to recreate that, they would have to clone every repository first and always keep them up to date. If they don't do that, their code doesn't build (and thus the CI also fails). Also, when developing apps outside of the goki organization, you need to manually make your own go.work and keep it up-to-date with all of the new repositories we keep making, which is an unnecessary extra burden.

kkoreilly commented 8 months ago

We are moving forward with this for the reasons listed above.

kkoreilly commented 8 months ago

The codebase will be unstable during this change.

rcoreilly commented 8 months ago

first pass completed! just need to update icons before merging into goki monorepo.

here's the script to prepare existing repo as a subdir:

#!/bin/bash -x

repo=$1
git clone https://github.com/goki/$repo
cd $repo
/bin/rm -rf .gitignore .goki LICENSE .github .travis.yml
git commit -am "cleanup"
mkdir $repo
mv * $repo
git filter-branch --index-filter \
     'git ls-files -s | sed "s#\t#&$repo/#" |
      GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
      git update-index --index-info &&
      mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
git add $repo
git commit -am "add $repo files"
ls -la .

# in target repo:
# git pull ../$repo --allow-unrelated-histories
# git push --force
rcoreilly commented 8 months ago

clearly the right way to go! Now in https://github.com/cogentcore/core