Skip to content

Conversation

@osdemah
Copy link
Member

@osdemah osdemah commented Jan 7, 2025

Preserve file permissions in the zip archive, fix bugs in gitignore matching and keep mvm and gradle files

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

  • Traditional ZipOutputStream doesn't include file permission when archiving. Switching to ZipFS to be able to preserve the permissions on the archives
  • Partial matching of gitignore rules would create some false-positive matches. e.g. settings.gradle file being ignored due to .gradle rule in gitignore. Changed the logic to fix it.
  • Many of the files for mvn and gradle build systems would be dropped with the current extension+blocklist+gitignore heuristic. Added some rules to keep them unless matched by gitignore rules.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@osdemah osdemah requested review from a team as code owners January 7, 2025 21:43

createTemporaryZipFileAsync { zipOutput ->
val zipFilePath = createTemporaryZipFileAsync { zipfs ->
val isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains("posix")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we assign the string to a variable?

val externalFilePath = Path(file.path)
val relativePath = Path(file.path).relativeTo(projectRootPath)
val zipfsPath = zipfs.getPath("/$relativePath")
runBlocking {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's on the background thread, but is it possible to run this without blocking the thread?

@manodnyab
Copy link
Contributor

/retryBuilds

@manodnyab manodnyab enabled auto-merge (squash) January 14, 2025 22:15
@manodnyab manodnyab merged commit 88c7687 into aws:main Jan 14, 2025
11 checks passed
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 17, 2025
…iles are kept in the repo archives (aws#5235)

* fix(amazonq): archives now preserve file premissions and amazon q can edit nvm/gradle files

* fix test failures on windows

* change FS operations to use BG context

---------

Co-authored-by: Hamed Soleimani <[email protected]>
Co-authored-by: manodnyab <[email protected]>
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 22, 2025
…iles are kept in the repo archives (aws#5235)

* fix(amazonq): archives now preserve file premissions and amazon q can edit nvm/gradle files

* fix test failures on windows

* change FS operations to use BG context

---------

Co-authored-by: Hamed Soleimani <[email protected]>
Co-authored-by: manodnyab <[email protected]>
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.

4 participants