Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git submodules should be updated if not offline #587

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

shiftkey
Copy link
Owner

@shiftkey shiftkey commented Aug 29, 2021

This PR fixes an issue spotted downstream in the Arch Linux packaging. From a clean build and package they were not seeing the submodules exist on disk, which meant the app didn't build. alerque/aur#22 is the workaround for that case.

I was able to reproduce this on macOS with a fresh clone:

> git clone https://github.com/shiftkey/desktop desktop-fresh-clone
Cloning into 'desktop-fresh-clone'...
remote: Enumerating objects: 208353, done.
remote: Counting objects: 100% (745/745), done.
remote: Compressing objects: 100% (304/304), done.
remote: Total 208353 (delta 501), reused 589 (delta 438), pack-reused 207608
Receiving objects: 100% (208353/208353), 71.77 MiB | 18.22 MiB/s, done.
Resolving deltas: 100% (166509/166509), done.

> cd desktop-fresh-clone
> yarn
yarn install v1.21.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.21.1".
$ ts-node -P script/tsconfig.json script/post-install.ts
yarn install v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Rebuilding all packages...
success Saved lockfile.
✨  Done in 23.54s.
yarn run v1.21.1
$ tsc -P script/tsconfig.json
✨  Done in 20.40s.
✨  Done in 104.66s.

> yarn build:dev
yarn run v1.21.1
$ yarn compile:dev && cross-env NODE_ENV=development ts-node -P script/tsconfig.json script/build.ts
$ cross-env NODE_ENV=development TS_NODE_PROJECT=script/tsconfig.json parallel-webpack --config app/webpack.development.ts
[WEBPACK] Building 5 targets
[WEBPACK] Started building main.js
[WEBPACK] Started building renderer.js
[WEBPACK] Started building crash.js
[WEBPACK] Started building cli.js
[WEBPACK] Started building highlighter.js
...
[WEBPACK] Finished build after 62.458 seconds
Building for development…
Removing old distribution…
Copying dependencies…
  Installing dependencies via yarn…
warning devtron > [email protected]: Support has ended for 9.x series. Upgrade to @latest
  Copying desktop-trampoline…
  Copying ssh-wrapper
  Copying git environment…
  Copying app-path binary…
Packaging emoji…
Error: ENOENT: no such file or directory, stat '/Users/shiftkey/src/test/desktop-fresh-clone/gemoji/images/emoji'
    at Object.statSync (fs.js:1086:3)
    at Object.statSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/graceful-fs/polyfills.js:307:34)
    at statSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:10:52)
    at getStatsSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:24:19)
    at Object.checkPathsSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:49:33)
    at Object.copySync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
    at removeAndCopy (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:233:6)
    at copyEmoji (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:239:3)
    at Object.<anonymous> (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:66:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module.m._compile (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I think we've just gotten this check wrong as part of the Flatpak work, and we should be running this when the environment variable is not found.

@AdvaithM when you have time, please confirm I've got this right, and that it's not going to affect the Flatpak side of things...

@shiftkey
Copy link
Owner Author

And here's the confirmation with this patch that we're correctly initializing the submodules again:

> git checkout inverted-logic-issue
Branch 'inverted-logic-issue' set up to track remote branch 'inverted-logic-issue' from 'origin'.
Switched to a new branch 'inverted-logic-issue'
> yarn
yarn install v1.21.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
$ ts-node -P script/tsconfig.json script/post-install.ts
yarn install v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Rebuilding all packages...
success Saved lockfile.
✨  Done in 3.34s.
Submodule 'app/static/common/choosealicense.com' (https://github.com/github/choosealicense.com.git) registered for path 'app/static/common/choosealicense.com'
Submodule 'app/static/common/gitignore' (https://github.com/github/gitignore.git) registered for path 'app/static/common/gitignore'
Submodule 'gemoji' (https://github.com/github/gemoji.git) registered for path 'gemoji'
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/app/static/common/choosealicense.com'...
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/app/static/common/gitignore'...
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/gemoji'...
Submodule path 'app/static/common/choosealicense.com': checked out '42e83d1315b15e63fa8e2337a4d58b5d58dfba08'
Submodule path 'app/static/common/gitignore': checked out 'ec246076319913acee4aaeef8caf86b78e586e7a'
Submodule path 'gemoji': checked out '50865e8895c54037bf06c4c1691aa925d030a59d'
yarn run v1.21.1
$ tsc -P script/tsconfig.json
✨  Done in 5.19s.
✨  Done in 16.59s.

@Lunarequest
Copy link

I'll confirm of this works soon

@Lunarequest
Copy link

@shiftkey this works when building with flatpaks

@shiftkey shiftkey marked this pull request as ready for review August 30, 2021 11:57
@shiftkey shiftkey merged commit c3733bc into linux Aug 30, 2021
@shiftkey shiftkey deleted the inverted-logic-issue branch August 30, 2021 11:57
shiftkey added a commit that referenced this pull request Sep 2, 2024
shiftkey added a commit that referenced this pull request Nov 8, 2024
shiftkey added a commit that referenced this pull request Nov 8, 2024
shiftkey added a commit that referenced this pull request Nov 8, 2024
shiftkey added a commit that referenced this pull request Nov 8, 2024
shiftkey added a commit that referenced this pull request Feb 5, 2025
shiftkey added a commit that referenced this pull request Feb 5, 2025
shiftkey added a commit that referenced this pull request Feb 5, 2025
shiftkey added a commit that referenced this pull request Feb 5, 2025
shiftkey added a commit that referenced this pull request Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants