aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/Gruntfile.coffee
blob: acd131b6b9cb6d8dd4dc318f9be35a8c9509d517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
module.exports = (grunt) ->
  grunt.initConfig
    pkg: grunt.file.readJSON('package.json')

    less:
      dev:
        files:
          '<%= pkg.assets %>css/sonar.css': [
            '<%= pkg.assets %>less/yui-reset-font.less'
            '<%= pkg.assets %>less/jquery-ui.less'
            '<%= pkg.assets %>less/select2.less'
            '<%= pkg.assets %>less/select2-sonar.less'
            '<%= pkg.assets %>less/layout.less'
            '<%= pkg.assets %>less/style.less'
            '<%= pkg.assets %>less/icons.less'
            '<%= pkg.assets %>less/ui.less'
            '<%= pkg.assets %>less/sonar-colorizer.less'
            '<%= pkg.assets %>less/dashboard.less'
            '<%= pkg.assets %>less/select-list.less'
            '<%= pkg.assets %>less/navigator.less'
            '<%= pkg.assets %>less/*.less'
          ]
      build:
        options:
          cleancss: true
        files:
          '<%= pkg.assets %>build/css/sonar.css': [
            '<%= pkg.assets %>less/yui-reset-font.less'
            '<%= pkg.assets %>less/jquery-ui.less'
            '<%= pkg.assets %>less/select2.less'
            '<%= pkg.assets %>less/select2-sonar.less'
            '<%= pkg.assets %>less/layout.less'
            '<%= pkg.assets %>less/style.less'
            '<%= pkg.assets %>less/icons.less'
            '<%= pkg.assets %>less/ui.less'
            '<%= pkg.assets %>less/sonar-colorizer.less'
            '<%= pkg.assets %>less/dashboard.less'
            '<%= pkg.assets %>less/select-list.less'
            '<%= pkg.assets %>less/navigator.less'
            '<%= pkg.assets %>less/*.less'
          ]


    coffee:
      dev:
        files: [
          expand: true
          cwd: '<%= pkg.assets %>coffee'
          src: ['**/*.coffee']
          dest: '<%= pkg.assets %>javascripts'
          ext: '.js'
        ]


    uglify:
      dev:
        options:
          beautify: true
        files:
          '<%= pkg.assets %>js/sonar.js': [
            '<%= pkg.assets %>javascripts/third-party/jquery.js'
            '<%= pkg.assets %>javascripts/third-party/jquery-ui.js'
            '<%= pkg.assets %>javascripts/third-party/d3.js'
            '<%= pkg.assets %>javascripts/third-party/underscore.js'
            '<%= pkg.assets %>javascripts/third-party/select2.js'
            '<%= pkg.assets %>javascripts/select2-jquery-ui-fix.js'
            '<%= pkg.assets %>javascripts/translate.js'
            '<%= pkg.assets %>javascripts/widgets/widget.js'
            '<%= pkg.assets %>javascripts/widgets/bubble-chart.js'
            '<%= pkg.assets %>javascripts/widgets/timeline.js'
            '<%= pkg.assets %>javascripts/widgets/stack-area.js'
            '<%= pkg.assets %>javascripts/widgets/pie-chart.js'
            '<%= pkg.assets %>javascripts/widgets/histogram.js'
            '<%= pkg.assets %>javascripts/top-search.js'
            '<%= pkg.assets %>javascripts/sortable.js'
            '<%= pkg.assets %>javascripts/common/inputs.js'
            '<%= pkg.assets %>javascripts/application.js'
            '<%= pkg.assets %>javascripts/dashboard.js'
            '<%= pkg.assets %>javascripts/duplication.js'
            '<%= pkg.assets %>javascripts/resource.js'
            '<%= pkg.assets %>javascripts/issue.js'
            '<%= pkg.assets %>javascripts/recent-history.js'
          ]
      build:
        options:
          preserveComments: false # remove all comments
        files:
          '<%= pkg.assets %>build/js/sonar.js': [
            '<%= pkg.assets %>javascripts/third-party/jquery.js'
            '<%= pkg.assets %>javascripts/third-party/jquery-ui.js'
            '<%= pkg.assets %>javascripts/third-party/d3.js'
            '<%= pkg.assets %>javascripts/third-party/underscore.js'
            '<%= pkg.assets %>javascripts/third-party/select2.js'
            '<%= pkg.assets %>javascripts/select2-jquery-ui-fix.js'
            '<%= pkg.assets %>javascripts/translate.js'
            '<%= pkg.assets %>javascripts/widgets/widget.js'
            '<%= pkg.assets %>javascripts/widgets/bubble-chart.js'
            '<%= pkg.assets %>javascripts/widgets/timeline.js'
            '<%= pkg.assets %>javascripts/widgets/stack-area.js'
            '<%= pkg.assets %>javascripts/widgets/pie-chart.js'
            '<%= pkg.assets %>javascripts/widgets/histogram.js'
            '<%= pkg.assets %>javascripts/top-search.js'
            '<%= pkg.assets %>javascripts/sortable.js'
            '<%= pkg.assets %>javascripts/common/inputs.js'
            '<%= pkg.assets %>javascripts/application.js'
            '<%= pkg.assets %>javascripts/dashboard.js'
            '<%= pkg.assets %>javascripts/duplication.js'
            '<%= pkg.assets %>javascripts/resource.js'
            '<%= pkg.assets %>javascripts/issue.js'
            '<%= pkg.assets %>javascripts/recent-history.js'
          ]


    requirejs:
      options:
        baseUrl: '<%= pkg.assets %>javascripts'

        paths:
          'backbone': 'third-party/backbone'
          'backbone.marionette': 'third-party/backbone.marionette'
          'handlebars': 'third-party/handlebars'
          'moment': 'third-party/moment'
          'select-list': 'common/select-list'
          'jquery.mockjax': 'third-party/jquery.mockjax'

        shim:
          'backbone.marionette':
            deps: ['backbone']
            exports: 'Marionette'
          'backbone': exports: 'Backbone'
          'handlebars': exports: 'Handlebars'
          'moment': exports: 'moment'
          'select-list': exports: 'SelectList'

      qualityGate: options:
        name: 'quality-gate/app'
        out: '<%= pkg.assets %>build/js/quality-gate/app.js'

      codingRules: options:
        name: 'coding-rules/app'
        out: '<%= pkg.assets %>build/js/coding-rules/app.js'

      issues: options:
        name: 'issues/app'
        out: '<%= pkg.assets %>build/js/issues/app.js'

      measures: options:
        name: 'measures/app'
        out: '<%= pkg.assets %>build/js/measures/app.js'

      selectList: options:
        name: 'common/select-list'
        out: '<%= pkg.assets %>build/js/common/select-list.js'


    watch:
      options:
        spawn: false

      less:
        files: '<%= pkg.assets %>less/**/*.less'
        tasks: ['less:dev']

      coffee:
        files: '<%= pkg.assets %>coffee/**/*.coffee'
        tasks: ['coffee:dev']

      uglify:
        files: '<%= pkg.assets %>javascripts/**/*.js'
        tasks: ['uglify:dev']



  # Load grunt-contrib-* plugins
  grunt.loadNpmTasks 'grunt-contrib-less'
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-contrib-uglify'
  grunt.loadNpmTasks 'grunt-contrib-requirejs'
  grunt.loadNpmTasks 'grunt-contrib-watch'


  # Define tasks
  grunt.registerTask 'default', ['less:dev', 'coffee:dev', 'uglify:dev']
  grunt.registerTask 'build', ['less:build', 'coffee:dev', 'uglify:build', 'requirejs']