V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lanxiner
V2EX  ›  Android

Gradle 脚本编写问题,求大神解惑

  •  
  •   lanxiner · 2022 年 10 月 20 日 · 11855 次点击
    这是一个创建于 1181 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想用编写 gralde 脚本批量执行多个 gradle 任务,从而生成多个渠道包
    例如按顺序执行以下几个任务,应该如何编写 graldle 脚本代码呢?
    assembleProduction1Release
    assembleProduction2Release
    assembleProduction3Release
    assembleProduction4Release
    assembleProduction5Release
    5 条回复    2022-10-23 20:55:29 +08:00
    hu8245
        1
    hu8245  
       2022 年 10 月 20 日
    白嫖啊?直接看 groovy 语法啊
    rb6221
        2
    rb6221  
       2022 年 10 月 20 日
    这不是 shell 脚本的事么,直接执行 gradlew assembleProduction1Release 这个命令啊。有几个你就执行几个。跟 gradle 脚本没关系吧
    300
        3
    300  
       2022 年 10 月 20 日 via Android
    直接写个脚本文件不就行了
    cmd 或者 shell 里
    ./gradlew assemble1
    XXWHCA
        4
    XXWHCA  
       2022 年 10 月 20 日
    如果你的 product 就这几个,你可以直接运行./gradlew assembleRelease
    如果是只需要运行着 5 个 product ,那就在后面拼接就行了,gradle 会按顺序执行的,./gradlew assembleProduction1Release assembleProduction2Release assembleProduction3Release ...
    yuanxiaosong
        5
    yuanxiaosong  
       2022 年 10 月 23 日
    task assembleProduction1Release(type: Copy) {
    }
    assemble.finalizedBy(assembleProduction1Release)

    task assembleProduction2Release(type: Copy) {
    }
    assembleProduction1Release.finalizedBy(assembleProduction2Release)

    ……
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   3412 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:35 · PVG 19:35 · LAX 03:35 · JFK 06:35
    ♥ Do have faith in what you're doing.