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

Use Makefile's pattern rules for the intermediate assert/writeln translation #1590

Merged
merged 5 commits into from
Mar 1, 2017

Conversation

wilzbach
Copy link
Member

  • only regeneration when real changes happen
  • removes the ugly rsync workaround

@wilzbach wilzbach changed the title Use pattern rules for the intermediate assert/writeln translation Use Makefile's pattern rules for the intermediate assert/writeln translation Feb 28, 2017
{
auto tmpFile = File(destFile ~ ".tmp", "w");
writeLinesToFile(tmpFile);
tmpFile.name.rename(destFile);
Copy link
Member

Choose a reason for hiding this comment

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

Renaming an open file will fail on Windows. Do we care about that?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I think it won't. Renaming over an open file will. Never mind.

if (inputDir.length == 0)
parseFile(file.name, outputDir);
else
parseFile(file.name, file.name.replace(inputDir, outputDir));
Copy link
Member

Choose a reason for hiding this comment

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

posix.mak Outdated
@@ -40,6 +40,10 @@ PHOBOS_STABLE_DIR=${PHOBOS_DIR}-${LATEST}
GENERATED=.generated
PHOBOS_DIR_GENERATED=$(GENERATED)/phobos-prerelease
PHOBOS_STABLE_DIR_GENERATED=$(GENERATED)/phobos-release
PHOBOS_FILES := $(shell find $(PHOBOS_DIR) -name '*.d' -o -name '*.mak' -o -name '*.ddoc')
PHOBOS_FILES_GENERATED := $(subst $(PHOBOS_DIR), $(PHOBOS_DIR_GENERATED), $(PHOBOS_FILES))
Copy link
Member

Choose a reason for hiding this comment

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

In general it would be nice if more things in the makefile were documented.

@wilzbach
Copy link
Member Author

wilzbach commented Mar 1, 2017

In general it would be nice if more things in the makefile were documented

I gave it a first shot. Nothing fancy, the biggest changes were to use the same osmodel.mak as everywhere else and the removal of the two git clones rules in favor of an already existing, generic one.

if (inputDir.length == 0)
parseFile(file.name, outputDir);
else
parseFile(file.name, file.name.rebasePath(inputDir, outputDir));
Copy link
Member Author

Choose a reason for hiding this comment

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

btw I just kept this support because it might be nice "in a possible future". It's not needed anymore as the Makefile does the invocations with a single file.

@@ -33,13 +39,24 @@ [email protected]:data

# Last released versions
DMD_STABLE_DIR=${DMD_DIR}-${LATEST}
DMD_REL=$(DMD_STABLE_DIR)/src/dmd
Copy link
Member Author

@wilzbach wilzbach Mar 1, 2017

Choose a reason for hiding this comment

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

Imho it would be better to rename this existing variable to sth. like DMD_STABLE_BIN

################################################################################

$(GENERATED):
mkdir -p $@
ASSERT_WRITELN_BIN = $(GENERATED)/assert_writeln_magic
Copy link
Member Author

Choose a reason for hiding this comment

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

Yet another small cleanup - sorry that I didn't think about this earlier.

@CyberShadow
Copy link
Member

I gave it a first shot.

Great, thanks!

@CyberShadow
Copy link
Member

BTW since I noticed [SQUASH] in commit titles seems to be a pattern, do you know about git commit --fixup?

HAS_RSYNC := $(shell command -v rsync 2> /dev/null)
$(ASSERT_WRITELN_BIN): assert_writeln_magic.d $(DUB)
@mkdir -p $(dir $@)
$(DUB) build --single $<
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that using DUB without a specified DMD executable apparently broke Martin's build script.
This is the current "status quo" and I am waiting for his feedback on how to resolve this at #1592
(so this shouldn't block this PR and #1592 can easily be rebased)

@wilzbach
Copy link
Member Author

wilzbach commented Mar 1, 2017

BTW since I noticed [SQUASH] in commit titles seems to be a pattern, do you know about git commit --fixup?

Yep, but I don't want to force-push during a review. The idea is that you only have to review the new changes ;-)

@CyberShadow
Copy link
Member

--fixup still creates a new commit, it just makes rebasing easier later.

@wilzbach
Copy link
Member Author

wilzbach commented Mar 1, 2017

--fixup still creates a new commit, it just makes rebasing easier later.

Not sure if it makes a difference if we use auto-merge-squash anyways later ;-)

Btw anything blocking this? I think this time I should do manual squashing to keep some commits, so please let me know.

@CyberShadow
Copy link
Member

Not sure if it makes a difference if we use auto-merge-squash anyways later ;-)

Actually, would be cool if dbot could auto-squash --fixup commits.

@CyberShadow
Copy link
Member

I think this time I should do manual squashing to keep some commits, so please let me know.

Yes please.

@wilzbach
Copy link
Member Author

wilzbach commented Mar 1, 2017

Actually, would be cool if dbot could auto-squash --fixup commits.

Good idea - noted it here:

dlang/dlang-bot#64

(but the queue is currently a bit full).

Yes please.

Done :)

@wilzbach wilzbach merged commit c1e1666 into dlang:master Mar 1, 2017
@wilzbach wilzbach deleted the cleanup-makefile-patterns branch March 1, 2017 18:15
@CyberShadow
Copy link
Member

Well, I was going to merge anyway :P

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.

3 participants