ソースを参照

Windows build: updates to build stuff to create better windows packages

Torkel Odegaard 10 年 前
コミット
c9a28ddd38
5 ファイル変更21 行追加28 行削除
  1. 3 1
      Gruntfile.js
  2. 6 0
      appveyor.yml
  3. 1 1
      tasks/build_task.js
  4. 1 5
      tasks/distribute_task.js
  5. 10 21
      tasks/options/compress.js

+ 3 - 1
Gruntfile.js

@@ -2,13 +2,15 @@
 'use strict';
 module.exports = function (grunt) {
 
+  var os = require('os');
   var config = {
     pkg: grunt.file.readJSON('package.json'),
     baseDir: '.',
     srcDir: 'public',
     destDir: 'dist',
     tempDir: 'tmp',
-    arch: grunt.option('arch') || 'x86_64',
+    arch: os.arch(),
+    platform: process.platform.replace('win32', 'windows'),
   };
 
   config.pkg.version = grunt.option('pkgVer') || config.pkg.version;

+ 6 - 0
appveyor.yml

@@ -5,9 +5,14 @@ os: Windows Server 2012 R2
 clone_folder: c:\gopath\src\github.com\grafana\grafana
 
 environment:
+  nodejs_version: "0.10"
   GOPATH: c:\gopath
 
 install:
+  # install nodejs and npm
+  - ps: Install-Product node $env:nodejs_version
+  - npm install
+  # install gcc (needed for sqlite3)
   - choco install -y mingw
   - set PATH=C:\tools\mingw64\bin;%PATH%
   - echo %PATH%
@@ -18,3 +23,4 @@ install:
 
 build_script:
   - go run build.go build
+  - grunt release

+ 1 - 1
tasks/build_task.js

@@ -55,7 +55,7 @@ module.exports = function(grunt) {
     grunt.config('copy.backend_bin', {
       cwd: 'bin',
       expand: true,
-      src: ['grafana-server'],
+      src: ['*'],
       options: { mode: true},
       dest: '<%= tempDir %>/bin/'
     });

+ 1 - 5
tasks/distribute_task.js

@@ -2,10 +2,6 @@ module.exports = function(grunt) {
   "use strict";
 
   // build, then zip and upload to s3
-  grunt.registerTask('release', [
-    'build',
-    'build-post-process',
-    'compress:tgz_release',
-  ]);
+  grunt.registerTask('release', ['build', 'build-post-process','compress:release']);
 
 };

+ 10 - 21
tasks/options/compress.js

@@ -1,8 +1,9 @@
 module.exports = function(config) {
-  return {
-    tgz: {
+
+  var task = {
+    release: {
       options: {
-        archive: '<%= destDir %>/<%= pkg.name %>-latest.tar.gz'
+        archive: '<%= destDir %>/<%= pkg.name %>-<%= pkg.version %>.<%= platform %>-<%= arch %>.tar.gz'
       },
       files : [
         {
@@ -17,24 +18,12 @@ module.exports = function(config) {
           dest: '<%= pkg.name %>/',
         }
       ]
-    },
-    tgz_release: {
-      options: {
-        archive: '<%= destDir %>/<%= pkg.name %>-<%= pkg.version %>.<%= arch %>.tar.gz'
-      },
-      files : [
-        {
-          expand: true,
-          cwd: '<%= tempDir %>',
-          src: ['**/*'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        },
-        {
-          expand: true,
-          src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        }
-      ]
     }
   };
+
+  if (config.platform === 'windows') {
+    task.release.options.archive = '<%= destDir %>/<%= pkg.name %>-<%= pkg.version %>.<%= platform %>-<%= arch %>.zip';
+  }
+
+  return task;
 };