Coder Social home page Coder Social logo

gradle-javaee-plugin's Introduction

Maven Central

Gradle plugin for Java Execution Environment

gradle-javaee-plugin is a Gradle plugin to automate the process of generating the optimized jar bundle. The generated jar bundle can be used for deployment to ICON networks that support the Java SCORE execution environment (a.k.a. JavaEE).

Getting Started

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'foundation.icon:gradle-javaee-plugin:0.8.5'
    }
}

repositories {
    mavenCentral()
}

apply plugin: 'java'
apply plugin: 'foundation.icon.javaee'

Configuring Tasks

The optimizedJar task type extends from Gradle's Jar type. This means that all attributes and methods available on Jar are also available on optimizedJar. Refer the Gradle User Guide for Jar for details.

Specifying a Main Class Name

mainClassName property is required to indicate the entry point that is used for the initial execution. This property will be included into the generated jar bundle with the Main-Class header in the manifest.

optimizedJar {
    mainClassName = 'com.iconloop.score.example.HelloWorld'
}

Enabling Debug Mode

optimizedJar task obfuscates the Java class names by default to reduce the output jar file size. However, this makes code analysis more difficult when debugging code by examining the stack trace. enableDebug option can be used to skip this optimization for debugging purpose.

optimizedJar {
    mainClassName = 'com.iconloop.score.example.HelloWorld'
    enableDebug = true
}

Jar Deployment

The deployJar extension can be used to deploy the optimized jar to local or remote ICON networks that support the Java SCORE execution environment.

deployJar {
    endpoints {
        local {
            uri = 'http://localhost:9082/api/v3'
            nid = 0x3
        }
    }
    keystore = './mykey.json'
    password = 'keypass'
    parameters {
        arg('name', 'Alice')
    }
}

The above extension creates deployToLocal task automatically based on the container name of the given endpoints property.

Deployment for update

Starting from version 0.7.9, you can specify to address to update an already deployed contract. to property is optional, thus omitting this is regarded as deploying a new contract.

deployJar {
    endpoints {
        local {
            uri = 'http://localhost:9082/api/v3'
            nid = 0x3
            to = 'cxe3d5237f13530bce0b936df320c0308885d062e9'
        }
    }
    ...
}

Examples

License

This project is available under the Apache License, Version 2.0.

gradle-javaee-plugin's People

Contributors

mksong76 avatar sink772 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gradle-javaee-plugin's Issues

Pass an array as parameter

Hello,

I got a contract with the following constructor :

class MyClass {

  MyClass (Address[] whitelist) {
    ...
  }
}

I'm trying to figure out how to pass the array "whitelist" in the gradle.build deployJar task :


deployJar {
    keystore = rootProject.hasProperty('keystoreName') ? "$keystoreName" 
        : 'Z:/Work/ICON/config/keystores/sejong/operator.icx'
    password = rootProject.hasProperty('keystorePass') ? "$keystorePass"
        : 'gochain'

    endpoints {
        sejong {
            uri = 'https://sejong.net.solidwallet.io/api/v3'
            nid = 83
        }
        local {
            uri = 'http://localhost:9082/api/v3'
            nid = 3
        }
    }
    parameters {
        arg('whitelist', ???) <- what to put here ?
    }
}

Whatever the value I try, it fails.

I noticed the multisig wallet contract uses a split on a String.
Is there any way to achieve what I want using the native Address array type ?

Update an already deployed Jar

Hello,

Is there any way to deploy an update to an already deployed Jar ? I can't see the Gradle task for that.

Thank you!

Different Key/password fields for each network

deployJar {
    endpoints {
        local {
            uri = 'http://localhost:9082/api/v3'
            nid = 0x3
        }
    }
    keystore = './mykey.json'
    password = 'keypass'
    parameters {
        arg('name', 'Alice')
    }
}

The current format allows a keystore and a password field which is useful, but it becomes useless whenever you need to manage multiple keys on different networks.

Would it be possible to move this field in the network section, in order to be able to use different keys without modifying the gradle.build file ?

Suggestion :

deployJar {
    endpoints {
        local {
            uri = 'http://localhost:9082/api/v3'
            nid = 0x3
            keystore = './mykey-local.json'
            password = 'keypass'
        }

        sejong {
            uri = 'https://sejong.net.solidwallet.io/api/v3'
            nid = 0x83
            keystore = './mykey-sejong.json'
            password = 'keypass'
        }
    }
    parameters {
        arg('name', 'Alice')
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.