Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FixpackageTimestamp setting for static assets#13159

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
dwickern wants to merge2 commits intoplayframework:main
base:main
Choose a base branch
Loading
fromdwickern:asset-timestamps

Conversation

dwickern
Copy link
Contributor

sbt 1.5.0 added aThisBuild / packageTimestamp setting to fix Play's last-modified header. The problem is, it doesn't work. SettingThisBuild / packageTimestamp has no effect on Play's packaged assets.

This PR fixes the settings to respectThisBuild / packageTimestamp for Play assets. Additionally, there is anAssets / packageTimestamp setting which can set asset timestamps differently from other packaging.

For example, this configuration is valid:

// use the git HEAD commit timestamp as the last-modified header for assetsAssets/ packageTimestamp:=Package.gitCommitDateTimestamp// use 2010 timestamp for other packaging (e.g. class files in jars)ThisBuild/ packageTimestamp:=Package.fixed2010Timestamp

I updated the docs to recommend settingpackageTimestamp instead ofpackageOptions.

Fixes#10572

Pull Request Checklist

@dwickern
Copy link
ContributorAuthor

dwickern commentedFeb 24, 2025
edited
Loading

It's possible that

Assets/ packageTimestamp:=Package.keepTimestamps

would be a reasonable default.

Personally I would have to revert it back because I useSOURCE_DATE_EPOCH. But I could see changing it for the benefit of users who just leave things at their default.

Edit: actually, this default would be the best of both worlds

Assets/ packageTimestamp:=  sys.env.get("SOURCE_DATE_EPOCH")    .map(_.toLong*1000)    .orElse(Package.keepTimestamps)

@dwickerndwickern marked this pull request as draftFebruary 24, 2025 04:24
@mkurz
Copy link
Member

Edit: actually, this default would be the best of both worlds

Yeah, I think this is the best solution. This basically restores sbt 1.4.0 behaviour (for Assets, at least), while also takesSOURCE_DATE_EPOCH into account.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
Status: 🆕 New
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Last-Modified HTTP header of assets contained in jar is wrong when using sbt >= 1.4.0
2 participants
@dwickern@mkurz

[8]ページ先頭

©2009-2025 Movatter.jp