You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/01/12 14:26:03 UTC

[isis] 01/04: ISIS-1811: copies over fixes to scripts from master branch

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch release-2.0.0-M2-RC1
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 981e96e11b62de2c6664a1b60c1d517dbc7b8747
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Jan 12 14:03:18 2019 +0000

    ISIS-1811: copies over fixes to scripts from master branch
---
 scripts/recreate-archetype.sh                  |   4 +-
 scripts/updateGeneratedArchetypeSources.groovy | 140 ++++++-------------------
 2 files changed, 32 insertions(+), 112 deletions(-)

diff --git a/scripts/recreate-archetype.sh b/scripts/recreate-archetype.sh
index ee5e1c0..acca8cb 100755
--- a/scripts/recreate-archetype.sh
+++ b/scripts/recreate-archetype.sh
@@ -57,8 +57,8 @@ for a in .project .classpath .settings bin .idea neo4j_DB target-ide; do /bin/fi
 /bin/find . -name "*.log" -exec rm {} \;
 /bin/find . -name "pom.xml.*" -exec rm {} \;
 
-echo "mvn -Drevision=$ISISREL archetype:create-from-project ..."
-mvn -Drevision=$ISISREL org.apache.maven.plugins:maven-archetype-plugin:3.0.1:create-from-project
+echo "mvn archetype:create-from-project ..."
+mvn org.apache.maven.plugins:maven-archetype-plugin:3.0.1:create-from-project
 
 # https://issues.apache.org/jira/browse/ARCHETYPE-548
 echo "copy over Dockerfile since seems to be excluded (bug: ARCHETYPE-548) ... "
diff --git a/scripts/updateGeneratedArchetypeSources.groovy b/scripts/updateGeneratedArchetypeSources.groovy
index 326ba45..044137a 100644
--- a/scripts/updateGeneratedArchetypeSources.groovy
+++ b/scripts/updateGeneratedArchetypeSources.groovy
@@ -78,8 +78,6 @@ if (!options) {
 application_name=options.n
 isis_version=options.v
 
-println "isis_version = ${isis_version}"
-
 /////////////////////////////////////////////////////
 //
 // update archetype's own pom.xml's groupId
@@ -104,130 +102,26 @@ pomXml.appendNode {
 }
 pomXml.groupId='org.apache.isis.archetype'
 
-pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
-  <parent>
-    <groupId>org.apache</groupId>
-    <artifactId>apache</artifactId>
-    <version>18</version>
-    <relativePath />
-  </parent>
-''' )
-)
-
-pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
-<properties>
+def fragmentToAdd = new XmlSlurper( false, true ).parseText( '''<properties>
     <archetype.test.skip>true</archetype.test.skip>
-</properties>
-''' )
-)
-
-pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
-  <profiles>
-    <profile>
-      <!--
-      as per https://stackoverflow.com/a/28860520/56880
-      allows -Dgpg.passphrase= to be used rather than gpg.useagent
-      inherited from parent.
-      Note that this requires gpg v2.1+
-      -->
-      <id>gpg</id>
-      <activation>
-        <property>
-          <name>gpg.passphrase</name>
-        </property>
-      </activation>
-      <properties>
-        <gpg.useagent>false</gpg.useagent>
-      </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-gpg-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>sign-release-artifacts</id>
-                <goals>
-                  <goal>sign</goal>
-                </goals>
-                <configuration>
-                  <gpgArguments>
-                    <arg>--pinentry-mode</arg>
-                    <arg>loopback</arg>
-                  </gpgArguments>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-''' )
-)
-
-pomFile.text = withLicense(pomXml)
+</properties>''' )
+pomXml.appendNode(fragmentToAdd)
 
 
 pomFile.text = serializeWithLicense(pomXml)
 
-/////////////////////////////////////////////////////
-//
-// update archetype's resource's pom.xml's
-// <revision> and <isis.version>
-//
-/////////////////////////////////////////////////////
-
-def resourcePomXmlFile=new File(BASE+"src/main/resources/archetype-resources/pom.xml")
-
-println "updating ${resourcePomXmlFile.path}"
-
-def resourcePomXml = new XmlSlurper(false,false).parseText(resourcePomXmlFile.text)
-
-
-// the properties.revision, meanwhile, is set to the version that is prompted for when the
-// app is first generated from the archetype
-resourcePomXml.properties.revision='${version}'
 
-resourcePomXml.properties['isis.version']=isis_version
-
-resourcePomXml.dependencyManagement.dependencies.dependency.each { dependency ->
-    if(dependency.groupId=='${groupId}') {
-        dependency.version='${project.version}'
-    }
-}
 
 
-resourcePomXmlFile.text = withLicense(resourcePomXml)
 
 
 /////////////////////////////////////////////////////
 //
-// update the pom files parent version
-//
-/////////////////////////////////////////////////////
-
-new File(ROOT+"BASE+\"src/main/resources/archetype-resources/").eachDirRecurse() { dir ->
-
-    dir.eachFileMatch(~/pom[.].xml/) { eachPomXmlFile ->
-
-        println "updating ${eachPomXmlFile.path}"
-
-        def eachPomXml = new XmlSlurper(false,false).parseText(eachPomXmlFile.text)
-        if(eachPomXml.parent.groupId=='${groupId}') {
-            eachPomXml.parent.version='${revision}'
-        }
-
-        eachPomXmlFile.text = withLicense(eachPomXml)
-    }
-}
-
-/////////////////////////////////////////////////////
-//
 // update archetype-metadata.xml
 //
 /////////////////////////////////////////////////////
 
+
 def metaDataFile=new File(ROOT+"META-INF/maven/archetype-metadata.xml")
 
 println "updating ${metaDataFile.path}"
@@ -261,6 +155,32 @@ metaDataXml.modules.module.each { module ->
 metaDataFile.text = serializeWithLicense(metaDataXml)
 
 
+/////////////////////////////////////////////////////
+//
+// update the .launch files
+//
+/////////////////////////////////////////////////////
+
+new File(ROOT+"archetype-resources/").eachDirRecurse() { dir ->  
+
+    dir.eachFileMatch(~/.*[.]launch/) { launchFile ->  
+
+        println "updating ${launchFile.path}"
+
+        def launchXml = new XmlSlurper().parseText(launchFile.text)
+        def projectAttr = launchXml.stringAttribute.find { it.@key=="org.eclipse.jdt.launching.PROJECT_ATTR" }
+        String oldValue=projectAttr.@value
+        def newValue = oldValue.replaceAll("${application_name}[^-]*-","\\\${rootArtifactId}-")
+        projectAttr.@value=newValue
+
+        launchFile.text = """#set( \$symbol_pound = '#' )
+#set( \$symbol_dollar = '\$' )
+#set( \$symbol_escape = '\\' )
+"""
+        launchFile.append(XmlUtil.serialize(launchXml))
+     }  
+}
+
 
 ///////////////////////////////////////////////////
 //