import java.io.File

rootProject.name = "inz"

String npPath = System.getProperty("np.path");
if (npPath == null || npPath.length() == 0) {
	npPath = new File(rootDir, "../../np").getCanonicalPath();
}

File npBuild = new File(npPath, "build.gradle");
if (npBuild.exists()) {
	includeBuild(npPath) {
		dependencySubstitution {
			substitute module('com.jiuqi:np.authz') with project(':np.authz')
			substitute module('com.jiuqi:np.authz.impl') with project(':np.authz.impl')
			substitute module('com.jiuqi:np.authz.reject.impl') with project(':np.authz.reject.impl')
			substitute module('com.jiuqi:np.blob') with project(':np.blob')
			substitute module('com.jiuqi:np.cache') with project(':np.cache')
			substitute module('com.jiuqi:np.core') with project(':np.core')
			substitute module('com.jiuqi:np.core.support') with project(':np.core.support')
			substitute module('com.jiuqi:np.dataengine') with project(':np.dataengine')
			substitute module('com.jiuqi:np.dbupdate') with project(':np.dbupdate')
			substitute module('com.jiuqi:np.definition') with project(':np.definition')
			substitute module('com.jiuqi:np.i18n') with project(':np.i18n')
			substitute module('com.jiuqi:np.lib') with project(':np.lib')
			substitute module('com.jiuqi:np.org') with project(':np.org')
			substitute module('com.jiuqi:np.org.impl') with project(':np.org.impl')
			substitute module('com.jiuqi:np.sql') with project(':np.sql')
			substitute module('com.jiuqi:np.sql.spring') with project(':np.sql.spring')
			substitute module('com.jiuqi:np.syntax') with project(':np.syntax')
			substitute module('com.jiuqi:np.tenant') with project(':np.tenant')
			substitute module('com.jiuqi:np.user') with project(':np.user')
			substitute module('com.jiuqi:np.user.impl') with project(':np.user.impl')
		}
	}
}


String aminoPath = System.getProperty("amino.path");
if (aminoPath == null || aminoPath.length() == 0) {
	aminoPath = new File(rootDir, "../../amino2-query").getCanonicalPath();
}

File aminoBuild = new File(aminoPath, "build.gradle");
if (aminoBuild.exists()) {
	includeBuild(aminoPath) {
		dependencySubstitution {
			substitute module('com.beecode:amino.amqp') with project(':amino.amqp')
			substitute module('com.beecode:amino.boot') with project(':amino.boot')
			substitute module('com.beecode:amino.boot.web') with project(':amino.boot.web')
			substitute module('com.beecode:amino.common') with project(':amino.common')
			substitute module('com.beecode:amino.core') with project(':amino.core')
			substitute module('com.beecode:amino.shell') with project(':amino.shell')
			substitute module('com.beecode:amino.tenant') with project(':amino.tenant')
			substitute module('com.beecode:amino.tenant.liquibase') with project(':amino.tenant.liquibase')
			substitute module('com.beecode:bcp.authc') with project(':bcp.authc')
			substitute module('com.beecode:bcp.authc.passwd') with project(':bcp.authc.passwd')
			substitute module('com.beecode:bcp.authz') with project(':bcp.authz')
			substitute module('com.beecode:bcp.base') with project(':bcp.base')
			substitute module('com.beecode:bcp.biz') with project(':bcp.biz')
			substitute module('com.beecode:bcp.config') with project(':bcp.config')
			substitute module('com.beecode:bcp.core') with project(':bcp.core')
			substitute module('com.beecode:bcp.dict') with project(':bcp.dict')
			substitute module('com.beecode:bcp.group') with project(':bcp.group')
			substitute module('com.beecode:bcp.import') with project(':bcp.import')
			substitute module('com.beecode:bcp.job') with project(':bcp.job')
			substitute module('com.beecode:bcp.limitation') with project(':bcp.limitation')
			substitute module('com.beecode:bcp.log') with project(':bcp.log')
			substitute module('com.beecode:bcp.org') with project(':bcp.org')
			substitute module('com.beecode:bcp.participant') with project(':bcp.participant')
			substitute module('com.beecode:bcp.print') with project(':bcp.print')
			substitute module('com.beecode:bcp.query') with project(':bcp.query')
			substitute module('com.beecode:bcp.advanced.query') with project(':bcp.advanced.query')
			substitute module('com.beecode:bcp.query-template') with project(':bcp.query-template')
			substitute module('com.beecode:bcp.script') with project(':bcp.script')
			substitute module('com.beecode:bcp.selector') with project(':bcp.selector')
			substitute module('com.beecode:bcp.sequence') with project(':bcp.sequence')
			substitute module('com.beecode:bcp.serial') with project(':bcp.serial')
			substitute module('com.beecode:bcp.store') with project(':bcp.store')
			substitute module('com.beecode:bcp.task') with project(':bcp.task')
			substitute module('com.beecode:bcp.type') with project(':bcp.type')
			substitute module('com.beecode:bcp.type.support.javascript') with project(':bcp.type.support.javascript')
			substitute module('com.beecode:bcp.type.support.json') with project(':bcp.type.support.json')
			substitute module('com.beecode:bcp.user') with project(':bcp.user')
			substitute module('com.beecode:bcp.workflow') with project(':bcp.workflow')
			substitute module('com.beecode:bcp.workflow.task') with project(':bcp.workflow.task')
		}
	}
}


String bapPath = System.getProperty("bap.path");
if (bapPath == null || bapPath.length() == 0) {
	bapPath = new File(rootDir, "../../bap2-query").getCanonicalPath();
}

File bapBuild = new File(bapPath, "backend/build.gradle");
if (bapBuild.exists()) {
	includeBuild(bapPath + "/backend") {
		dependencySubstitution {
			substitute module('com.beecode:bap2.attachment') with project(':bap2.attachment')
			substitute module('com.beecode:bap2.authz')	with project(':bap2.authz')
			substitute module('com.beecode:bap2.bill')	with project(':bap2.bill')
			substitute module('com.beecode:bap2.bill.redis') with project(':bap2.bill.redis')
			substitute module('com.beecode:bap2.biztrait') with project(':bap2.biztrait')
			substitute module('com.beecode:bap2.comment') with project(':bap2.comment')
			substitute module('com.beecode:bap2.common') with project(':bap2.common')
			substitute module('com.beecode:bap2.core') with project(':bap2.core')
			substitute module('com.beecode:bap2.department') with project(':bap2.department')
			substitute module('com.beecode:bap2.export') with project(':bap2.export')
			substitute module('com.beecode:bap2.functree') with project(':bap2.functree')
			substitute module('com.beecode:bap2.limitation') with project(':bap2.limitation')
			substitute module('com.beecode:bap2.log') with project(':bap2.log')
			substitute module('com.beecode:bap2.news') with project(':bap2.news')
			substitute module('com.beecode:bap2.org') with project(':bap2.org')
			substitute module('com.beecode:bap2.participant') with project(':bap2.participant')
			substitute module('com.beecode:bap2.query') with project(':bap2.query')
			substitute module('com.beecode:bap2.question') with project(':bap2.query')
			substitute module('com.beecode:bap2.scheduler') with project(':bap2.scheduler')
			substitute module('com.beecode:bap2.staff') with project(':bap2.staff')
			substitute module('com.beecode:bap2.sysconfig') with project(':bap2.sysconfig')
			substitute module('com.beecode:bap2.system') with project(':bap2.system')
			substitute module('com.beecode:bap2.user') with project(':bap2.user')
			substitute module('com.beecode:bap2.userprofile') with project(':bap2.userprofile')
			substitute module('com.beecode:bap2.workflow') with project(':bap2.workflow')
            substitute module('com.beecode:bap2.bill.workflow') with project(':bap2.bill.workflow')
		}
	}
}

include "inz.authentication"
include "inz.authmgr"
include "inz.basis"
include "inz.common"
include "inz.enterprisesetting"
include "inz.init.data"
include "inz.message"
include "inz.query"
include "inz.workflow"