普通文本  |  88行  |  3.82 KB

/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
def standaloneProject = project(":jetifier-standalone")
def jetifierBin = file("${standaloneProject.buildDir}/install/jetifier-standalone/bin/jetifier-standalone")

task stripArchive(type: Zip) {
    dependsOn tasks['createArchive']
    from zipTree(project.tasks['createArchive'].archivePath)
    destinationDir rootProject.buildDir
    archiveName "stripped_archive.zip"
    include "m2repository/androidx/annotation/**",
            "m2repository/androidx/appcompat/**",
            "m2repository/androidx/asynclayoutinflater/**",
            "m2repository/androidx/browser/**",
            "m2repository/androidx/car/**",
            "m2repository/androidx/cardview/**",
            "m2repository/androidx/collection/collection/**",
            "m2repository/androidx/coordinatorlayout/**",
            "m2repository/androidx/core/core/**",
            "m2repository/androidx/cursoradapter/**",
            "m2repository/androidx/customview/**",
            "m2repository/androidx/documentfile/**",
            "m2repository/androidx/drawerlayout/**",
            "m2repository/androidx/dynamicanimation/**",
            "m2repository/androidx/emoji/**",
            "m2repository/androidx/exifinterface/**",
            "m2repository/androidx/fragment/fragment/**",
            "m2repository/androidx/gridlayout/**",
            "m2repository/androidx/heifwriter/**",
            "m2repository/androidx/interpolator/**",
            "m2repository/androidx/leanback/**",
            "m2repository/androidx/legacy/**",
            "m2repository/androidx/loader/**",
            "m2repository/androidx/localbroadcastmanager/**",
            "m2repository/androidx/media/media/**",
            "m2repository/androidx/mediarouter/**",
            "m2repository/androidx/palette/palette/**",
            "m2repository/androidx/percentlayout/**",
            "m2repository/androidx/preference/**",
            "m2repository/androidx/print/**",
            "m2repository/androidx/recommendation/**",
            "m2repository/androidx/recyclerview/**",
            "m2repository/androidx/slice/**",
            "m2repository/androidx/slidingpanelayout/**",
            "m2repository/androidx/swiperefreshlayout/**",
            "m2repository/androidx/transition/**",
            "m2repository/androidx/tvprovider/**",
            "m2repository/androidx/vectordrawable/**",
            "m2repository/androidx/viewpager/**",
            "m2repository/androidx/wear/**",
            "m2repository/androidx/webkit/**"
}

task dejetifyArchive(type: Exec) {
    description "Produces a zip of dejetified artifacts by running Dejetifier against refactored" +
            " artifacts, for temporary usage by external clients that haven't upgraded to Jetpack" +
            " yet."

    dependsOn ':jetifier-standalone:installDist'
    dependsOn project.tasks['stripArchive']
    inputs.file project.tasks['stripArchive'].archivePath

    outputs.file "${rootProject.ext.distDir}/top-of-tree-m2repository-dejetified-${project.ext.buildNumber}.zip"

    commandLine (
        "${jetifierBin}",
        "-i", "${inputs.files.singleFile}",
        "-o", "${outputs.files.singleFile}",
        "--versions", "inDev",
        "--log", "warning",
        "--reversed",
        "--rebuildTopOfTree"
    )
}