Skip to content

[mono-runtimes] Rebuild mono when mono changes. #36

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

Merged
merged 1 commit into from
May 12, 2016

Conversation

jonpryor
Copy link
Contributor

The mono-runtimes project isn't resilient to mono changes, in large
part because of the _Autogen task: it only executes if autogen.sh
is newer than configure, and if it doesn't run, nothing else
is re-executed either.

Meaning if mono is bumped, e.g. in commit cebaba2, the "newly
updated" mono isn't necessarily rebuilt, because as far as the
_Autogen target is concerned, nothing has changed (unless there is a
commit which just happened to touch autogen.sh...which is a fairly
infrequent occurrence).

Add a new _GetMonoTimestamp target which always touch(1)es
autogen.sh to contain the timestamp of the most recent commit.
THat way, if (when) mono is updated, the timestamp of autogen.sh
will be updated to match, allowing mono to be properly rebuilt.
If mono isn't updated, the timestamp will be set to what it
previously was, and no rebuild will occur.

@jonpryor
Copy link
Contributor Author

hold off on merging; it's not working quite right.

The `mono-runtimes` project isn't resilient to mono changes, in large
part because of the `_Autogen` target: `_Autogen` only executes if
`$(_MonoPath)\autogen.sh` is newer than `$(_MonoPath)\configure`, and
if the `_Autogen` target *doesn't* run, *no other targets* are
re-executed either.

Meaning if mono is bumped, e.g. as in commit cebaba2, the "newly
updated" mono isn't necessarily rebuilt, because as far as the
`_Autogen` target is concerned, nothing has changed (unless there is a
commit which just happened to touch `autogen.sh`...which is a fairly
infrequent occurrence).

Add a new `_SetAutogenShTimeToLastCommitTimestamp` target which
*always* touch(1)es `autogen.sh` to contain the timestamp of the most
recent commit. That way, if (when) mono is updated, the timestamp of
`autogen.sh` will be updated to match, allowing mono to be properly
rebuilt. If mono *isn't* updated, the timestamp will be set to what
it previously was, and no rebuild will occur.

Note: `git log --date=format-local:...` must be used so that the
resulting timestamp is in the *local* timezone. Otherwise, it's
possible that if the current commit was done "in the future" relative
to the current local timezone, `autogen.sh` will *always* have a more
recent timestamp...until "tomorrow", anyway, and nobody wants to wait
for "tomorrow".
@jonpryor jonpryor force-pushed the jonp-mono-rebuild branch from 2b44d4d to 7a6d564 Compare May 11, 2016 22:27
@jonpryor
Copy link
Contributor Author

It wasn't working because of timezones. (Can you believe it?! Timezones)

Specifically, commit cebaba2 bumped mono to a commit from Wed May 11 14:11:28 2016 +0200.

As of the time of this writing, that was 10 hours ago.

However, in my local timezone (USA EDT, UTC-4, "Wed May 11 17:49:42 EDT 2016"), that commit is 17 minutes in the future:

# autogen.sh has the "timestamp of most recent commit"
$ stat external/mono/autogen.sh 
-xr-x 1 jon staff 0 4773 "May 11 18:06:09 2016" "May 11 18:36:28 2016" "May 11 18:05:43 2016" "Apr 18 17:03:26 2016" 4096 16 0 external/mono/autogen.sh

# configure was just generated by runnning autogen.sh, and thus is from "now"
$ stat external/mono/configure
16777218 86786687 -rwxr-xr-x 1 jon staff 0 916719 "May 11 17:49:42 2016" "May 11 17:48:55 2016" "May 11 17:48:55 2016" "Apr 19 11:29:07 2016" 4096 1792 0 external/mono/configure

So even though the commit was made 10+ hours ago, as far as the initial timestamp computation logic was concerned, it was ~17 minutes from now, so the _Autogen target always re-ran, and so did everything else!

Fun!

@radical radical merged commit 70e4042 into dotnet:master May 12, 2016
radical pushed a commit that referenced this pull request May 8, 2018
[generator] Upgrade generator from monodroid/a438c473
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants