Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 7d47408

Browse files
committed
Improve force-update-if-package-json task
1 parent a811398 commit 7d47408

File tree

2 files changed

+62
-14
lines changed

2 files changed

+62
-14
lines changed

core/src/plugins/gui.ajax/Gruntfile.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,23 @@ module.exports = function(grunt) {
237237
grunt.loadNpmTasks('grunt-run');
238238
grunt.loadNpmTasks('grunt-contrib-cssmin');
239239
grunt.loadNpmTasks('assemble-less');
240-
grunt.registerTask('default', [
240+
grunt.registerTask('type:js', [
241241
'babel:dist',
242242
'uglify:js',
243243
'babel:materialui',
244-
// 'run:materialui',
245244
'env:build',
246245
'browserify',
247246
'env:dev',
248247
'uglify:nodejs',
249-
'babel:pydio',
248+
'babel:pydio'
249+
]);
250+
grunt.registerTask('type:css', [
250251
'cssmin'
251252
]);
253+
grunt.registerTask('default', [
254+
'type:js',
255+
'type:css'
256+
]);
252257
grunt.registerTask('build-core', [
253258
'babel:dist',
254259
'uglify:js'

dist/phing/build-pydio.xml

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,11 @@
544544
<if>
545545
<not><equals arg1="${js_source_path}" arg2="__NOT_FOUND__"/></not>
546546
<then>
547+
<property name="has-js-path" value="true"/>
547548
<if>
548549
<available type="dir" file="${upgrade_export}/plugins/${plugin}/${js_source_path}"/>
549550
<then>
551+
<property name="js-required" value="true"/>
550552
<copy todir="${upgrade_export}/plugins/${plugin}/${js_source_path}">
551553
<fileset dir="${local_repository_root}/plugins/${plugin}/${js_source_path}" defaultexcludes="false">
552554
<include name="*/**"/>
@@ -559,9 +561,11 @@
559561
<if>
560562
<not><equals arg1="${css_source_path}" arg2="__NOT_FOUND__"/></not>
561563
<then>
564+
<property name="has-css-path" value="true"/>
562565
<if>
563566
<available type="dir" file="${upgrade_export}/plugins/${plugin}/${css_source_path}"/>
564567
<then>
568+
<property name="css-required" value="true"/>
565569
<copy todir="${upgrade_export}/plugins/${plugin}/${css_source_path}">
566570
<fileset dir="${local_repository_root}/plugins/${plugin}/${css_source_path}" defaultexcludes="false">
567571
<include name="*/**"/>
@@ -571,16 +575,46 @@
571575
</if>
572576
</then>
573577
</if>
574-
<echo message="REBUILD JS FOR PLUGIN ${plugin}"/>
575-
<copy todir="${upgrade_export}/plugins/${plugin}">
576-
<fileset dir="${local_repository_root}/plugins/${plugin}">
577-
<include name="Gruntfile.js"/>
578-
<include name="package.json"/>
579-
</fileset>
580-
</copy>
581-
<phingcall target="grunt">
582-
<property name="plugin_abs_dir" override="true" value="${upgrade_export}/plugins/${plugin}"/>
583-
</phingcall>
578+
<if>
579+
<or>
580+
<available property="js-required"/>
581+
<available property="css-required"/>
582+
</or>
583+
<then>
584+
<echo message="REBUILDING JS FOR PLUGIN ${plugin}"/>
585+
<copy todir="${upgrade_export}/plugins/${plugin}">
586+
<fileset dir="${local_repository_root}/plugins/${plugin}">
587+
<include name="Gruntfile.js"/>
588+
<include name="package.json"/>
589+
</fileset>
590+
</copy>
591+
592+
<property name="grunt-target" value=""/>
593+
<if>
594+
<and>
595+
<available property="js-required"/>
596+
<available property="has-css-path"/>
597+
<not><available property="css-required"/></not>
598+
</and>
599+
<then>
600+
<property name="grunt-target" value="type:js"/>
601+
</then>
602+
<elseif>
603+
<available property="css-required"/>
604+
<available property="has-js-path"/>
605+
<not><available property="js-required"/></not>
606+
<then>
607+
<property name="grunt-target" value="type:css"/>
608+
</then>
609+
</elseif>
610+
</if>
611+
612+
<phingcall target="grunt">
613+
<property name="plugin_abs_dir" override="true" value="${upgrade_export}/plugins/${plugin}"/>
614+
<property name="grunt_target" value="${grunt-target}"/>
615+
</phingcall>
616+
</then>
617+
</if>
584618
</then>
585619
</if>
586620
<!-- Looking for Composer.json File -->
@@ -610,12 +644,21 @@
610644
</target>
611645

612646
<target name="grunt">
647+
<if>
648+
<available property="grunt_target"/>
649+
<then>
650+
<property name="command" value="grunt ${grunt_target}"/>
651+
</then>
652+
<else>
653+
<property name="command" value="grunt"/>
654+
</else>
655+
</if>
613656
<if>
614657
<available file="${plugin_abs_dir}/package.json"/>
615658
<then>
616659
<!-- BUILD JAVASCRIPT -->
617660
<exec command="npm install" dir="${plugin_abs_dir}" passthru="true"/>
618-
<exec command="grunt" dir="${plugin_abs_dir}" passthru="true"/>
661+
<exec command="${command}" dir="${plugin_abs_dir}" passthru="true"/>
619662
<delete dir="${plugin_abs_dir}/node_modules"/>
620663
</then>
621664
</if>

0 commit comments

Comments
 (0)