天天看点

SAP Hybris Commerce installer目录下的build.gradle

文件位置:

SAP Hybris Commerce installer目录下的build.gradle
上面的代码获得customconfig和work文件夹的绝对路径:
SAP Hybris Commerce installer目录下的build.gradle
SAP Hybris Commerce installer目录下的build.gradle
给每个subproject添加libs文件夹内的.jar依赖:

project.subprojects.each { subProject ->
    subProject.buildscript.dependencies {
        delegate.classpath(fileTree(dir: "${rootProject.projectDir}/libs", include: '*.jar'))
    }
}      
SAP Hybris Commerce installer目录下的build.gradle

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

SAP Hybris Commerce installer目录下的build.gradle
SAP Hybris Commerce installer目录下的build.gradle
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]
    }
}