SAP Hybris Commerce installer目录下的build.gradle

文件位置:

project.ext.installerHome = project.projectDir
project.ext.installerWorkDir = Paths.get(project.installerHome as String, 'work').toAbsolutePath().toString()
project.ext.customConfigDir = Paths.get(project.installerHome as String, 'customconfig').toAbsolutePath().toString()
project.ext.suiteHome = getSuiteHome()

上面的代码获得customconfig和work文件夹的绝对路径:

getSuiteHome:获得整个Hybris目录路径,比如C:\Code\hybris670

给每个subproject添加libs文件夹内的.jar依赖:

project.subprojects.each { subProject ->
    subProject.buildscript.dependencies {
        delegate.classpath(fileTree(dir: "${rootProject.projectDir}/libs", include: '*.jar'))
    }
}

将标准和错误输出记录到logs文件夹下面的日志文件去:

printRecipeDescription: 打印recipes文件夹下的子文件夹比如b2b_acc内的readme.txt的内容:

subprojects {
    afterEvaluate { subProject ->
        def setupTask = createTaskInSubProject subProject, 'setup', 'Setups platform (writes configuration into local.properties, localextensions.xml)'
        def buildSystemTask = createTaskInSubProject subProject, 'buildSystem', 'Builds platform'
        def initializeTask = createTaskInSubProject subProject, 'initialize', 'Initializes platform fully'
        def initializeJunitTask = createTaskInSubProject subProject, 'initializeJunit', 'Initializes platform JUnitTenant'
        def startTask = createTaskInSubProject subProject, 'start', 'Starts platform interactively'
        def startInBackgroundTask = createTaskInSubProject subProject, 'startInBackground', 'Starts platform in background'
        def stopInBackgroundTask = createTaskInSubProject subProject, 'stopInBackground', 'Stops platform in background'
        def testJunitTask = createTaskInSubProject subProject, 'testJunit', 'Runs JUnit tests'
        def testInitializeTask = createTaskInSubProject subProject, 'testInitialize', 'Runs initialization tests'
        def testServerTask = createTaskInSubProject subProject, 'testServer', 'Runs JUnit tests'
        def createImageStructureTask = createTaskInSubProject subProject, 'createImagesStructure', 'Creates images structure'

        def buildDockerImagesTask = createTaskInSubProject subProject, 'buildImages', 'Builds docker images'
        buildDockerImagesTask.dependsOn = [createImageStructureTask]

        def pushDockerImagesTask = createTaskInSubProject subProject, 'pushImages', 'Pushes docker images'
        pushDockerImagesTask.dependsOn = [buildDockerImagesTask]

        buildSystemTask.mustRunAfter setupTask
        initializeTask.mustRunAfter buildSystemTask
        initializeJunitTask.mustRunAfter buildSystemTask
        startTask.mustRunAfter initializeTask
        startInBackgroundTask.mustRunAfter initializeTask
        stopInBackgroundTask.mustRunAfter testServerTask

        testJunitTask.mustRunAfter initializeJunitTask
        testInitializeTask.mustRunAfter initializeTask
        testServerTask.mustRunAfter startInBackgroundTask

        def performTask = createTaskInSubProject subProject, 'perform', 'Performs setup, build, initialize and start - in this order'
        performTask.dependsOn = [setupTask, buildSystemTask, initializeTask, startTask]

        def performTestJunitTask = createTaskInSubProject subProject, 'performTestJunit', 'Performs setup, buildSystem, initializeJunit, testJunit - in this order'
        performTestJunitTask.dependsOn = [setupTask, buildSystemTask, initializeJunitTask, testJunitTask]

        def performTestInitializeTask = createTaskInSubProject subProject, 'performTestInitialize', 'Performs setup, buildSystem, initialize, testInitialize - in this order'
        performTestInitializeTask.dependsOn = [setupTask, buildSystemTask, initializeTask, testInitializeTask]

        def performTestServerTask = createTaskInSubProject subProject, 'performTestServer', 'Performs setup, buildSystem, initialize, startInBackground, testServer - in this order'
        performTestServerTask.dependsOn = [setupTask, buildSystemTask, initializeTask, startInBackgroundTask, testServerTask, stopInBackgroundTask]
    }
}

创建各种task并设置依赖关系:

subprojects {
    afterEvaluate { subProject ->
        def setupTask = createTaskInSubProject subProject, 'setup', 'Setups platform (writes configuration into local.properties, localextensions.xml)'
        def buildSystemTask = createTaskInSubProject subProject, 'buildSystem', 'Builds platform'
        def initializeTask = createTaskInSubProject subProject, 'initialize', 'Initializes platform fully'
        def initializeJunitTask = createTaskInSubProject subProject, 'initializeJunit', 'Initializes platform JUnitTenant'
        def startTask = createTaskInSubProject subProject, 'start', 'Starts platform interactively'
        def startInBackgroundTask = createTaskInSubProject subProject, 'startInBackground', 'Starts platform in background'
        def stopInBackgroundTask = createTaskInSubProject subProject, 'stopInBackground', 'Stops platform in background'
        def testJunitTask = createTaskInSubProject subProject, 'testJunit', 'Runs JUnit tests'
        def testInitializeTask = createTaskInSubProject subProject, 'testInitialize', 'Runs initialization tests'
        def testServerTask = createTaskInSubProject subProject, 'testServer', 'Runs JUnit tests'
        def createImageStructureTask = createTaskInSubProject subProject, 'createImagesStructure', 'Creates images structure'

        def buildDockerImagesTask = createTaskInSubProject subProject, 'buildImages', 'Builds docker images'
        buildDockerImagesTask.dependsOn = [createImageStructureTask]

        def pushDockerImagesTask = createTaskInSubProject subProject, 'pushImages', 'Pushes docker images'
        pushDockerImagesTask.dependsOn = [buildDockerImagesTask]

        buildSystemTask.mustRunAfter setupTask
        initializeTask.mustRunAfter buildSystemTask
        initializeJunitTask.mustRunAfter buildSystemTask
        startTask.mustRunAfter initializeTask
        startInBackgroundTask.mustRunAfter initializeTask
        stopInBackgroundTask.mustRunAfter testServerTask

        testJunitTask.mustRunAfter initializeJunitTask
        testInitializeTask.mustRunAfter initializeTask
        testServerTask.mustRunAfter startInBackgroundTask

        def performTask = createTaskInSubProject subProject, 'perform', 'Performs setup, build, initialize and start - in this order'
        performTask.dependsOn = [setupTask, buildSystemTask, initializeTask, startTask]

        def performTestJunitTask = createTaskInSubProject subProject, 'performTestJunit', 'Performs setup, buildSystem, initializeJunit, testJunit - in this order'
        performTestJunitTask.dependsOn = [setupTask, buildSystemTask, initializeJunitTask, testJunitTask]

        def performTestInitializeTask = createTaskInSubProject subProject, 'performTestInitialize', 'Performs setup, buildSystem, initialize, testInitialize - in this order'
        performTestInitializeTask.dependsOn = [setupTask, buildSystemTask, initializeTask, testInitializeTask]

        def performTestServerTask = createTaskInSubProject subProject, 'performTestServer', 'Performs setup, buildSystem, initialize, startInBackground, testServer - in this order'
        performTestServerTask.dependsOn = [setupTask, buildSystemTask, initializeTask, startInBackgroundTask, testServerTask, stopInBackgroundTask]
    }
}

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

汪子熙 CSDN认证博客专家 前端框架 Node.js SAP
JerryWang,2007年从电子科技大学计算机专业硕士毕业后加入SAP成都研究院工作至今。Jerry是SAP社区导师,SAP中国技术大使。2020年5月下旬,Jerry做了脑部肿瘤的开颅切除手术,对编程和人生又有了新的感悟。
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值