Solidity Gradle Plugin – Solidity Gradle插件区块链毕设代写
区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Solidity Gradle Plugin – Solidity Gradle插件区块链毕设代写 是一篇很好的国外资料
Solidity Gradle Plugin
Simple Gradle plugin used by the Web3j plugin to compile Solidity contracts, but it can be used in any standalone project for this purpose.
Plugin configuration
To configure the Solidity Gradle Plugin using the plugins DSL or the legacy plugin application, check the plugin page. The minimum Gradle version to run the plugin is 5.+
.
Then run this command from your project containing Solidity contracts:
./gradlew build
After the task execution, the base directory for compiled code (by default $buildDir/resources/solidity
) will contain a directory for each source set (by default main
and test
), and each of those a directory with the compiled code.
Code generation
The solidity
DSL allows to configure the generated code, e.g.:
solidity { outputComponents = [BIN, ABI, ASM_JSON] optimizeRuns = 500 }
The properties accepted by the DSL are listed in the following table:
Name | Type | Default value | Description |
---|---|---|---|
executable |
String |
null (bundled with the plugin) |
Solidity compiler path. |
version |
String |
0.4.25 |
Solidity compiler version. |
overwrite |
Boolean |
true |
Overwrite existing files. |
optimize |
Boolean |
true |
Enable byte code optimizer. |
optimizeRuns |
Integer |
200 |
Set for how many contract runs to optimize. |
prettyJson |
Boolean |
false |
Output JSON in pretty format. Enables the combined JSON output. |
ignoreMissing |
Boolean |
false |
Ignore missing files. |
allowPaths |
List<String> |
['src/main/solidity', 'src/test/solidity', ...] |
Allow a given path for imports. |
evmVersion |
EVMVersion |
BYZANTIUM |
Select desired EVM version. |
outputComponents |
OutputComponent[] |
[BIN, ABI] |
List of output components to produce. |
combinedOutputComponents |
CombinedOutputComponent[] |
[BIN, BIN_RUNTIME, SRCMAP, SRCMAP_RUNTIME] |
List of output components in combined JSON output. |
Notes:
- Setting the
executable
property will disable the bundledsolc
and use your local or containerized executable:
solidity { executable = "docker run --rm -v $projectDir:/src satran004/aion-fastvm:latest solc" version = '0.4.15' }
- Use
version
to change the bundled Solidity version. Check the Solidity releases for all available versions. allowPaths
contains all project’s Solidity source sets by default.
Source sets
By default, all .sol
files in $projectDir/src/main/solidity
will be processed by the plugin. To specify and add different source sets, use the sourceSets
DSL. You can also set your preferred output directory for compiled code.
sourceSets { main { solidity { srcDir { "my/custom/path/to/solidity" } output.resourcesDir = file('out/bin/compiledSol') } } }
Plugin tasks
The Java Plugin adds tasks to your project build using a naming convention on a per source set basis (i.e. compileJava
, compileTestJava
).
Similarly, the Solidity plugin will add a:
compileSolidity
task for the projectmain
source set.compile<SourceSet>Solidity
for each remaining source set (e.g.compileTestSolidity
for thetest
source set, etc.).
To obtain a list and description of all added tasks, run the command:
./gradlew tasks --all
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they’re used to log you in. Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
Adds support for different solidity versions (
Solidity Gradle Plugin
Web3j插件用来编译Solidity契约的简单Gradle插件,但是它可以用于任何独立的项目中。
Plugin configuration
要使用插件DSL或旧插件应用程序配置Solidity Gradle插件,请查看插件页面。运行插件的最低版本是5。
然后从包含Solidity协定的项目中运行此命令:
./gradlew build
任务执行后,编译代码的基本目录(默认为$buildDir/resources/Solidity)将包含每个源集的目录(默认情况下为main和test),每个源集都包含编译代码的目录。
Code generation
solidity DSL允许配置生成的代码,例如:
solidity { outputComponents = [BIN, ABI, ASM_JSON] optimizeRuns = 500 }
下表列出了DSL接受的属性:
Name | Type | Default value | Description |
---|---|---|---|
executable |
String |
null (bundled with the plugin) |
Solidity compiler path. |
可执行的插件 | String |
0.4.25 |
。 |
版本 | 字符串 | 0.4.25 | Solidity编译器版本。 |
覆盖 | 布尔值 | true | 覆盖现有文件。 |
优化 | 布尔值 | true | 启用字节码优化器。 |
优化运行数 | 整数 | 200 | 设置要优化的合约运行数。 |
prettyJson | Boolean | false | 以漂亮的格式输出JSON。启用组合的JSON输出。 |
忽略丢失的文件。 | allowPaths | List<;String>; | [‘src/main/solidity’,’src/test/solidity’,…] |
允许导入的给定路径。 | EVM版本 | EVM版本 | 拜占庭 |
选择所需的EVM版本。 | 输出组件 | OutputComponent[] | [BIN,ABI] |
要生成的输出组件列表。 | combinedOutputComponents | CombinedOutputComponent[] | [BIN,BINu RUNTIME,SRCMAP,SRCMAP_RUNTIME] |
注意:
- 使用版本更改捆绑的Solidity版本。检查所有可用版本的Solidity版本。
solidity { executable = "docker run --rm -v $projectDir:/src satran004/aion-fastvm:latest solc" version = '0.4.15' }
- 默认情况下,allowPaths包含项目的所有Solidity源集。
- 项目主源代码集的compileSolidity任务。
Source sets
默认情况下,$projectDir/src/main/solidity中的所有.sol文件都将由插件处理。要指定和添加不同的源集,请使用sourceSets DSL。您还可以设置编译代码的首选输出目录。
sourceSets { main { solidity { srcDir { "my/custom/path/to/solidity" } output.resourcesDir = file('out/bin/compiledSol') } } }
Plugin tasks
Java插件使用基于每个源集的命名约定(即compileJava、compileTestJava)将任务添加到项目构建中。
类似地,Solidity插件将添加一个:
- 为每个剩余的源集编译<;SourceSet>;可靠性(例如,测试源集的compileTestSolidity等)。
可执行的插件 。 版本 字符串 0.4.25 Solidity编译器版本。 覆盖 布尔值 true 覆盖现有文件。 优化 布尔值 true 启用字节码优化器。 优化运行数 整数 200 设置要优化的合约运行数。 prettyJson Boolean false 以漂亮的格式输出JSON。启用组合的JSON输出。 忽略丢失的文件。 allowPaths List<;String>; [‘src/main/solidity’,’src/test/solidity’,…] 允许导入的给定路径。 EVM版本 EVM版本 拜占庭 选择所需的EVM版本。 输出组件 OutputComponent[] [BIN,ABI] 要生成的输出组件列表。 combinedOutputComponents CombinedOutputComponent[] [BIN,BINu RUNTIME,SRCMAP,SRCMAP_RUNTIME] 组合JSON输出中的输出组件列表。在 compile<SourceSet>Solidity
for each remaining source set (e.g.compileTestSolidity
for thetest
source set, etc.).
要获取所有添加任务的列表和说明,请运行命令:
./gradlew tasks --all
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。
Essential cookies
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
Always active
Analytics cookies
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多信息或容器化可执行文件:
Adds support for different solidity versions (
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Solidity Gradle Plugin – Solidity Gradle插件区块链毕设代写