You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by hs...@apache.org on 2021/05/28 06:22:27 UTC

[sling-slingpackager] branch travisBuild updated: Refactoring build scripts and integrating with maven.

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

hsaginor pushed a commit to branch travisBuild
in repository https://gitbox.apache.org/repos/asf/sling-slingpackager.git


The following commit(s) were added to refs/heads/travisBuild by this push:
     new d668c63  Refactoring build scripts and integrating with maven.
d668c63 is described below

commit d668c639df6a9f07e43d1f0f26d2e79e873b5ab9
Author: Henry Saginor <hs...@gmail.com>
AuthorDate: Thu May 27 23:01:36 2021 -0700

    Refactoring build scripts and integrating with maven.
---
 package-lock.json                        |  2 +-
 package.json                             |  2 +-
 pom.xml                                  | 63 +++++++++++++++++++++++++++++++-
 tools/scripts/build.sh                   | 26 +------------
 tools/scripts/{build.sh => compile.sh}   | 27 +-------------
 tools/scripts/{publish.sh => package.sh} | 17 +++------
 tools/scripts/publish.sh                 |  7 +---
 tools/scripts/setupenv.sh                |  5 +--
 8 files changed, 76 insertions(+), 73 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 484aba6..1428c10 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "@apache-sling/slingpackager",
-  "version": "0.0.5",
+  "version": "1.0.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 342ff87..c3a24b0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@apache-sling/slingpackager",
-  "version": "0.0.5",
+  "version": "1.0.0",
   "description": "A tool for working with Apache Sling content packages.",
   "repository": {
     "type": "git",
diff --git a/pom.xml b/pom.xml
index 752f260..1d6bcc7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,13 +23,13 @@
   <parent>
     <groupId>org.apache.sling</groupId>
     <artifactId>sling</artifactId>
-    <version>6</version>
+    <version>34</version>
   </parent>
 
   <groupId>org.apache.sling</groupId>
   <artifactId>sling-slingpackager</artifactId>
   <name>Apache Sling Slingpackager</name>
-  <version>0.0.5</version>
+  <version>1.0.0-SNAPSHOT</version>
 
   <scm>
     <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-slingpackager.git</connection>
@@ -44,6 +44,14 @@
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <version>0.13</version>
+        <executions>
+          <execution>
+            <phase>verify</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
         <configuration>
             <excludes>
                 <exclude>**/.git/**</exclude>
@@ -61,6 +69,57 @@
             </excludes>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>3.0.0</version>
+        <executions>
+          <execution>
+            <id>sling-slingpackager-compile</id>
+            <phase>compile</phase>
+            <goals>
+                <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>bash</executable>
+              <commandlineArgs>./tools/scripts/compile.sh</commandlineArgs>
+            </configuration>
+          </execution>
+          <execution>
+            <id>sling-slingpackager-test</id>
+            <phase>test</phase>
+            <goals>
+                <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>bash</executable>
+              <commandlineArgs>./tools/scripts/test.sh</commandlineArgs>
+            </configuration>
+          </execution>
+          <execution>
+            <id>sling-slingpackager-package</id>
+            <phase>package</phase>
+            <goals>
+                <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>bash</executable>
+              <commandlineArgs>./tools/scripts/package.sh</commandlineArgs>
+            </configuration>
+          </execution>
+          <execution>
+            <id>sling-slingpackager-deploy</id>
+            <phase>deploy</phase>
+            <goals>
+                <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>bash</executable>
+              <commandlineArgs>./tools/scripts/publish.sh</commandlineArgs>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/tools/scripts/build.sh b/tools/scripts/build.sh
index 94967a0..da38335 100755
--- a/tools/scripts/build.sh
+++ b/tools/scripts/build.sh
@@ -28,32 +28,10 @@ mvn clean apache-rat:check
 
 echo "Code scan successful."
 
-# Make new release directory
-if [ -d "$RELEASEDIR" ] 
-then
-    rm -rf $RELEASEDIR
-fi
-mkdir -p $RELEASEDIR
-
-echo "Copeing release files."
-
-# Copy code to release directory
-cp -p -a $ROOTDIR/bin $RELEASEDIR
-cp -p -a $ROOTDIR/cmds $RELEASEDIR
-cp -p -a $ROOTDIR/utils $RELEASEDIR
-cp -p -a $ROOTDIR/test $RELEASEDIR
-cp package.json LICENSE NOTICE .npmignore $RELEASEDIR
+. $SCRIPTDIR/compile.sh
 
 # Run tests
 . $SCRIPTDIR/test.sh
 
-cd $RELEASEDIR
-
 # Create release package
-npm pack
-
-# For integration with current Sling Release Management which uses Maven
-# copy generated arifect to target folder
-cp $RELEASEDIR/*.tgz $ROOTDIR/target
-
-cd $ROOTDIR
\ No newline at end of file
+. $SCRIPTDIR/package.sh
\ No newline at end of file
diff --git a/tools/scripts/build.sh b/tools/scripts/compile.sh
similarity index 70%
copy from tools/scripts/build.sh
copy to tools/scripts/compile.sh
index 94967a0..253fbf8 100755
--- a/tools/scripts/build.sh
+++ b/tools/scripts/compile.sh
@@ -17,17 +17,8 @@ set -e
 # limitations under the License.
 #
 
-# Build and release script.
-
 . tools/scripts/setupenv.sh
 
-echo "Build dir $RELEASEDIR"
-
-# Scan code
-mvn clean apache-rat:check
-
-echo "Code scan successful."
-
 # Make new release directory
 if [ -d "$RELEASEDIR" ] 
 then
@@ -35,25 +26,11 @@ then
 fi
 mkdir -p $RELEASEDIR
 
-echo "Copeing release files."
+echo "Copeing files to $RELEASEDIR."
 
 # Copy code to release directory
 cp -p -a $ROOTDIR/bin $RELEASEDIR
 cp -p -a $ROOTDIR/cmds $RELEASEDIR
 cp -p -a $ROOTDIR/utils $RELEASEDIR
 cp -p -a $ROOTDIR/test $RELEASEDIR
-cp package.json LICENSE NOTICE .npmignore $RELEASEDIR
-
-# Run tests
-. $SCRIPTDIR/test.sh
-
-cd $RELEASEDIR
-
-# Create release package
-npm pack
-
-# For integration with current Sling Release Management which uses Maven
-# copy generated arifect to target folder
-cp $RELEASEDIR/*.tgz $ROOTDIR/target
-
-cd $ROOTDIR
\ No newline at end of file
+cp package.json LICENSE NOTICE .npmignore $RELEASEDIR
\ No newline at end of file
diff --git a/tools/scripts/publish.sh b/tools/scripts/package.sh
similarity index 78%
copy from tools/scripts/publish.sh
copy to tools/scripts/package.sh
index 3a346d1..c3aa428 100755
--- a/tools/scripts/publish.sh
+++ b/tools/scripts/package.sh
@@ -16,20 +16,15 @@ set -e
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
-# Publish release script.
-
 . tools/scripts/setupenv.sh
 
 cd $RELEASEDIR
 
-# Upload signed release package to ASF archive
-# TODO
-
-# Now NPM publish (dry run for now)
-echo "Publishing to NPM"
-npm publish apache-sling-slingpackager-*.tgz --access public --dry-run
-
-cd $ROOTDIR
+# Create release package
+npm pack
 
+# For integration with current Sling Release Management which uses Maven
+# copy generated arifect to target folder
+cp $RELEASEDIR/*.tgz $ROOTDIR/target
 
+cd $ROOTDIR
\ No newline at end of file
diff --git a/tools/scripts/publish.sh b/tools/scripts/publish.sh
index 3a346d1..a4f3d16 100755
--- a/tools/scripts/publish.sh
+++ b/tools/scripts/publish.sh
@@ -21,12 +21,9 @@ set -e
 
 . tools/scripts/setupenv.sh
 
-cd $RELEASEDIR
+cd $ROOTDIR/target
 
-# Upload signed release package to ASF archive
-# TODO
-
-# Now NPM publish (dry run for now)
+# NPM publish (dry run for now)
 echo "Publishing to NPM"
 npm publish apache-sling-slingpackager-*.tgz --access public --dry-run
 
diff --git a/tools/scripts/setupenv.sh b/tools/scripts/setupenv.sh
index 6236fcf..094382b 100755
--- a/tools/scripts/setupenv.sh
+++ b/tools/scripts/setupenv.sh
@@ -22,7 +22,4 @@ export SLING_DOWNLOAD="https://downloads.apache.org/sling/$SLING_JAR"
 export PACK_NAME="slingpackager"
 export SCRIPTDIR=$(cd $(dirname "$0") && pwd)
 export ROOTDIR=$(cd $SCRIPTDIR/../.. && pwd)
-export RELEASEDIR="$ROOTDIR/releases/$PACK_NAME"
-
-# echo "ROOTDIR is $ROOTDIR"
-# echo "RELEASEDIR $RELEASEDIR"
+export RELEASEDIR="$ROOTDIR/target/$PACK_NAME"
\ No newline at end of file