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

Rework Windows resources hack to not depend on resource path strings #104

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ jobs:
run: brew install openssl
- name: Install Dependencies
run: zef install --/test --test-depends --deps-only .
- name: Install App::Prove6
run: zef install --/test App::Prove6
- name: Run Tests
run: raku -I. -e "require(q[Build.rakumod]); ::(q[Build]).new.build(q[.])" && prove6 -I. t
- name: Build
run: zef build .
- name: Stage, Test, and Installation
run: zef install . --debug
- name: Ensure dll rename hack works
if: runner.os == 'Windows'
run: |
Remove-Item -Path $env:TEMP\* -Recurse -Force -ErrorAction Ignore
raku ${{ github.workspace }}/t/06-digest-md5.t
24 changes: 12 additions & 12 deletions lib/OpenSSL/NativeLib.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ sub crypto-lib is export {
# XXX: This should be removed when CURI/%?RESOURCES gets a mechanism to bypass name mangling
use nqp;
sub dll-resource($resource-name) {
my $resource = %?RESOURCES{$resource-name};
return $resource.absolute if $resource.basename eq $resource-name;

my $content_id = nqp::sha1($resource.absolute);
my $content_store = $*TMPDIR.child($content_id);
my $content_file = $content_store.child($resource-name).absolute;
return $content_file if $content_file.IO.e;

mkdir $content_store unless $content_store.e;
copy($resource, $content_file);

$content_file;
my $content-id = nqp::sha1($resource-name);
my $dll-directory = $*TMPDIR.add($content-id);
my $dll-resource = $dll-directory.add($resource-name);

unless $dll-resource.e {
mkdir $dll-directory unless $dll-directory.e;
my $resource = %?RESOURCES{$resource-name};
my $resource-data := %?RESOURCES{$resource-name}.slurp(:bin, :close);
$dll-resource.spurt($resource-data, :bin, :close);
}

return $dll-resource.absolute;
}
Loading