/*
 * Copyright (C) 2005-2017 Qihoo 360 Inc.
 *
 * 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.
 */
import java.nio.file.Files

// 当前工程 Module
include ':replugin-host-gradle'
include ':replugin-host-library'
include ':replugin-plugin-gradle'
include ':replugin-plugin-library'

// 额外子工程
def includeBuildProjects = [
//        './replugin-sample/host',
//        './replugin-sample/plugin/plugin-demo1',
//        './replugin-sample/plugin/plugin-demo2',
//        './replugin-sample/plugin/plugin-demo3-kotlin',
//        './replugin-sample/plugin/plugin-webview',
//        './replugin-sample-extra/fresco/FrescoHost',
//        './replugin-sample-extra/fresco/FrescoPlugin',
//        './repluginx-sample/host',
//        './repluginx-sample/plugin/plugin-demo1'
]

// 批量初始化子工程 local.properties
def rootFile = file('local.properties')
if (rootFile.exists()) {
    includeBuildProjects.forEach {
        def includeBuildFile = file("${it}/local.properties")
        if (!includeBuildFile.exists()) {
            Files.copy(rootFile.toPath(), includeBuildFile.toPath())
        }
    }
}

// 批量导入子工程
includeBuildProjects.forEach { includeBuild(it) }


//includeBuild('./repluginx-sample/host') {
//    dependencySubstitution {
////        substitute module('com.github.GitLqr.RePluginX:replugin-host-library') with project(':')
//    }
//}
//includeBuild('./repluginx-sample/plugin/plugin-demo1') {
//    dependencySubstitution {
////        substitute module('com.github.GitLqr.RePluginX:replugin-plugin-library') with project(':')
//    }
//}
