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

Pre Release (v3.9.0-beta.6): git_revision.cをどうにかする #82

Merged
merged 25 commits into from
May 17, 2023

Conversation

sksat
Copy link
Collaborator

@sksat sksat commented Dec 6, 2021

概要

git_revision.cがトラッキングされていると,ビルドする度に無意味なdiffが発生する上誤ってcommitしてしまうことがある.
そのため,git_revision.cを生成するのではなく,コンパイルオプションに渡してdefineすることでgit revisionを埋め込むようにする.

Issue

NA

詳細

  • git_revision.cGIT_REVISION_C2A_CORE のような定数を埋め込むだけにする
  • git_revision.hsrc_core/Library に移した
  • git_revision.cc2a_core_main.c 内部に移した
  • 定数が定義されてない時は"0000000000000000000000000000000000000000"などが入る

検証結果

NA

影響範囲

詳しくはExample minimum userのsrc_user/Settings/git_revision_config.hを参照のこと.

  • 全user共通
    • 各ビルド環境でsrc/src_user/Library/git_revision.cではなくsrc/src_core/git_revision.cを使うようにする
    • 注: CMakeならcoreをadd_subdirectory()するだけでOK(userのCMakeLists.txtからgit_revision.cを消せばいい)
  • CMakeでビルドする環境(コマンドラインオプションでdefineする環境)
    • src_user/Settings/git_revision_config.hC2A_GIT_REVISION_FROM_OPTIONを定義する
  • git_revision.cを自動生成していた環境
    • git revision自動生成スクリプトのパス変更
      • 前: Examples/minimum_user_for_s2e/src/src_user/Script/git_revision.bat
      • 後: Examples/minimum_user_for_s2e/src/src_user/Script/Git/revision.bat
  • commit hashを埋め込まない環境
    • src_user/Settings/git_revision_config.hC2A_GIT_REVISION_IGNOREをdefineする

補足

  • マージ前に,2nd user にもあてる

@sksat
Copy link
Collaborator Author

sksat commented Dec 6, 2021

あとはgit_revision_template.cがCとして合法になっていればいい

@sksat
Copy link
Collaborator Author

sksat commented Dec 6, 2021

え,S2E系のCIだけ落ちてる...まさか...

@sksat sksat force-pushed the feature/refactor-git-revision branch from ecc2537 to 13577d1 Compare December 6, 2021 11:55
@sksat
Copy link
Collaborator Author

sksat commented Dec 6, 2021

if(WIN32)の方書き方ミスってただけだった.よかった.

@sksat
Copy link
Collaborator Author

sksat commented Dec 6, 2021

git_revision_template.cを合法にするの,微妙に面倒なのでifdefしたらいい気もする

@meltingrabbit meltingrabbit added the priority::medium priority medium label Dec 6, 2021
@sksat sksat force-pushed the feature/refactor-git-revision branch from 13577d1 to a320840 Compare December 7, 2021 11:29
@sksat
Copy link
Collaborator Author

sksat commented Dec 7, 2021

conflictしてたのでrebase

@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

再rebase

@sksat sksat force-pushed the feature/refactor-git-revision branch from a320840 to 6c49026 Compare December 10, 2021 11:50
@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

あと微塵もLibraryではないしsrc_user直下でもいい気もするんだよな

@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

というか.cじゃなくてヘッダを生成する方がまだだいぶマシだなあ.そうするか.

@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

coreにgit_revision.cだけを置いておいて,そこからsrc/src_user/git_revision.hをinclude,でよいのでは?だいぶシンプルになる.

@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

というかそれならgit_revision.cが要らないな.c2a_core_main.cでやってしまえばいい.

@sksat
Copy link
Collaborator Author

sksat commented Dec 10, 2021

いやsrc/src_user/git_revision.hも要らないな

@sksat sksat force-pushed the feature/refactor-git-revision branch from 6c49026 to ad276ca Compare December 10, 2021 13:01
@sksat sksat requested a review from meltingrabbit December 10, 2021 17:12
c2a_core_main.c Outdated Show resolved Hide resolved
git_revision.c Outdated Show resolved Hide resolved
git_revision.h Outdated Show resolved Hide resolved
@sksat
Copy link
Collaborator Author

sksat commented Dec 13, 2021

あ,conflictしてるんでrebase

@sksat sksat force-pushed the feature/refactor-git-revision branch from 05cbafc to 742d94b Compare December 13, 2021 06:45
@sksat sksat requested a review from meltingrabbit December 13, 2021 10:30
@sksat
Copy link
Collaborator Author

sksat commented Dec 13, 2021

これなんでcheck_coding_ruleコケてるのかと思ったら#error

@meltingrabbit
Copy link
Collaborator

#error って別に ""で囲わなくてもいいので,これは規約チェックスクリプトが良くないっぽいな

@sksat
Copy link
Collaborator Author

sksat commented Dec 13, 2021

まあ#errorはそうそう使わないですし気持ち的に囲ってた方がよくはあるので気にしなくていいかも

@sksat
Copy link
Collaborator Author

sksat commented Dec 13, 2021

descriptionを修正

@sksat sksat force-pushed the feature/refactor-git-revision branch from 073721c to 6765b55 Compare May 17, 2023 14:56
@meltingrabbit

This comment was marked as resolved.

@meltingrabbit
Copy link
Collaborator

2nd obc とおなじものはこれに追記 \c2a-core\Examples\2nd_obc_user\sync_with_minimum_user.bat

Copy link
Collaborator

@meltingrabbit meltingrabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おつ

@meltingrabbit meltingrabbit changed the title git_revision.cをどうにかする Pre Release (v3.9.0-beta.6): git_revision.cをどうにかする May 17, 2023
@meltingrabbit meltingrabbit self-requested a review May 17, 2023 16:14
Copy link
Collaborator

@meltingrabbit meltingrabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

リリースするのでversion up コミットうってもらって

Copy link
Collaborator

@meltingrabbit meltingrabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おつ2

@sksat sksat merged commit 784307c into develop May 17, 2023
@sksat sksat deleted the feature/refactor-git-revision branch May 17, 2023 16:22
@meltingrabbit
Copy link
Collaborator

2年越しのマージ

@meltingrabbit
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants