Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

.fabricignore file not being respected #3174

Closed
2 tasks
csandwith opened this issue Nov 9, 2022 · 1 comment
Closed
2 tasks

.fabricignore file not being respected #3174

csandwith opened this issue Nov 9, 2022 · 1 comment
Labels
wontfix This will not be worked on

Comments

@csandwith
Copy link

When packaging a Java-based Hyperledger Smart Contract, all files are included from the project despite entries in the .fabricignore file. This causes the package to become unnecessarily large (in my particular case, rendering it unusable due to timeouts)

Expected Behavior

The package should not contain files/folders listed in .fabricignore

Actual Behavior

The package contains all files in the project directory with no regard or respect for .fabricignore. For example, .fabricignore has the line /.gradle/ but the Package info clearly lists several files including [11/9/2022 9:49:20 AM] [INFO] - src/.gradle/5.6.2/executionHistory/executionHistory.lock

Possible Fix

Based on the CHANGELOG and the lack of direct reference to the .fabricignore file, I respect that this might not technically be the purview of the extension, but of an underlying library in use...perhaps this needs to be explicitly stated when the library is invoked?

Steps to reproduce

  • Create a directory on disk (e.g. "bug-example")
  • In VS Code IBM Blockchain Platform Extension, under Smart Contracts, select Create new Project
  • Default Contract, Java, MyAsset, browse to the directory created and select it, Open in new window
  • Observe that many default files and folders have been created
/bug-example$ ls -R
.:
bin  build.gradle  gradle  gradlew  gradlew.bat  settings.gradle  src  transaction_data

./bin:
main  test

./bin/main:
org

./bin/main/org:
example

./bin/main/org/example:
MyAsset.class  MyAssetContract.class

./bin/test:
org

./bin/test/org:
example

./bin/test/org/example:
'MyAssetContractTest$AssetCreates.class'  'MyAssetContractTest$AssetExists.class'  'MyAssetContractTest$AssetUpdates.class'   MyAssetContractTest.class

./gradle:
wrapper

./gradle/wrapper:
gradle-wrapper.jar  gradle-wrapper.properties

./src:
main  test

./src/main:
java

./src/main/java:
org

./src/main/java/org:
example

./src/main/java/org/example:
MyAssetContract.java  MyAsset.java

./src/test:
java

./src/test/java:
org

./src/test/java/org:
example

./src/test/java/org/example:
MyAssetContractTest.java

./transaction_data:
my-asset-transactions.txdata
  • Observe that a file has been created in the root called .fabricignore whose contents are
#
# SPDX-License-Identifier: Apache-2.0
#

/.classpath
/.git/
/.gradle/
/.project
/.settings/
/bin/
/build/
  • In IBM Blockchain Plaform Extension, under Smart Contracts, invoke "Package Open Project"
  • tar.gz, example, 1.0
  • Observe that example@1.0 (.tar.gz) is now listed in Smart Contracts
  • Right click example@1.0 and select "View Package Information"
  • Observe a listing of the files inside the package:
[11/9/2022 9:49:20 AM] [INFO] Found 27 file(s) in smart contract package example@1.0:
[11/9/2022 9:49:20 AM] [INFO] - metadata.json
[11/9/2022 9:49:20 AM] [INFO] - src/.fabricignore
[11/9/2022 9:49:20 AM] [INFO] - src/.gitignore
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/5.6.2/executionHistory/executionHistory.lock
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/5.6.2/fileChanges/last-build.bin
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/5.6.2/fileHashes/fileHashes.lock
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/5.6.2/gc.properties
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/buildOutputCleanup/buildOutputCleanup.lock
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/buildOutputCleanup/cache.properties
[11/9/2022 9:49:20 AM] [INFO] - src/.gradle/vcs-1/gc.properties
[11/9/2022 9:49:20 AM] [INFO] - src/.vscode/extensions.json
[11/9/2022 9:49:20 AM] [INFO] - src/bin/main/org/example/MyAsset.class
[11/9/2022 9:49:20 AM] [INFO] - src/bin/main/org/example/MyAssetContract.class
[11/9/2022 9:49:20 AM] [INFO] - src/bin/test/org/example/MyAssetContractTest.class
[11/9/2022 9:49:20 AM] [INFO] - src/bin/test/org/example/MyAssetContractTest$AssetCreates.class
[11/9/2022 9:49:20 AM] [INFO] - src/bin/test/org/example/MyAssetContractTest$AssetExists.class
[11/9/2022 9:49:20 AM] [INFO] - src/bin/test/org/example/MyAssetContractTest$AssetUpdates.class
[11/9/2022 9:49:20 AM] [INFO] - src/build.gradle
[11/9/2022 9:49:20 AM] [INFO] - src/gradle/wrapper/gradle-wrapper.jar
[11/9/2022 9:49:20 AM] [INFO] - src/gradle/wrapper/gradle-wrapper.properties
[11/9/2022 9:49:20 AM] [INFO] - src/gradlew
[11/9/2022 9:49:20 AM] [INFO] - src/gradlew.bat
[11/9/2022 9:49:20 AM] [INFO] - src/settings.gradle
[11/9/2022 9:49:20 AM] [INFO] - src/src/main/java/org/example/MyAsset.java
[11/9/2022 9:49:20 AM] [INFO] - src/src/main/java/org/example/MyAssetContract.java
[11/9/2022 9:49:20 AM] [INFO] - src/src/test/java/org/example/MyAssetContractTest.java
[11/9/2022 9:49:20 AM] [INFO] - src/transaction_data/my-asset-transactions.txdata
[11/9/2022 9:49:20 AM] [SUCCESS] Displayed information for smart contract package example@1.0.

Existing issues

I checked, but didn't find any

Log File

5-Blockchain.log

Your Environment

  • IBM Blockchain Platform Extension Version: v2.0.8
  • Visual Studio Code version: 1.73.0
  • Commit: 8fa188b2b301d36553cbc9ce1b0a146ccb93351f
  • Date: 2022-11-01T15:44:09.336Z
  • Electron: 19.0.17
  • Chromium: 102.0.5005.167
  • Node.js: 16.14.2
  • V8: 10.2.154.15-electron.0
  • OS: Linux x64 5.15.0-52-generic snap
  • Sandboxed: No
@jt-nti jt-nti added the wontfix This will not be worked on label Dec 13, 2022
@jt-nti
Copy link
Contributor

jt-nti commented Dec 13, 2022

Unfortunately this project is no longer active- see #3183

For Java chaincode I would recommend packaging a prebuilt jar if possible- there are some details here if that helps at all...
https://hyperledgendary.github.io/docs/goodpractice/java_chaincode_packaging.html

@jt-nti jt-nti closed this as completed Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants