You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2016/08/29 13:38:51 UTC

[3/4] incubator-edgent git commit: Merge branch 'master' of https://github.com/apache/incubator-edgent

Merge branch 'master' of https://github.com/apache/incubator-edgent


Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/5477795e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/5477795e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/5477795e

Branch: refs/heads/master
Commit: 5477795e0807554895d6b0f1401b982edfd236bf
Parents: 6606e62 fa16203
Author: Yaoliang Chen <ya...@cn.ibm.com>
Authored: Thu Aug 18 22:24:44 2016 +0800
Committer: Yaoliang Chen <ya...@cn.ibm.com>
Committed: Thu Aug 18 22:24:44 2016 +0800

----------------------------------------------------------------------
 DEVELOPMENT.md  |  36 ++++++++
 build.gradle    | 247 +++++++++++++++++++++++++++++++++++++++++----------
 settings.gradle |   4 +
 3 files changed, 242 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/5477795e/build.gradle
----------------------------------------------------------------------
diff --cc build.gradle
index dc2f973,eefae3c..0258f68
--- a/build.gradle
+++ b/build.gradle
@@@ -25,22 -27,10 +27,25 @@@ allprojects 
    }
  }
  
+ apply plugin: 'java'
+ 
 +/* SET PROJECT INFO for all artifacts */
 +assert hasProperty('version')   // See version in gradle.properties.
 +System.out.println("version=${version}")
 +group = 'org.apache.edgent'
 +
 +def getDate() {
 +  if (!hasProperty('buildDate') || buildDate == null) {
 +     ext.buildDate = new java.util.Date().format('yyyyMMddHHmm');
 +  }
 +  return ext.buildDate;
 +}
 +
 +getDate();
 +
 +
  ext {
+   commithash_error = ''
    commithash = {
      try {
        return "git rev-parse --short HEAD".execute().text.trim()
@@@ -62,10 -67,15 +82,17 @@@
  
  /* Configure subprojects */
  subprojects {
+ 
+   // ignore aggregator only projects so we don't assemble empty jars, etc for them.
+   if (aggregatorOnlyProjects.contains(project.path)) {
+     return
+   }
+ 
 +  apply plugin: 'maven-publish'
+   apply plugin: 'java'
    apply plugin: "jacoco"
 -
 +  ext.artifact = project.name
 +  
    if (buildFile.isFile() && !buildFile.exists()) {
      configurations.create('default')
      return
@@@ -149,14 -165,8 +182,15 @@@
      configure jarOptions
    }
  
 +  task sourceJar(type: Jar) {
 +    // baseName-appendix-version-classifier.extension
 +    from sourceSets.main.allJava
 +    classifier = 'sources'
 +  }
 +
 +
    task copyJar(type: Copy) {
+     description = "Copy subproject's assembled artifacts to target_dir (implicitly builds jars due to 'from jar')"
      def projectGroup = "$project.group".replace("edgent.", "")
  
      if (["api", "providers", "runtime", "spi"].contains(projectGroup)) {
@@@ -169,44 -182,40 +206,54 @@@
        rename("$jar.archiveName", "$jar.baseName.$jar.extension")
  
        //Copy Sample SRC to dist
-       copy {
-         into "${rootProject.ext.target_java8_dir}/" + projectGroup + "/src/$project.name/src/main/java/"
-         from(sourceSets.main.allSource.srcDirs) {
-           include '**/*.java'
+       doLast {
+         copy {
+           from(sourceSets.main.allSource.srcDirs) { include '**/*.java' }
+           into "${rootProject.ext.target_java8_dir}/$projectGroup/src/$project.name/src/main/java/"
          }
        }
-     } else {
+     } 
+     else {
+       // println "copyJar(cfg) other $project.group $projectGroup $project.name $jar.archiveName"
        from jar
-       into "${rootProject.ext.target_java8_dir}/" + projectGroup + "/$project.name".replaceAll(":", "/") + "/lib"
+       into "${rootProject.ext.target_java8_dir}/$projectGroup/$project.name/lib"
        rename("$jar.archiveName", "$jar.baseName.$jar.extension")
+       
+       // Copy console.war  (should be more general but this works for now)
+       if (projectGroup == 'console' && project.name == 'servlets') {
+         doLast {
+           copy {
+             from war
+             into "${rootProject.ext.target_java8_dir}/$projectGroup/webapps"
+           }
+         }
+       } 
      }
    }
 +
 +  publishing {
 +     publications {
 +        mavenJava(MavenPublication) {
 +           from components.java
 +           artifactId = artifact
 +           artifact sourceJar
 +           //artifact javadocJar
 +           //artifact testJar
 +           pom.withXml {
 +           }
 +        }
 +     }
 +  }
- 
-   copyJar.dependsOn assemble
-   build.dependsOn copyJar
+   
+   // assemble: inject updating target_dir 
+   assemble.finalizedBy copyJar
  }
  
- task copyScript {
-   copy {
-     includeEmptyDirs = false
-     from "scripts/"
-     into "${rootProject.ext.target_java8_dir}/scripts/"
-     include "**/*"
-   }
+ task copyScripts(type: Copy) {
+   description = 'Copy scripts to target_java8_dir'
+   includeEmptyDirs = false
+   from("scripts/") { include "**/*" }
+   into "${rootProject.ext.target_java8_dir}/scripts/"
  }
  
  //Create Junit Report