V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lanxiner
V2EX  ›  Android

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

  •  
  •   lanxiner · Oct 20, 2022 · 12439 views
    This topic created in 1285 days ago, the information mentioned may be changed or developed.
    想用编写 gralde 脚本批量执行多个 gradle 任务,从而生成多个渠道包
    例如按顺序执行以下几个任务,应该如何编写 graldle 脚本代码呢?
    assembleProduction1Release
    assembleProduction2Release
    assembleProduction3Release
    assembleProduction4Release
    assembleProduction5Release
    5 replies    2022-10-23 20:55:29 +08:00
    hu8245
        1
    hu8245  
       Oct 20, 2022
    白嫖啊?直接看 groovy 语法啊
    rb6221
        2
    rb6221  
       Oct 20, 2022
    这不是 shell 脚本的事么,直接执行 gradlew assembleProduction1Release 这个命令啊。有几个你就执行几个。跟 gradle 脚本没关系吧
    300
        3
    300  
       Oct 20, 2022 via Android
    直接写个脚本文件不就行了
    cmd 或者 shell 里
    ./gradlew assemble1
    XXWHCA
        4
    XXWHCA  
       Oct 20, 2022
    如果你的 product 就这几个,你可以直接运行./gradlew assembleRelease
    如果是只需要运行着 5 个 product ,那就在后面拼接就行了,gradle 会按顺序执行的,./gradlew assembleProduction1Release assembleProduction2Release assembleProduction3Release ...
    yuanxiaosong
        5
    yuanxiaosong  
       Oct 23, 2022
    task assembleProduction1Release(type: Copy) {
    }
    assemble.finalizedBy(assembleProduction1Release)

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

    ……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 21:28 · PVG 05:28 · LAX 14:28 · JFK 17:28
    ♥ Do have faith in what you're doing.