May be a bit out of date ⚠️⚠️⚠️

Wire specific for the proto kind module, it used to compile the proto definition to neutral result.

Setup

Please refer to: apihug-full-demo demo-user-proto gradle build.gradle:

plugins {
    id "java-library"
    alias(libs.plugins.hopeWire)
}

hopeWire {
    keepProto = false
    verbose = false
}

Meta information hope-wire.json:

{
  "packageName": "com.apihug.demo.user",
  "name": "demo-user-proto",
  "application": "demo-user",
  "domain": "user",
  "persistence" : {
    "identifyType" : "LONG",
    "tenantType" : "LONG"
  },
  "authority" : {
    "enumClass" : "com.apihug.demo.user.proto.infra.settings.UserAuthorityEnum",
    "codePrefix" : 10240000
  },
  "createdAt": "2024-02-29",
  "createdBy" : "dell",
  "api": {
    "openapi" : "3.0.1",
    "info" : {
      "contact" : {
        "name" : "developer@apihug.com",
        "url" : "https://github.com/apihug/",
        "email" : "developer@apihug.com"
      }
    },
    "externalDocs" : {
      "description" : "Hope is the best thing",
      "url" : "https://github.com/apihug/"
    },
    "tags" : [ {
      "name" : "sample",
      "description" : "Sample Tag"
    }]
  }
}

Configuration

Gradle hopeWire Configuration details:

ArgumentDescriptionTypeDefaultComment
disablePlugin debuggingbooleanfalseAfter dependency injection is complete, do not add additional tasks, for debugging and testing purposes
smockPlugin debuggingbooleanfalseAfter the above step is complete + Task injection is finished, do not execute the final generation action, for debugging and testing purposes
debugPlugin debuggingbooleanfalseAfter the above steps are complete + the first stage of the generation action is prepared, do not finally trigger the action, for debugging and testing purposes
restrictImplicit conversion for non-extensible typesbooleanfalseWhether google.protobuf.Timestamp is supported for default conversion to local time
verboseEnable execution process logbooleanfalseEnable full log for debugging when there are issues
generatedVersionInclude generated plugin versionbooleanfalseWhether to include the plugin version in the @Generated annotation of the generated code
generatedTimeInclude generation timestampbooleanfalseWhether to include the generation timestamp in the @Generated annotation of the generated code
pluginMainVersionPlugin auxiliary versionStringThe version dependency of the wire plugin at runtime, do not set unless necessary. The Apihug overall package is released with BOM, and this version should not be manually set
pluginMainClassPlugin auxiliary entry MainStringDo not set unless the plugin is extended
localLocal pluginbooleanfalseSet if you are extending the plugin yourself, otherwise do not set
protocVersionProtoc versionStringSupplied by Wire at the time of release, can be defined by oneself (may lead to incompatibility risks)
grpcVersionGRPC versionStringSupplied by Wire at the time of release, can be defined by oneself (may lead to incompatibility risks)
keepProtoInclude original compiled proto filesbooleanfalseWhether to carry the results of protoc compilation when the wire project is released, it should be limited to the POJO layer unless there is a deep logical dependency between projects
wireProtoBufGradlePluginVersionProtobuf plugin versionStringNot enabled
validationVersionValidation versionStringNot enabled
swaggerVersionSwagger versionStringNot enabled

Meta configuration resources\hope-wire.json:

NameDescriptionType(Default)Remarks
packageNamePackage NameStringRequiredProject package name, must conform to Java package naming conventions, cannot contain reserved keywords: wire, stub
nameProject NameStringRequiredProject identifier, must conform to artifact ID, lowercase, Chinese characters, example with a proto suffix: user-info-proto
applicationApplication ProjectStringRequiredThe name of the project that matches the proto, usually the name without the proto suffix, example: user-info
moduleModule NameStringRequiredUsed for service locator at runtime to locate, if not set, name is used instead, the combination of domain+module must be unique at runtime
domainDomain NameStringRequiredThe domain it belongs to
descriptionDescriptionStringOptionalDescription
persistence.identifyTypeDatabase, Account TypeStringOptionalData design, enabled when there is an account ID identifier, STRING|INTEGER|LONG
persistence.tenantTypeDatabase, Tenant TypeStringOptionalData design, enabled when there is a multi-tenant identifier, STRING|INTEGER|LONG
authority.enumClassAuthority, Permission Type EnumStringOptionalAuthority design, permission enumeration class, must be defined in the proto, checked at compile time
authority.codePrefixAuthority, Permission Code PrefixLongOptionalAuthority design, for multi-module setups, permission code segment to avoid overlap, example: 100000 for user permission range, 100001 for the first

Run

Every Auto generated project include a detail README example: README, include detail instruction how to use it.

Build All

sh gradlew clean build -x test -x wireTest -x stubTest

Build Individual Module

sh gradlew {YOUR_MODULE}:clean wire build -x test -x wireTest