Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Comments

use D tool to copy imports instead of explicit list of rules#3026

Merged
thewilsonator merged 1 commit intodlang:masterfrom
rainers:copy_imports
Apr 20, 2020
Merged

use D tool to copy imports instead of explicit list of rules#3026
thewilsonator merged 1 commit intodlang:masterfrom
rainers:copy_imports

Conversation

@rainers
Copy link
Member

@rainers rainers commented Apr 11, 2020

as an alternative to #3024

This adds a host dmd as an additional dependency, but it's usually available as dmd needs one to build anyway. It might also pave the way for using D to replace other makefile functionality.

In addition, it builds the tool into generated/windows hoping to move other build artifacts there, too.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @rainers!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3026"

@rainers rainers force-pushed the copy_imports branch 3 times, most recently from aa7e9a7 to 405cdc7 Compare April 11, 2020 08:03
@denizzzka
Copy link
Contributor

denizzzka commented Apr 11, 2020

std\stdio.d(16): Error: module `stddef` is in file 'core\stdc\stddef.d' which cannot be read
import path[0] = ../druntime\import
Error: cannot find source code for runtime library file 'object.d'
       dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
       config file: not found
import path[0] = ../druntime\import

I faced with this error when forgot to implement creation of ./import/ directory

@rainers
Copy link
Member Author

rainers commented Apr 11, 2020

I faced with this error when forgot to implement creation of ./import/ directory

The main problem is to find a host dmd, as the CI scripts are either in a different repo (for azure-pipelines) or virtually immutable (auto-tester).

@denizzzka
Copy link
Contributor

auto-tester stalled?

@rainers
Copy link
Member Author

rainers commented Apr 13, 2020

auto-tester stalled?

Not sure what happened, the test have passed successfully. I amended a couple of comments to restart the build.

Copy link
Member

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

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

Looks okay, but why not go all the way and copy things using a recursive descent instead of relying on mak/WINDOWS ?

args = args[1..$];

string importPath = absolutePath("import");
string srcPath = absolutePath("src");
Copy link
Member

Choose a reason for hiding this comment

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

This assumes that the script is run from the root project, right ?

Wouldn't the following at the module level be more robust:

immutable RootPath    = __FILE_FULL_PATH__.dirName();
immutable ImportPath   = RootPath.buildPath("import");
immutable SourceTarget = RootPath.buildPath("src");

?

Copy link
Member Author

Choose a reason for hiding this comment

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

My initial version allowed the import and src path to be configured via getopt, allowing it to be used in similar situations The current version assumes a bit more about files being passed on the command line, while your proposed change fixes it to the current single use.

It seems a bit strange to pass relative paths on the command line, but then assume other src/import paths internally. I'm not too opinionated, though.

@rainers
Copy link
Member Author

rainers commented Apr 13, 2020

but why not go all the way and copy things using a recursive descent instead of relying on mak/WINDOWS ?

dependency is on mak/COPY and mak/IMPORTS.

There are currently a number of exceptions, namely files in core/sync, that are treated differently (i.e. are processed to di file). No idea why that is the case, though.

Walter has objected the wildcard approach to avoid processing stale or temporary files for dmd, so I didn't try to change it here.

@Geod24
Copy link
Member

Geod24 commented Apr 13, 2020

Walter has objected the wildcard approach to avoid processing stale or temporary files for dmd, so I didn't try to change it here.

Could we then move those files into the tool itself, like it has been done for build.d ?
If you think it is too much change, let me know, I'm fine gong ahead with the current PR.

@rainers
Copy link
Member Author

rainers commented Apr 13, 2020

Could we then move those files into the tool itself, like it has been done for build.d ?
If you think it is too much change, let me know, I'm fine gong ahead with the current PR.

I think that belongs into a separate PR as it should happen for all platforms. Otherwise we have new duplications in the build tool and mak/*.

@kinke
Copy link
Contributor

kinke commented Apr 15, 2020

Is there anyone actually using these 'elaborately' copied imports on Windows? The DMD 2.091 package contains the full druntime and Phobos src trees, the .7z archive and the installer package too AFAICT, so at least the official Windows packages seem not to need any of this.

Edit: Ah, I hadn't realized the druntime src dir contains an additional import dir with the copies.

Edit2: This will also add 3 currently missing files (core.stdc.errno and core.internal.elf.{dl,io}), good.

/**
* Helper script to copy source files to the `import` directory
*
* When building druntime, files in `src` are copied to the `import` directory, excluding modules from the `rt` package.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: 3 things are excluded, rt.*, gc.* and test_runner.d. And the .d -> .di conversions in core.sync.* as you've mentioned (LDC doesn't do that).

Copy link
Member Author

Choose a reason for hiding this comment

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

Slightly adapted the comment, but left out the di-conversion as I plan to copy these files, too.

@rainers
Copy link
Member Author

rainers commented Apr 16, 2020

Edit: Ah, I hadn't realized the druntime src dir contains an additional import dir with the copies.

Yeah, the distribution is a bit of a mess. I think it should look more like LDC, not distributing sources of the compiler and the runtime, only "public" imports. For example, adding import test.dub_stdx_allocator; to your code does not raise an error.

@rainers
Copy link
Member Author

rainers commented Apr 16, 2020

Does anyone have an idea why the auto-tester keeps reporting "Pass: 8 Pending: 2" while the details show they are all done? Happens on other PRs, too, e.g. #3005. @braddr ?

@denizzzka
Copy link
Contributor

buildkite/druntime also failed

@rainers
Copy link
Member Author

rainers commented Apr 19, 2020

buildkite/druntime also failed

Looks pretty unrelated, too, as this only changes the Windows build.

@thewilsonator thewilsonator merged commit dc0c353 into dlang:master Apr 20, 2020
MartinNowak added a commit to MartinNowak/druntime that referenced this pull request Apr 28, 2020
- fixup for dlang#3026
- fixes 32-bit builds with ldc
  (vcvars x86, but x64 default target of ldc)
MartinNowak added a commit to MartinNowak/druntime that referenced this pull request Apr 28, 2020
- fixup for dlang#3026
- fixes 32-bit release builds with ldc
  (vcvars x86, but x64 default target of ldc)
@MartinNowak
Copy link
Member

This of course broke the release builder. Weird cause I thought we had at least the Windows part covered by now.

Btw, would be nice if the next build system changes didn't land just before the scheduled beta ;).
https://dlang.org/changelog/release-schedule.html

@rainers
Copy link
Member Author

rainers commented Apr 28, 2020

This of course broke the release builder.

Sorry for the breakage.

Weird cause I thought we had at least the Windows part covered by now.

The installer CI doesn't automatically run for changes in other repos. Maybe we can make it part of the nightly builds?

With the latest LDC, setting LDC_VSDIR_FORCE=1 avoids this trouble as it auto-detects the appropriate environment unconditionally.

  • does not forward HOST_DC make variable

AFAICT that variable is also deprecated for DMD, see https://github.com/dlang/dmd/blob/05ad63263925b7b2730660f90361b650a3ace8e6/src/posix.mak#L75

MartinNowak added a commit to dlang/installer that referenced this pull request Apr 29, 2020
@CyberShadow
Copy link
Member

This also broke Digger.

@CyberShadow
Copy link
Member

Another problem with this change is that it reports success despite that this step fails. This causes an error much later, when trying to build Phobos, manifesting as not finding core.stdc.stddef etc.

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.

8 participants